diff --git a/BUILD.bazel b/BUILD.bazel index 50d64cd0feef..890a1c7d835f 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -12,6 +12,7 @@ package(default_visibility = ["//visibility:public"]) # gazelle:exclude comp # gazelle:exclude internal/remote-agent # gazelle:exclude internal/third_party +# gazelle:exclude third_party # gazelle:exclude internal/tools/gotest-custom # gazelle:exclude internal/tools/independent-lint # gazelle:exclude internal/tools/modformatter diff --git a/CLAUDE.md b/CLAUDE.md index 900799d141a8..41b3ab63bbca 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,17 +16,17 @@ The StackState Agent is a monitoring and observability agent forked from Datadog ## Common Development Commands ### Initial Setup -```bash -# 1. Install Python dependencies (use virtual environment recommended) -pip install -r requirements.txt -# 2. Install Go tools -invoke install-tools +Install the `dda` development CLI following [the setup guide](docs/public/setup/required.md). It manages the Python environment used by Invoke tasks. + +```bash +# 1. Install Go tools +dda inv install-tools -# 3. Install Go dependencies -invoke deps +# 2. Install Go dependencies +dda inv deps -# 4. Create dev configuration (stackstate.yaml, not datadog.yaml) +# 3. Create dev configuration (stackstate.yaml, not datadog.yaml) echo "api_key: " > dev/dist/stackstate.yaml ``` @@ -64,7 +64,7 @@ invoke test --targets=./pkg/collector/python ### Linting ```bash # Run Go linters (do this before committing) -invoke lint-go +dda inv linter.go # Run linters on specific module/targets invoke linter.go --targets=./pkg/collector/check,./pkg/aggregator diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 72489ad70fa1..6928b06a538a 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1440,166 +1440,162 @@ "27bab004c72b3d7bd05a69b6ec0fc54a309b4b78cc569dd963d8b3ec28bfdb8c" ] }, - "1.25.9": { + "1.26.6": { "aix_ppc64": [ - "go1.25.9.aix-ppc64.tar.gz", - "b9ede6378a8f8d3d22bf52e68beb69ef7abdb65929ab2456020383002da15846" + "go1.26.6.aix-ppc64.tar.gz", + "982571d7beb65d66bc18bab3a72383275df0b418b586e77e8d84ce28ae2d4074" ], "darwin_amd64": [ - "go1.25.9.darwin-amd64.tar.gz", - "92cb78fba4796e218c1accb0ea0a214ef2094c382049a244ad6505505d015fbe" + "go1.26.6.darwin-amd64.tar.gz", + "08b65a63f244115121ced6c3b55ad38d801a7442acad5c949a17aad84ae6d684" ], "darwin_arm64": [ - "go1.25.9.darwin-arm64.tar.gz", - "9528be7329b9770631a6bd09ca2f3a73ed7332bec01d87435e75e92d8f130363" + "go1.26.6.darwin-arm64.tar.gz", + "2dc95ce4675829f2df0e86b28bcef3283635902062a5f0580ca659bf570f3204" ], "dragonfly_amd64": [ - "go1.25.9.dragonfly-amd64.tar.gz", - "918e44a471c5524caa52f74185064240d5eb343aa8023d604776511fc7adffa6" + "go1.26.6.dragonfly-amd64.tar.gz", + "7ed0537a740803fb3c6979fe45ad757b48d8899aa50589345eafcca41c294e37" ], "freebsd_386": [ - "go1.25.9.freebsd-386.tar.gz", - "2d67dbdfd09c6fcaa0e64485367ef43b8837ea200c663d6417183237bcddf83d" + "go1.26.6.freebsd-386.tar.gz", + "300d6751c189d3c7c6acfaa6e1f4feb17187c63c36cc8ed6e59f247a948a5ab4" ], "freebsd_amd64": [ - "go1.25.9.freebsd-amd64.tar.gz", - "9152d0c0badbfeb0c0e148e47c12bec28099d8cf2db60958810c879e0b679d07" + "go1.26.6.freebsd-amd64.tar.gz", + "9c805b762d9cd33c04c0dd414c1f4e86065a6ddce06e97e194e9bc806b120fc7" ], "freebsd_arm": [ - "go1.25.9.freebsd-arm.tar.gz", - "437dca59604ad4a806a6a88e3d7ec1cd98ac9b402a3671629f4e553dd8b9888f" + "go1.26.6.freebsd-arm.tar.gz", + "b21a3487c8fd121ecadb5d51f137dba83d5b14624a2c7e22d8864ac0ff4d8142" ], "freebsd_arm64": [ - "go1.25.9.freebsd-arm64.tar.gz", - "4c0fe53977412036fc8081e8d0992bbaabe4d3e1926137271ba11c2f5753300f" - ], - "freebsd_riscv64": [ - "go1.25.9.freebsd-riscv64.tar.gz", - "d6087cdd1c084bd186132f29e0d032852a745f3c7619003d0fd5612c1fa58c8a" + "go1.26.6.freebsd-arm64.tar.gz", + "577a874da5171c0a31ceafe10d75faddcf6a17baad99c2c471062bde2c9ec49b" ], "illumos_amd64": [ - "go1.25.9.illumos-amd64.tar.gz", - "f82e49037e195cb62beae6a6ad83497157b2af5a01bad2f1dcb65df41080aabb" + "go1.26.6.illumos-amd64.tar.gz", + "d8b8a5c43bf40449a9843c40c64ca4ffe4b3d6b605550622633977d2db17462a" ], "linux_386": [ - "go1.25.9.linux-386.tar.gz", - "1e14a73bc2b19e370e0d4c57ba87aabfe8aef1e435e14d246742d48a13254f36" + "go1.26.6.linux-386.tar.gz", + "f09a71029fc5cd2940fbe36b0eb1fb2d8f3407cd6adb6b7b4de3eaf04007f8c4" ], "linux_amd64": [ - "go1.25.9.linux-amd64.tar.gz", - "00859d7bd6defe8bf84d9db9e57b9a4467b2887c18cd93ae7460e713db774bc1" + "go1.26.6.linux-amd64.tar.gz", + "708effb774be8237570d0add163225abbdfaf4fca28b2611df167beba4feef89" ], "linux_arm64": [ - "go1.25.9.linux-arm64.tar.gz", - "ec342e7389b7f489564ed5463c63b16cf8040023dabc7861256677165a8c0e2b" + "go1.26.6.linux-arm64.tar.gz", + "d0507e9e9d7fe012aae570108cbd76c15de879e17130ab8cb90d4d7445cb1f2e" ], "linux_armv6l": [ - "go1.25.9.linux-armv6l.tar.gz", - "7d4f0d266d871301e08ef4ac31c56e66048688893b2848392e5c600276351ee8" + "go1.26.6.linux-armv6l.tar.gz", + "e1379a2fe77bd30fa29833074388247e7c65416e09279f746f20de2d5cf4dfea" ], "linux_loong64": [ - "go1.25.9.linux-loong64.tar.gz", - "f3460d901a14496bc609636e4accf9110ee1869d41c64af7e29cd567cffcf49b" + "go1.26.6.linux-loong64.tar.gz", + "dc7143e4da3e993956e09e19ae72b3330ccea9ceb1cc1fb8e27ea225ac8f8477" ], "linux_mips": [ - "go1.25.9.linux-mips.tar.gz", - "1da96ea449382ff96c09c55cee74815324e01d687d5ac6d2ade58244b8574306" + "go1.26.6.linux-mips.tar.gz", + "7ffdac8d508a633858896371f9e17821a0f2077fc14d0c83ef58fed3b7458b29" ], "linux_mips64": [ - "go1.25.9.linux-mips64.tar.gz", - "311a7f5f01f9a4bd51288b575eb619dc8e28e1fbc0cd78256a428b3ca668ff01" + "go1.26.6.linux-mips64.tar.gz", + "6914449089104f396001dbcc59c60094c7f3f29c3c3c9d718721afa4411487d1" ], "linux_mips64le": [ - "go1.25.9.linux-mips64le.tar.gz", - "0b4edaf9e2ba3f0a079547effda70ec6a4b51a6ca3271a1147652c87ebcf3735" + "go1.26.6.linux-mips64le.tar.gz", + "b9b67669e57eaee94e0e49f814e057fdc7511f887e75d43cfeb761c58cf0f0c3" ], "linux_mipsle": [ - "go1.25.9.linux-mipsle.tar.gz", - "42667340df264896f20b12261429d954e736e9772ab83ba289e68c30cf6f9628" + "go1.26.6.linux-mipsle.tar.gz", + "437cfa985eece5670983fb57582b4b2fe2776d3c3e6c873a50d6ba9efb57222f" ], "linux_ppc64": [ - "go1.25.9.linux-ppc64.tar.gz", - "b9cbb3a4894b5aca6966c23452608435e8535278ef019b18d8898fbbfab67e74" + "go1.26.6.linux-ppc64.tar.gz", + "0ca571bc19f3a6636e46358ab6f2395cb6da5c82ec03f14af01dd264451086a1" ], "linux_ppc64le": [ - "go1.25.9.linux-ppc64le.tar.gz", - "b0c41c7da1fc8d39020d65296a0dc54167afd9f76d67064e22c31ce3d839a739" + "go1.26.6.linux-ppc64le.tar.gz", + "232b65543a42eda95df6a63f76235c1795bb535eba5c74e509faec71bc648388" ], "linux_riscv64": [ - "go1.25.9.linux-riscv64.tar.gz", - "2a630be8f854177c13e5fa75f7812c721369ecb9bd6e4c0fb1bd1c708d08b37c" + "go1.26.6.linux-riscv64.tar.gz", + "7b3b526099181b40f5122c8ebf5c851486c7c92977e1f7f39dba9456c6ce42ff" ], "linux_s390x": [ - "go1.25.9.linux-s390x.tar.gz", - "0cf55136ac7eaccfc36d849054f849510ea289c2d959ffbed7b3866b4f484d17" + "go1.26.6.linux-s390x.tar.gz", + "958757933d38172dd544085d253c8738cf09793d24c8bc0422e5e1e1fffa4fde" ], "netbsd_386": [ - "go1.25.9.netbsd-386.tar.gz", - "eaf8167ff10a6a3e5dd304ef5f2e020b3a7379e76fa1011dc49c895800bf367c" + "go1.26.6.netbsd-386.tar.gz", + "a0721c869ecab78ae9ff6f75b6d8ad5d667bb4ed8c6d9c08bd7bc738244646fd" ], "netbsd_amd64": [ - "go1.25.9.netbsd-amd64.tar.gz", - "3cc6a861e62e23feae660984e0f2f14a2efb5d1f655900afee1d51af98919ae4" + "go1.26.6.netbsd-amd64.tar.gz", + "f37d9e86d24d04a83ef241d8467cae2d14e134e1c51c954b3ec860517135a5a2" ], "netbsd_arm": [ - "go1.25.9.netbsd-arm.tar.gz", - "c2c44dca10e882c30553f4aa2ab8f6722b670fb12882378c8f461a9105d40188" + "go1.26.6.netbsd-arm.tar.gz", + "d968690e8f5fc067749ed37872a77e249019b63665323db9bd0769a1db15b8a1" ], "netbsd_arm64": [ - "go1.25.9.netbsd-arm64.tar.gz", - "f301b71a8ec448053a5d2597df2e178120204bc9a33266c81600dd5d020a61b4" + "go1.26.6.netbsd-arm64.tar.gz", + "107b867e10807c6c4384ad6ed2b9bd4937e2d8c065b0821bc20e712d9c38f0ba" ], "openbsd_386": [ - "go1.25.9.openbsd-386.tar.gz", - "c4543b7fdef9707b4896810c69b4160a43ecec210af45c300f3abd78aa0c9e72" + "go1.26.6.openbsd-386.tar.gz", + "bc65e8b7fd818267f4b151a82713e9981d9af8c60108dfff7107a06ed54dbf26" ], "openbsd_amd64": [ - "go1.25.9.openbsd-amd64.tar.gz", - "37275325e314f5ab7cf8ae65c4efc7cbfdaf20b41c6849549739b57a3ac97544" + "go1.26.6.openbsd-amd64.tar.gz", + "1fe83868b4d2f8263bfb0a46d83ad82701cbb9ef11f8eb8c23d3fe001f5027c0" ], "openbsd_arm": [ - "go1.25.9.openbsd-arm.tar.gz", - "f9c05b6b315e979ecdd47354dd287c01708d6a88dc6ae7af74c84df8fa00df94" + "go1.26.6.openbsd-arm.tar.gz", + "0b3e67b301c89033e3c37dffb8aa9cbf0d23b5710fee4093df7d76712bb288d6" ], "openbsd_arm64": [ - "go1.25.9.openbsd-arm64.tar.gz", - "4e999f42cf959ff95ca84af1ea1db3771000f5e57e157904bc2ffc72c75e29a2" + "go1.26.6.openbsd-arm64.tar.gz", + "a032ab9370e64e5df6ff6691acdbddeb0c1dd81ae6581191d9c67b652415ef8a" ], "openbsd_ppc64": [ - "go1.25.9.openbsd-ppc64.tar.gz", - "0c7fa6c7c2b1cc13ad32fa94fc31273b4adf39c1e0f0e5dcedac158ff526af3f" + "go1.26.6.openbsd-ppc64.tar.gz", + "ed4e0cc786564f2d42989a739d62a734bfb3b1f56d61fedbb46edfbe6f13d2f3" ], "openbsd_riscv64": [ - "go1.25.9.openbsd-riscv64.tar.gz", - "347b33953a4b6e8df17719296f360f60878fe48a2d482ceb3637a3dfd4950065" + "go1.26.6.openbsd-riscv64.tar.gz", + "634e99a7883e09749cf9c9ed8530b4fa96fc9625f750f125ea4984196cfc09d0" ], "plan9_386": [ - "go1.25.9.plan9-386.tar.gz", - "889f77d567c06832e0d332fe2458653dc66d43cded7ddbca6f72ce0ca60029cc" + "go1.26.6.plan9-386.tar.gz", + "b2dd25b0a09d26a1f3b5c9ffc86c5bbd44e3a986c145304176897f2ca276f6f8" ], "plan9_amd64": [ - "go1.25.9.plan9-amd64.tar.gz", - "978b1f931fadec2f2516237d2649ee845d93c8eaf47dd196cfd8d26c7b2706a1" + "go1.26.6.plan9-amd64.tar.gz", + "a05fec45f6d53692836329bb2112465583f8bfa1dee6ab9ae1cab2d0aa1e2b43" ], "plan9_arm": [ - "go1.25.9.plan9-arm.tar.gz", - "30b9565e5ad0a212fe00990ead700c751b416eb2ef8d7c91a204945a7ff83a48" + "go1.26.6.plan9-arm.tar.gz", + "56d584473fa9f7c0e5a7ba64306b653541d0ea62565d172c31a158691f85c841" ], "solaris_amd64": [ - "go1.25.9.solaris-amd64.tar.gz", - "9e9125ff84ab3c3522ec758cab9540a17e9cba12bfcc34b6bf556cb89b522591" + "go1.26.6.solaris-amd64.tar.gz", + "111cb1bb13e0502e7dad2455af3d800a10e6a695d8ad7420c9499866eb35f665" ], "windows_386": [ - "go1.25.9.windows-386.zip", - "bf40515f5f4d834fa9ead31ff75581e61a38ac27bf49840b95c5c998d321c0f6" + "go1.26.6.windows-386.zip", + "1e352f0a2488a880b76f26d5f82479cbd3b286ef360cbbdf53e26df5f623f82f" ], "windows_amd64": [ - "go1.25.9.windows-amd64.zip", - "a7a710e225467b34e9e09fb432b829c86c9b2da5821ee5418f7eb2e8ae1a22cc" + "go1.26.6.windows-amd64.zip", + "5b6c5b556525810463b5c897b50dc7a82d6a3dc0bfaf55d990a7e9f31d6b2318" ], "windows_arm64": [ - "go1.25.9.windows-arm64.zip", - "33cd73cf1b3ceee655ef71bc96e94006c02ae3c617fdd67ac9be3dfae3957449" + "go1.26.6.windows-arm64.zip", + "06dbe785743d534ef8a469dad88adf7f1b2b438507ccfef9b98e7cf8c97b4b68" ] } }, diff --git a/bazel/repo/bazelify_go_work.bzl b/bazel/repo/bazelify_go_work.bzl index be6ec547b609..4ab287d0dbca 100644 --- a/bazel/repo/bazelify_go_work.bzl +++ b/bazel/repo/bazelify_go_work.bzl @@ -34,6 +34,9 @@ def _filter_lines(rctx): return False in_use_block, lines, symlinks = 0, [], set() + # Local owner replacements resolve relative to this filtered workspace. + if any(["./third_party/" in line for line in go_work]): + symlinks.add("third_party") for line in go_work: stripped = line.strip() if stripped == "use (": diff --git a/comp/api/api/def/go.mod b/comp/api/api/def/go.mod index 9e7ad54276ba..0a83da110225 100644 --- a/comp/api/api/def/go.mod +++ b/comp/api/api/def/go.mod @@ -5,12 +5,11 @@ go 1.25.0 require go.uber.org/fx v1.24.0 require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // indirect go.uber.org/dig v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect ) diff --git a/comp/api/api/def/go.sum b/comp/api/api/def/go.sum index 1e7c9b2a6c5c..6228232a9ca2 100644 --- a/comp/api/api/def/go.sum +++ b/comp/api/api/def/go.sum @@ -1,9 +1,5 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -14,9 +10,7 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/checks/winregistry/impl/winregistryimpl.go b/comp/checks/winregistry/impl/winregistryimpl.go index f9c864c6f13a..b2e4fd61a95c 100644 --- a/comp/checks/winregistry/impl/winregistryimpl.go +++ b/comp/checks/winregistry/impl/winregistryimpl.go @@ -31,11 +31,11 @@ import ( "github.com/DataDog/datadog-agent/pkg/metrics" agentLog "github.com/DataDog/datadog-agent/pkg/util/log" "github.com/DataDog/datadog-agent/pkg/util/option" - yy "github.com/ghodss/yaml" "github.com/swaggest/jsonschema-go" "github.com/xeipuuv/gojsonschema" "go.yaml.in/yaml/v2" "golang.org/x/sys/windows/registry" + yy "sigs.k8s.io/yaml" ) const ( diff --git a/comp/core/agenttelemetry/def/go.mod b/comp/core/agenttelemetry/def/go.mod index f276b32cd4e0..a594d12ae943 100644 --- a/comp/core/agenttelemetry/def/go.mod +++ b/comp/core/agenttelemetry/def/go.mod @@ -18,7 +18,7 @@ require ( github.com/tklauser/numcpus v0.11.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/comp/core/agenttelemetry/def/go.sum b/comp/core/agenttelemetry/def/go.sum index da3c602c679f..1480b81b2f9c 100644 --- a/comp/core/agenttelemetry/def/go.sum +++ b/comp/core/agenttelemetry/def/go.sum @@ -1,5 +1,3 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -7,22 +5,14 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -31,8 +21,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -40,8 +30,3 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/agenttelemetry/fx/go.mod b/comp/core/agenttelemetry/fx/go.mod index 10c90d751133..36801d3d92ab 100644 --- a/comp/core/agenttelemetry/fx/go.mod +++ b/comp/core/agenttelemetry/fx/go.mod @@ -8,8 +8,6 @@ require ( github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/api/api/def v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/config v0.78.3-rc.2 // indirect @@ -60,7 +58,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -76,7 +73,6 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -89,7 +85,7 @@ require ( github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // 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 @@ -99,7 +95,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect diff --git a/comp/core/agenttelemetry/fx/go.sum b/comp/core/agenttelemetry/fx/go.sum index 4e05a997dc78..42190c50af13 100644 --- a/comp/core/agenttelemetry/fx/go.sum +++ b/comp/core/agenttelemetry/fx/go.sum @@ -12,8 +12,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -65,8 +63,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -103,8 +99,8 @@ github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -126,8 +122,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 h1:jiDhWWeC7jfWqR9c/uplMOqJ0sbNlNWv0UkzE0vX1MA= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90/go.mod h1:xE1HEv6b+1SCZ5/uscMRjUBKtIxworgEcEi+/n9NQDQ= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= @@ -148,8 +145,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/agenttelemetry/impl/go.mod b/comp/core/agenttelemetry/impl/go.mod index fa74a42382c8..d8e732d887c2 100644 --- a/comp/core/agenttelemetry/impl/go.mod +++ b/comp/core/agenttelemetry/impl/go.mod @@ -23,13 +23,11 @@ require ( github.com/DataDog/zstd v1.5.7 github.com/prometheus/client_model v0.6.2 github.com/robfig/cron/v3 v3.0.1 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v2 v2.4.4 golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -66,7 +64,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -84,7 +81,6 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/common v0.67.5 // indirect @@ -104,7 +100,7 @@ require ( go.uber.org/fx v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/agenttelemetry/impl/go.sum b/comp/core/agenttelemetry/impl/go.sum index 3583e277e948..f69a1c76b0c5 100644 --- a/comp/core/agenttelemetry/impl/go.sum +++ b/comp/core/agenttelemetry/impl/go.sum @@ -12,8 +12,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -69,8 +67,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -107,8 +103,8 @@ github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -130,8 +126,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 h1:jiDhWWeC7jfWqR9c/uplMOqJ0sbNlNWv0UkzE0vX1MA= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90/go.mod h1:xE1HEv6b+1SCZ5/uscMRjUBKtIxworgEcEi+/n9NQDQ= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= @@ -152,8 +149,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/config/go.mod b/comp/core/config/go.mod index 006e0bfb9a4b..9cd0dadf7ae0 100644 --- a/comp/core/config/go.mod +++ b/comp/core/config/go.mod @@ -13,12 +13,10 @@ require ( github.com/DataDog/datadog-agent/pkg/util/defaultpaths v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/winutil v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/fx v1.24.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/def v0.78.3-rc.2 // indirect @@ -44,7 +42,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -58,7 +55,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -73,7 +69,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/config/go.sum b/comp/core/config/go.sum index 2f53e6942598..6a9ab90c3ccc 100644 --- a/comp/core/config/go.sum +++ b/comp/core/config/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -51,8 +49,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -75,8 +71,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -98,8 +94,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -114,8 +111,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/configsync/go.mod b/comp/core/configsync/go.mod index b662e42c48b5..7e2bf996fd04 100644 --- a/comp/core/configsync/go.mod +++ b/comp/core/configsync/go.mod @@ -14,13 +14,11 @@ require ( github.com/DataDog/datadog-agent/pkg/config/mock v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/model v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 go.uber.org/fx v1.24.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -57,7 +55,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -72,7 +69,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -90,7 +86,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/configsync/go.sum b/comp/core/configsync/go.sum index c6e2160725d5..81138872bdfd 100644 --- a/comp/core/configsync/go.sum +++ b/comp/core/configsync/go.sum @@ -10,8 +10,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -61,8 +59,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -93,8 +89,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -116,8 +112,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -136,8 +133,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/delegatedauth/api/cloudauth/aws/go.mod b/comp/core/delegatedauth/api/cloudauth/aws/go.mod index f668fd77e76d..3121d0035d7b 100644 --- a/comp/core/delegatedauth/api/cloudauth/aws/go.mod +++ b/comp/core/delegatedauth/api/cloudauth/aws/go.mod @@ -9,7 +9,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 github.com/aws/aws-sdk-go-v2 v1.41.5 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) require ( @@ -37,7 +37,6 @@ require ( github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/aws/smithy-go v1.24.3 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -50,7 +49,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -61,13 +59,12 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect golang.org/x/time v0.15.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/core/delegatedauth/api/cloudauth/aws/go.sum b/comp/core/delegatedauth/api/cloudauth/aws/go.sum index fbca0fb74849..35ded2b9978a 100644 --- a/comp/core/delegatedauth/api/cloudauth/aws/go.sum +++ b/comp/core/delegatedauth/api/cloudauth/aws/go.sum @@ -9,8 +9,6 @@ github.com/aws/smithy-go v1.24.3 h1:XgOAaUgx+HhVBoP4v8n6HCQoTRDhoMghKqw4LNHsDNg= github.com/aws/smithy-go v1.24.3/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -52,8 +50,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -72,8 +68,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -85,8 +81,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -103,8 +99,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/delegatedauth/go.mod b/comp/core/delegatedauth/go.mod index c19e21a5328b..adb6c998ec8e 100644 --- a/comp/core/delegatedauth/go.mod +++ b/comp/core/delegatedauth/go.mod @@ -14,7 +14,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 github.com/cenkalti/backoff/v5 v5.0.3 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) require ( @@ -43,7 +43,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect github.com/aws/smithy-go v1.24.3 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fatih/color v1.18.0 // indirect @@ -61,7 +60,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -77,13 +75,12 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect golang.org/x/time v0.15.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/core/delegatedauth/go.sum b/comp/core/delegatedauth/go.sum index b85ea29520aa..c6e971b0dd0e 100644 --- a/comp/core/delegatedauth/go.sum +++ b/comp/core/delegatedauth/go.sum @@ -12,8 +12,6 @@ github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F9 github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -65,8 +63,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -89,8 +85,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -112,8 +108,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -131,8 +128,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/flare/types/go.mod b/comp/core/flare/types/go.mod index 9e83bf136b5f..32c07899c89b 100644 --- a/comp/core/flare/types/go.mod +++ b/comp/core/flare/types/go.mod @@ -8,12 +8,11 @@ require ( ) require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // indirect go.uber.org/dig v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect ) diff --git a/comp/core/flare/types/go.sum b/comp/core/flare/types/go.sum index 1e7c9b2a6c5c..6228232a9ca2 100644 --- a/comp/core/flare/types/go.sum +++ b/comp/core/flare/types/go.sum @@ -1,9 +1,5 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -14,9 +10,7 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/hostname/hostnameinterface/go.mod b/comp/core/hostname/hostnameinterface/go.mod index 3a6f82ff0541..87eb9adcf4b7 100644 --- a/comp/core/hostname/hostnameinterface/go.mod +++ b/comp/core/hostname/hostnameinterface/go.mod @@ -4,23 +4,20 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/fx v1.24.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/def v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/option v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/pflag v1.0.10 // indirect go.uber.org/dig v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect ) diff --git a/comp/core/hostname/hostnameinterface/go.sum b/comp/core/hostname/hostnameinterface/go.sum index 71ab2a7e5a00..5392314376b9 100644 --- a/comp/core/hostname/hostnameinterface/go.sum +++ b/comp/core/hostname/hostnameinterface/go.sum @@ -1,24 +1,14 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -29,12 +19,9 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/ipc/httphelpers/go.mod b/comp/core/ipc/httphelpers/go.mod index 07fd1f0de6b5..ddc5010b17e6 100644 --- a/comp/core/ipc/httphelpers/go.mod +++ b/comp/core/ipc/httphelpers/go.mod @@ -10,11 +10,9 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/system v0.78.3-rc.2 github.com/mdlayher/vsock v1.2.1 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -49,7 +47,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -62,7 +59,6 @@ require ( github.com/mdlayher/socket v0.5.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -78,7 +74,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/ipc/httphelpers/go.sum b/comp/core/ipc/httphelpers/go.sum index 962dc810d4db..951d0dc21783 100644 --- a/comp/core/ipc/httphelpers/go.sum +++ b/comp/core/ipc/httphelpers/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -51,8 +49,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -75,8 +71,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -98,8 +94,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -116,8 +113,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/ipc/impl/go.mod b/comp/core/ipc/impl/go.mod index 7bba547f8c65..33762f03b41e 100644 --- a/comp/core/ipc/impl/go.mod +++ b/comp/core/ipc/impl/go.mod @@ -13,11 +13,9 @@ require ( github.com/DataDog/datadog-agent/pkg/config/model v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/flavor v0.78.3-rc.2 github.com/gofrs/flock v0.13.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -52,7 +50,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -65,7 +62,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -81,7 +77,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/ipc/impl/go.sum b/comp/core/ipc/impl/go.sum index 962dc810d4db..951d0dc21783 100644 --- a/comp/core/ipc/impl/go.sum +++ b/comp/core/ipc/impl/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -51,8 +49,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -75,8 +71,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -98,8 +94,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -116,8 +113,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/ipc/mock/go.mod b/comp/core/ipc/mock/go.mod index c3a36986e507..fcf4c5482d5b 100644 --- a/comp/core/ipc/mock/go.mod +++ b/comp/core/ipc/mock/go.mod @@ -9,11 +9,9 @@ require ( github.com/DataDog/datadog-agent/pkg/api v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/mock v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/model v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -49,7 +47,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -63,7 +60,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -79,7 +75,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/ipc/mock/go.sum b/comp/core/ipc/mock/go.sum index 962dc810d4db..951d0dc21783 100644 --- a/comp/core/ipc/mock/go.sum +++ b/comp/core/ipc/mock/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -51,8 +49,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -75,8 +71,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -98,8 +94,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -116,8 +113,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/log/def/go.mod b/comp/core/log/def/go.mod index fdc19825f099..9e7be0c0c8bd 100644 --- a/comp/core/log/def/go.mod +++ b/comp/core/log/def/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/comp/core/log/def go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/core/log/def/go.sum b/comp/core/log/def/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/comp/core/log/def/go.sum +++ b/comp/core/log/def/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/comp/core/log/fx/go.mod b/comp/core/log/fx/go.mod index 6b4a89419ac2..bfc326ea034f 100644 --- a/comp/core/log/fx/go.mod +++ b/comp/core/log/fx/go.mod @@ -7,8 +7,6 @@ require ( github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/config v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect @@ -46,7 +44,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -60,14 +57,13 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // 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 @@ -77,7 +73,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/log/fx/go.sum b/comp/core/log/fx/go.sum index 2f53e6942598..6a9ab90c3ccc 100644 --- a/comp/core/log/fx/go.sum +++ b/comp/core/log/fx/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -51,8 +49,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -75,8 +71,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -98,8 +94,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -114,8 +111,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/log/impl-trace/go.mod b/comp/core/log/impl-trace/go.mod index 3d6293573eb0..bb2447775dd5 100644 --- a/comp/core/log/impl-trace/go.mod +++ b/comp/core/log/impl-trace/go.mod @@ -8,7 +8,7 @@ require ( github.com/DataDog/datadog-agent/pkg/config/env v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/fx v1.24.0 // indirect ) @@ -19,8 +19,6 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log/setup v0.78.3-rc.2 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -51,7 +49,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -65,7 +62,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -80,7 +76,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/log/impl-trace/go.sum b/comp/core/log/impl-trace/go.sum index 2f53e6942598..6a9ab90c3ccc 100644 --- a/comp/core/log/impl-trace/go.sum +++ b/comp/core/log/impl-trace/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -51,8 +49,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -75,8 +71,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -98,8 +94,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -114,8 +111,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/log/impl/go.mod b/comp/core/log/impl/go.mod index 2cb1a1a543a4..67f2b9ae8c9d 100644 --- a/comp/core/log/impl/go.mod +++ b/comp/core/log/impl/go.mod @@ -9,11 +9,9 @@ require ( github.com/DataDog/datadog-agent/pkg/config/mock v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log/setup v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -46,7 +44,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -60,7 +57,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -76,7 +72,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/log/impl/go.sum b/comp/core/log/impl/go.sum index 2f53e6942598..6a9ab90c3ccc 100644 --- a/comp/core/log/impl/go.sum +++ b/comp/core/log/impl/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -51,8 +49,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -75,8 +71,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -98,8 +94,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -114,8 +111,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/log/mock/go.mod b/comp/core/log/mock/go.mod index 026cd8a03c8a..245f1ba0e665 100644 --- a/comp/core/log/mock/go.mod +++ b/comp/core/log/mock/go.mod @@ -12,7 +12,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/comp/core/log/mock/go.sum b/comp/core/log/mock/go.sum index f75dbfe49ae9..befeb0397c22 100644 --- a/comp/core/log/mock/go.sum +++ b/comp/core/log/mock/go.sum @@ -1,23 +1,8 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/secrets/fx/go.mod b/comp/core/secrets/fx/go.mod index 5f8eb7e40cdf..b39ce206366d 100644 --- a/comp/core/secrets/fx/go.mod +++ b/comp/core/secrets/fx/go.mod @@ -7,8 +7,6 @@ require ( github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/api/api/def v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect @@ -48,7 +46,6 @@ require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fatih/color v1.18.0 // indirect @@ -70,7 +67,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -81,7 +77,7 @@ require ( github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // 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 @@ -91,7 +87,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect diff --git a/comp/core/secrets/fx/go.sum b/comp/core/secrets/fx/go.sum index 473354aa20a1..218180ef490c 100644 --- a/comp/core/secrets/fx/go.sum +++ b/comp/core/secrets/fx/go.sum @@ -12,8 +12,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -76,8 +74,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -109,8 +105,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -132,8 +128,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 h1:jiDhWWeC7jfWqR9c/uplMOqJ0sbNlNWv0UkzE0vX1MA= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90/go.mod h1:xE1HEv6b+1SCZ5/uscMRjUBKtIxworgEcEi+/n9NQDQ= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= @@ -155,8 +152,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/secrets/impl/go.mod b/comp/core/secrets/impl/go.mod index 9d8ecb383e95..1be3a56a1675 100644 --- a/comp/core/secrets/impl/go.mod +++ b/comp/core/secrets/impl/go.mod @@ -19,14 +19,12 @@ require ( github.com/DataDog/datadog-agent/pkg/util/winutil v0.78.3-rc.2 github.com/benbjohnson/clock v1.3.5 github.com/json-iterator/go v1.1.12 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v2 v2.4.4 golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 golang.org/x/sys v0.47.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -53,7 +51,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fatih/color v1.18.0 // indirect @@ -74,7 +71,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -93,7 +89,7 @@ require ( go.uber.org/fx v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/text v0.41.0 // indirect diff --git a/comp/core/secrets/impl/go.sum b/comp/core/secrets/impl/go.sum index fdeb9d4e05dd..5d090b50ee58 100644 --- a/comp/core/secrets/impl/go.sum +++ b/comp/core/secrets/impl/go.sum @@ -12,8 +12,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -80,8 +78,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -113,8 +109,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -136,8 +132,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 h1:jiDhWWeC7jfWqR9c/uplMOqJ0sbNlNWv0UkzE0vX1MA= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90/go.mod h1:xE1HEv6b+1SCZ5/uscMRjUBKtIxworgEcEi+/n9NQDQ= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= @@ -159,8 +156,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/secrets/mock/go.sum b/comp/core/secrets/mock/go.sum index 4cb5cccad8bc..00232dc65225 100644 --- a/comp/core/secrets/mock/go.sum +++ b/comp/core/secrets/mock/go.sum @@ -1,10 +1,6 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/comp/core/secrets/noop-impl/go.sum b/comp/core/secrets/noop-impl/go.sum index 42c6a6137716..3efeb3ab42de 100644 --- a/comp/core/secrets/noop-impl/go.sum +++ b/comp/core/secrets/noop-impl/go.sum @@ -1,5 +1,3 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= @@ -16,14 +14,12 @@ github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHP github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -34,12 +30,10 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/secrets/utils/go.mod b/comp/core/secrets/utils/go.mod index 69744be85819..933d0abdd286 100644 --- a/comp/core/secrets/utils/go.mod +++ b/comp/core/secrets/utils/go.mod @@ -3,19 +3,11 @@ module github.com/DataDog/datadog-agent/comp/core/secrets/utils go 1.25.0 require ( - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v2 v2.4.4 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/core/secrets/utils/go.sum b/comp/core/secrets/utils/go.sum index d50fba8e7357..00232dc65225 100644 --- a/comp/core/secrets/utils/go.sum +++ b/comp/core/secrets/utils/go.sum @@ -1,25 +1,6 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/comp/core/status/go.mod b/comp/core/status/go.mod index 7e3447df217d..73d25dbdc782 100644 --- a/comp/core/status/go.mod +++ b/comp/core/status/go.mod @@ -7,25 +7,21 @@ require ( github.com/dustin/go-humanize v1.0.1 github.com/fatih/color v1.18.0 github.com/spf13/cast v1.10.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/fx v1.24.0 golang.org/x/text v0.41.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect go.uber.org/dig v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/core/status/go.sum b/comp/core/status/go.sum index e15a32ee4a47..3efeb3ab42de 100644 --- a/comp/core/status/go.sum +++ b/comp/core/status/go.sum @@ -1,5 +1,3 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= @@ -8,25 +6,20 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -37,15 +30,10 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/status/statusimpl/go.mod b/comp/core/status/statusimpl/go.mod index 49bba23c9069..73dba0c721ad 100644 --- a/comp/core/status/statusimpl/go.mod +++ b/comp/core/status/statusimpl/go.mod @@ -17,13 +17,11 @@ require ( github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 github.com/gorilla/mux v1.8.1 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/fx v1.24.0 golang.org/x/text v0.41.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -51,7 +49,6 @@ require ( github.com/DataDog/datadog-agent/pkg/util/winutil v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fatih/color v1.18.0 // indirect @@ -69,7 +66,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -84,7 +80,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/status/statusimpl/go.sum b/comp/core/status/statusimpl/go.sum index 32a2b7e40b8a..91e354f6486e 100644 --- a/comp/core/status/statusimpl/go.sum +++ b/comp/core/status/statusimpl/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -61,8 +59,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -85,8 +81,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -108,8 +104,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -127,8 +124,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/tagger/def/go.mod b/comp/core/tagger/def/go.mod index 5574171811ba..7293222c7ab4 100644 --- a/comp/core/tagger/def/go.mod +++ b/comp/core/tagger/def/go.mod @@ -11,8 +11,6 @@ require ( github.com/DataDog/datadog-agent/pkg/tagset v0.78.3-rc.2 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -49,7 +47,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -63,14 +60,13 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // indirect github.com/tklauser/go-sysconf v0.3.16 // indirect github.com/tklauser/numcpus v0.11.0 // indirect github.com/twmb/murmur3 v1.1.8 // indirect @@ -81,7 +77,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/core/tagger/def/go.sum b/comp/core/tagger/def/go.sum index 4406314260d8..635ce17170f1 100644 --- a/comp/core/tagger/def/go.sum +++ b/comp/core/tagger/def/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -51,8 +49,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -75,8 +71,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -100,8 +96,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -116,8 +113,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/tagger/fx-remote/go.mod b/comp/core/tagger/fx-remote/go.mod index ba79b42f8e30..986afee56a24 100644 --- a/comp/core/tagger/fx-remote/go.mod +++ b/comp/core/tagger/fx-remote/go.mod @@ -9,8 +9,6 @@ require ( go.uber.org/fx v1.24.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( cloud.google.com/go/auth v0.18.2 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect @@ -71,7 +69,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -96,7 +93,6 @@ require ( github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/philhofer/fwd v1.2.0 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -107,7 +103,7 @@ require ( github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // indirect github.com/tinylib/msgp v1.6.3 // indirect github.com/tklauser/go-sysconf v0.3.16 // indirect github.com/tklauser/numcpus v0.11.0 // indirect @@ -123,7 +119,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect diff --git a/comp/core/tagger/fx-remote/go.sum b/comp/core/tagger/fx-remote/go.sum index faf48cc8eb4b..d6b8aa9d97fa 100644 --- a/comp/core/tagger/fx-remote/go.sum +++ b/comp/core/tagger/fx-remote/go.sum @@ -27,8 +27,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -120,8 +118,6 @@ github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -157,8 +153,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -204,8 +200,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -296,13 +293,9 @@ google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/comp/core/tagger/generic_store/go.mod b/comp/core/tagger/generic_store/go.mod index 594f4536495c..e7dac80fe9e2 100644 --- a/comp/core/tagger/generic_store/go.mod +++ b/comp/core/tagger/generic_store/go.mod @@ -4,16 +4,13 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/comp/core/tagger/types v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/tagger/origindetection v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/tagger/utils v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/core/tagger/generic_store/go.sum b/comp/core/tagger/generic_store/go.sum index 2bdbe9cbda42..c2336837ec7d 100644 --- a/comp/core/tagger/generic_store/go.sum +++ b/comp/core/tagger/generic_store/go.sum @@ -1,17 +1,4 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/comp/core/tagger/impl-remote/go.mod b/comp/core/tagger/impl-remote/go.mod index d80eca8eb1b5..e3b9550f04d1 100644 --- a/comp/core/tagger/impl-remote/go.mod +++ b/comp/core/tagger/impl-remote/go.mod @@ -32,14 +32,11 @@ require ( github.com/cenkalti/backoff/v5 v5.0.3 github.com/google/uuid v1.6.0 github.com/mdlayher/vsock v1.2.1 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 google.golang.org/grpc v1.83.2 ) -require ( - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) +require github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect require ( cloud.google.com/go/auth v0.18.2 // indirect @@ -82,7 +79,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -104,7 +100,6 @@ require ( github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/philhofer/fwd v1.2.0 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -131,7 +126,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect diff --git a/comp/core/tagger/impl-remote/go.sum b/comp/core/tagger/impl-remote/go.sum index faf48cc8eb4b..d6b8aa9d97fa 100644 --- a/comp/core/tagger/impl-remote/go.sum +++ b/comp/core/tagger/impl-remote/go.sum @@ -27,8 +27,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -120,8 +118,6 @@ github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -157,8 +153,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -204,8 +200,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -296,13 +293,9 @@ google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/comp/core/tagger/origindetection/go.mod b/comp/core/tagger/origindetection/go.mod index 262309207955..dab5323e2e6b 100644 --- a/comp/core/tagger/origindetection/go.mod +++ b/comp/core/tagger/origindetection/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/comp/core/tagger/origindetection go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/core/tagger/origindetection/go.sum b/comp/core/tagger/origindetection/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/comp/core/tagger/origindetection/go.sum +++ b/comp/core/tagger/origindetection/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/comp/core/tagger/subscriber/go.mod b/comp/core/tagger/subscriber/go.mod index c9306cb7e285..0f7293eb1bd7 100644 --- a/comp/core/tagger/subscriber/go.mod +++ b/comp/core/tagger/subscriber/go.mod @@ -8,11 +8,9 @@ require ( github.com/DataDog/datadog-agent/comp/core/telemetry v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/tagger/origindetection v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/tagger/utils v0.78.3-rc.2 // indirect @@ -23,10 +21,8 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.5 // indirect @@ -39,7 +35,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/time v0.15.0 // indirect google.golang.org/protobuf v1.36.11 // indirect diff --git a/comp/core/tagger/subscriber/go.sum b/comp/core/tagger/subscriber/go.sum index e169f1f29a78..b1cbe942da3d 100644 --- a/comp/core/tagger/subscriber/go.sum +++ b/comp/core/tagger/subscriber/go.sum @@ -3,24 +3,16 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= @@ -29,16 +21,14 @@ github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTU github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= @@ -53,8 +43,9 @@ go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= @@ -62,7 +53,3 @@ golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/tagger/telemetry/go.sum b/comp/core/tagger/telemetry/go.sum index 14dc5f981d4c..f5356fb3e97b 100644 --- a/comp/core/tagger/telemetry/go.sum +++ b/comp/core/tagger/telemetry/go.sum @@ -2,14 +2,10 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= @@ -18,15 +14,15 @@ github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTU github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/core/tagger/types/go.mod b/comp/core/tagger/types/go.mod index a03ab5162973..4ed2a91a32b9 100644 --- a/comp/core/tagger/types/go.mod +++ b/comp/core/tagger/types/go.mod @@ -5,16 +5,10 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/comp/core/tagger/origindetection v0.78.3-rc.2 github.com/DataDog/datadog-agent/comp/core/tagger/utils v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/text v0.2.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/core/tagger/types/go.sum b/comp/core/tagger/types/go.sum index 89d5fa07d6c0..c2336837ec7d 100644 --- a/comp/core/tagger/types/go.sum +++ b/comp/core/tagger/types/go.sum @@ -1,18 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/comp/core/tagger/utils/go.mod b/comp/core/tagger/utils/go.mod index b0e6041aed6b..e0c2c71baa4e 100644 --- a/comp/core/tagger/utils/go.mod +++ b/comp/core/tagger/utils/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/comp/core/tagger/utils go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/core/tagger/utils/go.sum b/comp/core/tagger/utils/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/comp/core/tagger/utils/go.sum +++ b/comp/core/tagger/utils/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/comp/core/telemetry/go.mod b/comp/core/telemetry/go.mod index c370d4b260b4..6f5fbe2c7951 100644 --- a/comp/core/telemetry/go.mod +++ b/comp/core/telemetry/go.mod @@ -7,22 +7,18 @@ require ( github.com/prometheus/client_golang v1.23.2 github.com/prometheus/client_model v0.6.2 github.com/prometheus/common v0.67.5 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/fx v1.24.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/def v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/option v0.78.3-rc.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.18.7 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/procfs v0.20.1 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/pflag v1.0.10 // indirect @@ -30,6 +26,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/comp/core/telemetry/go.sum b/comp/core/telemetry/go.sum index 1bc8f6dd044d..8b60fb05877a 100644 --- a/comp/core/telemetry/go.sum +++ b/comp/core/telemetry/go.sum @@ -3,24 +3,16 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= @@ -29,16 +21,14 @@ github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTU github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -51,14 +41,11 @@ go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/def/go.mod b/comp/def/go.mod index 555d417a2f90..c059a8802d2b 100644 --- a/comp/def/go.mod +++ b/comp/def/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/comp/def go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/def/go.sum b/comp/def/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/comp/def/go.sum +++ b/comp/def/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/comp/forwarder/defaultforwarder/go.mod b/comp/forwarder/defaultforwarder/go.mod index 631a8d80b602..94130df1c124 100644 --- a/comp/forwarder/defaultforwarder/go.mod +++ b/comp/forwarder/defaultforwarder/go.mod @@ -29,15 +29,13 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 github.com/benbjohnson/clock v1.3.5 github.com/hashicorp/go-multierror v1.1.1 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 go.uber.org/fx v1.24.0 golang.org/x/sync v0.22.0 google.golang.org/protobuf v1.36.11 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -66,7 +64,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fatih/color v1.18.0 // indirect @@ -87,7 +84,6 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -106,7 +102,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect diff --git a/comp/forwarder/defaultforwarder/go.sum b/comp/forwarder/defaultforwarder/go.sum index cfeabbfb5669..d702b8d601b7 100644 --- a/comp/forwarder/defaultforwarder/go.sum +++ b/comp/forwarder/defaultforwarder/go.sum @@ -12,8 +12,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -78,8 +76,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -112,8 +108,8 @@ github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -135,8 +131,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -156,8 +153,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/forwarder/orchestrator/orchestratorinterface/go.mod b/comp/forwarder/orchestrator/orchestratorinterface/go.mod index af2350f0dd99..182c330b48e9 100644 --- a/comp/forwarder/orchestrator/orchestratorinterface/go.mod +++ b/comp/forwarder/orchestrator/orchestratorinterface/go.mod @@ -4,8 +4,6 @@ go 1.25.0 require github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder v0.78.3-rc.2 -require gopkg.in/yaml.v3 v3.0.1 // indirect - // Internal deps fix version replace github.com/spf13/cast => github.com/DataDog/cast v1.8.0 @@ -59,7 +57,6 @@ require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fatih/color v1.18.0 // indirect @@ -81,7 +78,6 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -93,7 +89,7 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/stretchr/objx v0.5.3 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // 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 @@ -103,7 +99,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/forwarder/orchestrator/orchestratorinterface/go.sum b/comp/forwarder/orchestrator/orchestratorinterface/go.sum index fd0202f48314..7d0437d2f13c 100644 --- a/comp/forwarder/orchestrator/orchestratorinterface/go.sum +++ b/comp/forwarder/orchestrator/orchestratorinterface/go.sum @@ -15,8 +15,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6N github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -83,8 +81,6 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -115,8 +111,8 @@ github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -138,8 +134,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -159,8 +156,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/host-profiler/collector/impl/agentprovider/provider_test.go b/comp/host-profiler/collector/impl/agentprovider/provider_test.go index 27fbed7da0b5..76705df6d618 100644 --- a/comp/host-profiler/collector/impl/agentprovider/provider_test.go +++ b/comp/host-profiler/collector/impl/agentprovider/provider_test.go @@ -35,7 +35,7 @@ import ( "go.opentelemetry.io/collector/otelcol/otelcoltest" "go.opentelemetry.io/collector/receiver/otlpreceiver" "go.opentelemetry.io/collector/service/telemetry/otelconftelemetry" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) var updateGolden = flag.Bool("update", false, "update golden test files") diff --git a/comp/logs-library/go.mod b/comp/logs-library/go.mod index 2ce2743ab195..1316fe61148f 100644 --- a/comp/logs-library/go.mod +++ b/comp/logs-library/go.mod @@ -8,20 +8,17 @@ require ( go.uber.org/fx v1.24.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/def v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/option v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // indirect go.uber.org/dig v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect ) diff --git a/comp/logs-library/go.sum b/comp/logs-library/go.sum index 71ab2a7e5a00..5392314376b9 100644 --- a/comp/logs-library/go.sum +++ b/comp/logs-library/go.sum @@ -1,24 +1,14 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -29,12 +19,9 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/logs/agent/config/go.mod b/comp/logs/agent/config/go.mod index 5f66e6839547..3dc1a8d65240 100644 --- a/comp/logs/agent/config/go.mod +++ b/comp/logs/agent/config/go.mod @@ -12,13 +12,11 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/pointer v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 - go.yaml.in/yaml/v3 v3.0.4 + go.yaml.in/yaml/v3 v3.0.5 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -48,7 +46,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -62,7 +59,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect diff --git a/comp/logs/agent/config/go.sum b/comp/logs/agent/config/go.sum index 962dc810d4db..951d0dc21783 100644 --- a/comp/logs/agent/config/go.sum +++ b/comp/logs/agent/config/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -51,8 +49,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -75,8 +71,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -98,8 +94,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -116,8 +113,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/otelcol/collector-contrib/def/go.mod b/comp/otelcol/collector-contrib/def/go.mod index 6e83049b3beb..5e6950a1bcd8 100644 --- a/comp/otelcol/collector-contrib/def/go.mod +++ b/comp/otelcol/collector-contrib/def/go.mod @@ -41,13 +41,11 @@ require ( go.opentelemetry.io/collector/processor/xprocessor v0.150.0 // indirect go.opentelemetry.io/collector/receiver/xreceiver v0.150.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.21.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -68,7 +66,6 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -77,7 +74,7 @@ require ( github.com/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // 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 @@ -120,7 +117,7 @@ require ( go.opentelemetry.io/proto/otlp v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect golang.org/x/net v0.58.0 // indirect diff --git a/comp/otelcol/collector-contrib/def/go.sum b/comp/otelcol/collector-contrib/def/go.sum index 81c03bf8402f..ef2a9df63b18 100644 --- a/comp/otelcol/collector-contrib/def/go.sum +++ b/comp/otelcol/collector-contrib/def/go.sum @@ -7,8 +7,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -58,10 +56,6 @@ github.com/knadh/koanf/providers/confmap v1.0.0 h1:mHKLJTE7iXEys6deO5p6olAiZdG5z github.com/knadh/koanf/providers/confmap v1.0.0/go.mod h1:txHYHiI2hAtF0/0sCmcuol4IDcuQbKTybiB1nOcUo1A= github.com/knadh/koanf/v2 v2.3.4 h1:fnynNSDlujWE+v83hAp8wKr/cdoxHLO0629SN+U8Urc= github.com/knadh/koanf/v2 v2.3.4/go.mod h1:gRb40VRAbd4iJMYYD5IxZ6hfuopFcXBpc9bbQpZwo28= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k= @@ -81,8 +75,6 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m github.com/pierrec/lz4/v4 v4.1.26 h1:GrpZw1gZttORinvzBdXPUXATeqlJjqUG/D87TKMnhjY= github.com/pierrec/lz4/v4 v4.1.26/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -95,8 +87,6 @@ github.com/prometheus/otlptranslator v1.0.0 h1:s0LJW/iN9dkIH+EnhiD3BlkkP5QVIUVEo github.com/prometheus/otlptranslator v1.0.0/go.mod h1:vRYWnXvI6aWGpsdY/mOT/cbeVRBlPWtBNDb7kGR3uKM= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -109,8 +99,8 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -293,8 +283,9 @@ go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.56.0 h1:GUh5Ii4J5jtcseSMiRqr1jXCNHoxjeV9Fmekc2oLy6Y= golang.org/x/crypto v0.56.0/go.mod h1:OMW5y6CY9l38uPLmxU6l6pwcXp1obtLo3e6gT7gQR2I= golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 h1:jiDhWWeC7jfWqR9c/uplMOqJ0sbNlNWv0UkzE0vX1MA= @@ -319,7 +310,3 @@ google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsok google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/otelcol/collector-contrib/impl/go.mod b/comp/otelcol/collector-contrib/impl/go.mod index 14de7ed03cff..ef483ef7dcb2 100644 --- a/comp/otelcol/collector-contrib/impl/go.mod +++ b/comp/otelcol/collector-contrib/impl/go.mod @@ -405,7 +405,7 @@ require ( github.com/spf13/pflag v1.0.10 // indirect github.com/stackitcloud/stackit-sdk-go/core v0.23.0 // indirect github.com/stretchr/objx v0.5.3 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // indirect github.com/tilinna/clock v1.1.0 // indirect github.com/tinylib/msgp v1.6.3 // indirect github.com/tklauser/go-sysconf v0.3.16 // indirect @@ -509,7 +509,7 @@ require ( go.uber.org/zap v1.28.0 // indirect go.uber.org/zap/exp v0.3.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect go.yaml.in/yaml/v4 v4.0.0-rc.4 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect diff --git a/comp/otelcol/collector-contrib/impl/go.sum b/comp/otelcol/collector-contrib/impl/go.sum index f5b084fee7c3..2ad3108aebcf 100644 --- a/comp/otelcol/collector-contrib/impl/go.sum +++ b/comp/otelcol/collector-contrib/impl/go.sum @@ -875,8 +875,9 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/testcontainers/testcontainers-go v0.42.0 h1:He3IhTzTZOygSXLJPMX7n44XtK+qhjat1nI9cneBbUY= github.com/testcontainers/testcontainers-go v0.42.0/go.mod h1:vZjdY1YmUA1qEForxOIOazfsrdyORJAbhi0bp8plN30= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= @@ -1175,8 +1176,9 @@ go.uber.org/zap/exp v0.3.0/go.mod h1:5I384qq7XGxYyByIhHm6jg5CHkGY0nsTfbDLgDDlgJQ go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= go.yaml.in/yaml/v4 v4.0.0-rc.4 h1:UP4+v6fFrBIb1l934bDl//mmnoIZEDK0idg1+AIvX5U= go.yaml.in/yaml/v4 v4.0.0-rc.4/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/comp/otelcol/converter/def/go.mod b/comp/otelcol/converter/def/go.mod index 63eca5d69c33..b3724787fbf8 100644 --- a/comp/otelcol/converter/def/go.mod +++ b/comp/otelcol/converter/def/go.mod @@ -7,7 +7,6 @@ require go.opentelemetry.io/collector/confmap v1.57.0 require github.com/gobwas/glob v0.2.3 // indirect require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/hashicorp/go-version v1.9.0 // indirect github.com/knadh/koanf/maps v0.1.2 // indirect @@ -15,12 +14,11 @@ require ( github.com/knadh/koanf/v2 v2.3.4 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect + github.com/stretchr/testify v1.12.1 // indirect go.opentelemetry.io/collector/featuregate v1.57.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/otelcol/converter/def/go.sum b/comp/otelcol/converter/def/go.sum index 3555e7710944..00803d2ed8a6 100644 --- a/comp/otelcol/converter/def/go.sum +++ b/comp/otelcol/converter/def/go.sum @@ -1,5 +1,3 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= @@ -12,20 +10,12 @@ github.com/knadh/koanf/providers/confmap v1.0.0 h1:mHKLJTE7iXEys6deO5p6olAiZdG5z github.com/knadh/koanf/providers/confmap v1.0.0/go.mod h1:txHYHiI2hAtF0/0sCmcuol4IDcuQbKTybiB1nOcUo1A= github.com/knadh/koanf/v2 v2.3.4 h1:fnynNSDlujWE+v83hAp8wKr/cdoxHLO0629SN+U8Urc= github.com/knadh/koanf/v2 v2.3.4/go.mod h1:gRb40VRAbd4iJMYYD5IxZ6hfuopFcXBpc9bbQpZwo28= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.opentelemetry.io/collector/confmap v1.57.0 h1:5AuK920dJmV8zxQAiODi2JHPl2r1HmEHHMaBSC+qF5I= go.opentelemetry.io/collector/confmap v1.57.0/go.mod h1:ifmog4kqEMM037qX04qEbom5CcxhmkadLUqhi2Vkuec= go.opentelemetry.io/collector/featuregate v1.57.0 h1:KPDSUKYn6MHwgyGRSGPPcW/G96HH93pxuvvPwM+R8nY= @@ -36,10 +26,5 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/comp/otelcol/converter/impl/go.mod b/comp/otelcol/converter/impl/go.mod index f893dcf56125..3342bf245e34 100644 --- a/comp/otelcol/converter/impl/go.mod +++ b/comp/otelcol/converter/impl/go.mod @@ -6,7 +6,7 @@ require ( github.com/DataDog/datadog-agent/comp/core/config v0.78.3-rc.2 github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface v0.78.3-rc.2 github.com/DataDog/datadog-agent/comp/otelcol/converter/def v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/confmap v1.57.0 go.opentelemetry.io/collector/confmap/provider/envprovider v1.56.0 go.opentelemetry.io/collector/confmap/provider/fileprovider v1.56.0 @@ -16,10 +16,7 @@ require ( go.uber.org/zap v1.28.0 ) -require ( - github.com/gobwas/glob v0.2.3 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) +require github.com/gobwas/glob v0.2.3 // indirect require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect @@ -56,7 +53,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -76,7 +72,6 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -92,7 +87,7 @@ require ( go.uber.org/fx v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/otelcol/converter/impl/go.sum b/comp/otelcol/converter/impl/go.sum index ec44a0af2d96..d5e6d1967b9f 100644 --- a/comp/otelcol/converter/impl/go.sum +++ b/comp/otelcol/converter/impl/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -65,8 +63,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -89,8 +85,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -128,8 +124,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -144,8 +141,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/otelcol/ddflareextension/def/go.mod b/comp/otelcol/ddflareextension/def/go.mod index b47e5d36d995..9950684da986 100644 --- a/comp/otelcol/ddflareextension/def/go.mod +++ b/comp/otelcol/ddflareextension/def/go.mod @@ -10,12 +10,11 @@ require ( ) require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/hashicorp/go-version v1.9.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/stretchr/testify v1.12.1 // indirect go.opentelemetry.io/collector/component v1.57.0 // indirect go.opentelemetry.io/collector/featuregate v1.57.0 // indirect go.opentelemetry.io/collector/pdata v1.57.0 // indirect @@ -24,6 +23,7 @@ require ( go.opentelemetry.io/otel/trace v1.45.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/otelcol/ddflareextension/def/go.sum b/comp/otelcol/ddflareextension/def/go.sum index b35bd65aa32e..2a200d62acab 100644 --- a/comp/otelcol/ddflareextension/def/go.sum +++ b/comp/otelcol/ddflareextension/def/go.sum @@ -2,8 +2,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -22,12 +20,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/collector/component v1.57.0 h1:WKIqx2Bs0JaAZxDEhsLradXpYxnwAxVFzWhQUmu2q3w= @@ -60,9 +56,7 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/otelcol/ddflareextension/impl/go.mod b/comp/otelcol/ddflareextension/impl/go.mod index b6da740b839d..e2672940cec1 100644 --- a/comp/otelcol/ddflareextension/impl/go.mod +++ b/comp/otelcol/ddflareextension/impl/go.mod @@ -20,7 +20,7 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/extension/pprofextension v0.150.0 github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.150.0 github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.150.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/component v1.57.0 go.opentelemetry.io/collector/component/componentstatus v0.150.0 go.opentelemetry.io/collector/component/componenttest v0.150.0 @@ -507,7 +507,7 @@ require ( go.uber.org/goleak v1.3.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap/exp v0.3.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect golang.org/x/mod v0.40.0 // indirect diff --git a/comp/otelcol/ddflareextension/impl/go.sum b/comp/otelcol/ddflareextension/impl/go.sum index b0c5d78e1c5f..9cd49e94cb9a 100644 --- a/comp/otelcol/ddflareextension/impl/go.sum +++ b/comp/otelcol/ddflareextension/impl/go.sum @@ -778,8 +778,9 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/testcontainers/testcontainers-go v0.42.0 h1:He3IhTzTZOygSXLJPMX7n44XtK+qhjat1nI9cneBbUY= github.com/testcontainers/testcontainers-go v0.42.0/go.mod h1:vZjdY1YmUA1qEForxOIOazfsrdyORJAbhi0bp8plN30= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= @@ -1060,8 +1061,9 @@ go.uber.org/zap/exp v0.3.0/go.mod h1:5I384qq7XGxYyByIhHm6jg5CHkGY0nsTfbDLgDDlgJQ go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= go.yaml.in/yaml/v4 v4.0.0-rc.4 h1:UP4+v6fFrBIb1l934bDl//mmnoIZEDK0idg1+AIvX5U= go.yaml.in/yaml/v4 v4.0.0-rc.4/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/comp/otelcol/ddprofilingextension/def/go.mod b/comp/otelcol/ddprofilingextension/def/go.mod index be80a9145a96..b389c3d3be0a 100644 --- a/comp/otelcol/ddprofilingextension/def/go.mod +++ b/comp/otelcol/ddprofilingextension/def/go.mod @@ -10,12 +10,11 @@ require ( ) require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/hashicorp/go-version v1.9.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/stretchr/testify v1.12.1 // indirect go.opentelemetry.io/collector/component v1.57.0 // indirect go.opentelemetry.io/collector/featuregate v1.57.0 // indirect go.opentelemetry.io/collector/pdata v1.57.0 // indirect @@ -24,6 +23,7 @@ require ( go.opentelemetry.io/otel/trace v1.45.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/comp/otelcol/ddprofilingextension/def/go.sum b/comp/otelcol/ddprofilingextension/def/go.sum index b35bd65aa32e..2a200d62acab 100644 --- a/comp/otelcol/ddprofilingextension/def/go.sum +++ b/comp/otelcol/ddprofilingextension/def/go.sum @@ -2,8 +2,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -22,12 +20,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/collector/component v1.57.0 h1:WKIqx2Bs0JaAZxDEhsLradXpYxnwAxVFzWhQUmu2q3w= @@ -60,9 +56,7 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/otelcol/ddprofilingextension/impl/go.mod b/comp/otelcol/ddprofilingextension/impl/go.mod index 6a5d173c29c0..5f0e90f77c41 100644 --- a/comp/otelcol/ddprofilingextension/impl/go.mod +++ b/comp/otelcol/ddprofilingextension/impl/go.mod @@ -13,7 +13,7 @@ require ( github.com/DataDog/datadog-agent/pkg/trace v0.78.3-rc.2 github.com/DataDog/datadog-go/v5 v5.8.3 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog v0.150.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/component v1.57.0 go.opentelemetry.io/collector/component/componentstatus v0.150.0 go.opentelemetry.io/collector/component/componenttest v0.150.0 @@ -38,7 +38,6 @@ require ( github.com/go-openapi/swag/yamlutils v0.25.5 // indirect go.opentelemetry.io/collector/internal/componentalias v0.151.0 // indirect go.opentelemetry.io/collector/pipeline/xpipeline v0.150.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( @@ -250,7 +249,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/mod v0.40.0 // indirect golang.org/x/net v0.58.0 // indirect diff --git a/comp/otelcol/ddprofilingextension/impl/go.sum b/comp/otelcol/ddprofilingextension/impl/go.sum index be11844bb6a5..3d75b7c2e765 100644 --- a/comp/otelcol/ddprofilingextension/impl/go.sum +++ b/comp/otelcol/ddprofilingextension/impl/go.sum @@ -348,8 +348,9 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= @@ -503,8 +504,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -600,7 +602,6 @@ gopkg.in/ini.v1 v1.67.1 h1:tVBILHy0R6e4wkYOn3XmiITt/hEVH4TFMYvAX2Ytz6k= gopkg.in/ini.v1 v1.67.1/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= k8s.io/api v0.35.3 h1:pA2fiBc6+N9PDf7SAiluKGEBuScsTzd2uYBkA5RzNWQ= diff --git a/comp/otelcol/logsagentpipeline/go.mod b/comp/otelcol/logsagentpipeline/go.mod index 8eb1d9630085..5fc775ea9597 100644 --- a/comp/otelcol/logsagentpipeline/go.mod +++ b/comp/otelcol/logsagentpipeline/go.mod @@ -4,8 +4,6 @@ go 1.25.0 require github.com/DataDog/datadog-agent/pkg/logs/pipeline v0.78.3-rc.2 -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/agent-payload/v5 v5.0.184 // indirect github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect @@ -60,7 +58,6 @@ require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -76,7 +73,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -87,7 +83,7 @@ require ( github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // 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 @@ -97,7 +93,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/otelcol/logsagentpipeline/go.sum b/comp/otelcol/logsagentpipeline/go.sum index b30cc7ba6fed..490cddc41eaf 100644 --- a/comp/otelcol/logsagentpipeline/go.sum +++ b/comp/otelcol/logsagentpipeline/go.sum @@ -16,8 +16,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -71,8 +69,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -103,8 +99,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -128,8 +124,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -173,8 +170,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.mod b/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.mod index 9e146968551a..9825d44e5027 100644 --- a/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.mod +++ b/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.mod @@ -24,13 +24,11 @@ require ( github.com/DataDog/datadog-agent/pkg/util/option v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/startstop v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/testutil v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/fx v1.24.0 go.uber.org/zap v1.28.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/agent-payload/v5 v5.0.184 // indirect github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect @@ -77,7 +75,6 @@ require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -93,7 +90,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -111,7 +107,7 @@ require ( go.uber.org/dig v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.sum b/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.sum index b30cc7ba6fed..490cddc41eaf 100644 --- a/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.sum +++ b/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.sum @@ -16,8 +16,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -71,8 +69,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -103,8 +99,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -128,8 +124,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -173,8 +170,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/otelcol/otlp/components/exporter/datadogexporter/go.mod b/comp/otelcol/otlp/components/exporter/datadogexporter/go.mod index bb10c093ca4c..429a80e981ea 100644 --- a/comp/otelcol/otlp/components/exporter/datadogexporter/go.mod +++ b/comp/otelcol/otlp/components/exporter/datadogexporter/go.mod @@ -23,7 +23,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/otel v0.78.3-rc.2 github.com/DataDog/datadog-go/v5 v5.8.3 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog v0.150.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/component v1.57.0 go.opentelemetry.io/collector/config/confignet v1.56.0 go.opentelemetry.io/collector/config/configoptional v1.56.0 @@ -46,7 +46,6 @@ require ( go.opentelemetry.io/collector/internal/componentalias v0.151.0 // indirect go.opentelemetry.io/collector/pipeline/xpipeline v0.150.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( @@ -199,7 +198,6 @@ require ( github.com/pierrec/lz4/v4 v4.1.26 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -252,7 +250,7 @@ require ( go.uber.org/dig v1.19.0 // indirect go.uber.org/fx v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect diff --git a/comp/otelcol/otlp/components/exporter/datadogexporter/go.sum b/comp/otelcol/otlp/components/exporter/datadogexporter/go.sum index bbe9da875a52..76581097cbd4 100644 --- a/comp/otelcol/otlp/components/exporter/datadogexporter/go.sum +++ b/comp/otelcol/otlp/components/exporter/datadogexporter/go.sum @@ -190,8 +190,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -243,8 +241,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -393,8 +392,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -477,7 +477,6 @@ gopkg.in/ini.v1 v1.67.1 h1:tVBILHy0R6e4wkYOn3XmiITt/hEVH4TFMYvAX2Ytz6k= gopkg.in/ini.v1 v1.67.1/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= k8s.io/apimachinery v0.35.3 h1:MeaUwQCV3tjKP4bcwWGgZ/cp/vpsRnQzqO6J6tJyoF8= diff --git a/comp/otelcol/otlp/components/exporter/logsagentexporter/go.mod b/comp/otelcol/otlp/components/exporter/logsagentexporter/go.mod index 5f2c16d50c5d..cbb1718a1f00 100644 --- a/comp/otelcol/otlp/components/exporter/logsagentexporter/go.mod +++ b/comp/otelcol/otlp/components/exporter/logsagentexporter/go.mod @@ -19,7 +19,7 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog v0.150.0 github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/component v1.57.0 go.opentelemetry.io/collector/config/configoptional v1.56.0 go.opentelemetry.io/collector/config/configretry v1.56.0 @@ -36,7 +36,6 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect go.opentelemetry.io/collector/internal/componentalias v0.151.0 // indirect go.opentelemetry.io/collector/pipeline/xpipeline v0.150.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( @@ -90,7 +89,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect @@ -129,7 +127,6 @@ require ( github.com/philhofer/fwd v1.2.0 // indirect github.com/pierrec/lz4/v4 v4.1.26 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -185,7 +182,7 @@ require ( go.uber.org/fx v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect diff --git a/comp/otelcol/otlp/components/exporter/logsagentexporter/go.sum b/comp/otelcol/otlp/components/exporter/logsagentexporter/go.sum index de3690df35b6..2312597e31f3 100644 --- a/comp/otelcol/otlp/components/exporter/logsagentexporter/go.sum +++ b/comp/otelcol/otlp/components/exporter/logsagentexporter/go.sum @@ -24,8 +24,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -143,8 +141,6 @@ github.com/pierrec/lz4/v4 v4.1.26/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcR github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -178,8 +174,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -315,8 +311,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -372,8 +369,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/otelcol/otlp/components/exporter/serializerexporter/go.mod b/comp/otelcol/otlp/components/exporter/serializerexporter/go.mod index fad556708aba..a43105eb8f11 100644 --- a/comp/otelcol/otlp/components/exporter/serializerexporter/go.mod +++ b/comp/otelcol/otlp/components/exporter/serializerexporter/go.mod @@ -29,7 +29,7 @@ require ( github.com/google/go-cmp v0.7.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog v0.150.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.150.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/tinylib/msgp v1.6.3 go.opentelemetry.io/collector/component v1.57.0 go.opentelemetry.io/collector/component/componenttest v0.150.0 @@ -65,7 +65,6 @@ require ( go.opentelemetry.io/collector/internal/componentalias v0.151.0 // indirect go.opentelemetry.io/collector/pipeline/xpipeline v0.150.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( @@ -122,7 +121,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fatih/color v1.18.0 // indirect @@ -164,7 +162,6 @@ require ( github.com/philhofer/fwd v1.2.0 // indirect github.com/pierrec/lz4/v4 v4.1.26 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -212,7 +209,7 @@ require ( go.opentelemetry.io/otel/trace v1.45.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.19.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/otelcol/otlp/components/exporter/serializerexporter/go.sum b/comp/otelcol/otlp/components/exporter/serializerexporter/go.sum index 1f9551e4cdce..1943ad8e812f 100644 --- a/comp/otelcol/otlp/components/exporter/serializerexporter/go.sum +++ b/comp/otelcol/otlp/components/exporter/serializerexporter/go.sum @@ -24,8 +24,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -162,8 +160,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -204,8 +200,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -341,8 +337,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -399,9 +396,5 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= diff --git a/comp/otelcol/otlp/components/metricsclient/go.mod b/comp/otelcol/otlp/components/metricsclient/go.mod index eff8dfd0c551..260cb97d37d8 100644 --- a/comp/otelcol/otlp/components/metricsclient/go.mod +++ b/comp/otelcol/otlp/components/metricsclient/go.mod @@ -5,27 +5,23 @@ go 1.26.0 require ( github.com/DataDog/datadog-agent/pkg/trace v0.78.3-rc.2 github.com/DataDog/datadog-go/v5 v5.8.3 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/otel v1.45.0 go.opentelemetry.io/otel/metric v1.45.0 go.opentelemetry.io/otel/sdk/metric v1.45.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/stretchr/objx v0.5.3 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/otel/sdk v1.45.0 // indirect go.opentelemetry.io/otel/trace v1.45.0 // indirect go.uber.org/atomic v1.11.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect ) diff --git a/comp/otelcol/otlp/components/metricsclient/go.sum b/comp/otelcol/otlp/components/metricsclient/go.sum index 290f73270b24..c09c39cb6f88 100644 --- a/comp/otelcol/otlp/components/metricsclient/go.sum +++ b/comp/otelcol/otlp/components/metricsclient/go.sum @@ -7,8 +7,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -19,16 +17,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -39,8 +29,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= @@ -58,6 +48,8 @@ go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOy go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -87,8 +79,5 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.mod b/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.mod index 08ae7d6b133b..ee3b60bf84c8 100644 --- a/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.mod +++ b/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.mod @@ -16,7 +16,7 @@ require ( github.com/DataDog/datadog-agent/pkg/config/setup v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/option v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/component v1.57.0 go.opentelemetry.io/collector/component/componenttest v0.150.0 go.opentelemetry.io/collector/confmap v1.57.0 @@ -41,7 +41,6 @@ require ( require ( go.opentelemetry.io/collector/internal/componentalias v0.151.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( @@ -104,7 +103,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -140,7 +138,6 @@ require ( github.com/pelletier/go-toml v1.9.5 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -167,7 +164,7 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect diff --git a/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.sum b/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.sum index 7a4a21220f6f..600a86f70048 100644 --- a/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.sum +++ b/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.sum @@ -29,8 +29,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -149,8 +147,6 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -186,8 +182,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -285,8 +281,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -379,13 +376,9 @@ google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/comp/otelcol/otlp/testutil/go.mod b/comp/otelcol/otlp/testutil/go.mod index 4774ebe84987..eed2aad462e9 100644 --- a/comp/otelcol/otlp/testutil/go.mod +++ b/comp/otelcol/otlp/testutil/go.mod @@ -12,13 +12,11 @@ require ( github.com/DataDog/datadog-agent/pkg/opentelemetry-mapping-go/otlp/attributes v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/proto v0.78.3-rc.2 github.com/DataDog/sketches-go v1.4.8 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/pdata v1.57.0 google.golang.org/protobuf v1.36.11 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -45,7 +43,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -64,7 +61,6 @@ require ( github.com/pelletier/go-toml v1.9.5 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -78,7 +74,7 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/otelcol/otlp/testutil/go.sum b/comp/otelcol/otlp/testutil/go.sum index 43b03c421cc5..f7bfef8ababf 100644 --- a/comp/otelcol/otlp/testutil/go.sum +++ b/comp/otelcol/otlp/testutil/go.sum @@ -7,8 +7,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -69,8 +67,6 @@ github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -90,8 +86,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -125,8 +121,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -145,8 +141,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/otelcol/status/impl/go.mod b/comp/otelcol/status/impl/go.mod index 816a110566f8..57be0501e25e 100644 --- a/comp/otelcol/status/impl/go.mod +++ b/comp/otelcol/status/impl/go.mod @@ -11,12 +11,10 @@ require ( github.com/DataDog/datadog-agent/comp/otelcol/ddflareextension/types v0.78.3-rc.2 github.com/DataDog/datadog-agent/comp/otelcol/status/def v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/prometheus v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 - go.yaml.in/yaml/v3 v3.0.4 + github.com/stretchr/testify v1.12.1 + go.yaml.in/yaml/v3 v3.0.5 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -62,7 +60,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/sso v1.30.15 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fatih/color v1.18.0 // indirect @@ -82,7 +79,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.5 // indirect diff --git a/comp/otelcol/status/impl/go.sum b/comp/otelcol/status/impl/go.sum index 374682ab1796..c58080c89eb0 100644 --- a/comp/otelcol/status/impl/go.sum +++ b/comp/otelcol/status/impl/go.sum @@ -54,8 +54,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -141,8 +139,6 @@ github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCko github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -181,8 +177,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -216,8 +212,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -272,11 +269,7 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/apimachinery v0.35.3 h1:MeaUwQCV3tjKP4bcwWGgZ/cp/vpsRnQzqO6J6tJyoF8= k8s.io/apimachinery v0.35.3/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= k8s.io/client-go v0.35.3 h1:s1lZbpN4uI6IxeTM2cpdtrwHcSOBML1ODNTCCfsP1pg= diff --git a/comp/serializer/logscompression/go.mod b/comp/serializer/logscompression/go.mod index c4451db265ce..895299e550ec 100644 --- a/comp/serializer/logscompression/go.mod +++ b/comp/serializer/logscompression/go.mod @@ -7,8 +7,6 @@ require ( github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/config v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect @@ -45,7 +43,6 @@ require ( github.com/DataDog/viper v1.15.1 // indirect github.com/DataDog/zstd v1.5.7 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -59,14 +56,13 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // 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 @@ -76,7 +72,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/serializer/logscompression/go.sum b/comp/serializer/logscompression/go.sum index f308d108da3e..bfaf0584d90e 100644 --- a/comp/serializer/logscompression/go.sum +++ b/comp/serializer/logscompression/go.sum @@ -8,8 +8,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -55,8 +53,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -79,8 +75,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -102,8 +98,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -118,8 +115,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/serializer/metricscompression/go.mod b/comp/serializer/metricscompression/go.mod index 1c47ca312702..0ac1cbd6091c 100644 --- a/comp/serializer/metricscompression/go.mod +++ b/comp/serializer/metricscompression/go.mod @@ -8,8 +8,6 @@ require ( github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -45,7 +43,6 @@ require ( github.com/DataDog/viper v1.15.1 // indirect github.com/DataDog/zstd v1.5.7 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -59,14 +56,13 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // 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 @@ -76,7 +72,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/comp/serializer/metricscompression/go.sum b/comp/serializer/metricscompression/go.sum index f308d108da3e..bfaf0584d90e 100644 --- a/comp/serializer/metricscompression/go.sum +++ b/comp/serializer/metricscompression/go.sum @@ -8,8 +8,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -55,8 +53,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -79,8 +75,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -102,8 +98,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -118,8 +115,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/trace/agent/def/go.sum b/comp/trace/agent/def/go.sum index a2dfeaf6fb3f..317bec3f929a 100644 --- a/comp/trace/agent/def/go.sum +++ b/comp/trace/agent/def/go.sum @@ -2,8 +2,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -32,12 +30,10 @@ github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/vmihailenco/msgpack/v4 v4.3.13 h1:A2wsiTbvp63ilDaWmsk2wjx6xZdxQOvpiNlKBGKKXKI= @@ -80,13 +76,11 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/deps/go.MODULE.bazel b/deps/go.MODULE.bazel index 4adb51d6960e..ffc333511a80 100644 --- a/deps/go.MODULE.bazel +++ b/deps/go.MODULE.bazel @@ -237,7 +237,6 @@ use_repo( "com_github_favadi_protoc_go_inject_tag", "com_github_frapposelli_wwhrd", "com_github_freddierice_go_losetup", - "com_github_ghodss_yaml", "com_github_glaslos_ssdeep", "com_github_go_delve_delve", "com_github_go_enry_go_license_detector_v4", @@ -390,13 +389,12 @@ use_repo( "com_github_vmihailenco_msgpack_v5", "com_github_wadey_gocovmerge", "com_github_wi2l_jsondiff", + "com_github_wk8_go_ordered_map_v2", "com_github_xeipuuv_gojsonschema", "com_github_xi2_xz", "com_github_yusufpapurcu_wmi", "com_gitlab_gitlab_org_api_client_go", "in_gopkg_datadog_dd_trace_go_v1", - "in_gopkg_yaml_v2", - "in_gopkg_yaml_v3", "in_gopkg_zorkian_go_datadog_api_v2", "in_yaml_go_yaml_v2", "in_yaml_go_yaml_v3", diff --git a/docs/dev/go-yaml-owner-backports.md b/docs/dev/go-yaml-owner-backports.md new file mode 100644 index 000000000000..87aad60fb1d7 --- /dev/null +++ b/docs/dev/go-yaml-owner-backports.md @@ -0,0 +1,99 @@ +# Maintained YAML owner backports + +Tracking: https://github.com/StackVista/stackstate/issues/717. + +The agent and cluster-agent select temporary independently addressable source +modules through explicit root and workspace replacements. The independent +network-device profile module also selects ordered-map. Dependency replacements +do not propagate to external consumers: repeat the relevant owner selections +when consuming these sources outside this checkout. + +| Logical owner | Retained exact source | +| --- | --- | +| `github.com/netsampler/goflow2` v1.3.3 | `69a6eaf99e205ed3cd02d29f044a01659107dd02` | +| `github.com/wk8/go-ordered-map/v2` v2.1.8 | `85ca4a2b29d3241fa4513f82be3d38fe2392a791` | +| `github.com/cloudfoundry-community/go-cfclient/v2` | `3d15366c582080a7cafa6aeb28d2f5fe9c3146d1` | +| `github.com/open-policy-agent/opa` v1.7.1 | Datadog lightweight source `d2e1e78e081663d4b11109032715b68eb9b9d17a` | + +The sources retain their logical paths, licenses, tests and attribution. The +only Go source changes select matching maintained YAML v2/v3 imports. Ordered-map +retains coherent typed node marshal/unmarshal interfaces. Datadog OPA patches are +preserved. Compatible releases checked on October 1, 2026 still use legacy YAML +or predate the selected source; their metadata/evidence is recorded in the +handoff. Standalone test requirements use maintained Testify. OPA's documentation +compiler uses compatible Cobra v1.10.2, already selected by the agent. + +Do not classify the owners from their old requested versions alone: inspect the +explicit replacements, source commits, actual parser imports and binary build +info. The owned parser lines are `go.yaml.in/yaml/v2` v2.4.4 and +`go.yaml.in/yaml/v3` v3.0.5. No blanket old-parser module replacement is used. + +The modules are not workspace main modules; this prevents workspace sync from +rewriting their independent dependency minima. They are outside the agent module +release registry and require separate standalone checks. Restore and verify long +upstream fixture/document paths before upstream fixtures: + +```sh +(cd third_party/go-ordered-map && tar -xzf LONG_PATHS.tar.gz && sha256sum -c LONG_PATHS.sha256) +(cd third_party/opa && tar -xzf LONG_PATHS.tar.gz && sha256sum -c LONG_PATHS.sha256) +for owner in goflow2 go-ordered-map go-cfclient; do + (cd "third_party/$owner" && GOWORK=off go mod tidy && GOWORK=off go test ./...) +done +(cd third_party/opa && GOWORK=off go mod tidy && GOWORK=off go test ./v1/ast ./v1/util ./v1/loader ./internal/config ./internal/strvals) +``` + +The archives retain 124 assets byte-for-byte without weakening the agent's Windows +filename limit. No Go source or embedded production resource is archived. OPA +bundle fixtures pass with vet disabled; two formatting assertions in untouched +upstream bundle tests fail Go 1.26 vet and reproduce on the original source. + +Consumer qualification includes NetFlow adapter/server, profiledefinition +contracts in workspace and standalone mode, Cloud Foundry/autodiscovery, +compliance, and Kubernetes event/configuration tests under their actual tags. +For an unbranded profiledefinition test set `AGENT_GITHUB_ORG=DataDog` and +`AGENT_REPO_NAME=datadog-agent`; the broader schema tests' repository-ID mismatch +reproduces on the previous candidate. Compliance fixture file-mode assertions +require a process-local umask that permits the requested fixture permissions. +Run the normal module consistency and native/CI build checks as well. + +The original candidate and baseline run 36773106564 failed the cacerts checksum +check before package compilation: mutable `https://curl.se/ca/cacert.pem` returned +September 25 bytes against the older pinned checksum. The recipe now pins +`https://curl.se/ca/cacert-2026-09-25.pem`, independently verified against curl's +published `cacert-2026-09-25.pem.sha256` and CA-extract publication. SHA256: +`a41b5d356aea97a529fe27e0f7316d2f9d946d75927476cf9cf1b90637d00505` +(188900 bytes, 121 certificates). Target filename, installed trust paths, modes +and checksum enforcement are preserved. Fresh package/image CI qualification +remains necessary; repairing the source prerequisite does not establish adoption. +A local agent build needs systemd development headers or the documented systemd +exclusion. Inherited Windows API failures and the bundled-events timeout were +qualified separately in the original handoff. + +Residual test/tooling graphs remain distinct from the selected Linux product +binaries: Windows E2E uses Pulumi/ESC and needs test-infra-definitions coordination; +standalone OPA CLI tooling still uses legacy v3 through Viper. Other inherited +commands must be qualified individually rather than inferred from agent graphs. + +Remove each backport after a compatible owning release (or lightweight Datadog +OPA patch release) selects maintained YAML and passes the same consumer fixtures. +Approved release rebuilds still require both architectures, artifact provenance, +image/secret/VEX checks and downstream chart/GitOps adoption. A source PR or local +binary does not establish that adoption. + +Bazel metadata follows `tasks/go.py:_bazel_tidy`: prune imports, sync/tidy +registered modules, reconcile imports, then infer BUILD rules. The initial +`bazel mod tidy` removes stale ghodss and old YAML imports and selects ordered-map. +The filtered Bazel workspace links the local owner sources, while Gazelle excludes +the retained third_party trees from root BUILD generation. Original owner identities +and explicit replacements remain unchanged. Package qualification must use fresh +CI, including the Omnibus `@openssl//:install` analysis that previously failed on +the stale module-extension import; a mirror warning alone is not that failure. + +Bazel 8.6.0 qualification: the supported five-step generation sequence passes; +no BUILD rules or registered Go manifests drift. Gazelle reports three inherited +missing dyninst fixture patterns (rc_tester.json, rc_tester_v1.json, decoded), +without failing generation. `bazel mod show_repo` confirms all four logical owner +identities select the linked local sources, and maintained parser repositories +select v2.4.4/v3.0.5. `bazel build --nobuild @openssl//:install` passes analysis +(5851 configured targets); this is not a compiled package or image qualification. +The generated lockfile only refreshes SDK facts to the already selected Go 1.26.6. diff --git a/docs/public/components/shared_features/flares.md b/docs/public/components/shared_features/flares.md index 7eabf3d3dc27..2e4a73be6bf7 100644 --- a/docs/public/components/shared_features/flares.md +++ b/docs/public/components/shared_features/flares.md @@ -22,7 +22,7 @@ Example: ```go import ( - yaml "gopkg.in/yaml.v2" + yaml "go.yaml.in/yaml/v2" flare "github.com/DataDog/datadog-agent/comp/core/flare/def" ) diff --git a/go.mod b/go.mod index c520a8a978f6..969318ea278b 100644 --- a/go.mod +++ b/go.mod @@ -225,7 +225,6 @@ require ( github.com/fatih/color v1.18.0 github.com/fatih/structtag v1.2.0 github.com/freddierice/go-losetup v0.0.0-20220711213114-2a14873012db - github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 github.com/glaslos/ssdeep v0.4.0 github.com/go-delve/delve v1.26.0 github.com/go-ini/ini v1.67.0 @@ -319,7 +318,7 @@ require ( github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 github.com/streadway/amqp v1.1.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/swaggest/jsonschema-go v0.3.70 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 github.com/tinylib/msgp v1.6.3 @@ -381,7 +380,7 @@ require ( go.uber.org/multierr v1.11.0 go.uber.org/zap v1.28.0 go.yaml.in/yaml/v2 v2.4.4 - go.yaml.in/yaml/v3 v3.0.4 + go.yaml.in/yaml/v3 v3.0.5 go4.org/intern v0.0.0-20230525184215-6c62f75575cb go4.org/mem v0.0.0-20220726221520-4f986261bf13 go4.org/netipx v0.0.0-20220812043211-3cc044ffd68d @@ -609,7 +608,6 @@ require ( github.com/googleapis/enterprise-certificate-proxy v0.3.14 // indirect github.com/googleapis/gax-go/v2 v2.20.0 // indirect github.com/gophercloud/gophercloud/v2 v2.11.1 // indirect - github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect github.com/grafana/regexp v0.0.0-20250905093917-f7b3be9d1853 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect @@ -784,7 +782,6 @@ require ( github.com/shoenig/go-m1cpu v0.1.7 // indirect github.com/shopspring/decimal v1.4.0 // indirect github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect - github.com/smartystreets/assertions v1.1.0 // indirect github.com/smira/go-ftp-protocol v0.0.0-20140829150050-066b75c2b70d // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -993,8 +990,6 @@ require ( go.opentelemetry.io/collector/otelcol/otelcoltest v0.150.0 go.temporal.io/api v1.62.2 go.temporal.io/sdk v1.39.0 - gopkg.in/yaml.v2 v2.4.0 - gopkg.in/yaml.v3 v3.0.1 gotest.tools v2.2.0+incompatible mvdan.cc/sh/v3 v3.13.0 ) @@ -1212,6 +1207,8 @@ require ( go.yaml.in/yaml/v4 v4.0.0-rc.4 // indirect gopkg.in/neurosnap/sentences.v1 v1.0.7 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) // github.com/aws/karpenter-provider-aws requires alpha versions of K8s libraries. We are only using some constants from these packages. @@ -1279,8 +1276,8 @@ replace k8s.io/kube-state-metrics/v2 v2.13.1-0.20241025121156-110f03d7331f => gi // among with the Connect, Bind and Accept requests replace github.com/iceber/iouring-go => github.com/lebauce/iouring-go v0.0.0-20250513121434-2d4fb49003b5 -// Fork to remove some text/template usage, https://github.com/DataDog/opa/tree/lightweight-1.7.1 -replace github.com/open-policy-agent/opa => github.com/DataDog/opa v0.0.0-20251126100856-d2e1e78e0816 +// Preserve Datadog lightweight OPA patches; see third_party/opa/PROVENANCE.md. +replace github.com/open-policy-agent/opa => ./third_party/opa // TODO: Remove this replace once v0.148.0 is released @@ -1464,3 +1461,9 @@ replace ( github.com/DataDog/datadog-agent/test/new-e2e => ./test/new-e2e github.com/DataDog/datadog-agent/test/otel => ./test/otel ) + +replace github.com/netsampler/goflow2 => ./third_party/goflow2 + +replace github.com/wk8/go-ordered-map/v2 => ./third_party/go-ordered-map + +replace github.com/cloudfoundry-community/go-cfclient/v2 => ./third_party/go-cfclient diff --git a/go.sum b/go.sum index 43960950c75e..202f7d20b17a 100644 --- a/go.sum +++ b/go.sum @@ -2594,8 +2594,6 @@ github.com/DataDog/netlink v1.0.1-0.20240223195320-c7a4f832a3d1 h1:HnvrdC79xJ+RP github.com/DataDog/netlink v1.0.1-0.20240223195320-c7a4f832a3d1/go.mod h1:whJevzBpTrid75eZy99s3DqCmy05NfibNaF2Ol5Ox5A= github.com/DataDog/nikos v1.12.12 h1:72YrdzMeQT3wcXIDgiS1ClU53SzUdR7uAbp5FSSpo5k= github.com/DataDog/nikos v1.12.12/go.mod h1:kZGOhfE76+nXS7V5PAlIw3MRxWKM70ynET4VeuZ4U4k= -github.com/DataDog/opa v0.0.0-20251126100856-d2e1e78e0816 h1:8diKw2aLYE6LsjWfYxDEqx0ZmcyMMmqB+qapRJrGtys= -github.com/DataDog/opa v0.0.0-20251126100856-d2e1e78e0816/go.mod h1:7cPuErOAt7k/oVWAVJnxqAC6mwArrAazkvk0RXiih2A= github.com/DataDog/opentelemetry-ebpf-profiler v0.0.0-20260317195537-817b91eb7dd4 h1:9+K8vjF7sQSLjVJporNyv6nw46cMg/Q8ogxbBZmrf+A= github.com/DataDog/opentelemetry-ebpf-profiler v0.0.0-20260317195537-817b91eb7dd4/go.mod h1:KEBv+q78RzBcDPNFm1WB0V0za14gY95E/Atp3dJZ/8M= github.com/DataDog/rshell v0.0.9 h1:HS38O5aVK43ctHkTFm5RGTZA1JCP5oDxcD5O97NnoSc= @@ -3012,8 +3010,6 @@ github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4= github.com/cloudfoundry-community/go-cfclient v0.0.0-20220930021109-9c4e6c59ccf1 h1:ef0OsiQjSQggHrLFAMDRiu6DfkVSElA5jfG1/Nkyu6c= github.com/cloudfoundry-community/go-cfclient v0.0.0-20220930021109-9c4e6c59ccf1/go.mod h1:sgaEj3tRn0hwe7GPdEUwxrdOqjBzyjyvyOCGf1OQyZY= -github.com/cloudfoundry-community/go-cfclient/v2 v2.0.1-0.20230503155151-3d15366c5820 h1:ixkQUDJYG6eSxgUEl6LLE2l2TD2C5AYmlm+fVhsr6Zs= -github.com/cloudfoundry-community/go-cfclient/v2 v2.0.1-0.20230503155151-3d15366c5820/go.mod h1:hB1MLDqhbVF09FbBLrU430kDZZPAO9lVck00xhljoqU= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -3308,8 +3304,6 @@ github.com/gammazero/deque v0.2.1/go.mod h1:LFroj8x4cMYCukHJDbxFCkT+r9AndaJnFMuZ github.com/gammazero/workerpool v1.1.3 h1:WixN4xzukFoN0XSeXF6puqEqFTl2mECI9S6W44HWy9Q= github.com/gammazero/workerpool v1.1.3/go.mod h1:wPjyBLDbyKnUn2XwwyD3EEwo9dHutia9/fwNmSHWACc= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew= -github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= github.com/glaslos/ssdeep v0.4.0 h1:w9PtY1HpXbWLYgrL/rvAVkj2ZAMOtDxoGKcBHcUFCLs= @@ -3704,9 +3698,8 @@ github.com/gophercloud/gophercloud v0.1.0 h1:P/nh25+rzXouhytV2pUHBb65fnds26Ghl8/ github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gophercloud/gophercloud/v2 v2.11.1 h1:jCs4vLH8sJgRqrPzqVfWgl7uI6JnIIlsgeIRM0uHjxY= github.com/gophercloud/gophercloud/v2 v2.11.1/go.mod h1:Rm0YvKQ4QYX2rY9XaDKnjRzSGwlG5ge4h6ABYnmkKQM= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0= -github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= @@ -4465,8 +4458,6 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncw/swift v1.0.30/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= -github.com/netsampler/goflow2 v1.3.3 h1:uheCMgWwbaHnVdsvc2bqbdQe93E73pVF77WGu/kPE7U= -github.com/netsampler/goflow2 v1.3.3/go.mod h1:mUjr4ERDTtNUAVtf2EomWHmr6Xvz2N9DahhFkhNnFkQ= github.com/neurosnap/sentences v1.0.6 h1:iBVUivNtlwGkYsJblWV8GGVFmXzZzak907Ci8aA0VTE= github.com/neurosnap/sentences v1.0.6/go.mod h1:pg1IapvYpWCJJm/Etxeh0+gtMf1rI1STY9S7eUCPbDc= github.com/nexus-rpc/sdk-go v0.5.1 h1:UFYYfoHlQc+Pn9gQpmn9QE7xluewAn2AO1OSkAh7YFU= @@ -4948,9 +4939,8 @@ github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnB github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= github.com/skydive-project/go-debouncer v1.0.1 h1:N75Mdusd65Jjbc7k5t2oo+7qLIdMtSNJKssmpEYuSgo= github.com/skydive-project/go-debouncer v1.0.1/go.mod h1:7pK+5HBlYCD8W2cXhvMRsMsdWelDEPfpbE6PwSlDX68= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/assertions v1.1.0 h1:MkTeG1DMwsrdH7QtLXy5W+fUxWq+vmb6cLmyJ7aRtF0= -github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smira/commander v0.0.0-20140515201010-f408b00e68d5/go.mod h1:XTQy55hw5s3pxmC42m7X0/b+9naXQ1rGN9Of6BGIZmU= @@ -5031,8 +5021,9 @@ github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/substrait-io/substrait-go v0.4.2/go.mod h1:qhpnLmrcvAnlZsUyPXZRqldiHapPTXC3t7xFgDi3aQg= @@ -5165,8 +5156,6 @@ github.com/wI2L/jsondiff v0.7.0 h1:1lH1G37GhBPqCfp/lrs91rf/2j3DktX6qYAKZkLuCQQ= github.com/wI2L/jsondiff v0.7.0/go.mod h1:KAEIojdQq66oJiHhDyQez2x+sRit0vIzC9KeK0yizxM= github.com/weppos/publicsuffix-go v0.50.3 h1:eT5dcjHQcVDNc0igpFEsGHKIip30feuB2zuuI9eJxiE= github.com/weppos/publicsuffix-go v0.50.3/go.mod h1:/rOa781xBykZhHK/I3QeHo92qdDKVmKZKF7s8qAEM/4= -github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= -github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0 h1:3UeQBvD0TFrlVjOeLOBz+CPAI8dnbqNSVwUwRrkp7vQ= github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0/go.mod h1:IXCdmsXIht47RaVFLEdVnh1t+pgYtTAhQGj73kz+2DM= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= @@ -5598,8 +5587,9 @@ go.uber.org/zap/exp v0.3.0/go.mod h1:5I384qq7XGxYyByIhHm6jg5CHkGY0nsTfbDLgDDlgJQ go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= go.yaml.in/yaml/v4 v4.0.0-rc.4 h1:UP4+v6fFrBIb1l934bDl//mmnoIZEDK0idg1+AIvX5U= go.yaml.in/yaml/v4 v4.0.0-rc.4/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= go4.org/intern v0.0.0-20230525184215-6c62f75575cb h1:ae7kzL5Cfdmcecbh22ll7lYP3iuUdnfnhiPcSaDgH/8= diff --git a/go.work b/go.work index 12c13b2fa4f4..72f994f5bb46 100644 --- a/go.work +++ b/go.work @@ -194,3 +194,11 @@ use ( ) replace github.com/prometheus/prometheus => github.com/prometheus/prometheus v0.311.4-0.20260507094802-91c184a899b8 + +replace github.com/netsampler/goflow2 => ./third_party/goflow2 + +replace github.com/wk8/go-ordered-map/v2 => ./third_party/go-ordered-map + +replace github.com/cloudfoundry-community/go-cfclient/v2 => ./third_party/go-cfclient + +replace github.com/open-policy-agent/opa => ./third_party/opa diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 034617e85ef2..dd6659a07e6c 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -84,7 +84,6 @@ require ( github.com/cyphar/filepath-securejoin v0.6.1 // indirect github.com/daixiang0/gci v0.13.7 // indirect github.com/dave/dst v0.27.3 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/denis-tingaikin/go-header v0.5.0 // indirect github.com/dgryski/go-minhash v0.0.0-20190315135803-ad340ca03076 // indirect github.com/dlclark/regexp2 v1.11.5 // indirect @@ -206,7 +205,6 @@ require ( github.com/pjbgf/sha1cd v0.3.2 // indirect github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.5 // indirect @@ -245,7 +243,7 @@ require ( github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.3.1 // indirect github.com/stretchr/objx v0.5.3 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tetafro/godot v1.5.4 // indirect github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67 // indirect @@ -273,7 +271,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect golang.org/x/exp/typeparams v0.0.0-20251125195548-87e1e737ad39 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index b479fc14863b..4e4a649a42cd 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -143,8 +143,6 @@ github.com/dave/jennifer v1.7.1 h1:B4jJJDHelWcDhlRQxWeo0Npa/pYKBLrirAQoTN45txo= github.com/dave/jennifer v1.7.1/go.mod h1:nXbxhEmQfOZhWml3D1cDK5M1FLnMSozpbFN/m3RmGZc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denis-tingaikin/go-header v0.5.0 h1:SRdnP5ZKvcO9KKRP1KJrhFR3RrlGuD+42t4429eC9k8= github.com/denis-tingaikin/go-header v0.5.0/go.mod h1:mMenU5bWrok6Wl2UsZjy+1okegmwQ3UgWl4V1D8gjlY= github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc h1:8WFBn63wegobsYAX0YjD+8suexZDga5CctH4CCTx2+8= @@ -459,8 +457,6 @@ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsK github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= @@ -551,8 +547,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -628,8 +624,9 @@ go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/internal/tools/modparser/go.mod b/internal/tools/modparser/go.mod index 0db841f18a7d..135d32f5f2db 100644 --- a/internal/tools/modparser/go.mod +++ b/internal/tools/modparser/go.mod @@ -3,18 +3,10 @@ module github.com/DataDog/datadog-agent/internal/tools/modparser go 1.26.0 require ( - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 golang.org/x/mod v0.40.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect replace github.com/go-openapi/testify/v2 => github.com/go-openapi/testify/v2 v2.4.1 diff --git a/internal/tools/modparser/go.sum b/internal/tools/modparser/go.sum index 49243127bae4..6edb6c38165a 100644 --- a/internal/tools/modparser/go.sum +++ b/internal/tools/modparser/go.sum @@ -1,25 +1,6 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs= golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/tools/worksynchronizer/go.mod b/internal/tools/worksynchronizer/go.mod index d3cae5a28964..6eead5dadc44 100644 --- a/internal/tools/worksynchronizer/go.mod +++ b/internal/tools/worksynchronizer/go.mod @@ -3,18 +3,9 @@ module github.com/DataDog/datadog-agent/internal/tools/worksynchronizer go 1.26.0 require ( - github.com/stretchr/testify v1.11.1 - go.yaml.in/yaml/v3 v3.0.4 + github.com/stretchr/testify v1.12.1 + go.yaml.in/yaml/v3 v3.0.5 golang.org/x/mod v0.40.0 ) -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - replace github.com/go-openapi/testify/v2 => github.com/go-openapi/testify/v2 v2.4.1 diff --git a/internal/tools/worksynchronizer/go.sum b/internal/tools/worksynchronizer/go.sum index 5c47db128349..6edb6c38165a 100644 --- a/internal/tools/worksynchronizer/go.sum +++ b/internal/tools/worksynchronizer/go.sum @@ -1,27 +1,6 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs= golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/omnibus/config/software/cacerts.rb b/omnibus/config/software/cacerts.rb index 56fb5732c2ed..65315284df2e 100644 --- a/omnibus/config/software/cacerts.rb +++ b/omnibus/config/software/cacerts.rb @@ -25,13 +25,9 @@ # doing this. name "cacerts" -# We have a synthetic monitor on the latest cacerts file to warn us when the latest -# cacerts bundle changes. -# This allows us to always use up-to-date cacerts, without breaking all builds -# when they change. -default_version "latest" -source url: "https://curl.se/ca/cacert.pem", - sha256: "f66dff1bdf8f96060b8177976f8b7d9254bc89bc4db933d769f7384d28480bc9", +default_version "2026-09-25" +source url: "https://curl.se/ca/cacert-#{version}.pem", + sha256: "a41b5d356aea97a529fe27e0f7316d2f9d946d75927476cf9cf1b90637d00505", target_filename: "cacert.pem" relative_path "cacerts-#{version}" diff --git a/pkg/aggregator/ckey/go.mod b/pkg/aggregator/ckey/go.mod index 675a15f02407..3242674568af 100644 --- a/pkg/aggregator/ckey/go.mod +++ b/pkg/aggregator/ckey/go.mod @@ -5,16 +5,11 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/tagset v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/sort v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/twmb/murmur3 v1.1.8 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/aggregator/ckey/go.sum b/pkg/aggregator/ckey/go.sum index bca4ed1f4687..d7823f2c401d 100644 --- a/pkg/aggregator/ckey/go.sum +++ b/pkg/aggregator/ckey/go.sum @@ -1,19 +1,6 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/api/go.mod b/pkg/api/go.mod index 3bb8aab180bf..c314c74579c9 100644 --- a/pkg/api/go.mod +++ b/pkg/api/go.mod @@ -12,11 +12,9 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 github.com/gorilla/mux v1.8.1 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -39,7 +37,6 @@ require ( github.com/DataDog/datadog-agent/pkg/util/winutil v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -52,7 +49,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -63,7 +59,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/api/go.sum b/pkg/api/go.sum index a870ebc84c7b..8b74dc75dfbf 100644 --- a/pkg/api/go.sum +++ b/pkg/api/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -50,8 +48,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -70,8 +66,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -83,8 +79,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -101,8 +97,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/collector/corechecks/cluster/kubeapi/kubernetes_events.go b/pkg/collector/corechecks/cluster/kubeapi/kubernetes_events.go index aad7ee8b6fee..6eff038a7e87 100644 --- a/pkg/collector/corechecks/cluster/kubeapi/kubernetes_events.go +++ b/pkg/collector/corechecks/cluster/kubeapi/kubernetes_events.go @@ -20,7 +20,7 @@ import ( "github.com/DataDog/datadog-agent/pkg/util/option" cache "github.com/patrickmn/go-cache" - "gopkg.in/yaml.v2" + "go.yaml.in/yaml/v2" v1 "k8s.io/api/core/v1" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" diff --git a/pkg/collector/corechecks/cluster/kubeapi/kubernetes_metrics.go b/pkg/collector/corechecks/cluster/kubeapi/kubernetes_metrics.go index 6aa46b192d44..5e56adf9e3f6 100644 --- a/pkg/collector/corechecks/cluster/kubeapi/kubernetes_metrics.go +++ b/pkg/collector/corechecks/cluster/kubeapi/kubernetes_metrics.go @@ -22,7 +22,7 @@ import ( "time" - "gopkg.in/yaml.v2" + "go.yaml.in/yaml/v2" "k8s.io/api/core/v1" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" diff --git a/pkg/collector/corechecks/cluster/kubeapi/kubernetes_topology_config.go b/pkg/collector/corechecks/cluster/kubeapi/kubernetes_topology_config.go index 2be9adf5b46a..ca9a1bdc097b 100644 --- a/pkg/collector/corechecks/cluster/kubeapi/kubernetes_topology_config.go +++ b/pkg/collector/corechecks/cluster/kubeapi/kubernetes_topology_config.go @@ -8,7 +8,7 @@ import ( pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" "github.com/DataDog/datadog-agent/pkg/util/log" "github.com/StackVista/stackstate-receiver-go-client/pkg/model/topology" - "gopkg.in/yaml.v2" + "go.yaml.in/yaml/v2" ) const ( @@ -17,14 +17,14 @@ const ( // TopologyConfig is the config of the API server. type TopologyConfig struct { - ClusterName string `yaml:"cluster_name"` - CollectTopology bool `yaml:"collect_topology"` - CollectTimeout int `yaml:"collect_timeout"` - ConfigMapMaxDataSize int `yaml:"configmap_max_datasize"` - CSIPVMapperEnabled bool `yaml:"csi_pv_mapper_enabled"` - Resources ResourcesConfig `yaml:"resources"` - CheckID checkid.ID - Instance topology.Instance + ClusterName string `yaml:"cluster_name"` + CollectTopology bool `yaml:"collect_topology"` + CollectTimeout int `yaml:"collect_timeout"` + ConfigMapMaxDataSize int `yaml:"configmap_max_datasize"` + CSIPVMapperEnabled bool `yaml:"csi_pv_mapper_enabled"` + Resources ResourcesConfig `yaml:"resources"` + CheckID checkid.ID + Instance topology.Instance } type ResourcesConfig struct { diff --git a/pkg/collector/corechecks/cluster/kubeapi/kubernetes_topology_test.go b/pkg/collector/corechecks/cluster/kubeapi/kubernetes_topology_test.go index 36e27a348b0d..71d0dad25e62 100644 --- a/pkg/collector/corechecks/cluster/kubeapi/kubernetes_topology_test.go +++ b/pkg/collector/corechecks/cluster/kubeapi/kubernetes_topology_test.go @@ -110,11 +110,11 @@ func testConfigParsed(t *testing.T, input string, expected TopologyConfig) { func TestConfigurationParsing(t *testing.T) { defaultConfig := TopologyConfig{ // for empty config something is coming from global configuration - ClusterName: pkgconfigsetup.Datadog().GetString("cluster_name"), - CollectTopology: pkgconfigsetup.Datadog().GetBool("collect_kubernetes_topology"), - CollectTimeout: pkgconfigsetup.Datadog().GetInt("collect_kubernetes_timeout"), - ConfigMapMaxDataSize: DefaultConfigMapDataSizeLimit, - CSIPVMapperEnabled: pkgconfigsetup.Datadog().GetBool("kubernetes_csi_pv_mapper_enabled"), + ClusterName: pkgconfigsetup.Datadog().GetString("cluster_name"), + CollectTopology: pkgconfigsetup.Datadog().GetBool("collect_kubernetes_topology"), + CollectTimeout: pkgconfigsetup.Datadog().GetInt("collect_kubernetes_timeout"), + ConfigMapMaxDataSize: DefaultConfigMapDataSizeLimit, + CSIPVMapperEnabled: pkgconfigsetup.Datadog().GetBool("kubernetes_csi_pv_mapper_enabled"), Resources: ResourcesConfig{ Persistentvolumes: true, Persistentvolumeclaims: true, @@ -154,6 +154,29 @@ resources: expectedSimple.ClusterName = "mycluster" expectedSimple.Resources = ResourcesConfig{} testConfigParsed(t, allResourcesAreDisabledConfig, expectedSimple) + + aliasedResourcesConfig := ` +resource_defaults: &resource_defaults + configmaps: no + secrets: false +cluster_name: |- + mycluster +collect_topology: yes +collect_timeout: 0x2a +configmap_max_datasize: null +resources: + <<: *resource_defaults + namespaces: false +` + expectedAliased := defaultConfig + expectedAliased.ClusterName = "mycluster" + expectedAliased.CollectTopology = true + expectedAliased.CollectTimeout = 42 + expectedAliased.ConfigMapMaxDataSize = 0 + expectedAliased.Resources.ConfigMaps = false + expectedAliased.Resources.Secrets = false + expectedAliased.Resources.Namespaces = false + testConfigParsed(t, aliasedResourcesConfig, expectedAliased) } func TestRunClusterCollectors(t *testing.T) { diff --git a/pkg/collector/corechecks/system/windowscertificate/windows_certificate.go b/pkg/collector/corechecks/system/windowscertificate/windows_certificate.go index 27192e4f7e00..3b871688c585 100644 --- a/pkg/collector/corechecks/system/windowscertificate/windows_certificate.go +++ b/pkg/collector/corechecks/system/windowscertificate/windows_certificate.go @@ -18,12 +18,12 @@ import ( "time" "unsafe" - yy "github.com/ghodss/yaml" "github.com/swaggest/jsonschema-go" "github.com/xeipuuv/gojsonschema" yaml "go.yaml.in/yaml/v2" "golang.org/x/sys/windows" "golang.org/x/sys/windows/registry" + yy "sigs.k8s.io/yaml" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" "github.com/DataDog/datadog-agent/pkg/aggregator/sender" diff --git a/pkg/config/basic/go.mod b/pkg/config/basic/go.mod index 8d6003f7c46e..64846fa68ce2 100644 --- a/pkg/config/basic/go.mod +++ b/pkg/config/basic/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/config/basic go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/config/basic/go.sum b/pkg/config/basic/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/config/basic/go.sum +++ b/pkg/config/basic/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/config/create/go.mod b/pkg/config/create/go.mod index 0d4d1cd587f3..fd1ea146b094 100644 --- a/pkg/config/create/go.mod +++ b/pkg/config/create/go.mod @@ -10,30 +10,26 @@ require ( github.com/DataDog/datadog-agent/pkg/config/viperconfig v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/config/basic v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/config/helper v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/magiconair/properties v1.8.10 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/config/create/go.sum b/pkg/config/create/go.sum index a1512e440c01..a2ddeed706b1 100644 --- a/pkg/config/create/go.sum +++ b/pkg/config/create/go.sum @@ -3,8 +3,6 @@ github.com/DataDog/viper v1.15.1 h1:kcdFE+qPndlWkhU4iEf/WpWQMCyVYHTv5HqvVf+SYJs= github.com/DataDog/viper v1.15.1/go.mod h1:rDLDREOPd+gpEbA8y4Y/5wTvyLqvUiCmDXX0jRZy8mw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -31,8 +29,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -47,15 +43,15 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= @@ -63,8 +59,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/config/env/go.mod b/pkg/config/env/go.mod index ca1297f0f566..6a3c872acb27 100644 --- a/pkg/config/env/go.mod +++ b/pkg/config/env/go.mod @@ -7,11 +7,9 @@ require ( github.com/DataDog/datadog-agent/pkg/util/filesystem v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/system v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/pointer v0.78.3-rc.2 // indirect @@ -19,7 +17,6 @@ require ( github.com/DataDog/datadog-agent/pkg/util/winutil v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/gofrs/flock v0.13.0 // indirect @@ -27,14 +24,13 @@ require ( github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // indirect github.com/mdlayher/socket v0.5.1 // indirect github.com/mdlayher/vsock v1.2.1 // 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/shirou/gopsutil/v4 v4.26.3 // 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.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/config/env/go.sum b/pkg/config/env/go.sum index f062aff2fa19..7084128be478 100644 --- a/pkg/config/env/go.sum +++ b/pkg/config/env/go.sum @@ -1,7 +1,5 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -13,26 +11,18 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/hectane/go-acl v0.0.0-20230225031251-cdfc9e3acf94 h1:0G5JVG0aJDpWvH1r8idd+wbPcAH14UqIuUMepx3v9rE= github.com/hectane/go-acl v0.0.0-20230225031251-cdfc9e3acf94/go.mod h1:MvF7bZQy5lD2WcLXjFytRVvnTrFvrjo/qGka1MIBOPE= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos= github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ= github.com/mdlayher/vsock v1.2.1 h1:pC1mTJTvjo1r9n9fbm7S1j04rCgCzhCOS5DY0zqHlnQ= github.com/mdlayher/vsock v1.2.1/go.mod h1:NRfCibel++DgeMD8z/hP+PPTjlNJsdPOmxcnENvE+SE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -41,8 +31,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -54,8 +44,3 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/config/helper/go.mod b/pkg/config/helper/go.mod index e81baf1dccdd..eceb5c258334 100644 --- a/pkg/config/helper/go.mod +++ b/pkg/config/helper/go.mod @@ -5,11 +5,9 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/config/model v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/viperconfig v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/config/basic v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect @@ -17,19 +15,17 @@ require ( github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/magiconair/properties v1.8.10 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/config/helper/go.sum b/pkg/config/helper/go.sum index a1512e440c01..a2ddeed706b1 100644 --- a/pkg/config/helper/go.sum +++ b/pkg/config/helper/go.sum @@ -3,8 +3,6 @@ github.com/DataDog/viper v1.15.1 h1:kcdFE+qPndlWkhU4iEf/WpWQMCyVYHTv5HqvVf+SYJs= github.com/DataDog/viper v1.15.1/go.mod h1:rDLDREOPd+gpEbA8y4Y/5wTvyLqvUiCmDXX0jRZy8mw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -31,8 +29,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -47,15 +43,15 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= @@ -63,8 +59,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/config/mock/go.mod b/pkg/config/mock/go.mod index 2afe6847dcb2..4d4ce0fe8c71 100644 --- a/pkg/config/mock/go.mod +++ b/pkg/config/mock/go.mod @@ -6,11 +6,9 @@ require ( github.com/DataDog/datadog-agent/pkg/config/create v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/model v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/setup v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -34,7 +32,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -47,7 +44,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -58,7 +54,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/config/mock/go.sum b/pkg/config/mock/go.sum index 0e81bdb38fc4..36f6fca801a0 100644 --- a/pkg/config/mock/go.sum +++ b/pkg/config/mock/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -48,8 +46,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -68,8 +64,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -81,8 +77,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -97,8 +93,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/config/nodetreemodel/go.mod b/pkg/config/nodetreemodel/go.mod index 9f655143cf16..7a0894481875 100644 --- a/pkg/config/nodetreemodel/go.mod +++ b/pkg/config/nodetreemodel/go.mod @@ -13,27 +13,23 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/spf13/cast v1.10.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 go.yaml.in/yaml/v2 v2.4.4 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/magiconair/properties v1.8.10 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/config/nodetreemodel/go.sum b/pkg/config/nodetreemodel/go.sum index 41cb505fa815..72ad134834a7 100644 --- a/pkg/config/nodetreemodel/go.sum +++ b/pkg/config/nodetreemodel/go.sum @@ -6,8 +6,6 @@ github.com/DataDog/viper v1.15.1/go.mod h1:rDLDREOPd+gpEbA8y4Y/5wTvyLqvUiCmDXX0j github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -36,8 +34,6 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= @@ -50,15 +46,15 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= @@ -66,8 +62,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/config/remote/go.mod b/pkg/config/remote/go.mod index fcd76d1dfbca..66d93c692f67 100644 --- a/pkg/config/remote/go.mod +++ b/pkg/config/remote/go.mod @@ -19,7 +19,7 @@ require ( github.com/benbjohnson/clock v1.3.5 github.com/coreos/go-semver v0.3.1 github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.etcd.io/bbolt v1.4.3 go.uber.org/atomic v1.11.0 google.golang.org/protobuf v1.36.11 @@ -55,7 +55,6 @@ require ( go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/sync v0.22.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( @@ -83,7 +82,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -102,7 +100,6 @@ require ( github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/philhofer/fwd v1.2.0 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -118,7 +115,7 @@ require ( go.opentelemetry.io/otel v1.45.0 // indirect go.opentelemetry.io/otel/metric v1.45.0 // indirect go.opentelemetry.io/otel/trace v1.45.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect diff --git a/pkg/config/remote/go.sum b/pkg/config/remote/go.sum index 53b3440e16a7..96684330be65 100644 --- a/pkg/config/remote/go.sum +++ b/pkg/config/remote/go.sum @@ -33,8 +33,6 @@ github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03V github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -130,8 +128,6 @@ github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -171,8 +167,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -218,8 +214,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/pkg/config/render_config/go.mod b/pkg/config/render_config/go.mod index 28ee7ec34022..334f0373e67f 100644 --- a/pkg/config/render_config/go.mod +++ b/pkg/config/render_config/go.mod @@ -4,13 +4,7 @@ go 1.26.0 require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 - go.yaml.in/yaml/v3 v3.0.4 -) - -require ( - github.com/kr/pretty v0.3.1 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + go.yaml.in/yaml/v3 v3.0.5 ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/config/render_config/go.sum b/pkg/config/render_config/go.sum index 8f5f0e82592d..5d33bf7e23d2 100644 --- a/pkg/config/render_config/go.sum +++ b/pkg/config/render_config/go.sum @@ -1,19 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/config/render_config/render_config.go b/pkg/config/render_config/render_config.go index 5deecf8c770c..df38de1b8724 100644 --- a/pkg/config/render_config/render_config.go +++ b/pkg/config/render_config/render_config.go @@ -223,7 +223,7 @@ func lint(destFile string) error { normalized = bytes.TrimSpace(normalized) // [sts] Collapse runs of blank lines on both sides before comparing. The - // gopkg.in/yaml.v3 encoder is non-idempotent around bare null keys (e.g. + // go.yaml.in/yaml/v3 encoder is non-idempotent around bare null keys (e.g. // `api_key:` followed by a blank line and a `## @param` block) — it // arbitrarily adds or removes the blank line depending on what follows in // the file, even though the YAML node tree is identical. The lint's @@ -252,7 +252,7 @@ func lint(destFile string) error { } // collapseBlankLines drops every blank-only line so the lint comparison ignores -// cosmetic whitespace shuffling that the gopkg.in/yaml.v3 encoder introduces +// cosmetic whitespace shuffling that the go.yaml.in/yaml/v3 encoder introduces // around null-value scalar nodes (e.g. it arbitrarily adds or removes the // single blank line between `api_key:` and a following `## @param` block, // even when the YAML node tree is identical). Blank lines in YAML carry no diff --git a/pkg/config/setup/go.mod b/pkg/config/setup/go.mod index 5472d15f5031..cb255c4d5aa4 100644 --- a/pkg/config/setup/go.mod +++ b/pkg/config/setup/go.mod @@ -21,13 +21,11 @@ require ( github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/system v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/winutil v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v2 v2.4.4 golang.org/x/sys v0.47.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/secrets/utils v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/config/basic v0.78.3-rc.2 // indirect @@ -40,7 +38,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -53,7 +50,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -63,7 +59,7 @@ require ( github.com/tklauser/numcpus v0.11.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/time v0.15.0 // indirect diff --git a/pkg/config/setup/go.sum b/pkg/config/setup/go.sum index 0d373952d9c9..fa9d327ee0ea 100644 --- a/pkg/config/setup/go.sum +++ b/pkg/config/setup/go.sum @@ -8,8 +8,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -53,8 +51,6 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= @@ -71,8 +67,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -84,8 +80,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -100,8 +96,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/config/structure/go.mod b/pkg/config/structure/go.mod index 71223d3e8f97..23cde3462bd0 100644 --- a/pkg/config/structure/go.mod +++ b/pkg/config/structure/go.mod @@ -12,11 +12,9 @@ require ( github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/viperconfig v0.78.3-rc.2 github.com/go-viper/mapstructure/v2 v2.5.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/config/basic v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.78.3-rc.2 // indirect @@ -25,18 +23,16 @@ require ( github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/magiconair/properties v1.8.10 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/config/structure/go.sum b/pkg/config/structure/go.sum index 41cb505fa815..72ad134834a7 100644 --- a/pkg/config/structure/go.sum +++ b/pkg/config/structure/go.sum @@ -6,8 +6,6 @@ github.com/DataDog/viper v1.15.1/go.mod h1:rDLDREOPd+gpEbA8y4Y/5wTvyLqvUiCmDXX0j github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -36,8 +34,6 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= @@ -50,15 +46,15 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= @@ -66,8 +62,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/config/teeconfig/go.mod b/pkg/config/teeconfig/go.mod index 67c046c236a1..5b2b89834f71 100644 --- a/pkg/config/teeconfig/go.mod +++ b/pkg/config/teeconfig/go.mod @@ -5,19 +5,16 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/config/model v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/time v0.15.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/config/teeconfig/go.sum b/pkg/config/teeconfig/go.sum index f75dbfe49ae9..befeb0397c22 100644 --- a/pkg/config/teeconfig/go.sum +++ b/pkg/config/teeconfig/go.sum @@ -1,23 +1,8 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/config/utils/go.mod b/pkg/config/utils/go.mod index 065864d5ed57..cf3737cae1d1 100644 --- a/pkg/config/utils/go.mod +++ b/pkg/config/utils/go.mod @@ -10,12 +10,10 @@ require ( github.com/DataDog/datadog-agent/pkg/fips v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 golang.org/x/net v0.58.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -36,7 +34,6 @@ require ( github.com/DataDog/datadog-agent/pkg/util/winutil v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -49,7 +46,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -60,7 +56,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect diff --git a/pkg/config/utils/go.sum b/pkg/config/utils/go.sum index 748ed97c826e..1854466698df 100644 --- a/pkg/config/utils/go.sum +++ b/pkg/config/utils/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -48,8 +46,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -68,8 +64,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -81,8 +77,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -99,8 +95,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/config/viperconfig/go.mod b/pkg/config/viperconfig/go.mod index 510398d1f567..ef57c19150bf 100644 --- a/pkg/config/viperconfig/go.mod +++ b/pkg/config/viperconfig/go.mod @@ -8,28 +8,25 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/viper v1.15.1 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/magiconair/properties v1.8.10 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/config/viperconfig/go.sum b/pkg/config/viperconfig/go.sum index a1512e440c01..a2ddeed706b1 100644 --- a/pkg/config/viperconfig/go.sum +++ b/pkg/config/viperconfig/go.sum @@ -3,8 +3,6 @@ github.com/DataDog/viper v1.15.1 h1:kcdFE+qPndlWkhU4iEf/WpWQMCyVYHTv5HqvVf+SYJs= github.com/DataDog/viper v1.15.1/go.mod h1:rDLDREOPd+gpEbA8y4Y/5wTvyLqvUiCmDXX0jRZy8mw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -31,8 +29,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -47,15 +43,15 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= @@ -63,8 +59,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/errors/go.mod b/pkg/errors/go.mod index ca98b6cb60b2..dbbc373dd02a 100644 --- a/pkg/errors/go.mod +++ b/pkg/errors/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/errors go 1.26.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/errors/go.sum b/pkg/errors/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/errors/go.sum +++ b/pkg/errors/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/fleet/installer/go.mod b/pkg/fleet/installer/go.mod index 12d0b9ced085..88d1b1e88c58 100644 --- a/pkg/fleet/installer/go.mod +++ b/pkg/fleet/installer/go.mod @@ -15,23 +15,21 @@ require ( github.com/google/uuid v1.6.0 github.com/shirou/gopsutil/v4 v4.26.3 github.com/spf13/cobra v1.10.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.etcd.io/bbolt v1.4.3 go.uber.org/atomic v1.11.0 go.uber.org/multierr v1.11.0 go.yaml.in/yaml/v2 v2.4.4 - go.yaml.in/yaml/v3 v3.0.4 + go.yaml.in/yaml/v3 v3.0.5 golang.org/x/net v0.58.0 golang.org/x/sys v0.47.0 golang.org/x/text v0.41.0 gopkg.in/evanphx/json-patch.v4 v4.13.0 - gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/containerd/stargz-snapshotter/estargz v0.18.1 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/docker/cli v29.2.1+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect github.com/docker/docker-credential-helpers v0.9.4 // indirect @@ -45,7 +43,6 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // 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/sirupsen/logrus v1.9.4 // indirect github.com/spf13/pflag v1.0.10 // indirect diff --git a/pkg/fleet/installer/go.sum b/pkg/fleet/installer/go.sum index 93ab9086b055..8b443f3b9d08 100644 --- a/pkg/fleet/installer/go.sum +++ b/pkg/fleet/installer/go.sum @@ -7,8 +7,6 @@ github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F9 github.com/containerd/stargz-snapshotter/estargz v0.18.1 h1:cy2/lpgBXDA3cDKSyEfNOFMA/c10O1axL69EU7iirO8= github.com/containerd/stargz-snapshotter/estargz v0.18.1/go.mod h1:ALIEqa7B6oVDsrF37GkGN20SuvG/pIMm7FwP7ZmRb0Q= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/docker/cli v29.2.1+incompatible h1:n3Jt0QVCN65eiVBoUTZQM9mcQICCJt3akW4pKAbKdJg= github.com/docker/cli v29.2.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= @@ -32,10 +30,6 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= @@ -48,12 +42,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= @@ -66,8 +56,8 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -84,8 +74,9 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs= golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= @@ -107,11 +98,7 @@ golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/evanphx/json-patch.v4 v4.13.0 h1:czT3CmqEaQ1aanPc5SdlgQrrEIb8w/wwCvWWnfEbYzo= gopkg.in/evanphx/json-patch.v4 v4.13.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= diff --git a/pkg/fleet/installer/packages/datadog_agent_extensions.go b/pkg/fleet/installer/packages/datadog_agent_extensions.go index 361b64d3f526..a69cf7279cea 100644 --- a/pkg/fleet/installer/packages/datadog_agent_extensions.go +++ b/pkg/fleet/installer/packages/datadog_agent_extensions.go @@ -11,7 +11,7 @@ import ( "path/filepath" "strings" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" "github.com/DataDog/datadog-agent/pkg/fleet/installer/env" "github.com/DataDog/datadog-agent/pkg/fleet/installer/oci" diff --git a/pkg/fleet/installer/packages/datadog_agent_extensions_test.go b/pkg/fleet/installer/packages/datadog_agent_extensions_test.go index e7df9c7ce5fe..e534453b3920 100644 --- a/pkg/fleet/installer/packages/datadog_agent_extensions_test.go +++ b/pkg/fleet/installer/packages/datadog_agent_extensions_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" extensionsPkg "github.com/DataDog/datadog-agent/pkg/fleet/installer/packages/extensions" ) @@ -86,6 +86,33 @@ installer: assert.Nil(t, config.Installer.Registry.Extensions) } +func TestParseRegistryConfigAliases(t *testing.T) { + configContent := ` +registry_defaults: ®istry_defaults + url: registry.example.com + auth: password + username: null + password: |- + first line + second line +installer: + registry: + <<: *registry_defaults + extensions: + datadog-agent: + ddot: *registry_defaults +` + var config datadogAgentConfig + require.NoError(t, yaml.Unmarshal([]byte(configContent), &config)) + registry := config.Installer.Registry + assert.Equal(t, "registry.example.com", registry.URL) + assert.Empty(t, registry.Username) + assert.Equal(t, "first line\nsecond line", registry.Password) + require.Contains(t, registry.Extensions[agentPackage], "ddot") + assert.Equal(t, registry.URL, registry.Extensions[agentPackage]["ddot"].URL) + assert.Equal(t, registry.Password, registry.Extensions[agentPackage]["ddot"].Password) +} + func TestInstallDDOTExtensionIfEnabled_Disabled(t *testing.T) { t.Setenv("DD_OTELCOLLECTOR_ENABLED", "false") ctx := HookContext{Context: context.Background()} diff --git a/pkg/gohai/go.mod b/pkg/gohai/go.mod index b796ce14a877..1b318ec72ea9 100644 --- a/pkg/gohai/go.mod +++ b/pkg/gohai/go.mod @@ -8,27 +8,23 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/moby/sys/mountinfo v0.7.2 github.com/shirou/gopsutil/v4 v4.26.3 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 golang.org/x/sys v0.47.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // 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/tklauser/go-sysconf v0.3.16 // indirect github.com/tklauser/numcpus v0.11.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/gohai/go.sum b/pkg/gohai/go.sum index 0ae72b5db40a..0ccd443951a9 100644 --- a/pkg/gohai/go.sum +++ b/pkg/gohai/go.sum @@ -1,5 +1,3 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -7,24 +5,16 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg= github.com/moby/sys/mountinfo v0.7.2/go.mod h1:1YOa8w8Ih7uW0wALDUgT1dTTSBrZ+HiBLGws92L2RU4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -33,8 +23,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -42,8 +32,3 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/logs/client/go.mod b/pkg/logs/client/go.mod index 051f6ccafd4c..74956c93ab0a 100644 --- a/pkg/logs/client/go.mod +++ b/pkg/logs/client/go.mod @@ -18,12 +18,10 @@ require ( github.com/DataDog/datadog-agent/pkg/util/http v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 golang.org/x/net v0.58.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -56,7 +54,6 @@ require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -71,7 +68,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -91,7 +87,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect diff --git a/pkg/logs/client/go.sum b/pkg/logs/client/go.sum index 9552a60742b4..b66e7af26a69 100644 --- a/pkg/logs/client/go.sum +++ b/pkg/logs/client/go.sum @@ -12,8 +12,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -63,8 +61,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -95,8 +91,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -118,8 +114,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -138,8 +135,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/logs/diagnostic/go.mod b/pkg/logs/diagnostic/go.mod index c73369024ff8..8d81e9dde200 100644 --- a/pkg/logs/diagnostic/go.mod +++ b/pkg/logs/diagnostic/go.mod @@ -8,11 +8,9 @@ require ( github.com/DataDog/datadog-agent/pkg/config/setup v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/logs/message v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/logs/sources v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -45,7 +43,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -59,7 +56,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -75,7 +71,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/logs/diagnostic/go.sum b/pkg/logs/diagnostic/go.sum index 962dc810d4db..951d0dc21783 100644 --- a/pkg/logs/diagnostic/go.sum +++ b/pkg/logs/diagnostic/go.sum @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -51,8 +49,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -75,8 +71,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -98,8 +94,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -116,8 +113,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/logs/message/go.mod b/pkg/logs/message/go.mod index 300dab443dd4..8aecfbe5894a 100644 --- a/pkg/logs/message/go.mod +++ b/pkg/logs/message/go.mod @@ -7,11 +7,9 @@ require ( github.com/DataDog/datadog-agent/pkg/logs/sources v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/logs/types v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -40,7 +38,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -53,7 +50,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -64,7 +60,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/logs/message/go.sum b/pkg/logs/message/go.sum index 725644c637d0..74c1064f9b92 100644 --- a/pkg/logs/message/go.sum +++ b/pkg/logs/message/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -50,8 +48,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -72,8 +68,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -93,8 +89,8 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -111,8 +107,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/logs/metrics/go.mod b/pkg/logs/metrics/go.mod index 87e460c7d036..53c17f24a3d0 100644 --- a/pkg/logs/metrics/go.mod +++ b/pkg/logs/metrics/go.mod @@ -5,11 +5,9 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/telemetry v0.78.3-rc.2 github.com/benbjohnson/clock v1.3.5 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/telemetry v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/def v0.78.3-rc.2 // indirect @@ -17,10 +15,8 @@ require ( github.com/DataDog/datadog-agent/pkg/util/option v0.78.3-rc.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.5 // indirect @@ -33,6 +29,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/pkg/logs/metrics/go.sum b/pkg/logs/metrics/go.sum index fc3cd035b5d1..c0559a1d1856 100644 --- a/pkg/logs/metrics/go.sum +++ b/pkg/logs/metrics/go.sum @@ -5,24 +5,16 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= @@ -31,16 +23,14 @@ github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTU github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= @@ -55,14 +45,11 @@ go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/logs/pipeline/go.mod b/pkg/logs/pipeline/go.mod index 867405a0f522..1daa22aeaf7f 100644 --- a/pkg/logs/pipeline/go.mod +++ b/pkg/logs/pipeline/go.mod @@ -19,12 +19,10 @@ require ( github.com/DataDog/datadog-agent/pkg/logs/status/statusinterface v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/compression v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/startstop v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/agent-payload/v5 v5.0.184 // indirect github.com/DataDog/datadog-agent/comp/core/config v0.78.3-rc.2 // indirect @@ -71,7 +69,6 @@ require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -87,7 +84,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -106,7 +102,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/logs/pipeline/go.sum b/pkg/logs/pipeline/go.sum index b30cc7ba6fed..490cddc41eaf 100644 --- a/pkg/logs/pipeline/go.sum +++ b/pkg/logs/pipeline/go.sum @@ -16,8 +16,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -71,8 +69,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -103,8 +99,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -128,8 +124,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -173,8 +170,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/logs/processor/go.mod b/pkg/logs/processor/go.mod index 7162345cef52..cf29d2b2f4e8 100644 --- a/pkg/logs/processor/go.mod +++ b/pkg/logs/processor/go.mod @@ -12,11 +12,9 @@ require ( github.com/DataDog/datadog-agent/pkg/logs/metrics v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/logs/sources v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -53,7 +51,6 @@ require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -69,7 +66,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -89,7 +85,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/logs/processor/go.sum b/pkg/logs/processor/go.sum index e74221951ec0..b7d252c28f59 100644 --- a/pkg/logs/processor/go.sum +++ b/pkg/logs/processor/go.sum @@ -14,8 +14,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -69,8 +67,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -101,8 +97,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -126,8 +122,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -171,8 +168,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/logs/sender/go.mod b/pkg/logs/sender/go.mod index ce80bac058f1..ef8198660111 100644 --- a/pkg/logs/sender/go.mod +++ b/pkg/logs/sender/go.mod @@ -16,12 +16,10 @@ require ( github.com/DataDog/datadog-agent/pkg/util/compression v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/benbjohnson/clock v1.3.5 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/config v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect @@ -65,7 +63,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -80,7 +77,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -99,7 +95,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/logs/sender/go.sum b/pkg/logs/sender/go.sum index d078d6f10ae4..30484aaf552b 100644 --- a/pkg/logs/sender/go.sum +++ b/pkg/logs/sender/go.sum @@ -14,8 +14,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -65,8 +63,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -97,8 +93,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -120,8 +116,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -140,8 +137,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/logs/sources/go.mod b/pkg/logs/sources/go.mod index 68bc1a8006f1..4c71e1ef54dd 100644 --- a/pkg/logs/sources/go.mod +++ b/pkg/logs/sources/go.mod @@ -7,11 +7,9 @@ require ( github.com/DataDog/datadog-agent/pkg/logs/status/utils v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/statstracker v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -39,7 +37,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -52,7 +49,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -63,7 +59,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/logs/sources/go.sum b/pkg/logs/sources/go.sum index 725644c637d0..74c1064f9b92 100644 --- a/pkg/logs/sources/go.sum +++ b/pkg/logs/sources/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -50,8 +48,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -72,8 +68,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -93,8 +89,8 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -111,8 +107,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/logs/status/utils/go.mod b/pkg/logs/status/utils/go.mod index beb7cb90ccb1..eadab5bd3116 100644 --- a/pkg/logs/status/utils/go.mod +++ b/pkg/logs/status/utils/go.mod @@ -3,19 +3,11 @@ module github.com/DataDog/datadog-agent/pkg/logs/status/utils go 1.25.0 require ( - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/logs/status/utils/go.sum b/pkg/logs/status/utils/go.sum index e4b982ff7a81..ff2ce5d09b0e 100644 --- a/pkg/logs/status/utils/go.sum +++ b/pkg/logs/status/utils/go.sum @@ -1,25 +1,6 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/logs/util/testutils/go.mod b/pkg/logs/util/testutils/go.mod index cc86c77c1ff8..f579f1048d76 100644 --- a/pkg/logs/util/testutils/go.mod +++ b/pkg/logs/util/testutils/go.mod @@ -57,7 +57,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/logs/util/testutils/go.sum b/pkg/logs/util/testutils/go.sum index 725644c637d0..74c1064f9b92 100644 --- a/pkg/logs/util/testutils/go.sum +++ b/pkg/logs/util/testutils/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -50,8 +48,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -72,8 +68,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -93,8 +89,8 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -111,8 +107,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/metrics/go.mod b/pkg/metrics/go.mod index c005bda0ffc3..8c65dfa582ed 100644 --- a/pkg/metrics/go.mod +++ b/pkg/metrics/go.mod @@ -13,12 +13,10 @@ require ( github.com/DataDog/datadog-agent/pkg/util/buf v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/quantile v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/config v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect @@ -60,7 +58,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -76,7 +73,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -96,7 +92,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/metrics/go.sum b/pkg/metrics/go.sum index 498020f7e7b6..17f5731172ba 100644 --- a/pkg/metrics/go.sum +++ b/pkg/metrics/go.sum @@ -12,8 +12,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -67,8 +65,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -99,8 +95,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -124,8 +120,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -142,8 +139,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/network/driver/go.mod b/pkg/network/driver/go.mod index 9eb831250c34..a400772578e6 100644 --- a/pkg/network/driver/go.mod +++ b/pkg/network/driver/go.mod @@ -7,13 +7,11 @@ require ( github.com/DataDog/datadog-agent/pkg/telemetry v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/winutil v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 golang.org/x/sys v0.47.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/def v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect @@ -23,10 +21,8 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.5 // indirect @@ -38,7 +34,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/time v0.15.0 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/pkg/network/driver/go.sum b/pkg/network/driver/go.sum index e169f1f29a78..b1cbe942da3d 100644 --- a/pkg/network/driver/go.sum +++ b/pkg/network/driver/go.sum @@ -3,24 +3,16 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= @@ -29,16 +21,14 @@ github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTU github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= @@ -53,8 +43,9 @@ go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= @@ -62,7 +53,3 @@ golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/networkdevice/profile/go.mod b/pkg/networkdevice/profile/go.mod index ae9fa3f948b6..ad865793c15f 100644 --- a/pkg/networkdevice/profile/go.mod +++ b/pkg/networkdevice/profile/go.mod @@ -6,24 +6,18 @@ require ( github.com/invopop/jsonschema v0.12.0 github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 github.com/spf13/cobra v1.10.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v2 v2.4.4 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/buger/jsonparser v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/kr/pretty v0.3.1 // indirect github.com/mailru/easyjson v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually @@ -207,3 +201,5 @@ replace ( ) replace github.com/go-openapi/testify/v2 => github.com/go-openapi/testify/v2 v2.4.1 + +replace github.com/wk8/go-ordered-map/v2 => ../../../third_party/go-ordered-map diff --git a/pkg/networkdevice/profile/go.sum b/pkg/networkdevice/profile/go.sum index 00000c9c0602..f08b2432314f 100644 --- a/pkg/networkdevice/profile/go.sum +++ b/pkg/networkdevice/profile/go.sum @@ -3,28 +3,12 @@ github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xW github.com/buger/jsonparser v1.1.2 h1:frqHqw7otoVbk5M8LlE/L7HTnIq2v9RX6EJ48i9AxJk= github.com/buger/jsonparser v1.1.2/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI= github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8= github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= @@ -33,15 +17,11 @@ github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiT github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= -github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/networkpath/payload/go.mod b/pkg/networkpath/payload/go.mod index fc51e67eff21..547896c5bc9b 100644 --- a/pkg/networkpath/payload/go.mod +++ b/pkg/networkpath/payload/go.mod @@ -4,18 +4,10 @@ go 1.26.0 require ( github.com/DataDog/datadog-agent/pkg/network/payload v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/networkpath/payload/go.sum b/pkg/networkpath/payload/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/networkpath/payload/go.sum +++ b/pkg/networkpath/payload/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/obfuscate/go.mod b/pkg/obfuscate/go.mod index 9130f3532075..50ea8abc1fa1 100644 --- a/pkg/obfuscate/go.mod +++ b/pkg/obfuscate/go.mod @@ -6,26 +6,19 @@ require ( github.com/DataDog/datadog-go/v5 v5.8.3 github.com/DataDog/go-sqllexer v0.2.1 github.com/outcaste-io/ristretto v0.2.3 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/kr/pretty v0.3.1 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - github.com/stretchr/objx v0.5.3 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sys v0.47.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/obfuscate/go.sum b/pkg/obfuscate/go.sum index 0e1e0706a1e1..1d73a23d3cf5 100644 --- a/pkg/obfuscate/go.sum +++ b/pkg/obfuscate/go.sum @@ -8,11 +8,8 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38= github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -20,24 +17,11 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn 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/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/outcaste-io/ristretto v0.2.3 h1:AK4zt/fJ76kjlYObOeNwh4T3asEuaCmp26pOvUOL9w0= github.com/outcaste-io/ristretto v0.2.3/go.mod h1:W8HywhmtlopSB1jeMg3JtdIhf+DYkLAr0VN/s4+MHac= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -50,12 +34,14 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -86,8 +72,5 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/opentelemetry-mapping-go/inframetadata/go.mod b/pkg/opentelemetry-mapping-go/inframetadata/go.mod index ea69dc53bfa8..c69044570670 100644 --- a/pkg/opentelemetry-mapping-go/inframetadata/go.mod +++ b/pkg/opentelemetry-mapping-go/inframetadata/go.mod @@ -5,32 +5,28 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/opentelemetry-mapping-go/otlp/attributes v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/serializer v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/pdata v1.57.0 go.opentelemetry.io/otel v1.45.0 go.uber.org/zap v1.28.0 ) -require ( - github.com/cespare/xxhash/v2 v2.3.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) +require github.com/cespare/xxhash/v2 v2.3.0 // indirect require ( github.com/DataDog/datadog-agent/pkg/trace/log v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/trace/traceutil v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/hashicorp/go-version v1.9.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.opentelemetry.io/collector/component v1.57.0 // indirect go.opentelemetry.io/collector/featuregate v1.57.0 // indirect go.opentelemetry.io/otel/metric v1.45.0 // indirect go.opentelemetry.io/otel/trace v1.45.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/opentelemetry-mapping-go/inframetadata/go.sum b/pkg/opentelemetry-mapping-go/inframetadata/go.sum index 7b3e85381567..c9df74ffe51f 100644 --- a/pkg/opentelemetry-mapping-go/inframetadata/go.sum +++ b/pkg/opentelemetry-mapping-go/inframetadata/go.sum @@ -2,8 +2,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -17,10 +15,6 @@ github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaX github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -28,14 +22,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/collector/component v1.57.0 h1:WKIqx2Bs0JaAZxDEhsLradXpYxnwAxVFzWhQUmu2q3w= @@ -72,14 +62,9 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/opentelemetry-mapping-go/inframetadata/gohai/internal/gohaitest/go.mod b/pkg/opentelemetry-mapping-go/inframetadata/gohai/internal/gohaitest/go.mod index 9e655cf9a1d4..ccb4a24f221b 100644 --- a/pkg/opentelemetry-mapping-go/inframetadata/gohai/internal/gohaitest/go.mod +++ b/pkg/opentelemetry-mapping-go/inframetadata/gohai/internal/gohaitest/go.mod @@ -5,19 +5,13 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/opentelemetry-mapping-go/inframetadata v0.78.3-rc.2 github.com/DataDog/gohai v0.0.0-20230524154621-4316413895ee - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/opentelemetry-mapping-go/inframetadata/gohai/internal/gohaitest/go.sum b/pkg/opentelemetry-mapping-go/inframetadata/gohai/internal/gohaitest/go.sum index 57c6e8542733..4cec0e125c8e 100644 --- a/pkg/opentelemetry-mapping-go/inframetadata/gohai/internal/gohaitest/go.sum +++ b/pkg/opentelemetry-mapping-go/inframetadata/gohai/internal/gohaitest/go.sum @@ -3,30 +3,14 @@ github.com/DataDog/gohai v0.0.0-20230524154621-4316413895ee/go.mod h1:nTot/Iy0kW github.com/cihub/seelog v0.0.0-20151216151435-d2c6e5aa9fbf/go.mod h1:9d6lWj8KzO/fd/NrVaLscBKmPigpZpn5YawRPw+e3Yo= github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 h1:kHaBemcxl8o/pQ5VM1c8PVE1PubbNx3mjUr09OqWGCs= github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575/go.mod h1:9d6lWj8KzO/fd/NrVaLscBKmPigpZpn5YawRPw+e3Yo= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/shirou/gopsutil/v3 v3.22.12/go.mod h1:Xd7P1kwZcp5VW52+9XsirIKd/BROzbb2wdX3Kqlz9uI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -35,11 +19,13 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -48,8 +34,5 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/opentelemetry-mapping-go/otlp/attributes/go.mod b/pkg/opentelemetry-mapping-go/otlp/attributes/go.mod index 0b19bf2ca197..31768b0f8644 100644 --- a/pkg/opentelemetry-mapping-go/otlp/attributes/go.mod +++ b/pkg/opentelemetry-mapping-go/otlp/attributes/go.mod @@ -5,7 +5,7 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/trace/log v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/trace/traceutil v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/component v1.57.0 go.opentelemetry.io/collector/component/componenttest v0.150.0 go.opentelemetry.io/collector/pdata v1.57.0 @@ -19,16 +19,13 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-version v1.9.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/collector/featuregate v1.57.0 // indirect go.opentelemetry.io/otel/sdk v1.45.0 // indirect @@ -36,6 +33,7 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect ) diff --git a/pkg/opentelemetry-mapping-go/otlp/attributes/go.sum b/pkg/opentelemetry-mapping-go/otlp/attributes/go.sum index 0428669ce2a9..a3426114fbd0 100644 --- a/pkg/opentelemetry-mapping-go/otlp/attributes/go.sum +++ b/pkg/opentelemetry-mapping-go/otlp/attributes/go.sum @@ -2,8 +2,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -18,10 +16,6 @@ github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaX github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -29,14 +23,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/collector/component v1.57.0 h1:WKIqx2Bs0JaAZxDEhsLradXpYxnwAxVFzWhQUmu2q3w= @@ -75,14 +65,9 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/opentelemetry-mapping-go/otlp/logs/go.mod b/pkg/opentelemetry-mapping-go/otlp/logs/go.mod index 7b255ed2eb2c..b43db5115cbb 100644 --- a/pkg/opentelemetry-mapping-go/otlp/logs/go.mod +++ b/pkg/opentelemetry-mapping-go/otlp/logs/go.mod @@ -8,7 +8,7 @@ require ( github.com/DataDog/datadog-agent/pkg/opentelemetry-mapping-go/otlp/rum v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/orchestrator/model v0.78.3-rc.2 github.com/DataDog/datadog-api-client-go/v2 v2.56.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/twmb/murmur3 v1.1.8 go.opentelemetry.io/collector/component v1.57.0 go.opentelemetry.io/collector/component/componenttest v0.150.0 @@ -17,10 +17,7 @@ require ( go.uber.org/zap v1.28.0 ) -require ( - github.com/cespare/xxhash/v2 v2.3.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) +require github.com/cespare/xxhash/v2 v2.3.0 // indirect require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect @@ -32,7 +29,6 @@ require ( github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49 // indirect github.com/DataDog/zstd v1.5.7 // indirect github.com/DataDog/zstd_0 v0.0.0-20210310093942-586c1286621f // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/goccy/go-json v0.10.6 // indirect @@ -44,7 +40,6 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/collector/featuregate v1.57.0 // indirect go.opentelemetry.io/otel/metric v1.45.0 // indirect @@ -53,7 +48,7 @@ require ( go.opentelemetry.io/otel/trace v1.45.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/oauth2 v0.36.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/time v0.15.0 // indirect diff --git a/pkg/opentelemetry-mapping-go/otlp/logs/go.sum b/pkg/opentelemetry-mapping-go/otlp/logs/go.sum index cda42d7f4a32..62a52044c0dd 100644 --- a/pkg/opentelemetry-mapping-go/otlp/logs/go.sum +++ b/pkg/opentelemetry-mapping-go/otlp/logs/go.sum @@ -12,8 +12,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -36,10 +34,6 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -49,14 +43,10 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWu github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -99,8 +89,8 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -134,8 +124,3 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/opentelemetry-mapping-go/otlp/metrics/go.mod b/pkg/opentelemetry-mapping-go/otlp/metrics/go.mod index 9f58b11ae1f5..74ea42b6958a 100644 --- a/pkg/opentelemetry-mapping-go/otlp/metrics/go.mod +++ b/pkg/opentelemetry-mapping-go/otlp/metrics/go.mod @@ -11,7 +11,7 @@ require ( github.com/lightstep/go-expohisto v1.0.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.150.0 github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/twmb/murmur3 v1.1.8 go.opentelemetry.io/collector/component v1.57.0 go.opentelemetry.io/collector/component/componenttest v0.150.0 @@ -21,16 +21,12 @@ require ( google.golang.org/protobuf v1.36.11 ) -require ( - go.opentelemetry.io/collector/pdata/xpdata v0.150.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) +require go.opentelemetry.io/collector/pdata/xpdata v0.150.0 // indirect require ( github.com/DataDog/datadog-agent/pkg/trace/log v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/trace/traceutil v0.78.3-rc.2 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -42,7 +38,6 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.150.0 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/tinylib/msgp v1.6.3 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/collector/featuregate v1.57.0 // indirect @@ -53,6 +48,7 @@ require ( go.opentelemetry.io/otel/trace v1.45.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect ) diff --git a/pkg/opentelemetry-mapping-go/otlp/metrics/go.sum b/pkg/opentelemetry-mapping-go/otlp/metrics/go.sum index f807cb67812b..fe77f18cee66 100644 --- a/pkg/opentelemetry-mapping-go/otlp/metrics/go.sum +++ b/pkg/opentelemetry-mapping-go/otlp/metrics/go.sum @@ -4,8 +4,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -26,10 +24,6 @@ github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaX github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lightstep/go-expohisto v1.0.0 h1:UPtTS1rGdtehbbAF7o/dhkWLTDI73UifG8LbfQI7cA4= github.com/lightstep/go-expohisto v1.0.0/go.mod h1:xDXD0++Mu2FOaItXtdDfksfgxfV0z1TMPa+e/EUd0cs= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -51,14 +45,10 @@ github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= @@ -109,16 +99,13 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/opentelemetry-mapping-go/otlp/rum/go.mod b/pkg/opentelemetry-mapping-go/otlp/rum/go.mod index 0c8560ef306f..e30f364018e1 100644 --- a/pkg/opentelemetry-mapping-go/otlp/rum/go.mod +++ b/pkg/opentelemetry-mapping-go/otlp/rum/go.mod @@ -3,28 +3,23 @@ module github.com/DataDog/datadog-agent/pkg/opentelemetry-mapping-go/otlp/rum go 1.25.0 require ( - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/pdata v1.57.0 go.opentelemetry.io/otel v1.45.0 go.uber.org/zap v1.28.0 ) -require ( - github.com/cespare/xxhash/v2 v2.3.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) +require github.com/cespare/xxhash/v2 v2.3.0 // indirect require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/hashicorp/go-version v1.9.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect go.opentelemetry.io/collector/featuregate v1.57.0 // indirect go.opentelemetry.io/otel/trace v1.45.0 // indirect go.uber.org/multierr v1.11.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/opentelemetry-mapping-go/otlp/rum/go.sum b/pkg/opentelemetry-mapping-go/otlp/rum/go.sum index f38ef2f2b3b7..774e183fbd9c 100644 --- a/pkg/opentelemetry-mapping-go/otlp/rum/go.sum +++ b/pkg/opentelemetry-mapping-go/otlp/rum/go.sum @@ -2,8 +2,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -11,10 +9,6 @@ github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaX github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -22,14 +16,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.opentelemetry.io/collector/featuregate v1.57.0 h1:KPDSUKYn6MHwgyGRSGPPcW/G96HH93pxuvvPwM+R8nY= go.opentelemetry.io/collector/featuregate v1.57.0/go.mod h1:4ga1QBMPEejXXmpyJS8lmaRpknJ3Lb9Bvk6e420bUFU= go.opentelemetry.io/collector/internal/testutil v0.151.0 h1:CFjDItLuqzblItOsnK6IPSdrsOaZCaDjYpB8qWG+XHI= @@ -52,12 +42,7 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/orchestrator/model/go.mod b/pkg/orchestrator/model/go.mod index 19c35ec2fea1..35511c7723b7 100644 --- a/pkg/orchestrator/model/go.mod +++ b/pkg/orchestrator/model/go.mod @@ -12,7 +12,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/orchestrator/model/go.sum b/pkg/orchestrator/model/go.sum index 5422e584ec98..23a37a0b2ad6 100644 --- a/pkg/orchestrator/model/go.sum +++ b/pkg/orchestrator/model/go.sum @@ -1,25 +1,10 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/orchestrator/util/go.mod b/pkg/orchestrator/util/go.mod index f2e314cd2711..e516b4a1c278 100644 --- a/pkg/orchestrator/util/go.mod +++ b/pkg/orchestrator/util/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/orchestrator/util go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/orchestrator/util/go.sum b/pkg/orchestrator/util/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/orchestrator/util/go.sum +++ b/pkg/orchestrator/util/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/process/util/api/go.mod b/pkg/process/util/api/go.mod index fe565454d2d6..929af8fda0fd 100644 --- a/pkg/process/util/api/go.mod +++ b/pkg/process/util/api/go.mod @@ -7,11 +7,9 @@ require ( github.com/DataDog/datadog-agent/pkg/config/utils v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/telemetry v0.78.3-rc.2 github.com/gogo/protobuf v1.3.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -47,7 +45,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -63,7 +60,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -83,7 +79,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/process/util/api/go.sum b/pkg/process/util/api/go.sum index 68b76af65129..124eccee1971 100644 --- a/pkg/process/util/api/go.sum +++ b/pkg/process/util/api/go.sum @@ -18,8 +18,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -73,8 +71,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -105,8 +101,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -130,8 +126,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -175,8 +172,4 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/proto/go.mod b/pkg/proto/go.mod index 00329aa53442..e7d6bcab4c2f 100644 --- a/pkg/proto/go.mod +++ b/pkg/proto/go.mod @@ -8,25 +8,22 @@ require ( github.com/golang/mock v1.7.0-rc.1 github.com/google/gofuzz v1.2.0 github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/tinylib/msgp v1.6.3 github.com/vmihailenco/msgpack/v4 v4.3.13 google.golang.org/grpc v1.83.2 google.golang.org/protobuf v1.36.11 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/philhofer/fwd v1.2.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/vmihailenco/tagparser v0.1.2 // indirect go.opentelemetry.io/otel v1.45.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.45.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect diff --git a/pkg/proto/go.sum b/pkg/proto/go.sum index 1d727de94ac0..48faddc48836 100644 --- a/pkg/proto/go.sum +++ b/pkg/proto/go.sum @@ -2,8 +2,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -36,13 +34,11 @@ github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/vmihailenco/msgpack/v4 v4.3.13 h1:A2wsiTbvp63ilDaWmsk2wjx6xZdxQOvpiNlKBGKKXKI= @@ -64,6 +60,8 @@ go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJj go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA= go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag= go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -122,9 +120,6 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/remoteconfig/state/go.mod b/pkg/remoteconfig/state/go.mod index 489df522688f..e122c435f80b 100644 --- a/pkg/remoteconfig/state/go.mod +++ b/pkg/remoteconfig/state/go.mod @@ -5,16 +5,13 @@ go 1.26.0 require ( github.com/DataDog/go-tuf v1.1.1-0.5.2 github.com/secure-systems-lab/go-securesystemslib v0.9.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect ) diff --git a/pkg/remoteconfig/state/go.sum b/pkg/remoteconfig/state/go.sum index eb8571879a66..1e96206aa6df 100644 --- a/pkg/remoteconfig/state/go.sum +++ b/pkg/remoteconfig/state/go.sum @@ -1,8 +1,6 @@ github.com/DataDog/go-tuf v1.1.1-0.5.2 h1:YWvghV4ZvrQsPcUw8IOUMSDpqc3W5ruOIC+KJxPknv0= github.com/DataDog/go-tuf v1.1.1-0.5.2/go.mod h1:zBcq6f654iVqmkk8n2Cx81E1JnNTMOAx1UEO/wZR+P0= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -10,21 +8,18 @@ github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3x github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/secure-systems-lab/go-securesystemslib v0.9.0 h1:rf1HIbL64nUpEIZnjLZ3mcNEL9NBPB0iuVjyxvq3LZc= github.com/secure-systems-lab/go-securesystemslib v0.9.0/go.mod h1:DVHKMcZ+V4/woA/peqr+L0joiRXbPpQ042GgJckkFgw= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.56.0 h1:GUh5Ii4J5jtcseSMiRqr1jXCNHoxjeV9Fmekc2oLy6Y= golang.org/x/crypto v0.56.0/go.mod h1:OMW5y6CY9l38uPLmxU6l6pwcXp1obtLo3e6gT7gQR2I= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/security/secl/go.mod b/pkg/security/secl/go.mod index 2639c0d0fee3..bd95b55dd287 100644 --- a/pkg/security/secl/go.mod +++ b/pkg/security/secl/go.mod @@ -14,28 +14,24 @@ require ( github.com/jellydator/ttlcache/v3 v3.4.0 github.com/skydive-project/go-debouncer v1.0.1 github.com/spf13/cast v1.10.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/weppos/publicsuffix-go v0.50.3 github.com/xeipuuv/gojsonschema v1.2.0 go.uber.org/atomic v1.11.0 - go.yaml.in/yaml/v3 v3.0.4 + go.yaml.in/yaml/v3 v3.0.5 golang.org/x/sys v0.47.0 golang.org/x/text v0.41.0 sigs.k8s.io/yaml v1.6.0 ) require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/security/secl/go.sum b/pkg/security/secl/go.sum index d096193d3096..5e5f7b251540 100644 --- a/pkg/security/secl/go.sum +++ b/pkg/security/secl/go.sum @@ -7,8 +7,6 @@ github.com/charlievieth/strcase v0.0.5 h1:gV4iXVyD6eI5KdfOV+/vIVCKXZwtCWOmDMcu7U github.com/charlievieth/strcase v0.0.5/go.mod h1:FIOYY1aDBMSIOFqmVomHBpoK+bteGlESRsgsdWjrhx8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= @@ -26,16 +24,11 @@ github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/jellydator/ttlcache/v3 v3.4.0 h1:YS4P125qQS0tNhtL6aeYkheEaB/m8HCqdMMP4mnWdTY= github.com/jellydator/ttlcache/v3 v3.4.0/go.mod h1:Hw9EgjymziQD3yGsQdf1FqFdpp7YjFMd4Srg5EJlgD4= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/skydive-project/go-debouncer v1.0.1 h1:N75Mdusd65Jjbc7k5t2oo+7qLIdMtSNJKssmpEYuSgo= @@ -45,8 +38,8 @@ github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qq github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/weppos/publicsuffix-go v0.50.3 h1:eT5dcjHQcVDNc0igpFEsGHKIip30feuB2zuuI9eJxiE= github.com/weppos/publicsuffix-go v0.50.3/go.mod h1:/rOa781xBykZhHK/I3QeHo92qdDKVmKZKF7s8qAEM/4= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -62,8 +55,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= @@ -85,10 +78,6 @@ golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/pkg/security/seclwin/go.sum b/pkg/security/seclwin/go.sum index 5b407565c85e..0f22d18af671 100644 --- a/pkg/security/seclwin/go.sum +++ b/pkg/security/seclwin/go.sum @@ -5,21 +5,19 @@ github.com/charlievieth/strcase v0.0.5 h1:gV4iXVyD6eI5KdfOV+/vIVCKXZwtCWOmDMcu7U github.com/charlievieth/strcase v0.0.5/go.mod h1:FIOYY1aDBMSIOFqmVomHBpoK+bteGlESRsgsdWjrhx8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/jellydator/ttlcache/v3 v3.4.0 h1:YS4P125qQS0tNhtL6aeYkheEaB/m8HCqdMMP4mnWdTY= github.com/jellydator/ttlcache/v3 v3.4.0/go.mod h1:Hw9EgjymziQD3yGsQdf1FqFdpp7YjFMd4Srg5EJlgD4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/weppos/publicsuffix-go v0.50.3 h1:eT5dcjHQcVDNc0igpFEsGHKIip30feuB2zuuI9eJxiE= github.com/weppos/publicsuffix-go v0.50.3/go.mod h1:/rOa781xBykZhHK/I3QeHo92qdDKVmKZKF7s8qAEM/4= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -30,5 +28,3 @@ golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/serializer/go.mod b/pkg/serializer/go.mod index 3a9549dac1df..1d40b2769b12 100644 --- a/pkg/serializer/go.mod +++ b/pkg/serializer/go.mod @@ -30,13 +30,11 @@ require ( github.com/json-iterator/go v1.1.12 github.com/protocolbuffers/protoscope v0.0.0-20221109213918-8e7a6aafa2c9 github.com/richardartoul/molecule v1.0.1-0.20240531184615-7ca0df43c0b3 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/twmb/murmur3 v1.1.8 google.golang.org/protobuf v1.36.11 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -88,7 +86,6 @@ require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fatih/color v1.18.0 // indirect @@ -114,7 +111,6 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pelletier/go-toml v1.9.5 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -135,7 +131,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/serializer/go.sum b/pkg/serializer/go.sum index df63fbcf9f4f..9d4c8daed3e2 100644 --- a/pkg/serializer/go.sum +++ b/pkg/serializer/go.sum @@ -22,8 +22,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -109,8 +107,6 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -149,8 +145,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -176,8 +172,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -224,9 +221,5 @@ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBN google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= diff --git a/pkg/ssi/testutils/go.mod b/pkg/ssi/testutils/go.mod index 12c4e60c1554..606eada056b2 100644 --- a/pkg/ssi/testutils/go.mod +++ b/pkg/ssi/testutils/go.mod @@ -3,25 +3,23 @@ module github.com/DataDog/datadog-agent/pkg/ssi/testutils go 1.26.0 require ( - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 k8s.io/api v0.35.3 k8s.io/apimachinery v0.35.3 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fxamacker/cbor/v2 v2.9.1 // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/kr/text v0.2.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/x448/float16 v0.8.4 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/text v0.41.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/pkg/ssi/testutils/go.sum b/pkg/ssi/testutils/go.sum index 71acbc4fabdd..b5c0d326d230 100644 --- a/pkg/ssi/testutils/go.sum +++ b/pkg/ssi/testutils/go.sum @@ -1,4 +1,3 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -12,10 +11,6 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -25,29 +20,24 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWu github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.35.3 h1:pA2fiBc6+N9PDf7SAiluKGEBuScsTzd2uYBkA5RzNWQ= k8s.io/api v0.35.3/go.mod h1:9Y9tkBcFwKNq2sxwZTQh1Njh9qHl81D0As56tu42GA4= k8s.io/apimachinery v0.35.3 h1:MeaUwQCV3tjKP4bcwWGgZ/cp/vpsRnQzqO6J6tJyoF8= diff --git a/pkg/status/health/go.mod b/pkg/status/health/go.mod index 0cc1a3e170d2..609c01045b00 100644 --- a/pkg/status/health/go.mod +++ b/pkg/status/health/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/status/health go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/status/health/go.sum b/pkg/status/health/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/status/health/go.sum +++ b/pkg/status/health/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/tagger/types/go.sum b/pkg/tagger/types/go.sum index 5d19fde92527..c2336837ec7d 100644 --- a/pkg/tagger/types/go.sum +++ b/pkg/tagger/types/go.sum @@ -1,8 +1,4 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/tagset/go.mod b/pkg/tagset/go.mod index 05cde227ccb7..f184cd486d29 100644 --- a/pkg/tagset/go.mod +++ b/pkg/tagset/go.mod @@ -4,17 +4,11 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/util/sort v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/twmb/murmur3 v1.1.8 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/text v0.2.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/tagset/go.sum b/pkg/tagset/go.sum index 5a14dd5d387a..d7823f2c401d 100644 --- a/pkg/tagset/go.sum +++ b/pkg/tagset/go.sum @@ -1,20 +1,6 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/telemetry/go.mod b/pkg/telemetry/go.mod index 52bcfee88e55..8f98935c46d3 100644 --- a/pkg/telemetry/go.mod +++ b/pkg/telemetry/go.mod @@ -7,30 +7,27 @@ require ( go.uber.org/atomic v1.11.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/def v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/fxutil v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/option v0.78.3-rc.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.5 // indirect github.com/prometheus/procfs v0.20.1 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // indirect go.uber.org/dig v1.19.0 // indirect go.uber.org/fx v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/pkg/telemetry/go.sum b/pkg/telemetry/go.sum index 24d0ca9b0796..fea1d3fefb33 100644 --- a/pkg/telemetry/go.sum +++ b/pkg/telemetry/go.sum @@ -3,24 +3,16 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= @@ -29,16 +21,14 @@ github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTU github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= @@ -53,14 +43,11 @@ go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/trace/go.mod b/pkg/trace/go.mod index d10f09355687..76c765ec8269 100644 --- a/pkg/trace/go.mod +++ b/pkg/trace/go.mod @@ -26,7 +26,7 @@ require ( github.com/google/go-cmp v0.7.0 github.com/google/uuid v1.6.0 github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.150.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/tinylib/msgp v1.6.3 github.com/vmihailenco/msgpack/v4 v4.3.13 go.opentelemetry.io/collector/component v1.57.0 // indirect @@ -69,7 +69,6 @@ require ( go.opentelemetry.io/collector/featuregate v1.57.0 // indirect go.opentelemetry.io/collector/processor/processorhelper v0.150.0 // indirect go.opentelemetry.io/collector/processor/xprocessor v0.150.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( @@ -107,7 +106,6 @@ require ( github.com/philhofer/fwd v1.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -147,7 +145,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/text v0.41.0 // indirect diff --git a/pkg/trace/go.sum b/pkg/trace/go.sum index 962ac974d6af..fc0f58b0eca7 100644 --- a/pkg/trace/go.sum +++ b/pkg/trace/go.sum @@ -120,8 +120,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -160,8 +158,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -333,8 +332,9 @@ go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -422,7 +422,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/ini.v1 v1.67.1 h1:tVBILHy0R6e4wkYOn3XmiITt/hEVH4TFMYvAX2Ytz6k= gopkg.in/ini.v1 v1.67.1/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/apimachinery v0.35.3 h1:MeaUwQCV3tjKP4bcwWGgZ/cp/vpsRnQzqO6J6tJyoF8= k8s.io/apimachinery v0.35.3/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= diff --git a/pkg/trace/log/go.mod b/pkg/trace/log/go.mod index 1f90af90c0a5..c1ac6963b4ad 100644 --- a/pkg/trace/log/go.mod +++ b/pkg/trace/log/go.mod @@ -3,19 +3,11 @@ module github.com/DataDog/datadog-agent/pkg/trace/log go 1.25.0 require ( - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/trace/log/go.sum b/pkg/trace/log/go.sum index e4b982ff7a81..ff2ce5d09b0e 100644 --- a/pkg/trace/log/go.sum +++ b/pkg/trace/log/go.sum @@ -1,25 +1,6 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/trace/otel/go.mod b/pkg/trace/otel/go.mod index 8df728d18d83..91ef9a4ce458 100644 --- a/pkg/trace/otel/go.mod +++ b/pkg/trace/otel/go.mod @@ -16,7 +16,7 @@ require ( github.com/DataDog/datadog-agent/pkg/trace/traceutil v0.78.3-rc.2 github.com/DataDog/datadog-go/v5 v5.8.3 github.com/google/go-cmp v0.7.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/component/componenttest v0.150.0 go.opentelemetry.io/collector/consumer v1.57.0 go.opentelemetry.io/collector/pdata v1.57.0 @@ -26,8 +26,6 @@ require ( google.golang.org/protobuf v1.36.11 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( cloud.google.com/go/auth v0.18.2 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect @@ -101,7 +99,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect @@ -135,7 +132,6 @@ require ( github.com/philhofer/fwd v1.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -176,7 +172,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect diff --git a/pkg/trace/otel/go.sum b/pkg/trace/otel/go.sum index 91d6f22601ed..9af47124b464 100644 --- a/pkg/trace/otel/go.sum +++ b/pkg/trace/otel/go.sum @@ -37,8 +37,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38= github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -176,8 +174,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -225,8 +221,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -326,8 +323,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -439,7 +437,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/trace/stats/go.mod b/pkg/trace/stats/go.mod index 490daefe0430..db9a4c6a2218 100644 --- a/pkg/trace/stats/go.mod +++ b/pkg/trace/stats/go.mod @@ -12,14 +12,12 @@ require ( github.com/DataDog/datadog-go/v5 v5.8.3 github.com/DataDog/sketches-go v1.4.8 github.com/google/gofuzz v1.2.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/collector/pdata v1.57.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d google.golang.org/protobuf v1.36.11 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/tagger/origindetection v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/opentelemetry-mapping-go/otlp/attributes v0.78.3-rc.2 // indirect @@ -32,7 +30,6 @@ require ( github.com/DataDog/go-tuf v1.1.1-0.5.2 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -45,7 +42,6 @@ require ( github.com/philhofer/fwd v1.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // 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/secure-systems-lab/go-securesystemslib v0.9.0 // indirect github.com/shirou/gopsutil/v4 v4.26.3 // indirect @@ -61,7 +57,7 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/time v0.15.0 // indirect gopkg.in/ini.v1 v1.67.1 // indirect diff --git a/pkg/trace/stats/go.sum b/pkg/trace/stats/go.sum index abeb90e6a5a9..3415eea61bff 100644 --- a/pkg/trace/stats/go.sum +++ b/pkg/trace/stats/go.sum @@ -14,8 +14,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38= github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -72,8 +70,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -96,8 +92,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -172,8 +169,8 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.56.0 h1:GUh5Ii4J5jtcseSMiRqr1jXCNHoxjeV9Fmekc2oLy6Y= @@ -222,7 +219,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/ini.v1 v1.67.1 h1:tVBILHy0R6e4wkYOn3XmiITt/hEVH4TFMYvAX2Ytz6k= gopkg.in/ini.v1 v1.67.1/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/apimachinery v0.35.3 h1:MeaUwQCV3tjKP4bcwWGgZ/cp/vpsRnQzqO6J6tJyoF8= k8s.io/apimachinery v0.35.3/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= diff --git a/pkg/trace/traceutil/go.mod b/pkg/trace/traceutil/go.mod index 8bce69166d7c..1bca77683141 100644 --- a/pkg/trace/traceutil/go.mod +++ b/pkg/trace/traceutil/go.mod @@ -5,19 +5,15 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/proto v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/trace/log v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/tinylib/msgp v1.6.3 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/text v0.2.0 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.uber.org/atomic v1.11.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/pkg/trace/traceutil/go.sum b/pkg/trace/traceutil/go.sum index 299406f3b1c6..1d73e1a35a46 100644 --- a/pkg/trace/traceutil/go.sum +++ b/pkg/trace/traceutil/go.sum @@ -1,26 +1,15 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/vmihailenco/msgpack/v4 v4.3.13 h1:A2wsiTbvp63ilDaWmsk2wjx6xZdxQOvpiNlKBGKKXKI= @@ -29,12 +18,9 @@ github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vb github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/aws/creds/go.mod b/pkg/util/aws/creds/go.mod index 3b463db7e9db..3e6a72c16e4c 100644 --- a/pkg/util/aws/creds/go.mod +++ b/pkg/util/aws/creds/go.mod @@ -7,7 +7,7 @@ require ( github.com/DataDog/datadog-agent/pkg/config/utils v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/http v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) require ( @@ -34,7 +34,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -47,7 +46,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -58,13 +56,12 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect golang.org/x/time v0.15.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/aws/creds/go.sum b/pkg/util/aws/creds/go.sum index 748ed97c826e..1854466698df 100644 --- a/pkg/util/aws/creds/go.sum +++ b/pkg/util/aws/creds/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -48,8 +46,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -68,8 +64,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -81,8 +77,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -99,8 +95,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/backoff/go.mod b/pkg/util/backoff/go.mod index 1c1e6f2d9cb2..7776d0eaa441 100644 --- a/pkg/util/backoff/go.mod +++ b/pkg/util/backoff/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/util/backoff go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/backoff/go.sum b/pkg/util/backoff/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/util/backoff/go.sum +++ b/pkg/util/backoff/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/buf/go.mod b/pkg/util/buf/go.mod index 5cab3e63590e..1e6716307c06 100644 --- a/pkg/util/buf/go.mod +++ b/pkg/util/buf/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/util/buf go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/buf/go.sum b/pkg/util/buf/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/util/buf/go.sum +++ b/pkg/util/buf/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/cache/go.mod b/pkg/util/cache/go.mod index 3155789fcc94..9cddcb460572 100644 --- a/pkg/util/cache/go.mod +++ b/pkg/util/cache/go.mod @@ -4,18 +4,10 @@ go 1.25.0 require ( github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/cache/go.sum b/pkg/util/cache/go.sum index 2336f9be0b90..e37d456af70d 100644 --- a/pkg/util/cache/go.sum +++ b/pkg/util/cache/go.sum @@ -1,25 +1,6 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/cgroups/go.mod b/pkg/util/cgroups/go.mod index b35c318642c7..331e6c3f70af 100644 --- a/pkg/util/cgroups/go.mod +++ b/pkg/util/cgroups/go.mod @@ -7,24 +7,20 @@ require ( github.com/DataDog/datadog-agent/pkg/util/pointer v0.78.3-rc.2 github.com/containerd/cgroups/v3 v3.1.2 github.com/google/go-cmp v0.7.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/coreos/go-systemd/v22 v22.7.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/docker/go-units v0.5.0 // indirect github.com/godbus/dbus/v5 v5.2.2 // indirect github.com/moby/sys/userns v0.1.0 // indirect github.com/opencontainers/runtime-spec v1.3.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/time v0.15.0 // indirect google.golang.org/protobuf v1.36.11 // indirect diff --git a/pkg/util/cgroups/go.sum b/pkg/util/cgroups/go.sum index 7f8a572d53c7..b0ec80e65bb9 100644 --- a/pkg/util/cgroups/go.sum +++ b/pkg/util/cgroups/go.sum @@ -2,40 +2,25 @@ github.com/containerd/cgroups/v3 v3.1.2 h1:OSosXMtkhI6Qove637tg1XgK4q+DhR0mX8Wi8 github.com/containerd/cgroups/v3 v3.1.2/go.mod h1:PKZ2AcWmSBsY/tJUVhtS/rluX0b1uq1GmPO1ElCmbOw= github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA= github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ= github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/opencontainers/runtime-spec v1.3.0 h1:YZupQUdctfhpZy3TM39nN9Ika5CBWT5diQ8ibYCRkxg= github.com/opencontainers/runtime-spec v1.3.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/common/go.mod b/pkg/util/common/go.mod index 0927968a3150..494e1068743b 100644 --- a/pkg/util/common/go.mod +++ b/pkg/util/common/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/util/common go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/common/go.sum b/pkg/util/common/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/util/common/go.sum +++ b/pkg/util/common/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/compression/go.mod b/pkg/util/compression/go.mod index f33fc6f7f09e..d7c58ff4e425 100644 --- a/pkg/util/compression/go.mod +++ b/pkg/util/compression/go.mod @@ -9,8 +9,6 @@ require ( github.com/klauspost/compress v1.18.7 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.78.3-rc.2 // indirect @@ -45,7 +43,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -59,14 +56,13 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/stretchr/testify v1.11.1 // indirect + github.com/stretchr/testify v1.12.1 // 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 @@ -76,7 +72,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/util/compression/go.sum b/pkg/util/compression/go.sum index f308d108da3e..bfaf0584d90e 100644 --- a/pkg/util/compression/go.sum +++ b/pkg/util/compression/go.sum @@ -8,8 +8,6 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -55,8 +53,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -79,8 +75,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -102,8 +98,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -118,8 +115,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/containers/image/go.mod b/pkg/util/containers/image/go.mod index 04ef7e10da7e..109f7763baf5 100644 --- a/pkg/util/containers/image/go.mod +++ b/pkg/util/containers/image/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/util/containers/image go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/containers/image/go.sum b/pkg/util/containers/image/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/util/containers/image/go.sum +++ b/pkg/util/containers/image/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/defaultpaths/go.mod b/pkg/util/defaultpaths/go.mod index 50704c7ed62c..ad07ec7207fd 100644 --- a/pkg/util/defaultpaths/go.mod +++ b/pkg/util/defaultpaths/go.mod @@ -55,7 +55,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/time v0.15.0 // indirect diff --git a/pkg/util/defaultpaths/go.sum b/pkg/util/defaultpaths/go.sum index 0e81bdb38fc4..36f6fca801a0 100644 --- a/pkg/util/defaultpaths/go.sum +++ b/pkg/util/defaultpaths/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -48,8 +46,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -68,8 +64,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -81,8 +77,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -97,8 +93,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/executable/go.mod b/pkg/util/executable/go.mod index b1db44c21d2d..be721aa27bee 100644 --- a/pkg/util/executable/go.mod +++ b/pkg/util/executable/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/util/executable go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/executable/go.sum b/pkg/util/executable/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/util/executable/go.sum +++ b/pkg/util/executable/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/filesystem/go.mod b/pkg/util/filesystem/go.mod index dda0ec93048a..b3ed583fb280 100644 --- a/pkg/util/filesystem/go.mod +++ b/pkg/util/filesystem/go.mod @@ -8,25 +8,21 @@ require ( github.com/gofrs/flock v0.13.0 github.com/hectane/go-acl v0.0.0-20230225031251-cdfc9e3acf94 github.com/shirou/gopsutil/v4 v4.26.3 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 golang.org/x/sync v0.22.0 golang.org/x/sys v0.47.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/go-ole/go-ole v1.3.0 // 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/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/util/filesystem/go.sum b/pkg/util/filesystem/go.sum index 5882701511ef..74e716990402 100644 --- a/pkg/util/filesystem/go.sum +++ b/pkg/util/filesystem/go.sum @@ -1,5 +1,3 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -9,26 +7,18 @@ github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= github.com/hectane/go-acl v0.0.0-20230225031251-cdfc9e3acf94 h1:0G5JVG0aJDpWvH1r8idd+wbPcAH14UqIuUMepx3v9rE= github.com/hectane/go-acl v0.0.0-20230225031251-cdfc9e3acf94/go.mod h1:MvF7bZQy5lD2WcLXjFytRVvnTrFvrjo/qGka1MIBOPE= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -38,8 +28,3 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/flavor/go.mod b/pkg/util/flavor/go.mod index 21a77160ef03..49db4d5245b1 100644 --- a/pkg/util/flavor/go.mod +++ b/pkg/util/flavor/go.mod @@ -6,11 +6,9 @@ require ( github.com/DataDog/datadog-agent/pkg/config/mock v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/model v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/setup v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -35,7 +33,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -48,7 +45,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -59,7 +55,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/util/flavor/go.sum b/pkg/util/flavor/go.sum index 0e81bdb38fc4..36f6fca801a0 100644 --- a/pkg/util/flavor/go.sum +++ b/pkg/util/flavor/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -48,8 +46,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -68,8 +64,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -81,8 +77,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -97,8 +93,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/fxutil/go.mod b/pkg/util/fxutil/go.mod index ff8545487b2c..390aa42a0faa 100644 --- a/pkg/util/fxutil/go.mod +++ b/pkg/util/fxutil/go.mod @@ -6,20 +6,17 @@ require ( github.com/DataDog/datadog-agent/comp/def v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/option v0.78.3-rc.2 github.com/spf13/cobra v1.10.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/fx v1.24.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/pflag v1.0.10 // indirect go.uber.org/dig v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect ) diff --git a/pkg/util/fxutil/go.sum b/pkg/util/fxutil/go.sum index 71ab2a7e5a00..5392314376b9 100644 --- a/pkg/util/fxutil/go.sum +++ b/pkg/util/fxutil/go.sum @@ -1,24 +1,14 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= @@ -29,12 +19,9 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/grpc/go.mod b/pkg/util/grpc/go.mod index 0afbdc39f811..ac11dfaa30cd 100644 --- a/pkg/util/grpc/go.mod +++ b/pkg/util/grpc/go.mod @@ -11,12 +11,10 @@ require ( github.com/DataDog/datadog-agent/pkg/util/system v0.78.3-rc.2 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/mdlayher/vsock v1.2.1 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 google.golang.org/grpc v1.83.2 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( cloud.google.com/go/auth v0.18.2 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect @@ -49,7 +47,6 @@ require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -70,7 +67,6 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/philhofer/fwd v1.2.0 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -97,7 +93,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect diff --git a/pkg/util/grpc/go.sum b/pkg/util/grpc/go.sum index 848abe198e54..565ba91d88f5 100644 --- a/pkg/util/grpc/go.sum +++ b/pkg/util/grpc/go.sum @@ -25,8 +25,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -116,8 +114,6 @@ github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -153,8 +149,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -198,8 +194,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -290,13 +287,9 @@ google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/util/hostinfo/go.mod b/pkg/util/hostinfo/go.mod index a9513ee4c069..116259de75b6 100644 --- a/pkg/util/hostinfo/go.mod +++ b/pkg/util/hostinfo/go.mod @@ -10,28 +10,24 @@ require ( github.com/DataDog/datadog-agent/pkg/util/winutil v0.78.3-rc.2 github.com/shirou/gopsutil/v4 v4.26.3 github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 golang.org/x/sys v0.47.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // 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/tklauser/go-sysconf v0.3.16 // indirect github.com/tklauser/numcpus v0.11.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/util/hostinfo/go.sum b/pkg/util/hostinfo/go.sum index de44aece6750..edc0021e0ce5 100644 --- a/pkg/util/hostinfo/go.sum +++ b/pkg/util/hostinfo/go.sum @@ -1,5 +1,3 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -7,26 +5,18 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -35,8 +25,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -44,8 +34,3 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/hostname/validate/go.mod b/pkg/util/hostname/validate/go.mod index 22a3f30db9ee..ff4a54f2fd0c 100644 --- a/pkg/util/hostname/validate/go.mod +++ b/pkg/util/hostname/validate/go.mod @@ -4,19 +4,15 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/util/hostname/validate/go.sum b/pkg/util/hostname/validate/go.sum index f75dbfe49ae9..befeb0397c22 100644 --- a/pkg/util/hostname/validate/go.sum +++ b/pkg/util/hostname/validate/go.sum @@ -1,23 +1,8 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/http/go.mod b/pkg/util/http/go.mod index 058c15da77ba..dc851db01b96 100644 --- a/pkg/util/http/go.mod +++ b/pkg/util/http/go.mod @@ -6,12 +6,10 @@ require ( github.com/DataDog/datadog-agent/pkg/config/mock v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/model v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 golang.org/x/net v0.58.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -36,7 +34,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -49,7 +46,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -60,7 +56,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect diff --git a/pkg/util/http/go.sum b/pkg/util/http/go.sum index 748ed97c826e..1854466698df 100644 --- a/pkg/util/http/go.sum +++ b/pkg/util/http/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -48,8 +46,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -68,8 +64,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -81,8 +77,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -99,8 +95,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/json/go.mod b/pkg/util/json/go.mod index 10e5d6f92eef..1057e9ebab0f 100644 --- a/pkg/util/json/go.mod +++ b/pkg/util/json/go.mod @@ -4,19 +4,13 @@ go 1.25.0 require ( github.com/json-iterator/go v1.1.12 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/json/go.sum b/pkg/util/json/go.sum index 097f7a7fc33e..b84217e2f69d 100644 --- a/pkg/util/json/go.sum +++ b/pkg/util/json/go.sum @@ -1,37 +1,18 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/jsonquery/go.mod b/pkg/util/jsonquery/go.mod index 37f70341e682..2245a6e7e3f1 100644 --- a/pkg/util/jsonquery/go.mod +++ b/pkg/util/jsonquery/go.mod @@ -6,21 +6,18 @@ require ( github.com/DataDog/datadog-agent/pkg/util/cache v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/itchyny/gojq v0.12.17 - github.com/stretchr/testify v1.11.1 - go.yaml.in/yaml/v3 v3.0.4 + github.com/stretchr/testify v1.12.1 + go.yaml.in/yaml/v3 v3.0.5 ) require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/itchyny/timefmt-go v0.1.6 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.uber.org/atomic v1.11.0 // indirect golang.org/x/time v0.15.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/jsonquery/go.sum b/pkg/util/jsonquery/go.sum index d3936f0c9df9..4b35bd0dc7db 100644 --- a/pkg/util/jsonquery/go.sum +++ b/pkg/util/jsonquery/go.sum @@ -1,29 +1,14 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/itchyny/gojq v0.12.17 h1:8av8eGduDb5+rvEdaOO+zQUjA04MS0m3Ps8HiD+fceg= github.com/itchyny/gojq v0.12.17/go.mod h1:WBrEMkgAfAGO1LUcGOckBl5O726KPp+OlkKug0I/FEY= github.com/itchyny/timefmt-go v0.1.6 h1:ia3s54iciXDdzWzwaVKXZPbiXzxxnv1SPGFfM/myJ5Q= github.com/itchyny/timefmt-go v0.1.6/go.mod h1:RRDZYC5s9ErkjQvTvvU7keJjxUYzIISJGxm9/mAERQg= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/kubernetes/apiserver/common/namespace/go.mod b/pkg/util/kubernetes/apiserver/common/namespace/go.mod index 50d682865d76..cbca62fc2a24 100644 --- a/pkg/util/kubernetes/apiserver/common/namespace/go.mod +++ b/pkg/util/kubernetes/apiserver/common/namespace/go.mod @@ -53,7 +53,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/util/kubernetes/apiserver/common/namespace/go.sum b/pkg/util/kubernetes/apiserver/common/namespace/go.sum index 0e81bdb38fc4..36f6fca801a0 100644 --- a/pkg/util/kubernetes/apiserver/common/namespace/go.sum +++ b/pkg/util/kubernetes/apiserver/common/namespace/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -48,8 +46,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -68,8 +64,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -81,8 +77,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -97,8 +93,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/log/go.mod b/pkg/util/log/go.mod index ffc3b7cdcf46..16d75b93ba23 100644 --- a/pkg/util/log/go.mod +++ b/pkg/util/log/go.mod @@ -5,20 +5,16 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 go.uber.org/zap v1.28.0 golang.org/x/time v0.15.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.uber.org/multierr v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/log/go.sum b/pkg/util/log/go.sum index fb7fb0d2d3c2..163e2e2e13d3 100644 --- a/pkg/util/log/go.sum +++ b/pkg/util/log/go.sum @@ -1,15 +1,5 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -18,12 +8,7 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/log/setup/go.mod b/pkg/util/log/setup/go.mod index 3015fb260224..f20640f718c2 100644 --- a/pkg/util/log/setup/go.mod +++ b/pkg/util/log/setup/go.mod @@ -7,11 +7,9 @@ require ( github.com/DataDog/datadog-agent/pkg/config/model v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/config/setup v0.78.3-rc.2 github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/comp/core/secrets/def v0.78.3-rc.2 // indirect @@ -35,7 +33,6 @@ require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect github.com/DataDog/viper v1.15.1 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -48,7 +45,6 @@ require ( github.com/mdlayher/vsock v1.2.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.9.5 // 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/shirou/gopsutil/v4 v4.26.3 // indirect github.com/spf13/cast v1.10.0 // indirect @@ -59,7 +55,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/pkg/util/log/setup/go.sum b/pkg/util/log/setup/go.sum index 0e81bdb38fc4..36f6fca801a0 100644 --- a/pkg/util/log/setup/go.sum +++ b/pkg/util/log/setup/go.sum @@ -5,8 +5,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -48,8 +46,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -68,8 +64,8 @@ github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3A github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -81,8 +77,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -97,8 +93,4 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/option/go.mod b/pkg/util/option/go.mod index 85898809dc54..98049102c8e5 100644 --- a/pkg/util/option/go.mod +++ b/pkg/util/option/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/util/option go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/option/go.sum b/pkg/util/option/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/util/option/go.sum +++ b/pkg/util/option/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/otel/go.mod b/pkg/util/otel/go.mod index 97d139c847db..5bf47d76647e 100644 --- a/pkg/util/otel/go.mod +++ b/pkg/util/otel/go.mod @@ -4,7 +4,7 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/opentelemetry-mapping-go/otlp/attributes v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) require ( @@ -17,14 +17,11 @@ require ( require ( github.com/hashicorp/go-version v1.9.0 // indirect go.opentelemetry.io/collector/featuregate v1.57.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( github.com/DataDog/datadog-agent/pkg/trace/log v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/trace/traceutil v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect go.opentelemetry.io/collector/component v1.57.0 // indirect go.opentelemetry.io/collector/pdata v1.57.0 // indirect go.opentelemetry.io/otel v1.45.0 // indirect @@ -33,6 +30,7 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/otel/go.sum b/pkg/util/otel/go.sum index 7b3e85381567..c9df74ffe51f 100644 --- a/pkg/util/otel/go.sum +++ b/pkg/util/otel/go.sum @@ -2,8 +2,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -17,10 +15,6 @@ github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaX github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -28,14 +22,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/collector/component v1.57.0 h1:WKIqx2Bs0JaAZxDEhsLradXpYxnwAxVFzWhQUmu2q3w= @@ -72,14 +62,9 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/prometheus/go.mod b/pkg/util/prometheus/go.mod index 19156ac0ac03..706acbe68017 100644 --- a/pkg/util/prometheus/go.mod +++ b/pkg/util/prometheus/go.mod @@ -5,11 +5,9 @@ go 1.26.0 require ( github.com/prometheus/common v0.67.5 github.com/prometheus/prometheus v0.311.3 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect github.com/aws/aws-sdk-go-v2/config v1.32.14 // indirect @@ -17,22 +15,19 @@ require ( github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 // indirect github.com/aws/smithy-go v1.24.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/googleapis/gax-go/v2 v2.20.0 // indirect github.com/grafana/regexp v0.0.0-20250905093917-f7b3be9d1853 // indirect github.com/klauspost/compress v1.18.7 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/procfs v0.20.1 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 // indirect go.opentelemetry.io/otel v1.45.0 // indirect go.opentelemetry.io/otel/metric v1.45.0 // indirect go.opentelemetry.io/otel/trace v1.45.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.56.0 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/text v0.41.0 // indirect diff --git a/pkg/util/prometheus/go.sum b/pkg/util/prometheus/go.sum index 8b471b3ce3f7..1fbbd5d3db74 100644 --- a/pkg/util/prometheus/go.sum +++ b/pkg/util/prometheus/go.sum @@ -46,9 +46,6 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= @@ -77,10 +74,6 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.18.7 h1:aUyZsS4kH3QTKurYhAOwAHxllVPnOthb3vPfnF1Ehjw= github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= @@ -89,9 +82,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_golang/exp v0.0.0-20260325093428-d8591d0db856 h1:1Y6bmpZb8peQCy1IpctnAhIFuyhrdtMaDnETChhSNns= @@ -108,11 +98,8 @@ github.com/prometheus/prometheus v0.311.3 h1:3IrVxQv6v5i/ZCGi6OrYeBhtCwaPTn6Z3DY github.com/prometheus/prometheus v0.311.3/go.mod h1:gjsCxTKtHO1Q8T9333u1s+lUR1OjPyM7ruuGH8RvVyo= github.com/prometheus/sigv4 v0.4.1 h1:EIc3j+8NBea9u1iV6O5ZAN8uvPq2xOIUPcqCTivHuXs= github.com/prometheus/sigv4 v0.4.1/go.mod h1:eu+ZbRvsc5TPiHwqh77OWuCnWK73IdkETYY46P4dXOU= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= @@ -131,6 +118,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -176,11 +165,6 @@ google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU= google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/apimachinery v0.35.3 h1:MeaUwQCV3tjKP4bcwWGgZ/cp/vpsRnQzqO6J6tJyoF8= k8s.io/apimachinery v0.35.3/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= k8s.io/client-go v0.35.3 h1:s1lZbpN4uI6IxeTM2cpdtrwHcSOBML1ODNTCCfsP1pg= diff --git a/pkg/util/quantile/go.mod b/pkg/util/quantile/go.mod index 2364f8520191..3f1a78e43b6e 100644 --- a/pkg/util/quantile/go.mod +++ b/pkg/util/quantile/go.mod @@ -6,15 +6,11 @@ require ( github.com/DataDog/datadog-agent/pkg/util/quantile/sketchtest v0.78.3-rc.2 github.com/DataDog/sketches-go v1.4.8 github.com/dustin/go-humanize v1.0.1 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/text v0.2.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/pkg/util/quantile/go.sum b/pkg/util/quantile/go.sum index 664bae799846..3d5f6996c105 100644 --- a/pkg/util/quantile/go.sum +++ b/pkg/util/quantile/go.sum @@ -1,28 +1,14 @@ github.com/DataDog/sketches-go v1.4.8 h1:pFk9BNn+Rzv8IMIoPUttoOpOr3bJOqU3P6EP5wK+Lv8= github.com/DataDog/sketches-go v1.4.8/go.mod h1:a/wjRUqzqtGS8qRHRPDCs4EAQfmvPDZGDlMIF5mxXOE= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/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/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/quantile/sketchtest/go.mod b/pkg/util/quantile/sketchtest/go.mod index 048b1355d572..ada3e8bd8939 100644 --- a/pkg/util/quantile/sketchtest/go.mod +++ b/pkg/util/quantile/sketchtest/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/util/quantile/sketchtest go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect retract v0.4.0 // see #107 diff --git a/pkg/util/quantile/sketchtest/go.sum b/pkg/util/quantile/sketchtest/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/util/quantile/sketchtest/go.sum +++ b/pkg/util/quantile/sketchtest/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/scrubber/go.mod b/pkg/util/scrubber/go.mod index 278ee164bfc2..4e5d1629cf17 100644 --- a/pkg/util/scrubber/go.mod +++ b/pkg/util/scrubber/go.mod @@ -4,15 +4,8 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 - github.com/stretchr/testify v1.11.1 - go.yaml.in/yaml/v3 v3.0.4 -) - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/text v0.2.0 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect + github.com/stretchr/testify v1.12.1 + go.yaml.in/yaml/v3 v3.0.5 ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/scrubber/go.sum b/pkg/util/scrubber/go.sum index 06e9977bd0d5..c2336837ec7d 100644 --- a/pkg/util/scrubber/go.sum +++ b/pkg/util/scrubber/go.sum @@ -1,20 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/sort/go.mod b/pkg/util/sort/go.mod index 4e00e5bbe07e..d294be89d82c 100644 --- a/pkg/util/sort/go.mod +++ b/pkg/util/sort/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/util/sort go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/sort/go.sum b/pkg/util/sort/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/util/sort/go.sum +++ b/pkg/util/sort/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/startstop/go.mod b/pkg/util/startstop/go.mod index 33ca445cc5db..e445b677d2e4 100644 --- a/pkg/util/startstop/go.mod +++ b/pkg/util/startstop/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/util/startstop go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/startstop/go.sum b/pkg/util/startstop/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/util/startstop/go.sum +++ b/pkg/util/startstop/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/statstracker/go.mod b/pkg/util/statstracker/go.mod index 2711d752d23c..38fe5adea6b4 100644 --- a/pkg/util/statstracker/go.mod +++ b/pkg/util/statstracker/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/util/statstracker go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/statstracker/go.sum b/pkg/util/statstracker/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/util/statstracker/go.sum +++ b/pkg/util/statstracker/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/system/go.mod b/pkg/util/system/go.mod index 3c1f8f7ae71a..38d1854efdc1 100644 --- a/pkg/util/system/go.mod +++ b/pkg/util/system/go.mod @@ -11,30 +11,26 @@ require ( github.com/Microsoft/go-winio v0.6.2 github.com/mdlayher/vsock v1.2.1 github.com/shirou/gopsutil/v4 v4.26.3 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 golang.org/x/sys v0.47.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/gofrs/flock v0.13.0 // indirect github.com/hectane/go-acl v0.0.0-20230225031251-cdfc9e3acf94 // indirect github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // indirect github.com/mdlayher/socket v0.5.1 // 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/tklauser/go-sysconf v0.3.16 // indirect github.com/tklauser/numcpus v0.11.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/time v0.15.0 // indirect diff --git a/pkg/util/system/go.sum b/pkg/util/system/go.sum index f062aff2fa19..7084128be478 100644 --- a/pkg/util/system/go.sum +++ b/pkg/util/system/go.sum @@ -1,7 +1,5 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -13,26 +11,18 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/hectane/go-acl v0.0.0-20230225031251-cdfc9e3acf94 h1:0G5JVG0aJDpWvH1r8idd+wbPcAH14UqIuUMepx3v9rE= github.com/hectane/go-acl v0.0.0-20230225031251-cdfc9e3acf94/go.mod h1:MvF7bZQy5lD2WcLXjFytRVvnTrFvrjo/qGka1MIBOPE= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos= github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ= github.com/mdlayher/vsock v1.2.1 h1:pC1mTJTvjo1r9n9fbm7S1j04rCgCzhCOS5DY0zqHlnQ= github.com/mdlayher/vsock v1.2.1/go.mod h1:NRfCibel++DgeMD8z/hP+PPTjlNJsdPOmxcnENvE+SE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -41,8 +31,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= @@ -54,8 +44,3 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/testutil/go.mod b/pkg/util/testutil/go.mod index f5829fe860a7..5bf0d6149eed 100644 --- a/pkg/util/testutil/go.mod +++ b/pkg/util/testutil/go.mod @@ -3,17 +3,8 @@ module github.com/DataDog/datadog-agent/pkg/util/testutil go 1.25.0 require ( - github.com/stretchr/testify v1.11.1 - go.yaml.in/yaml/v3 v3.0.4 -) - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect + github.com/stretchr/testify v1.12.1 + go.yaml.in/yaml/v3 v3.0.5 ) // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/testutil/go.sum b/pkg/util/testutil/go.sum index 16c96a71d3db..c2336837ec7d 100644 --- a/pkg/util/testutil/go.sum +++ b/pkg/util/testutil/go.sum @@ -1,25 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/utilizationtracker/go.mod b/pkg/util/utilizationtracker/go.mod index 6f2022893741..6fac29cf3739 100644 --- a/pkg/util/utilizationtracker/go.mod +++ b/pkg/util/utilizationtracker/go.mod @@ -4,18 +4,10 @@ go 1.25.0 require ( github.com/benbjohnson/clock v1.3.5 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/util/utilizationtracker/go.sum b/pkg/util/utilizationtracker/go.sum index 079696b46573..09ad5bc2e48e 100644 --- a/pkg/util/utilizationtracker/go.sum +++ b/pkg/util/utilizationtracker/go.sum @@ -1,25 +1,6 @@ github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/pkg/util/uuid/go.mod b/pkg/util/uuid/go.mod index 975a9f98d273..63c018d4a012 100644 --- a/pkg/util/uuid/go.mod +++ b/pkg/util/uuid/go.mod @@ -22,7 +22,7 @@ require ( github.com/tklauser/numcpus v0.11.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/util/uuid/go.sum b/pkg/util/uuid/go.sum index 9e909ef03de5..8dea321fb55e 100644 --- a/pkg/util/uuid/go.sum +++ b/pkg/util/uuid/go.sum @@ -1,5 +1,3 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -7,24 +5,16 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k= github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= 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= @@ -33,8 +23,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -42,8 +32,3 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/util/winutil/go.mod b/pkg/util/winutil/go.mod index c6c4139581cb..67131dd37589 100644 --- a/pkg/util/winutil/go.mod +++ b/pkg/util/winutil/go.mod @@ -5,21 +5,17 @@ go 1.25.0 require ( github.com/DataDog/datadog-agent/pkg/util/log v0.78.3-rc.2 github.com/fsnotify/fsnotify v1.9.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.uber.org/atomic v1.11.0 golang.org/x/sys v0.47.0 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/pkg/template v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/version v0.78.3-rc.2 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/stretchr/objx v0.5.3 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/time v0.15.0 // indirect ) diff --git a/pkg/util/winutil/go.sum b/pkg/util/winutil/go.sum index 3cd7730894d2..32629fec3b19 100644 --- a/pkg/util/winutil/go.sum +++ b/pkg/util/winutil/go.sum @@ -1,29 +1,14 @@ -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= -go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/version/go.mod b/pkg/version/go.mod index 4380fb106830..8005f963abd8 100644 --- a/pkg/version/go.mod +++ b/pkg/version/go.mod @@ -2,17 +2,9 @@ module github.com/DataDog/datadog-agent/pkg/version go 1.25.0 -require github.com/stretchr/testify v1.11.1 +require github.com/stretchr/testify v1.12.1 -require gopkg.in/yaml.v3 v3.0.1 // indirect - -require ( - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect // This section was automatically added by 'dda inv modules.add-all-replace' command, do not edit manually diff --git a/pkg/version/go.sum b/pkg/version/go.sum index 5a10c3915835..c2336837ec7d 100644 --- a/pkg/version/go.sum +++ b/pkg/version/go.sum @@ -1,23 +1,4 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/test/e2e-framework/go.mod b/test/e2e-framework/go.mod index 0e908da399fb..2817f0ac4a03 100644 --- a/test/e2e-framework/go.mod +++ b/test/e2e-framework/go.mod @@ -46,9 +46,9 @@ require ( github.com/pulumi/pulumi/sdk/v3 v3.190.0 github.com/pulumiverse/pulumi-time/sdk v0.1.0 github.com/samber/lo v1.52.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v2 v2.4.4 - go.yaml.in/yaml/v3 v3.0.4 + go.yaml.in/yaml/v3 v3.0.5 golang.org/x/crypto v0.56.0 golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 diff --git a/test/e2e-framework/go.sum b/test/e2e-framework/go.sum index 777ee4242ac1..a40e3c078f5c 100644 --- a/test/e2e-framework/go.sum +++ b/test/e2e-framework/go.sum @@ -471,8 +471,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/texttheater/golang-levenshtein v1.0.1 h1:+cRNoVrfiwufQPhoMzB6N0Yf/Mqajr6t1lOv8GyGE2U= github.com/texttheater/golang-levenshtein v1.0.1/go.mod h1:PYAKrbF5sAiq9wd+H82hs7gNaen0CplQ9uvm6+enD/8= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= @@ -528,8 +528,9 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/test/fakeintake/go.mod b/test/fakeintake/go.mod index 4473ab67fbc1..13fd50fd6a8f 100644 --- a/test/fakeintake/go.mod +++ b/test/fakeintake/go.mod @@ -19,13 +19,11 @@ require ( github.com/prometheus/client_golang v1.23.2 github.com/samber/lo v1.52.0 github.com/spf13/cobra v1.10.2 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/tinylib/msgp v1.6.3 google.golang.org/protobuf v1.36.11 ) -require gopkg.in/yaml.v3 v3.0.1 // indirect - require ( github.com/DataDog/datadog-agent/comp/core/tagger/origindetection v0.78.3-rc.2 // indirect github.com/DataDog/datadog-agent/pkg/network/payload v0.78.3-rc.2 // indirect @@ -35,7 +33,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/clipperhouse/uax29/v2 v2.2.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.18.7 // indirect @@ -44,13 +41,13 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.5 // indirect github.com/prometheus/procfs v0.20.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/spf13/pflag v1.0.10 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect ) diff --git a/test/fakeintake/go.sum b/test/fakeintake/go.sum index 880419121c4e..8e65d58afd44 100644 --- a/test/fakeintake/go.sum +++ b/test/fakeintake/go.sum @@ -18,8 +18,6 @@ github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdoh github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= @@ -54,8 +52,6 @@ github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= @@ -75,8 +71,8 @@ github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiT github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/vmihailenco/msgpack/v4 v4.3.13 h1:A2wsiTbvp63ilDaWmsk2wjx6xZdxQOvpiNlKBGKKXKI= @@ -90,6 +86,8 @@ go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -124,7 +122,3 @@ google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJ google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/test/new-e2e/go.mod b/test/new-e2e/go.mod index 0bad27616067..c76173c85f72 100644 --- a/test/new-e2e/go.mod +++ b/test/new-e2e/go.mod @@ -35,7 +35,7 @@ require ( github.com/pulumi/pulumi-kubernetes/sdk/v4 v4.23.0 github.com/pulumi/pulumi/sdk/v3 v3.190.0 github.com/samber/lo v1.52.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 github.com/xeipuuv/gojsonschema v1.2.0 go.yaml.in/yaml/v2 v2.4.4 golang.org/x/crypto v0.56.0 @@ -185,7 +185,7 @@ require ( go.opentelemetry.io/otel/metric v1.45.0 // indirect go.opentelemetry.io/otel/trace v1.45.0 // indirect go.uber.org/atomic v1.11.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 + go.yaml.in/yaml/v3 v3.0.5 golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 golang.org/x/mod v0.40.0 golang.org/x/net v0.58.0 @@ -229,7 +229,6 @@ require ( github.com/go-viper/mapstructure/v2 v2.5.0 github.com/google/go-containerregistry v0.20.7 github.com/hairyhenderson/go-codeowners v0.7.0 - gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -354,6 +353,7 @@ require ( golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/ini.v1 v1.67.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/randfill v1.0.0 // indirect sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect ) diff --git a/test/new-e2e/go.sum b/test/new-e2e/go.sum index 13967456e644..0515e8b94e32 100644 --- a/test/new-e2e/go.sum +++ b/test/new-e2e/go.sum @@ -600,8 +600,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/texttheater/golang-levenshtein v1.0.1 h1:+cRNoVrfiwufQPhoMzB6N0Yf/Mqajr6t1lOv8GyGE2U= github.com/texttheater/golang-levenshtein v1.0.1/go.mod h1:PYAKrbF5sAiq9wd+H82hs7gNaen0CplQ9uvm6+enD/8= github.com/theckman/httpforwarded v0.4.0 h1:N55vGJT+6ojTnLY3LQCNliJC4TW0P0Pkeys1G1WpX2w= @@ -724,8 +725,9 @@ go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo= go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/test/new-e2e/tests/installer/windows/suites/apm-inject-package/system_probe_config_test.go b/test/new-e2e/tests/installer/windows/suites/apm-inject-package/system_probe_config_test.go index 556635cc1927..c6a3686c3ff8 100644 --- a/test/new-e2e/tests/installer/windows/suites/apm-inject-package/system_probe_config_test.go +++ b/test/new-e2e/tests/installer/windows/suites/apm-inject-package/system_probe_config_test.go @@ -12,7 +12,7 @@ import ( "time" "github.com/cenkalti/backoff/v5" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" "github.com/DataDog/datadog-agent/test/e2e-framework/testing/e2e" winawshost "github.com/DataDog/datadog-agent/test/e2e-framework/testing/provisioners/aws/host/windows" diff --git a/test/otel/go.mod b/test/otel/go.mod index e7799e85ebe3..6fe6bf6db16d 100644 --- a/test/otel/go.mod +++ b/test/otel/go.mod @@ -17,7 +17,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/compression v0.78.3-rc.2 github.com/go-logr/logr v1.4.4 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog v0.150.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 go.opentelemetry.io/otel v1.45.0 go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.21.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0 @@ -89,7 +89,6 @@ require ( go.opentelemetry.io/collector/consumer/consumererror v0.150.0 // indirect go.opentelemetry.io/collector/pdata/pprofile v0.151.0 // indirect golang.org/x/sync v0.22.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( @@ -162,7 +161,6 @@ require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect @@ -197,7 +195,6 @@ require ( github.com/philhofer/fwd v1.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // 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/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect @@ -240,7 +237,7 @@ require ( go.uber.org/fx v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect golang.org/x/sys v0.47.0 // indirect diff --git a/test/otel/go.sum b/test/otel/go.sum index 8d74c2ce9b3c..610b6c93339f 100644 --- a/test/otel/go.sum +++ b/test/otel/go.sum @@ -34,8 +34,6 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= -github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38= github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= @@ -174,8 +172,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= -github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -222,8 +218,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA= @@ -385,8 +382,9 @@ go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -461,7 +459,6 @@ gopkg.in/ini.v1 v1.67.1 h1:tVBILHy0R6e4wkYOn3XmiITt/hEVH4TFMYvAX2Ytz6k= gopkg.in/ini.v1 v1.67.1/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/apimachinery v0.35.3 h1:MeaUwQCV3tjKP4bcwWGgZ/cp/vpsRnQzqO6J6tJyoF8= k8s.io/apimachinery v0.35.3/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= diff --git a/third_party/.gitignore b/third_party/.gitignore new file mode 100644 index 000000000000..5e0504db0f60 --- /dev/null +++ b/third_party/.gitignore @@ -0,0 +1,125 @@ +# Restored byte-identical upstream assets stored in module-local LONG_PATHS archives. +/go-ordered-map/testdata/fuzz/FuzzRoundTripJSON/62c005f96216d8ba8f62ac0799dfc1a6893e68418238a831ee79cd9c39b4cfc6 +/go-ordered-map/testdata/fuzz/FuzzRoundTripJSON/8093511184ad3e258aa13b957e75ff26c7fae64672dae0c0bc0a9fa5b61a05e7 +/opa/docs/docs/policy-reference/_examples/encoding/envoy_header_manipulation/config.json +/opa/docs/docs/policy-reference/_examples/encoding/envoy_header_manipulation/input.json +/opa/docs/docs/policy-reference/_examples/encoding/envoy_header_manipulation/policy.rego +/opa/docs/docs/policy-reference/_examples/encoding/envoy_header_manipulation/title.txt +/opa/v1/test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1073.yaml +/opa/v1/test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1074.yaml +/opa/v1/test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1075.yaml +/opa/v1/test/cases/testdata/v0/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml +/opa/v1/test/cases/testdata/v0/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml +/opa/v1/test/cases/testdata/v0/functionerrors/test-functionerrors-undefined-builtin-result.yaml +/opa/v1/test/cases/testdata/v0/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml +/opa/v1/test/cases/testdata/v0/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml +/opa/v1/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml +/opa/v1/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml +/opa/v1/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml +/opa/v1/test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml +/opa/v1/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml +/opa/v1/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml +/opa/v1/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml +/opa/v1/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml +/opa/v1/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml +/opa/v1/test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml +/opa/v1/test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml +/opa/v1/test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml +/opa/v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml +/opa/v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml +/opa/v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml +/opa/v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml +/opa/v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml +/opa/v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml +/opa/v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml +/opa/v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml +/opa/v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml +/opa/v1/test/cases/testdata/v0/objectfilteridempotent/test-objectfilteridempotent-0319.yaml +/opa/v1/test/cases/testdata/v0/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml +/opa/v1/test/cases/testdata/v0/objectremoveidempotent/test-objectremoveidempotent-0298.yaml +/opa/v1/test/cases/testdata/v0/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml +/opa/v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml +/opa/v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml +/opa/v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml +/opa/v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml +/opa/v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml +/opa/v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml +/opa/v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml +/opa/v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml +/opa/v1/test/cases/testdata/v0/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml +/opa/v1/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1073.yaml +/opa/v1/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1074.yaml +/opa/v1/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1075.yaml +/opa/v1/test/cases/testdata/v1/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml +/opa/v1/test/cases/testdata/v1/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml +/opa/v1/test/cases/testdata/v1/functionerrors/test-functionerrors-undefined-builtin-result.yaml +/opa/v1/test/cases/testdata/v1/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml +/opa/v1/test/cases/testdata/v1/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml +/opa/v1/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml +/opa/v1/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml +/opa/v1/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml +/opa/v1/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml +/opa/v1/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml +/opa/v1/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml +/opa/v1/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml +/opa/v1/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml +/opa/v1/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml +/opa/v1/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml +/opa/v1/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml +/opa/v1/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml +/opa/v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml +/opa/v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml +/opa/v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml +/opa/v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml +/opa/v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml +/opa/v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml +/opa/v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml +/opa/v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml +/opa/v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml +/opa/v1/test/cases/testdata/v1/objectfilteridempotent/test-objectfilteridempotent-0319.yaml +/opa/v1/test/cases/testdata/v1/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml +/opa/v1/test/cases/testdata/v1/objectremoveidempotent/test-objectremoveidempotent-0298.yaml +/opa/v1/test/cases/testdata/v1/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml +/opa/v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml +/opa/v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml +/opa/v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml +/opa/v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml +/opa/v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml +/opa/v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml +/opa/v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml +/opa/v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml +/opa/v1/test/cases/testdata/v1/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml diff --git a/third_party/README.md b/third_party/README.md index e723f102418a..2166b9796249 100644 --- a/third_party/README.md +++ b/third_party/README.md @@ -1,20 +1,20 @@ -# Third Party code +# Temporary owning-library YAML backports -All files under this folder are owned by other entitites than DataDog. +These independently addressable modules retain the selected upstream APIs and +source commits. Each module's `PROVENANCE.md` records its source and removal +condition. They are temporarily owned under +https://github.com/StackVista/stackstate/issues/717. -While our normal build process is to reference upstream projects by URL of a -release artifact, sometimes this is not feasible. Typical cases are: +The root module and workspace explicitly replace all four owners with these sources; the independent +network-device profile module also selects ordered-map. External Go consumers +must repeat the appropriate source selections because dependency `replace` +directives do not propagate. OPA retains the Datadog lightweight source rather +than switching to upstream OPA. -1. The dependency has been abandoned and we need to maintain it ourselves. -1. That we need a small subset of files from an upstream repository ahead of their release. -1. We are actively working to add features to a dependency, and are co-developing those - along with our own use. - -In the first case, this code may be long lived. In all other cases, we expect -to drop the code from this repository when the features are available in an -upstream release. - -# Rules - -- You must only copy projects that are published under a license that permits this copying. -- All projects must have an explicit owner(s), listed in the file DATADOG.md in the tree. +The workspace uses owner replacements rather than registering these as main +modules, so `go work sync` does not rewrite their independent dependency minima. +The modules retain their original logical paths, so they are outside the agent's +module release registry. Validate each with `GOWORK=off go mod tidy` and upstream +unit fixtures separately, then run the agent module consistency and consumer +checks. Upstream CI configuration and vendored snapshots are excluded; upstream +source, tests, fixtures, licenses and attribution are retained. diff --git a/third_party/go-cfclient/.gitignore b/third_party/go-cfclient/.gitignore new file mode 100644 index 000000000000..06e1eff75058 --- /dev/null +++ b/third_party/go-cfclient/.gitignore @@ -0,0 +1,30 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test +_workspace + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +vendor + +# GoLand +.idea \ No newline at end of file diff --git a/third_party/go-cfclient/LICENSE b/third_party/go-cfclient/LICENSE new file mode 100644 index 000000000000..cb2ec6c50df7 --- /dev/null +++ b/third_party/go-cfclient/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2017 Long Nguyen + +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/third_party/go-cfclient/Makefile b/third_party/go-cfclient/Makefile new file mode 100644 index 000000000000..b7412e582918 --- /dev/null +++ b/third_party/go-cfclient/Makefile @@ -0,0 +1,42 @@ +GOLANG_CI_LINT_VERSION := $(shell golangci-lint --version 2>/dev/null) + +.PHONY: all +all: test lint + +.PHONY: clean +clean: ## Clean testcache and delete build output + go clean -testcache + +.PHONY: test +test: ## Run the unit tests + go test -v -race + +.PHONY: generate +generate: ## Generate fakes + go generate + +.PHONY: lint-prepare +lint-prepare: +ifdef GOLANG_CI_LINT_VERSION + @echo "Found golangci-lint $(GOLANG_CI_LINT_VERSION)" +else + @echo "Installing golangci-lint" + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s latest + @echo "[OK] golangci-lint installed" +endif + +.PHONY: lint +lint: lint-prepare ## Run the golangci linter + golangci-lint run + +.PHONY: tidy +tidy: ## Remove unused dependencies + go mod tidy + +.PHONY: list +list: ## Print the current module's dependencies. + go list -m all + +# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html +help: ## Print help for each make target + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' \ No newline at end of file diff --git a/third_party/go-cfclient/PROVENANCE.md b/third_party/go-cfclient/PROVENANCE.md new file mode 100644 index 000000000000..39628cd2d5ca --- /dev/null +++ b/third_party/go-cfclient/PROVENANCE.md @@ -0,0 +1,18 @@ +# Temporary maintained-YAML backport + +Source: https://github.com/cloudfoundry-community/go-cfclient +Exact source commit: `3d15366c582080a7cafa6aeb28d2f5fe9c3146d1` (v2.0.1-0.20230503155151-3d15366c5820). +Logical module identity: `github.com/cloudfoundry-community/go-cfclient/v2`. + +Upstream source, tests, fixtures, licenses and attribution are retained. Upstream +CI metadata and vendored dependency snapshots are excluded; dependency sources +continue to resolve through Go modules. The only code edits select the matching +maintained YAML v2/v3 API, including typed YAML node methods and tests. Module +metadata changes select those parsers and satisfy their Go minima. + +Tracking and temporary ownership: https://github.com/StackVista/stackstate/issues/717 +Removal condition: adopt a compatible owning-library release (or Datadog +lightweight OPA patch release) with maintained YAML and passing consumer tests, +then remove this source and its explicit root/workspace/consumer selections. +Dependency replacements do not propagate: external consumers must explicitly +select this independently addressable nested module as well. diff --git a/third_party/go-cfclient/README.md b/third_party/go-cfclient/README.md new file mode 100644 index 000000000000..84788de57156 --- /dev/null +++ b/third_party/go-cfclient/README.md @@ -0,0 +1,114 @@ +# go-cfclient + +## Overview +`cfclient` is a package to assist you in writing apps that need to interact with the [Cloud Foundry](http://cloudfoundry.org) +v2 cloud controller API. + +## v2 go-cfclient deprecated +The v2 version of the client and corresponding v2 cloud controller (CC) API is deprecated. Please start using the v3 version of this +client and CC API. This v2 branch is only kept around to support critical bug fixes. + +## Upgrading the v2 go-cfclient +If you're currently using an old version of the go-cfclient and need to upgrade to the latest version that still +supports the v2 CC API, then you'll need to go get the "new" v2 module. + +```shell +$ go get -u github.com/cloudfoundry-community/go-cfclient/v2 +``` + +Update your go import statements as necessary in your go source files, then finally: +```shell +$ go mod tidy +``` + +## Usage +``` +go get github.com/cloudfoundry-community/go-cfclient/v2 +``` +Some example code: + +```go +package main + +import ( + "fmt" + + "github.com/cloudfoundry-community/go-cfclient/v2" +) + +func main() { + c := &cfclient.Config{ + ApiAddress: "https://api.10.244.0.34.xip.io", + Username: "admin", + Password: "secret", + } + client, _ := cfclient.NewClient(c) + apps, _ := client.ListApps() + fmt.Println(apps) +} +``` + +### Paging Results + +The API supports paging results via query string parameters. All of the v3 ListV3*ByQuery functions support paging. Only a subset of v2 function calls support paging the results: + +- ListSpacesByQuery +- ListOrgsByQuery +- ListAppsByQuery +- ListServiceInstancesByQuery +- ListUsersByQuery + +You can iterate over the results page-by-page using a function similar to this one: + +```go +func processSpacesOnePageAtATime(client *cfclient.Client) error { + page := 1 + pageSize := 50 + + q := url.Values{} + q.Add("results-per-page", strconv.Itoa(pageSize)) + + for { + // get the current page of spaces + q.Set("page", strconv.Itoa(page)) + spaces, err := client.ListSpacesByQuery(q) + if err != nil { + fmt.Printf("Error getting spaces by query: %s", err) + return err + } + + // do something with each space + fmt.Printf("Page %d:\n", page) + for _, s := range spaces { + fmt.Println(" " + s.Name) + } + + // if we hit an empty page or partial page, that means we're done + if len(spaces) < pageSize { + break + } + + // next page + page++ + } + return nil +} +``` + +## Development + +```shell +make all +``` + +### Errors + +If the Cloud Foundry error definitions change at +then the error predicate functions in this package need to be regenerated. + +To do this, simply use Go to regenerate the code: + +```shell +make generate +``` + diff --git a/third_party/go-cfclient/app_update.go b/third_party/go-cfclient/app_update.go new file mode 100644 index 000000000000..458b366c754b --- /dev/null +++ b/third_party/go-cfclient/app_update.go @@ -0,0 +1,128 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + + "github.com/pkg/errors" +) + +type UpdateResponse struct { + Metadata Meta `json:"metadata"` + Entity UpdateResponseEntity `json:"entity"` +} + +type AppUpdateResource struct { + Name string `json:"name,omitempty"` + Memory int `json:"memory,omitempty"` + Instances int `json:"instances,omitempty"` + DiskQuota int `json:"disk_quota,omitempty"` + SpaceGuid string `json:"space_guid,omitempty"` + StackGuid string `json:"stack_guid,omitempty"` + State AppState `json:"state,omitempty"` + Command string `json:"command,omitempty"` + Buildpack string `json:"buildpack,omitempty"` + HealthCheckHttpEndpoint string `json:"health_check_http_endpoint,omitempty"` + HealthCheckType string `json:"health_check_type,omitempty"` + HealthCheckTimeout int `json:"health_check_timeout,omitempty"` + Diego bool `json:"diego,omitempty"` + EnableSSH bool `json:"enable_ssh,omitempty"` + DockerImage string `json:"docker_image,omitempty"` + DockerCredentials map[string]interface{} `json:"docker_credentials_json,omitempty"` + Environment map[string]interface{} `json:"environment_json,omitempty"` + StagingFailedReason string `json:"staging_failed_reason,omitempty"` + StagingFailedDescription string `json:"staging_failed_description,omitempty"` + Ports []int `json:"ports,omitempty"` +} + +type UpdateResponseEntity struct { + Name string `json:"name"` + Production bool `json:"production"` + SpaceGuid string `json:"space_guid"` + StackGuid string `json:"stack_guid"` + Buildpack string `json:"buildpack"` + DetectedBuildpack string `json:"detected_buildpack"` + DetectedBuildpackGuid string `json:"detected_buildpack_guid"` + Environment map[string]interface{} `json:"environment_json"` + Memory int `json:"memory"` + Instances int `json:"instances"` + DiskQuota int `json:"disk_quota"` + State string `json:"state"` + Version string `json:"version"` + Command string `json:"command"` + Console bool `json:"console"` + Debug string `json:"debug"` + StagingTaskId string `json:"staging_task_id"` + PackageState string `json:"package_state"` + HealthCheckHttpEndpoint string `json:"health_check_http_endpoint"` + HealthCheckType string `json:"health_check_type"` + HealthCheckTimeout int `json:"health_check_timeout"` + StagingFailedReason string `json:"staging_failed_reason"` + StagingFailedDescription string `json:"staging_failed_description"` + Diego bool `json:"diego,omitempty"` + DockerImage string `json:"docker_image"` + DockerCredentials struct { + Username string `json:"username"` + Password string `json:"password"` + } `json:"docker_credentials"` + PackageUpdatedAt string `json:"package_updated_at"` + DetectedStartCommand string `json:"detected_start_command"` + EnableSSH bool `json:"enable_ssh"` + Ports []int `json:"ports"` + SpaceURL string `json:"space_url"` + StackURL string `json:"stack_url"` + RoutesURL string `json:"routes_url"` + EventsURL string `json:"events_url"` + ServiceBindingsUrl string `json:"service_bindings_url"` + RouteMappingsUrl string `json:"route_mappings_url"` +} + +func (c *Client) UpdateApp(guid string, aur AppUpdateResource) (UpdateResponse, error) { + var updateResponse UpdateResponse + + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(aur) + if err != nil { + return UpdateResponse{}, err + } + req := c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/apps/%s", guid), buf) + resp, err := c.DoRequest(req) + if err != nil { + return UpdateResponse{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return UpdateResponse{}, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return UpdateResponse{}, err + } + err = json.Unmarshal(body, &updateResponse) + if err != nil { + return UpdateResponse{}, err + } + return updateResponse, nil +} + +func (c *Client) RestageApp(guid string) (UpdateResponse, error) { + var result UpdateResponse + + req := c.NewRequest("POST", "/v2/apps/"+guid+"/restage") + resp, err := c.DoRequest(req) + if err != nil { + return result, errors.Wrap(err, "Error restaging app:") + } + + defer resp.Body.Close() + if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { + return result, err + } + + return result, nil +} diff --git a/third_party/go-cfclient/app_update_test.go b/third_party/go-cfclient/app_update_test.go new file mode 100644 index 000000000000..7d405ca3d786 --- /dev/null +++ b/third_party/go-cfclient/app_update_test.go @@ -0,0 +1,43 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestUpdateApp(t *testing.T) { + Convey("Update app", t, func() { + setup(MockRoute{"PUT", "/v2/apps/97f7e56b-addf-4d26-be82-998a06600011", []string{AppUpdatePayload}, "", 201, "", nil}, t) + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + aur := AppUpdateResource{Name: "NewName", DiskQuota: 1024, Instances: 1, Memory: 65} + ret, err := client.UpdateApp("97f7e56b-addf-4d26-be82-998a06600011", aur) + So(err, ShouldBeNil) + So(ret.Entity.Memory, ShouldEqual, 65) + So(ret.Entity.Instances, ShouldEqual, 1) + So(ret.Entity.DiskQuota, ShouldEqual, 1024) + So(ret.Entity.Name, ShouldEqual, "NewName") + }) +} + +func TestRestageApp(t *testing.T) { + Convey("Restage app", t, func() { + setup(MockRoute{"POST", "/v2/apps/97f7e56b-addf-4d26-be82-998a06600011/restage", []string{appRestagePayload}, "", 201, "", nil}, t) + client, err := NewClient(&Config{ + ApiAddress: server.URL, + Token: "foobar", + }) + So(err, ShouldBeNil) + + resp, err := client.RestageApp("97f7e56b-addf-4d26-be82-998a06600011") + So(err, ShouldBeNil) + So(resp.Metadata.Guid, ShouldEqual, "97f7e56b-addf-4d26-be82-998a06600011") + So(resp.Entity.Name, ShouldEqual, "name-2047") + So(resp.Entity.EnableSSH, ShouldBeTrue) + }) +} diff --git a/third_party/go-cfclient/app_usage_events.go b/third_party/go-cfclient/app_usage_events.go new file mode 100644 index 000000000000..227c4fe32421 --- /dev/null +++ b/third_party/go-cfclient/app_usage_events.go @@ -0,0 +1,80 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/url" + + "github.com/pkg/errors" +) + +type AppUsageEvent struct { + GUID string `json:"guid"` + CreatedAt string `json:"created_at"` + State string `json:"state"` + PreviousState string `json:"previous_state"` + MemoryInMbPerInstance int `json:"memory_in_mb_per_instance"` + PreviousMemoryInMbPerInstance int `json:"previous_memory_in_mb_per_instance"` + InstanceCount int `json:"instance_count"` + PreviousInstanceCount int `json:"previous_instance_count"` + AppGUID string `json:"app_guid"` + SpaceGUID string `json:"space_guid"` + SpaceName string `json:"space_name"` + OrgGUID string `json:"org_guid"` + BuildpackGUID string `json:"buildpack_guid"` + BuildpackName string `json:"buildpack_name"` + PackageState string `json:"package_state"` + PreviousPackageState string `json:"previous_package_state"` + ParentAppGUID string `json:"parent_app_guid"` + ParentAppName string `json:"parent_app_name"` + ProcessType string `json:"process_type"` + TaskName string `json:"task_name"` + TaskGUID string `json:"task_guid"` + c *Client +} + +type AppUsageEventsResponse struct { + TotalResults int `json:"total_results"` + Pages int `json:"total_pages"` + NextURL string `json:"next_url"` + Resources []AppUsageEventResource `json:"resources"` +} + +type AppUsageEventResource struct { + Meta Meta `json:"metadata"` + Entity AppUsageEvent `json:"entity"` +} + +// ListAppUsageEventsByQuery lists all events matching the provided query. +func (c *Client) ListAppUsageEventsByQuery(query url.Values) ([]AppUsageEvent, error) { + var appUsageEvents []AppUsageEvent + requestURL := fmt.Sprintf("/v2/app_usage_events?%s", query.Encode()) + for { + var appUsageEventsResponse AppUsageEventsResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "error requesting events") + } + defer resp.Body.Close() + if err := json.NewDecoder(resp.Body).Decode(&appUsageEventsResponse); err != nil { + return nil, errors.Wrap(err, "error unmarshaling events") + } + for _, e := range appUsageEventsResponse.Resources { + e.Entity.GUID = e.Meta.Guid + e.Entity.CreatedAt = e.Meta.CreatedAt + e.Entity.c = c + appUsageEvents = append(appUsageEvents, e.Entity) + } + requestURL = appUsageEventsResponse.NextURL + if requestURL == "" { + break + } + } + return appUsageEvents, nil +} + +// ListAppUsageEvents lists all unfiltered events. +func (c *Client) ListAppUsageEvents() ([]AppUsageEvent, error) { + return c.ListAppUsageEventsByQuery(nil) +} diff --git a/third_party/go-cfclient/app_usage_events_test.go b/third_party/go-cfclient/app_usage_events_test.go new file mode 100644 index 000000000000..13fc1c9d5d17 --- /dev/null +++ b/third_party/go-cfclient/app_usage_events_test.go @@ -0,0 +1,53 @@ +package cfclient + +import ( + "net/url" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListAppUsageEvents(t *testing.T) { + Convey("List App Usage Events", t, func() { + setup(MockRoute{"GET", "/v2/app_usage_events", []string{listAppUsageEventsPayload, listAppUsageEventsPayloadPage2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + appUsageEvents, err := client.ListAppUsageEvents() + So(err, ShouldBeNil) + + So(len(appUsageEvents), ShouldEqual, 4) + So(appUsageEvents[0].GUID, ShouldEqual, "b32241a5-5508-4d42-893c-360e42a300b6") + So(appUsageEvents[0].CreatedAt, ShouldEqual, "2016-06-08T16:41:33Z") + }) +} + +func TestListAppUsageEventsByQuery(t *testing.T) { + Convey("List App Usage Events", t, func() { + setup(MockRoute{"GET", "/v2/app_usage_events", []string{listAppUsageEventsPayload, listAppUsageEventsPayloadPage2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + var query = url.Values{ + "results-per-page": []string{ + "2", + }, + } + appUsageEvents, err := client.ListAppUsageEventsByQuery(query) + So(err, ShouldBeNil) + + So(len(appUsageEvents), ShouldEqual, 4) + So(appUsageEvents[0].GUID, ShouldEqual, "b32241a5-5508-4d42-893c-360e42a300b6") + So(appUsageEvents[0].CreatedAt, ShouldEqual, "2016-06-08T16:41:33Z") + }) +} diff --git a/third_party/go-cfclient/appevents.go b/third_party/go-cfclient/appevents.go new file mode 100644 index 000000000000..1f6c76922565 --- /dev/null +++ b/third_party/go-cfclient/appevents.go @@ -0,0 +1,174 @@ +package cfclient + +import ( + "encoding/json" + "io/ioutil" + "time" + + "github.com/pkg/errors" +) + +// Exported event constants +const ( + AppCrash = "app.crash" + AppStart = "audit.app.start" + AppStop = "audit.app.stop" + AppUpdate = "audit.app.update" + AppCreate = "audit.app.create" + AppDelete = "audit.app.delete-request" + AppSSHAuth = "audit.app.ssh-authorized" + AppSSHUnauth = "audit.app.ssh-unauthorized" + AppRestage = "audit.app.restage" + AppMapRoute = "audit.app.map-route" + AppUnmapRoute = "audit.app.unmap-route" +) + +// Exported filter constants +const ( + FilterTimestamp = "timestamp" + FilterActee = "actee" +) + +// ValidOperators global variable for all valid operators in a query +var ValidOperators = []string{":", ">=", "<=", "<", ">", "IN"} + +// AppEventResponse the entire response +type AppEventResponse struct { + Results int `json:"total_results"` + Pages int `json:"total_pages"` + PrevURL string `json:"prev_url"` + NextURL string `json:"next_url"` + Resources []AppEventResource `json:"resources"` +} + +// AppEventResource the event resources +type AppEventResource struct { + Meta Meta `json:"metadata"` + Entity AppEventEntity `json:"entity"` +} + +// AppEventQuery a struct for defining queries like 'q=filter>value' or 'q=filter IN a,b,c' +type AppEventQuery struct { + Filter string + Operator string + Value string +} + +// The AppEventEntity the actual app event body +type AppEventEntity struct { + // EventTypes are app.crash, audit.app.start, audit.app.stop, audit.app.update, audit.app.create, audit.app.delete-request + EventType string `json:"type"` + // The GUID of the actor. + Actor string `json:"actor"` + // The actor type, user or app + ActorType string `json:"actor_type"` + // The name of the actor. + ActorName string `json:"actor_name"` + // The GUID of the actee. + Actee string `json:"actee"` + // The actee type, space, app or v3-app + ActeeType string `json:"actee_type"` + // The name of the actee. + ActeeName string `json:"actee_name"` + // Timestamp format "2016-02-26T13:29:44Z". The event creation time. + Timestamp time.Time `json:"timestamp"` + MetaData struct { + // app.crash event fields + ExitDescription string `json:"exit_description,omitempty"` + ExitReason string `json:"reason,omitempty"` + ExitStatus string `json:"exit_status,omitempty"` + + Request struct { + Name string `json:"name,omitempty"` + Instances float64 `json:"instances,omitempty"` + State string `json:"state,omitempty"` + Memory float64 `json:"memory,omitempty"` + EnvironmentVars string `json:"environment_json,omitempty"` + DockerCredentials string `json:"docker_credentials_json,omitempty"` + // audit.app.create event fields + Console bool `json:"console,omitempty"` + Buildpack string `json:"buildpack,omitempty"` + Space string `json:"space_guid,omitempty"` + HealthcheckType string `json:"health_check_type,omitempty"` + HealthcheckTimeout float64 `json:"health_check_timeout,omitempty"` + Production bool `json:"production,omitempty"` + // app.crash event fields + Index float64 `json:"index,omitempty"` + } `json:"request"` + } `json:"metadata"` +} + +// ListAppEvents returns all app events based on eventType +func (c *Client) ListAppEvents(eventType string) ([]AppEventEntity, error) { + return c.ListAppEventsByQuery(eventType, nil) +} + +// ListAppEventsByQuery returns all app events based on eventType and queries +func (c *Client) ListAppEventsByQuery(eventType string, queries []AppEventQuery) ([]AppEventEntity, error) { + var events []AppEventEntity + + if eventType != AppCrash && eventType != AppStart && eventType != AppStop && eventType != AppUpdate && eventType != AppCreate && + eventType != AppDelete && eventType != AppSSHAuth && eventType != AppSSHUnauth && eventType != AppRestage && + eventType != AppMapRoute && eventType != AppUnmapRoute { + return nil, errors.New("Unsupported app event type " + eventType) + } + + var query = "/v2/events?q=type:" + eventType + // adding the additional queries + if len(queries) > 0 { + for _, eventQuery := range queries { + if eventQuery.Filter != FilterTimestamp && eventQuery.Filter != FilterActee { + return nil, errors.New("Unsupported query filter type " + eventQuery.Filter) + } + if !stringInSlice(eventQuery.Operator, ValidOperators) { + return nil, errors.New("Unsupported query operator type " + eventQuery.Operator) + } + query += "&q=" + eventQuery.Filter + eventQuery.Operator + eventQuery.Value + } + } + + for { + eventResponse, err := c.getAppEventsResponse(query) + if err != nil { + return []AppEventEntity{}, err + } + for _, event := range eventResponse.Resources { + events = append(events, event.Entity) + } + query = eventResponse.NextURL + if query == "" { + break + } + } + + return events, nil +} + +func (c *Client) getAppEventsResponse(query string) (AppEventResponse, error) { + var eventResponse AppEventResponse + r := c.NewRequest("GET", query) + resp, err := c.DoRequest(r) + if err != nil { + return AppEventResponse{}, errors.Wrap(err, "Error requesting appevents") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return AppEventResponse{}, errors.Wrap(err, "Error reading appevents response body") + } + + err = json.Unmarshal(resBody, &eventResponse) + if err != nil { + return AppEventResponse{}, errors.Wrap(err, "Error unmarshalling appevent") + } + return eventResponse, nil +} + +func stringInSlice(str string, list []string) bool { + for _, v := range list { + if v == str { + return true + } + } + return false +} diff --git a/third_party/go-cfclient/appevents_test.go b/third_party/go-cfclient/appevents_test.go new file mode 100644 index 000000000000..21b5bd4a2f76 --- /dev/null +++ b/third_party/go-cfclient/appevents_test.go @@ -0,0 +1,84 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListAppEvents(t *testing.T) { + Convey("List App Events", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/events", []string{listAppsCreatedEventPayload}, "", 200, "q=type:audit.app.create", nil}, + {"GET", "/v2/events2", []string{listAppsCreatedEventPayload2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + _, err = client.ListAppEvents("blub") + So(err.Error(), ShouldEqual, "Unsupported app event type blub") + appEvents, err := client.ListAppEvents(AppCreate) + So(err, ShouldBeNil) + So(len(appEvents), ShouldEqual, 3) + So(appEvents[0].MetaData.Request.State, ShouldEqual, "STOPPED") + So(appEvents[1].EventType, ShouldEqual, AppCrash) + So(appEvents[1].MetaData.Request.State, ShouldEqual, "") + So(appEvents[1].MetaData.ExitReason, ShouldEqual, "CRASHED") + So(appEvents[2].MetaData.Request.State, ShouldEqual, "STARTED") + }) +} + +func TestListAppEventsByQuery(t *testing.T) { + Convey("List App Events By Query", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/events", []string{listAppsCreatedEventPayload}, "", 200, "q=type:audit.app.create&q=actee:3ca436ff-67a8-468a-8c7d-27ec68a6cfe5", nil}, + {"GET", "/v2/events2", []string{listAppsCreatedEventPayload2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + _, err = client.ListAppEventsByQuery("blub", []AppEventQuery{}) + So(err.Error(), ShouldEqual, "Unsupported app event type blub") + + appEventQuery := AppEventQuery{ + Filter: "nofilter", + Operator: ":", + Value: "retlifon", + } + _, err = client.ListAppEventsByQuery(AppCreate, []AppEventQuery{appEventQuery}) + So(err.Error(), ShouldEqual, "Unsupported query filter type nofilter") + + appEventQuery = AppEventQuery{ + Filter: FilterTimestamp, + Operator: "not", + Value: "retlifon", + } + _, err = client.ListAppEventsByQuery(AppCreate, []AppEventQuery{appEventQuery}) + So(err.Error(), ShouldEqual, "Unsupported query operator type not") + + appEventQuery = AppEventQuery{ + Filter: FilterActee, + Operator: ":", + Value: "3ca436ff-67a8-468a-8c7d-27ec68a6cfe5", + } + appEvents, err := client.ListAppEventsByQuery(AppCreate, []AppEventQuery{appEventQuery}) + So(err, ShouldBeNil) + So(len(appEvents), ShouldEqual, 3) + So(appEvents[0].MetaData.Request.State, ShouldEqual, "STOPPED") + So(appEvents[1].EventType, ShouldEqual, AppCrash) + So(appEvents[1].MetaData.Request.State, ShouldEqual, "") + So(appEvents[1].MetaData.ExitReason, ShouldEqual, "CRASHED") + So(appEvents[2].MetaData.Request.State, ShouldEqual, "STARTED") + }) +} diff --git a/third_party/go-cfclient/apps.go b/third_party/go-cfclient/apps.go new file mode 100644 index 000000000000..d4cba0cbced2 --- /dev/null +++ b/third_party/go-cfclient/apps.go @@ -0,0 +1,795 @@ +package cfclient + +import ( + "bytes" + "crypto/tls" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "mime/multipart" + "net/http" + "net/url" + "os" + "strconv" + "strings" + "time" + + "github.com/pkg/errors" +) + +type AppResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []AppResource `json:"resources"` +} + +type AppResource struct { + Meta Meta `json:"metadata"` + Entity App `json:"entity"` +} + +type AppState string + +const ( + APP_STOPPED AppState = "STOPPED" + APP_STARTED AppState = "STARTED" +) + +type HealthCheckType string + +const ( + HEALTH_HTTP HealthCheckType = "http" + HEALTH_PORT HealthCheckType = "port" + HEALTH_PROCESS HealthCheckType = "process" +) + +type DockerCredentials struct { + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` +} + +type AppCreateRequest struct { + Name string `json:"name"` + SpaceGuid string `json:"space_guid"` + // Memory for the app, in MB + Memory int `json:"memory,omitempty"` + // Instances to startup + Instances int `json:"instances,omitempty"` + // Disk quota in MB + DiskQuota int `json:"disk_quota,omitempty"` + StackGuid string `json:"stack_guid,omitempty"` + // Desired state of the app. Either "STOPPED" or "STARTED" + State AppState `json:"state,omitempty"` + // Command to start an app + Command string `json:"command,omitempty"` + // Buildpack to build the app. Three options: + // 1. Blank for autodetection + // 2. GIT url + // 3. Name of an installed buildpack + Buildpack string `json:"buildpack,omitempty"` + // Endpoint to check if an app is healthy + HealthCheckHttpEndpoint string `json:"health_check_http_endpoint,omitempty"` + // How to check if an app is healthy. Defaults to HEALTH_PORT if not specified + HealthCheckType HealthCheckType `json:"health_check_type,omitempty"` + HealthCheckTimeout int `json:"health_check_timeout,omitempty"` + Diego bool `json:"diego,omitempty"` + EnableSSH bool `json:"enable_ssh,omitempty"` + DockerImage string `json:"docker_image,omitempty"` + DockerCredentials DockerCredentials `json:"docker_credentials,omitempty"` + Environment map[string]interface{} `json:"environment_json,omitempty"` +} + +type App struct { + Guid string `json:"guid"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Name string `json:"name"` + Memory int `json:"memory"` + Instances int `json:"instances"` + DiskQuota int `json:"disk_quota"` + SpaceGuid string `json:"space_guid"` + StackGuid string `json:"stack_guid"` + State string `json:"state"` + PackageState string `json:"package_state"` + Command string `json:"command"` + Buildpack string `json:"buildpack"` + DetectedBuildpack string `json:"detected_buildpack"` + DetectedBuildpackGuid string `json:"detected_buildpack_guid"` + HealthCheckHttpEndpoint string `json:"health_check_http_endpoint"` + HealthCheckType string `json:"health_check_type"` + HealthCheckTimeout int `json:"health_check_timeout"` + Diego bool `json:"diego"` + EnableSSH bool `json:"enable_ssh"` + DetectedStartCommand string `json:"detected_start_command"` + DockerImage string `json:"docker_image"` + DockerCredentialsJSON map[string]interface{} `json:"docker_credentials_json"` + DockerCredentials DockerCredentials `json:"docker_credentials"` + Environment map[string]interface{} `json:"environment_json"` + StagingFailedReason string `json:"staging_failed_reason"` + StagingFailedDescription string `json:"staging_failed_description"` + Ports []int `json:"ports"` + SpaceURL string `json:"space_url"` + SpaceData SpaceResource `json:"space"` + PackageUpdatedAt string `json:"package_updated_at"` + c *Client +} + +type AppInstance struct { + State string `json:"state"` + Since sinceTime `json:"since"` +} + +type AppStats struct { + State string `json:"state"` + Stats struct { + Name string `json:"name"` + Uris []string `json:"uris"` + Host string `json:"host"` + Port int `json:"port"` + Uptime int `json:"uptime"` + MemQuota int `json:"mem_quota"` + DiskQuota int `json:"disk_quota"` + FdsQuota int `json:"fds_quota"` + Usage struct { + Time statTime `json:"time"` + CPU float64 `json:"cpu"` + Mem int `json:"mem"` + Disk int `json:"disk"` + } `json:"usage"` + } `json:"stats"` +} + +type AppSummary struct { + Guid string `json:"guid"` + Name string `json:"name"` + ServiceCount int `json:"service_count"` + RunningInstances int `json:"running_instances"` + SpaceGuid string `json:"space_guid"` + StackGuid string `json:"stack_guid"` + Buildpack string `json:"buildpack"` + DetectedBuildpack string `json:"detected_buildpack"` + Environment map[string]interface{} `json:"environment_json"` + Memory int `json:"memory"` + Instances int `json:"instances"` + DiskQuota int `json:"disk_quota"` + State string `json:"state"` + Command string `json:"command"` + PackageState string `json:"package_state"` + HealthCheckType string `json:"health_check_type"` + HealthCheckTimeout int `json:"health_check_timeout"` + StagingFailedReason string `json:"staging_failed_reason"` + StagingFailedDescription string `json:"staging_failed_description"` + Diego bool `json:"diego"` + DockerImage string `json:"docker_image"` + DetectedStartCommand string `json:"detected_start_command"` + EnableSSH bool `json:"enable_ssh"` + DockerCredentials map[string]interface{} `json:"docker_credentials_json"` +} + +type AppEnv struct { + // These can have arbitrary JSON so need to map to interface{} + Environment map[string]interface{} `json:"environment_json"` + StagingEnv map[string]interface{} `json:"staging_env_json"` + RunningEnv map[string]interface{} `json:"running_env_json"` + SystemEnv map[string]interface{} `json:"system_env_json"` + ApplicationEnv map[string]interface{} `json:"application_env_json"` +} + +// Custom time types to handle non-RFC3339 formatting in API JSON + +type sinceTime struct { + time.Time +} + +func (s *sinceTime) UnmarshalJSON(b []byte) (err error) { + timeFlt, err := strconv.ParseFloat(string(b), 64) + if err != nil { + return err + } + time := time.Unix(int64(timeFlt), 0) + *s = sinceTime{time} + return nil +} + +func (s sinceTime) ToTime() time.Time { + t, err := time.Parse(time.UnixDate, s.Format(time.UnixDate)) + if err != nil { + panic(err) + } + return t +} + +type statTime struct { + time.Time +} + +func (s *statTime) UnmarshalJSON(b []byte) (err error) { + timeString, err := strconv.Unquote(string(b)) + if err != nil { + return err + } + + possibleFormats := [...]string{time.RFC3339, time.RFC3339Nano, "2006-01-02 15:04:05 -0700", "2006-01-02 15:04:05 MST"} + + var value time.Time + for _, possibleFormat := range possibleFormats { + if value, err = time.Parse(possibleFormat, timeString); err == nil { + *s = statTime{value} + return nil + } + } + + return fmt.Errorf("%s was not in any of the expected Date Formats %v", timeString, possibleFormats) +} + +func (s statTime) ToTime() time.Time { + t, err := time.Parse(time.UnixDate, s.Format(time.UnixDate)) + if err != nil { + panic(err) + } + return t +} + +func (a *App) Space() (Space, error) { + var spaceResource SpaceResource + r := a.c.NewRequest("GET", a.SpaceURL) + resp, err := a.c.DoRequest(r) + if err != nil { + return Space{}, errors.Wrap(err, "Error requesting space") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return Space{}, errors.Wrap(err, "Error reading space response") + } + + err = json.Unmarshal(resBody, &spaceResource) + if err != nil { + return Space{}, errors.Wrap(err, "Error unmarshalling body") + } + return a.c.mergeSpaceResource(spaceResource), nil +} + +func (a *App) Summary() (AppSummary, error) { + var appSummary AppSummary + requestUrl := fmt.Sprintf("/v2/apps/%s/summary", a.Guid) + r := a.c.NewRequest("GET", requestUrl) + resp, err := a.c.DoRequest(r) + if err != nil { + return AppSummary{}, errors.Wrap(err, "Error requesting app summary") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return AppSummary{}, errors.Wrap(err, "Error reading app summary body") + } + err = json.Unmarshal(resBody, &appSummary) + if err != nil { + return AppSummary{}, errors.Wrap(err, "Error unmarshalling app summary") + } + return appSummary, nil +} + +// ListAppsByQueryWithLimits queries totalPages app info. When totalPages is +// less and equal than 0, it queries all app info +// When there are no more than totalPages apps on server side, all apps info will be returned +func (c *Client) ListAppsByQueryWithLimits(query url.Values, totalPages int) ([]App, error) { + return c.listApps("/v2/apps", query, totalPages) +} + +func (c *Client) ListAppsByQuery(query url.Values) ([]App, error) { + return c.listApps("/v2/apps", query, -1) +} + +// GetAppByGuidNoInlineCall will fetch app info including space and orgs information +// Without using inline-relations-depth=2 call +func (c *Client) GetAppByGuidNoInlineCall(guid string) (App, error) { + var appResource AppResource + r := c.NewRequest("GET", "/v2/apps/"+guid) + resp, err := c.DoRequest(r) + if err != nil { + return App{}, errors.Wrap(err, "Error requesting apps") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return App{}, errors.Wrap(err, "Error reading app response body") + } + + err = json.Unmarshal(resBody, &appResource) + if err != nil { + return App{}, errors.Wrap(err, "Error unmarshalling app") + } + app := c.mergeAppResource(appResource) + + // If no Space Information no need to check org. + if app.SpaceGuid != "" { + // Getting Spaces Resource + space, err := app.Space() + if err != nil { + return App{}, errors.Wrap(err, "Unable to get the Space for the app "+app.Name) + } else { + app.SpaceData.Entity = space + } + + // Getting orgResource + org, err := app.SpaceData.Entity.Org() + if err != nil { + return App{}, errors.Wrap(err, "Unable to get the Org for the app "+app.Name) + } else { + app.SpaceData.Entity.OrgData.Entity = org + } + } + + return app, nil +} + +func (c *Client) ListApps() ([]App, error) { + q := url.Values{} + q.Set("inline-relations-depth", "2") + return c.ListAppsByQuery(q) +} + +func (c *Client) ListAppsByRoute(routeGuid string) ([]App, error) { + return c.listApps(fmt.Sprintf("/v2/routes/%s/apps", routeGuid), url.Values{}, -1) +} + +func (c *Client) ListAppsBySpaceGuid(spaceGuid string) ([]App, error) { + return c.listApps(fmt.Sprintf("/v2/spaces/%s/apps", spaceGuid), url.Values{}, -1) +} + +func (c *Client) listApps(path string, query url.Values, totalPages int) ([]App, error) { + requestUrl := path + "?" + query.Encode() + pages := 0 + apps := []App{} + for { + var appResp AppResponse + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + + if err != nil { + return nil, errors.Wrap(err, "Error requesting apps") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading app request") + } + + err = json.Unmarshal(resBody, &appResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshalling app") + } + for _, app := range appResp.Resources { + apps = append(apps, c.mergeAppResource(app)) + } + + requestUrl = appResp.NextUrl + if requestUrl == "" || query.Get("page") != "" { + break + } + + pages++ + if totalPages > 0 && pages >= totalPages { + break + } + } + return apps, nil +} + +func (c *Client) GetAppInstances(guid string) (map[string]AppInstance, error) { + var appInstances map[string]AppInstance + + requestURL := fmt.Sprintf("/v2/apps/%s/instances", guid) + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting app instances") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading app instances") + } + err = json.Unmarshal(resBody, &appInstances) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshalling app instances") + } + return appInstances, nil +} + +func (c *Client) GetAppEnv(guid string) (AppEnv, error) { + var appEnv AppEnv + + requestURL := fmt.Sprintf("/v2/apps/%s/env", guid) + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return appEnv, errors.Wrap(err, "Error requesting app env") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return appEnv, errors.Wrap(err, "Error reading app env") + } + err = json.Unmarshal(resBody, &appEnv) + if err != nil { + return appEnv, errors.Wrap(err, "Error unmarshalling app env") + } + return appEnv, nil +} + +func (c *Client) GetAppRoutes(guid string) ([]Route, error) { + return c.fetchRoutes(fmt.Sprintf("/v2/apps/%s/routes", guid)) +} + +func (c *Client) GetAppStats(guid string) (map[string]AppStats, error) { + var appStats map[string]AppStats + + requestURL := fmt.Sprintf("/v2/apps/%s/stats", guid) + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting app stats") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading app stats") + } + err = json.Unmarshal(resBody, &appStats) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshalling app stats") + } + return appStats, nil +} + +func (c *Client) KillAppInstance(guid string, index string) error { + requestURL := fmt.Sprintf("/v2/apps/%s/instances/%s", guid, index) + r := c.NewRequest("DELETE", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return errors.Wrapf(err, "Error stopping app %s at index %s", guid, index) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error stopping app %s at index %s", guid, index) + } + return nil +} + +func (c *Client) GetAppByGuid(guid string) (App, error) { + var appResource AppResource + r := c.NewRequest("GET", "/v2/apps/"+guid+"?inline-relations-depth=2") + resp, err := c.DoRequest(r) + if err != nil { + return App{}, errors.Wrap(err, "Error requesting apps") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return App{}, errors.Wrap(err, "Error reading app response body") + } + + err = json.Unmarshal(resBody, &appResource) + if err != nil { + return App{}, errors.Wrap(err, "Error unmarshalling app") + } + return c.mergeAppResource(appResource), nil +} + +func (c *Client) AppByGuid(guid string) (App, error) { + return c.GetAppByGuid(guid) +} + +// AppByName takes an appName, and GUIDs for a space and org, and performs +// the API lookup with those query parameters set to return you the desired +// App object. +func (c *Client) AppByName(appName, spaceGuid, orgGuid string) (App, error) { + query := url.Values{} + query.Add("q", fmt.Sprintf("organization_guid:%s", orgGuid)) + query.Add("q", fmt.Sprintf("space_guid:%s", spaceGuid)) + query.Add("q", fmt.Sprintf("name:%s", appName)) + apps, err := c.ListAppsByQuery(query) + if err != nil { + return App{}, err + } + if len(apps) == 0 { + cfErr := NewAppNotFoundError() + cfErr.Description = fmt.Sprintf(cfErr.Description, appName) + return App{}, cfErr + } + return apps[0], nil +} + +// UploadAppBits uploads the application's contents +func (c *Client) UploadAppBits(file io.Reader, appGUID string) error { + requestFile, err := ioutil.TempFile("", "requests") + if err != nil { + return errors.Wrap(err, "Could not create temp file for app bits") + } + + defer func() { + requestFile.Close() + os.Remove(requestFile.Name()) + }() + + writer := multipart.NewWriter(requestFile) + err = writer.WriteField("resources", "[]") + if err != nil { + return errors.Wrapf(err, "Error uploading app %s bits", appGUID) + } + + part, err := writer.CreateFormFile("application", "application.zip") + if err != nil { + return errors.Wrapf(err, "Error uploading app %s bits", appGUID) + } + + _, err = io.Copy(part, file) + if err != nil { + return errors.Wrapf(err, "Error uploading app %s bits, failed to copy all bytes", appGUID) + } + + err = writer.Close() + if err != nil { + return errors.Wrapf(err, "Error uploading app %s bits, failed to close multipart writer", appGUID) + } + + _, err = requestFile.Seek(0, 0) + if err != nil { + return errors.Wrapf(err, "Error uploading app %s bits, failed to seek beginning of file", appGUID) + } + fileStats, err := requestFile.Stat() + if err != nil { + return errors.Wrapf(err, "Error uploading app %s bits, failed to get temp file stats", appGUID) + } + + requestURL := fmt.Sprintf("/v2/apps/%s/bits", appGUID) + r := c.NewRequestWithBody("PUT", requestURL, requestFile) + req, err := r.toHTTP() + if err != nil { + return errors.Wrapf(err, "Error uploading app %s bits", appGUID) + } + + req.ContentLength = fileStats.Size() + contentType := fmt.Sprintf("multipart/form-data; boundary=%s", writer.Boundary()) + req.Header.Set("Content-Type", contentType) + + resp, err := c.Do(req) + if err != nil { + return errors.Wrapf(err, "Error uploading app %s bits", appGUID) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return errors.Wrapf(err, "Error uploading app %s bits, response code: %d", appGUID, resp.StatusCode) + } + + return nil +} + +// GetAppBits downloads the application's bits as a tar file +func (c *Client) GetAppBits(guid string) (io.ReadCloser, error) { + requestURL := fmt.Sprintf("/v2/apps/%s/download", guid) + req := c.NewRequest("GET", requestURL) + resp, err := c.DoRequestWithoutRedirects(req) + if err != nil { + return nil, errors.Wrapf(err, "Error downloading app %s bits, API request failed", guid) + } + defer resp.Body.Close() + if isResponseRedirect(resp) { + // directly download the bits from blobstore using a non cloud controller transport + // some blobstores will return a 400 if an Authorization header is sent + blobStoreLocation := resp.Header.Get("Location") + tr := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: c.Config.SkipSslValidation}, + } + client := &http.Client{Transport: tr} + resp, err = client.Get(blobStoreLocation) + if err != nil { + return nil, errors.Wrapf(err, "Error downloading app %s bits from blobstore", guid) + } + } else { + return nil, errors.Wrapf(err, "Error downloading app %s bits, expected redirect to blobstore", guid) + } + return resp.Body, nil +} + +// GetDropletBits downloads the application's droplet bits as a tar file +func (c *Client) GetDropletBits(guid string) (io.ReadCloser, error) { + requestURL := fmt.Sprintf("/v2/apps/%s/droplet/download", guid) + req := c.NewRequest("GET", requestURL) + resp, err := c.DoRequestWithoutRedirects(req) + if err != nil { + return nil, errors.Wrapf(err, "Error downloading droplet %s bits, API request failed", guid) + } + defer resp.Body.Close() + if isResponseRedirect(resp) { + // directly download the bits from blobstore using a non cloud controller transport + // some blobstores will return a 400 if an Authorization header is sent + blobStoreLocation := resp.Header.Get("Location") + tr := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: c.Config.SkipSslValidation}, + } + client := &http.Client{Transport: tr} + resp, err = client.Get(blobStoreLocation) + if err != nil { + return nil, errors.Wrapf(err, "Error downloading droplet %s bits from blobstore", guid) + } + } else { + return nil, errors.Wrapf(err, "Error downloading droplet %s bits, expected redirect to blobstore", guid) + } + return resp.Body, nil +} + +// GetDropletBits downloads the application's droplet bits as a tar file +// Returns the GUID, job URL for monitoring, and an error +func (c *Client) UploadDropletBits(dropletReader io.Reader, appGUID string) (string, error) { + dropletFile, err := ioutil.TempFile("", "droplet") + if err != nil { + return "", errors.Wrap(err, "Could not create temp file for droplet bits") + } + + defer func() { + dropletFile.Close() + os.Remove(dropletFile.Name()) + }() + + writer := multipart.NewWriter(dropletFile) + part, err := writer.CreateFormFile("droplet", "droplet.tgz") + if err != nil { + return "", errors.Wrapf(err, "Error uploading app %s droplet", appGUID) + } + + _, err = io.Copy(part, dropletReader) + if err != nil { + return "", errors.Wrapf(err, "Error uploading app %s droplet, failed to copy all bytes", appGUID) + } + + err = writer.Close() + if err != nil { + return "", errors.Wrapf(err, "Error uploading app %s droplet, failed to close multipart writer", appGUID) + } + + _, err = dropletFile.Seek(0, 0) + if err != nil { + return "", errors.Wrapf(err, "Error uploading app %s droplet, failed to seek beginning of file", appGUID) + } + fileStats, err := dropletFile.Stat() + if err != nil { + return "", errors.Wrapf(err, "Error uploading app %s droplet, failed to get temp file stats", appGUID) + } + + requestURL := fmt.Sprintf("/v2/apps/%s/droplet/upload", appGUID) + r := c.NewRequestWithBody("PUT", requestURL, dropletFile) + req, err := r.toHTTP() + if err != nil { + return "", errors.Wrapf(err, "Error uploading app %s droplet", appGUID) + } + + req.ContentLength = fileStats.Size() + req.Header.Set("Content-Type", writer.FormDataContentType()) + + resp, err := c.Do(req) + if err != nil { + return "", errors.Wrapf(err, "Error uploading app %s droplet", appGUID) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return "", errors.Wrapf(err, "Error uploading app %s droplet, response code: %d", appGUID, resp.StatusCode) + } + + var respObj struct { + Metadata struct { + GUID string `json:"guid"` + URL string `json:"url"` + } `json:"metadata"` + } + + if err = json.NewDecoder(resp.Body).Decode(&respObj); err != nil { + return "", errors.Wrapf(err, "Error parsing response") + } + + return respObj.Metadata.URL, nil +} + +// CreateApp creates a new empty application that still needs it's +// app bit uploaded and to be started +func (c *Client) CreateApp(req AppCreateRequest) (App, error) { + var appResp AppResource + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(req) + if err != nil { + return App{}, err + } + r := c.NewRequestWithBody("POST", "/v2/apps", buf) + resp, err := c.DoRequest(r) + if err != nil { + return App{}, errors.Wrapf(err, "Error creating app %s", req.Name) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return App{}, errors.Wrapf(err, "Error creating app %s, response code: %d", req.Name, resp.StatusCode) + } + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return App{}, errors.Wrapf(err, "Error reading app %s http response body", req.Name) + } + err = json.Unmarshal(resBody, &appResp) + if err != nil { + return App{}, errors.Wrapf(err, "Error deserializing app %s response", req.Name) + } + return c.mergeAppResource(appResp), nil +} + +func (c *Client) StartApp(guid string) error { + startRequest := strings.NewReader(`{ "state": "STARTED" }`) + resp, err := c.DoRequest(c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/apps/%s", guid), startRequest)) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error starting app %s, response code: %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) StopApp(guid string) error { + stopRequest := strings.NewReader(`{ "state": "STOPPED" }`) + resp, err := c.DoRequest(c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/apps/%s", guid), stopRequest)) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error stopping app %s, response code: %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) DeleteApp(guid string) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/apps/%s", guid))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting app %s, response code: %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) RestartApp(guid string) error { + var err error + err = c.StopApp(guid) + if err != nil { + return err + } + + err = c.StartApp(guid) + if err != nil { + return err + } + + return nil +} + +func (c *Client) mergeAppResource(app AppResource) App { + app.Entity.Guid = app.Meta.Guid + app.Entity.CreatedAt = app.Meta.CreatedAt + app.Entity.UpdatedAt = app.Meta.UpdatedAt + app.Entity.SpaceData.Entity.Guid = app.Entity.SpaceData.Meta.Guid + app.Entity.SpaceData.Entity.OrgData.Entity.Guid = app.Entity.SpaceData.Entity.OrgData.Meta.Guid + app.Entity.c = c + return app.Entity +} + +func isResponseRedirect(res *http.Response) bool { + switch res.StatusCode { + case http.StatusTemporaryRedirect, http.StatusPermanentRedirect, http.StatusMovedPermanently, http.StatusFound, http.StatusSeeOther: + return true + } + return false +} diff --git a/third_party/go-cfclient/apps_test.go b/third_party/go-cfclient/apps_test.go new file mode 100644 index 000000000000..533943e200d7 --- /dev/null +++ b/third_party/go-cfclient/apps_test.go @@ -0,0 +1,639 @@ +package cfclient + +import ( + "bytes" + "io/ioutil" + "net/http" + "net/http/httptest" + "testing" + "time" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListApps(t *testing.T) { + Convey("List Apps", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/apps", []string{listAppsPayload}, "Test-golang", 200, "inline-relations-depth=2", nil}, + {"GET", "/v2/appsPage2", []string{listAppsPayloadPage2}, "Test-golang", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + UserAgent: "Test-golang", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + apps, err := client.ListApps() + assertAppList(apps, err) + }) +} + +func TestListAppsByRoute(t *testing.T) { + Convey("List Apps by Route", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/routes/a3fb8d86-4620-4725-b643-0b5122a432e0/apps", []string{listAppsPayload}, "Test-golang", 200, "", nil}, + {"GET", "/v2/appsPage2", []string{listAppsPayloadPage2}, "Test-golang", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + UserAgent: "Test-golang", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + apps, err := client.ListAppsByRoute("a3fb8d86-4620-4725-b643-0b5122a432e0") + assertAppList(apps, err) + }) +} + +func assertAppList(apps []App, err error) { + So(err, ShouldBeNil) + + So(len(apps), ShouldEqual, 2) + So(apps[0].Guid, ShouldEqual, "af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c") + So(apps[0].CreatedAt, ShouldEqual, "2014-10-10T21:03:13+00:00") + So(apps[0].UpdatedAt, ShouldEqual, "2014-11-10T14:07:31+00:00") + So(apps[0].Name, ShouldEqual, "app-test") + So(apps[0].Memory, ShouldEqual, 256) + So(apps[0].Instances, ShouldEqual, 1) + So(apps[0].DiskQuota, ShouldEqual, 1024) + So(apps[0].SpaceGuid, ShouldEqual, "8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(apps[0].StackGuid, ShouldEqual, "2c531037-68a2-4e2c-a9e0-71f9d0abf0d4") + So(apps[0].State, ShouldEqual, "STARTED") + So(apps[0].Command, ShouldEqual, "") + So(apps[0].Buildpack, ShouldEqual, "https://github.com/cloudfoundry/buildpack-go.git") + So(apps[0].DetectedBuildpack, ShouldEqual, "") + So(apps[0].DetectedBuildpackGuid, ShouldEqual, "0d22f6a1-76c5-417f-ac6c-d9d21463ecbc") + So(apps[0].HealthCheckHttpEndpoint, ShouldEqual, "") + So(apps[0].HealthCheckType, ShouldEqual, "port") + So(apps[0].HealthCheckTimeout, ShouldEqual, 0) + So(apps[0].Diego, ShouldEqual, true) + So(apps[0].EnableSSH, ShouldEqual, true) + So(apps[0].DetectedStartCommand, ShouldEqual, "app-launching-service-broker") + So(apps[0].DockerImage, ShouldEqual, "") + So(apps[0].DockerCredentialsJSON["redacted_message"], ShouldEqual, "[PRIVATE DATA HIDDEN]") + So(apps[0].Environment["FOOBAR"], ShouldEqual, "QUX") + So(apps[0].StagingFailedReason, ShouldEqual, "") + So(apps[0].StagingFailedDescription, ShouldEqual, "") + So(apps[0].PackageState, ShouldEqual, "PENDING") + So(len(apps[0].Ports), ShouldEqual, 1) + So(apps[0].Ports[0], ShouldEqual, 8080) + + So(apps[1].Guid, ShouldEqual, "f9ad202b-76dd-44ec-b7c2-fd2417a561e8") + So(apps[1].Name, ShouldEqual, "app-test2") +} + +func TestGetAppByGuidNoInlineCall(t *testing.T) { + Convey("App By GUID", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2", []string{appPayload}, "Test-golang", 200, "", nil}, + {"GET", "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73", []string{spacePayload}, "Test-golang", 200, "", nil}, + {"GET", "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2", []string{orgPayload}, "Test-golang", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + UserAgent: "Test-golang", + } + + client, err := NewClient(c) + So(err, ShouldBeNil) + + app, err := client.GetAppByGuidNoInlineCall("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + + So(app.Guid, ShouldEqual, "9902530c-c634-4864-a189-71d763cb12e2") + So(app.Name, ShouldEqual, "test-env") + }) + + Convey("App By GUID and space returns error", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2", []string{appPayload}, "Test-golang", 200, "", nil}, + {"GET", "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73", []string{"error"}, "Test-golang", 500, "", nil}, + {"GET", "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2", []string{"error"}, "Test-golang", 500, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + UserAgent: "Test-golang", + } + + client, err := NewClient(c) + So(err, ShouldBeNil) + + _, err = client.GetAppByGuidNoInlineCall("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldNotBeNil) + + So(err.Error(), ShouldStartWith, "Unable to get the Space for the app test-env") + }) + + Convey("App By GUID with environment variables with different types", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2", []string{appPayloadWithEnvironment}, "Test-golang", 200, "", nil}, + {"GET", "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73", []string{spacePayload}, "Test-golang", 200, "", nil}, + {"GET", "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2", []string{orgPayload}, "Test-golang", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + UserAgent: "Test-golang", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + app, err := client.GetAppByGuidNoInlineCall("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + So(app.Environment["string"], ShouldEqual, "string") + So(app.Environment["int"], ShouldEqual, 1) + }) +} + +func TestAppByGuid(t *testing.T) { + Convey("App By GUID", t, func() { + setup(MockRoute{"GET", "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2", []string{appPayload}, "", 200, "inline-relations-depth=2", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + app, err := client.GetAppByGuid("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + + So(app.Guid, ShouldEqual, "9902530c-c634-4864-a189-71d763cb12e2") + So(app.Name, ShouldEqual, "test-env") + }) + + Convey("App By GUID with environment variables with different types", t, func() { + setup(MockRoute{"GET", "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2", []string{appPayloadWithEnvironment}, "", 200, "inline-relations-depth=2", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + app, err := client.GetAppByGuid("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + + So(app.Environment["string"], ShouldEqual, "string") + So(app.Environment["int"], ShouldEqual, 1) + }) +} + +func TestGetAppInstances(t *testing.T) { + Convey("App completely running", t, func() { + setup(MockRoute{"GET", "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/instances", []string{appInstancePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + appInstances, err := client.GetAppInstances("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + + So(appInstances["0"].State, ShouldEqual, "RUNNING") + So(appInstances["1"].State, ShouldEqual, "RUNNING") + + var d0 float64 = 1455210430.5104606 + var d1 float64 = 1455210430.3912115 + date0 := time.Unix(int64(d0), 0) + date1 := time.Unix(int64(d1), 0) + + So(appInstances["0"].Since.Format(time.UnixDate), ShouldEqual, date0.Format(time.UnixDate)) + So(appInstances["1"].Since.Format(time.UnixDate), ShouldEqual, date1.Format(time.UnixDate)) + So(appInstances["0"].Since.ToTime(), ShouldHaveSameTypeAs, date0) + So(appInstances["1"].Since.ToTime(), ShouldHaveSameTypeAs, date1) + + }) + + Convey("App partially running", t, func() { + setup(MockRoute{"GET", "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/instances", []string{appInstanceUnhealthyPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + appInstances, err := client.GetAppInstances("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + + So(appInstances["0"].State, ShouldEqual, "RUNNING") + So(appInstances["1"].State, ShouldEqual, "STARTING") + + var d0 float64 = 1455210430.5104606 + var d1 float64 = 1455210430.3912115 + date0 := time.Unix(int64(d0), 0) + date1 := time.Unix(int64(d1), 0) + + So(appInstances["0"].Since.Format(time.UnixDate), ShouldEqual, date0.Format(time.UnixDate)) + So(appInstances["1"].Since.Format(time.UnixDate), ShouldEqual, date1.Format(time.UnixDate)) + So(appInstances["0"].Since.ToTime(), ShouldHaveSameTypeAs, date0) + So(appInstances["1"].Since.ToTime(), ShouldHaveSameTypeAs, date1) + + }) +} + +func TestGetAppStats(t *testing.T) { + Convey("App stats completely running", t, func() { + setup(MockRoute{"GET", "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/stats", []string{appStatsPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + appStats, err := client.GetAppStats("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + + So(appStats["0"].State, ShouldEqual, "RUNNING") + So(appStats["1"].State, ShouldEqual, "RUNNING") + So(appStats["2"].State, ShouldEqual, "RUNNING") + So(appStats["3"].State, ShouldEqual, "RUNNING") + + date0, _ := time.Parse("2006-01-02 15:04:05 -0700", "2016-09-17 15:46:17 +0000") + date1, _ := time.Parse("2006-01-02 15:04:05 -0700", "2016-09-17 15:46:17 +0000") + date2, _ := time.Parse(time.RFC3339Nano, "2017-04-06T20:32:19.273294439Z") + date3, _ := time.Parse("2006-01-02 15:04:05 MST", "2017-04-12 15:27:44 UTC") + + So(appStats["0"].Stats.Usage.Time.Format(time.UnixDate), ShouldEqual, date0.Format(time.UnixDate)) + So(appStats["1"].Stats.Usage.Time.Format(time.RFC3339), ShouldEqual, date1.Format(time.RFC3339)) + So(appStats["2"].Stats.Usage.Time.Format(time.RFC3339Nano), ShouldEqual, date2.Format(time.RFC3339Nano)) + So(appStats["3"].Stats.Usage.Time.Format("2006-01-02 15:04:05 MST"), ShouldEqual, date3.Format("2006-01-02 15:04:05 MST")) + So(appStats["0"].Stats.Usage.Time.ToTime(), ShouldHaveSameTypeAs, date0) + So(appStats["1"].Stats.Usage.Time.ToTime(), ShouldHaveSameTypeAs, date1) + So(appStats["2"].Stats.Usage.Time.ToTime(), ShouldHaveSameTypeAs, date2) + So(appStats["3"].Stats.Usage.Time.ToTime(), ShouldHaveSameTypeAs, date3) + So(appStats["0"].Stats.Usage.CPU, ShouldEqual, 0.36580239597146486) + So(appStats["1"].Stats.Usage.CPU, ShouldEqual, 0.33857742931636664) + So(appStats["2"].Stats.Usage.CPU, ShouldEqual, 0.33857742931636664) + So(appStats["3"].Stats.Usage.CPU, ShouldEqual, 0.33857742931636664) + So(appStats["0"].Stats.Usage.Mem, ShouldEqual, 518123520) + So(appStats["1"].Stats.Usage.Mem, ShouldEqual, 530731008) + So(appStats["2"].Stats.Usage.Mem, ShouldEqual, 530731008) + So(appStats["3"].Stats.Usage.Mem, ShouldEqual, 530731008) + So(appStats["0"].Stats.Usage.Disk, ShouldEqual, 151150592) + So(appStats["1"].Stats.Usage.Disk, ShouldEqual, 151150592) + So(appStats["2"].Stats.Usage.Disk, ShouldEqual, 151150592) + So(appStats["3"].Stats.Usage.Disk, ShouldEqual, 151150592) + + }) +} + +func TestGetAppRoutes(t *testing.T) { + Convey("List app routes", t, func() { + setup(MockRoute{"GET", "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/routes", []string{appRoutesPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + routes, err := client.GetAppRoutes("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + + So(len(routes), ShouldEqual, 1) + So(routes[0].Guid, ShouldEqual, "311d34d1-c045-4853-845f-05132377ad7d") + So(routes[0].Host, ShouldEqual, "host-36") + So(routes[0].Path, ShouldEqual, "/foo") + So(routes[0].DomainGuid, ShouldEqual, "40a499f7-198a-4289-9aa2-605ba43f92ee") + So(routes[0].SpaceGuid, ShouldEqual, "c7c0dd06-b078-43d7-adcb-3974cd785fdd") + So(routes[0].ServiceInstanceGuid, ShouldEqual, "") + So(routes[0].Port, ShouldEqual, 0) + + }) +} + +func TestUploadAppBits(t *testing.T) { + Convey("Upload app bits", t, func() { + expectedPayload := "this should really be zipped binary data" + mr := MockRoute{ + Method: "PUT-FILE", + Endpoint: "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/bits", + Status: 201, + PostForm: &expectedPayload, + Output: []string{""}, + } + setup(mr, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + bits := bytes.NewBufferString(expectedPayload) + err = client.UploadAppBits(bits, "9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + }) +} + +func TestGetAppBits(t *testing.T) { + Convey("Get app bits", t, func() { + + next := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + w.Header().Set("Content-Type", "application/gzip") + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte("apptarbinarydata")) + }) + s := httptest.NewServer(next) + defer s.Close() + + mr := MockRouteWithRedirect{ + MockRoute: MockRoute{ + Method: "GET", + Endpoint: "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/download", + Status: 302, + Output: []string{""}, + }, + RedirectLocation: s.URL, + } + setupWithRedirect(mr, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + bits, err := client.GetAppBits("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + So(bits, ShouldNotBeNil) + + var download string + if b, err := ioutil.ReadAll(bits); err == nil { + download = string(b) + } + So(download, ShouldEqual, "apptarbinarydata") + }) +} + +func TestUploadDropletBits(t *testing.T) { + Convey("Upload droplet bits", t, func() { + expectedPayload := "this should really be tar'd and gzipped binary data" + mr := MockRoute{ + Method: "PUT-FILE", + Endpoint: "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/droplet/upload", + Status: 201, + PostForm: &expectedPayload, + Output: []string{`{"metadata":{"guid": "123", "url":"abc"}}`}, + } + setup(mr, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + bits := bytes.NewBufferString(expectedPayload) + _, err = client.UploadDropletBits(bits, "9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + }) +} + +func TestGetDropletBits(t *testing.T) { + Convey("Get droplet bits", t, func() { + + next := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + w.Header().Set("Content-Type", "application/gzip") + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte("apptarbinarydata")) + }) + s := httptest.NewServer(next) + defer s.Close() + + mr := MockRouteWithRedirect{ + MockRoute: MockRoute{ + Method: "GET", + Endpoint: "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/droplet/download", + Status: 302, + Output: []string{""}, + }, + RedirectLocation: s.URL, + } + setupWithRedirect(mr, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + bits, err := client.GetDropletBits("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + So(bits, ShouldNotBeNil) + + var download string + if b, err := ioutil.ReadAll(bits); err == nil { + download = string(b) + } + So(download, ShouldEqual, "apptarbinarydata") + }) +} + +func TestKillAppInstance(t *testing.T) { + Convey("Kills an app instance", t, func() { + setup(MockRoute{"DELETE", "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/instances/0", []string{""}, "", 204, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + So(client.KillAppInstance("9902530c-c634-4864-a189-71d763cb12e2", "0"), ShouldBeNil) + }) +} + +func TestAppEnv(t *testing.T) { + Convey("Find app space", t, func() { + setup(MockRoute{"GET", "/v2/apps/a7c47787-a982-467c-95d7-9ab17cbcc918/env", []string{appEnvPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + appEnv, err := client.GetAppEnv("a7c47787-a982-467c-95d7-9ab17cbcc918") + So(err, ShouldBeNil) + So(appEnv.StagingEnv, ShouldResemble, map[string]interface{}{"STAGING_ENV": "staging_value"}) + So(appEnv.RunningEnv, ShouldResemble, map[string]interface{}{"RUNNING_ENV": "running_value"}) + So(appEnv.Environment, ShouldResemble, map[string]interface{}{"env_var": "env_val"}) + So(appEnv.SystemEnv["VCAP_SERVICES"].(map[string]interface{})["abc"], ShouldEqual, 123) + So(appEnv.ApplicationEnv["VCAP_APPLICATION"].(map[string]interface{})["application_name"], ShouldEqual, "name-2245") + }) +} + +func TestAppSummary(t *testing.T) { + Convey("Get app summary", t, func() { + setup(MockRoute{"GET", "/v2/apps/b5f0d1bd-a3a9-40a4-af1a-312ad26e5379/summary", []string{appSummaryPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + app := &App{ + Guid: "b5f0d1bd-a3a9-40a4-af1a-312ad26e5379", + c: client, + } + + summary, err := app.Summary() + So(err, ShouldBeNil) + + So(summary.Guid, ShouldEqual, "b5f0d1bd-a3a9-40a4-af1a-312ad26e5379") + So(summary.Name, ShouldEqual, "test-app") + So(summary.ServiceCount, ShouldEqual, 1) + So(summary.RunningInstances, ShouldEqual, 1) + So(summary.SpaceGuid, ShouldEqual, "494d8b64-8181-4183-a6d3-6279db8fec6e") + So(summary.StackGuid, ShouldEqual, "67e019a3-322a-407a-96e0-178e95bd0e55") + So(summary.Buildpack, ShouldEqual, "ruby_buildpack") + So(summary.DetectedBuildpack, ShouldEqual, "") + So(summary.Memory, ShouldEqual, 256) + So(summary.Instances, ShouldEqual, 1) + So(summary.DiskQuota, ShouldEqual, 512) + So(summary.State, ShouldEqual, "STARTED") + So(summary.Command, ShouldEqual, "") + So(summary.PackageState, ShouldEqual, "STAGED") + So(summary.HealthCheckType, ShouldEqual, "port") + So(summary.HealthCheckTimeout, ShouldEqual, 0) + So(summary.StagingFailedReason, ShouldEqual, "") + So(summary.StagingFailedDescription, ShouldEqual, "") + So(summary.Diego, ShouldEqual, true) + So(summary.DockerImage, ShouldEqual, "") + So(summary.DetectedStartCommand, ShouldEqual, "rackup -p $PORT") + So(summary.EnableSSH, ShouldEqual, true) + So(summary.DockerCredentials["redacted_message"], ShouldEqual, "[PRIVATE DATA HIDDEN]") + }) +} + +func TestAppSpace(t *testing.T) { + Convey("Find app space", t, func() { + setup(MockRoute{"GET", "/v2/spaces/foobar", []string{spacePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + app := &App{ + Guid: "123", + Name: "test app", + SpaceURL: "/v2/spaces/foobar", + c: client, + } + space, err := app.Space() + So(err, ShouldBeNil) + + So(space.Name, ShouldEqual, "test-space") + So(space.Guid, ShouldEqual, "a72fa1e8-c694-47b3-85f2-55f61fd00d73") + }) +} + +func TestDeleteApps(t *testing.T) { + Convey("Delete app", t, func() { + setup(MockRoute{"DELETE", "/v2/apps/a537761f-9d93-4b30-af17-3d73dbca181b", []string{""}, "", 204, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteApp("a537761f-9d93-4b30-af17-3d73dbca181b") + So(err, ShouldBeNil) + }) +} + +func TestCreateApp(t *testing.T) { + Convey("Delete app", t, func() { + setup(MockRoute{"POST", "/v2/apps", []string{appPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + req := AppCreateRequest{ + Name: "test-env", + SpaceGuid: "a72fa1e8-c694-47b3-85f2-55f61fd00d73", + } + app, err := client.CreateApp(req) + So(err, ShouldBeNil) + So(app.Guid, ShouldEqual, "9902530c-c634-4864-a189-71d763cb12e2") + So(app.Name, ShouldEqual, "test-env") + So(app.SpaceGuid, ShouldEqual, "a72fa1e8-c694-47b3-85f2-55f61fd00d73") + }) +} + +func TestStartApp(t *testing.T) { + Convey("Start app", t, func() { + expectedBody := `{ "state": "STARTED" }` + setup(MockRoute{"PUT", "/v2/apps/a537761f-9d93-4b30-af17-3d73dbca181b", []string{appPayload}, "", http.StatusCreated, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + So(client.StartApp("a537761f-9d93-4b30-af17-3d73dbca181b"), ShouldBeNil) + }) +} + +func TestStopApp(t *testing.T) { + Convey("Stop app", t, func() { + expectedBody := `{ "state": "STOPPED" }` + setup(MockRoute{"PUT", "/v2/apps/a537761f-9d93-4b30-af17-3d73dbca181b", []string{appPayload}, "", http.StatusCreated, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + So(client.StopApp("a537761f-9d93-4b30-af17-3d73dbca181b"), ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/buildpacks.go b/third_party/go-cfclient/buildpacks.go new file mode 100644 index 000000000000..3ac6978a8381 --- /dev/null +++ b/third_party/go-cfclient/buildpacks.go @@ -0,0 +1,264 @@ +package cfclient + +import ( + "encoding/json" + "io" + "io/ioutil" + "mime/multipart" + "os" + + "fmt" + "net/http" + + "github.com/pkg/errors" +) + +type BuildpackResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []BuildpackResource `json:"resources"` +} + +type BuildpackResource struct { + Meta Meta `json:"metadata"` + Entity Buildpack `json:"entity"` +} + +type Buildpack struct { + Guid string `json:"guid"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Name string `json:"name"` + Enabled bool `json:"enabled"` + Locked bool `json:"locked"` + Position int `json:"position"` + Filename string `json:"filename"` + Stack string `json:"stack"` + c *Client +} + +type BuildpackRequest struct { + // These are all pointers to the values so that we can tell + // whether people wanted position 0, or enable/unlock values, + // vs whether they didn't specify them and want them unchanged/default. + Name *string `json:"name,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Locked *bool `json:"locked,omitempty"` + Position *int `json:"position,omitempty"` + Stack *string `json:"stack,omitempty"` +} + +func (c *Client) CreateBuildpack(bpr *BuildpackRequest) (*Buildpack, error) { + if bpr.Name == nil || *bpr.Name == "" { + return nil, errors.New("Unable to create a buidlpack with no name") + } + requestUrl := "/v2/buildpacks" + req := c.NewRequest("POST", requestUrl) + req.obj = bpr + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error creating buildpack:") + } + defer resp.Body.Close() + bp, err := c.handleBuildpackResp(resp) + if err != nil { + return nil, errors.Wrap(err, "Error creating buildpack:") + } + return &bp, nil +} + +func (c *Client) ListBuildpacks() ([]Buildpack, error) { + var buildpacks []Buildpack + requestUrl := "/v2/buildpacks" + for { + buildpackResp, err := c.getBuildpackResponse(requestUrl) + if err != nil { + return []Buildpack{}, err + } + for _, buildpack := range buildpackResp.Resources { + buildpacks = append(buildpacks, c.mergeBuildpackResource(buildpack)) + } + requestUrl = buildpackResp.NextUrl + if requestUrl == "" { + break + } + } + return buildpacks, nil +} + +func (c *Client) DeleteBuildpack(guid string, async bool) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/buildpacks/%s?async=%t", guid, async))) + if err != nil { + return err + } + defer resp.Body.Close() + if (async && (resp.StatusCode != http.StatusAccepted)) || (!async && (resp.StatusCode != http.StatusNoContent)) { + return errors.Wrapf(err, "Error deleting buildpack %s, response code: %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) getBuildpackResponse(requestUrl string) (BuildpackResponse, error) { + var buildpackResp BuildpackResponse + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return BuildpackResponse{}, errors.Wrap(err, "Error requesting buildpacks") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return BuildpackResponse{}, errors.Wrap(err, "Error reading buildpack request") + } + err = json.Unmarshal(resBody, &buildpackResp) + if err != nil { + return BuildpackResponse{}, errors.Wrap(err, "Error unmarshalling buildpack") + } + return buildpackResp, nil +} + +func (c *Client) mergeBuildpackResource(buildpack BuildpackResource) Buildpack { + buildpack.Entity.Guid = buildpack.Meta.Guid + buildpack.Entity.CreatedAt = buildpack.Meta.CreatedAt + buildpack.Entity.UpdatedAt = buildpack.Meta.UpdatedAt + buildpack.Entity.c = c + return buildpack.Entity +} + +func (c *Client) GetBuildpackByGuid(buildpackGUID string) (Buildpack, error) { + requestUrl := fmt.Sprintf("/v2/buildpacks/%s", buildpackGUID) + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return Buildpack{}, errors.Wrap(err, "Error requesting buildpack info") + } + + return c.handleBuildpackResp(resp) +} + +func (c *Client) handleBuildpackResp(resp *http.Response) (Buildpack, error) { + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return Buildpack{}, err + } + var buildpackResource BuildpackResource + if err := json.Unmarshal(body, &buildpackResource); err != nil { + return Buildpack{}, err + } + return c.mergeBuildpackResource(buildpackResource), nil +} + +func (b *Buildpack) Upload(file io.Reader, fileName string) error { + var capturedErr error + tempFile("requests", func(requestFile *os.File, err error) { + if err != nil { + capturedErr = err + return + } + writer := multipart.NewWriter(requestFile) + part, err := writer.CreateFormFile("buildpack", fileName) + + if err != nil { + _ = writer.Close() + capturedErr = err + return + } + + _, err = io.Copy(part, file) + if err != nil { + capturedErr = fmt.Errorf("Error creating upload: %s", err.Error()) + return + } + + err = writer.Close() + if err != nil { + capturedErr = err + return + } + + _, err = requestFile.Seek(0, 0) + if err != nil { + capturedErr = fmt.Errorf("Error seeking beginning of file: %s", err) + } + fileStats, err := requestFile.Stat() + if err != nil { + capturedErr = fmt.Errorf("Error getting file info: %s", err) + } + + req, err := http.NewRequest("PUT", fmt.Sprintf("%s/v2/buildpacks/%s/bits", b.c.Config.ApiAddress, b.Guid), requestFile) + if err != nil { + capturedErr = err + return + } + + req.ContentLength = fileStats.Size() + contentType := fmt.Sprintf("multipart/form-data; boundary=%s", writer.Boundary()) + req.Header.Set("Content-Type", contentType) + resp, err := b.c.Do(req) // client.Do() handles the HTTP status code checking for us + if err != nil { + capturedErr = err + return + } + defer resp.Body.Close() + }) + + return errors.Wrap(capturedErr, "Error uploading buildpack:") +} + +func (b *Buildpack) Update(bpr *BuildpackRequest) error { + requestUrl := fmt.Sprintf("/v2/buildpacks/%s", b.Guid) + req := b.c.NewRequest("PUT", requestUrl) + req.obj = bpr + resp, err := b.c.DoRequest(req) + if err != nil { + return errors.Wrap(err, "Error updating buildpack:") + } + defer resp.Body.Close() + newBp, err := b.c.handleBuildpackResp(resp) + if err != nil { + return errors.Wrap(err, "Error updating buildpack:") + } + b.Name = newBp.Name + b.Locked = newBp.Locked + b.Enabled = newBp.Enabled + return nil +} + +func (bpr *BuildpackRequest) Lock() { + b := true + bpr.Locked = &b +} +func (bpr *BuildpackRequest) Unlock() { + b := false + bpr.Locked = &b +} +func (bpr *BuildpackRequest) Enable() { + b := true + bpr.Enabled = &b +} +func (bpr *BuildpackRequest) Disable() { + b := false + bpr.Enabled = &b +} +func (bpr *BuildpackRequest) SetPosition(i int) { + bpr.Position = &i +} +func (bpr *BuildpackRequest) SetName(s string) { + bpr.Name = &s +} +func (bpr *BuildpackRequest) SetStack(s string) { + bpr.Stack = &s +} + +func tempFile(namePrefix string, cb func(tmpFile *os.File, err error)) { + tmpFile, err := ioutil.TempFile("", namePrefix) + + defer func() { + _ = tmpFile.Close() + _ = os.Remove(tmpFile.Name()) + }() + + cb(tmpFile, err) +} diff --git a/third_party/go-cfclient/buildpacks_test.go b/third_party/go-cfclient/buildpacks_test.go new file mode 100644 index 000000000000..43aa8e39cc88 --- /dev/null +++ b/third_party/go-cfclient/buildpacks_test.go @@ -0,0 +1,375 @@ +package cfclient + +import ( + "bytes" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListBuildpacks(t *testing.T) { + Convey("List buildpack", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/buildpacks", []string{listBuildpacksPayload}, "", 200, "", nil}, + {"GET", "/v2/buildpacksPage2", []string{listBuildpacksPayload2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpacks, err := client.ListBuildpacks() + So(err, ShouldBeNil) + + So(len(buildpacks), ShouldEqual, 6) + So(buildpacks[0].Guid, ShouldEqual, "c92b6f5f-d2a4-413a-b515-647d059723aa") + So(buildpacks[0].CreatedAt, ShouldEqual, "2016-06-08T16:41:31Z") + So(buildpacks[0].UpdatedAt, ShouldEqual, "2016-06-08T16:41:26Z") + So(buildpacks[0].Name, ShouldEqual, "name_1") + So(buildpacks[0].Stack, ShouldEqual, "cflinuxfs2") + }) +} + +func TestGetBuildpackByGuid(t *testing.T) { + Convey("A buildpack", t, func() { + setup(MockRoute{"GET", "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", []string{buildpackPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpack, err := client.GetBuildpackByGuid("c92b6f5f-d2a4-413a-b515-647d059723aa") + So(err, ShouldBeNil) + + So(buildpack.Guid, ShouldEqual, "c92b6f5f-d2a4-413a-b515-647d059723aa") + So(buildpack.CreatedAt, ShouldEqual, "2016-06-08T16:41:31Z") + So(buildpack.UpdatedAt, ShouldEqual, "2016-06-08T16:41:26Z") + So(buildpack.Name, ShouldEqual, "name_1") + So(buildpack.Stack, ShouldEqual, "cflinuxfs2") + }) + Convey("A buildpack with no stack", t, func() { + setup(MockRoute{"GET", "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", []string{buildpackPayloadBackwardsCompat}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpack, err := client.GetBuildpackByGuid("c92b6f5f-d2a4-413a-b515-647d059723aa") + So(err, ShouldBeNil) + + So(buildpack.Guid, ShouldEqual, "c92b6f5f-d2a4-413a-b515-647d059723aa") + So(buildpack.CreatedAt, ShouldEqual, "2016-06-08T16:41:31Z") + So(buildpack.UpdatedAt, ShouldEqual, "2016-06-08T16:41:26Z") + So(buildpack.Name, ShouldEqual, "name_1") + So(buildpack.Stack, ShouldEqual, "") + }) +} + +func TestUploadBuildpack(t *testing.T) { + Convey("Uploading a buildpack succeeds", t, func() { + expectedPayload := "this should really be zipped binary data" + setup(MockRoute{"PUT-FILE", "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa/bits", []string{buildpackUploadPayload}, "", 200, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + bits := bytes.NewBufferString(expectedPayload) + buildpack := Buildpack{Guid: "c92b6f5f-d2a4-413a-b515-647d059723aa", c: client} + err = buildpack.Upload(bits, "test.zip") + So(err, ShouldBeNil) + }) + Convey("Uploading a buildpack throws an error in the event of failure", t, func() { + expectedPayload := "this should really be zipped binary data" + setup(MockRoute{"PUT-FILE", "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa/bits", []string{buildpackUploadPayload}, "", 400, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + bits := bytes.NewBufferString(expectedPayload) + buildpack := Buildpack{Guid: "c92b6f5f-d2a4-413a-b515-647d059723aa", c: client} + err = buildpack.Upload(bits, "test.zip") + So(err, ShouldNotBeNil) + }) +} + +func TestUpdateBuildpack(t *testing.T) { + Convey("Updating a buildpack succeeds", t, func() { + expectedPayload := `{"name":"renamed-buildpack","enabled":true,"locked":true,"position":100}` + setup(MockRoute{"PUT", "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", []string{buildpackUpdatePayload}, "", 200, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpack := Buildpack{ + Guid: "c92b6f5f-d2a4-413a-b515-647d059723aa", + c: client, + } + buildpackRequest := &BuildpackRequest{} + buildpackRequest.SetName("renamed-buildpack") + buildpackRequest.Lock() + buildpackRequest.Enable() + buildpackRequest.SetPosition(100) + + err = buildpack.Update(buildpackRequest) + So(err, ShouldBeNil) + }) + Convey("Updating a buildpack doesn't accidentally unlock, rename, disable, or reorder the buildpack", t, func() { + expectedPayload := `{}` + setup(MockRoute{"PUT", "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", []string{buildpackUpdatePayload}, "", 200, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpack := Buildpack{ + Guid: "c92b6f5f-d2a4-413a-b515-647d059723aa", + c: client, + } + buildpackRequest := &BuildpackRequest{} + + err = buildpack.Update(buildpackRequest) + So(err, ShouldBeNil) + }) + Convey("Unlocking, disabling, reordering to 0, and removing name from buildpacks is still possible", t, func() { + expectedPayload := `{"name":"","enabled":false,"locked":false,"position":0}` + setup(MockRoute{"PUT", "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", []string{buildpackUpdatePayload}, "", 200, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpack := Buildpack{ + Guid: "c92b6f5f-d2a4-413a-b515-647d059723aa", + c: client, + } + buildpackRequest := &BuildpackRequest{} + buildpackRequest.SetName("") + buildpackRequest.Unlock() + buildpackRequest.Disable() + buildpackRequest.SetPosition(0) + + err = buildpack.Update(buildpackRequest) + So(err, ShouldBeNil) + }) + Convey("Updating a buildpack returns an error in the event of failure", t, func() { + expectedPayload := `{}` + setup(MockRoute{"PUT", "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", []string{buildpackUpdatePayload}, "", 400, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpack := Buildpack{ + Guid: "c92b6f5f-d2a4-413a-b515-647d059723aa", + c: client, + } + + buildpackRequest := &BuildpackRequest{} + + err = buildpack.Update(buildpackRequest) + So(err, ShouldNotBeNil) + }) + Convey("It is possible to update a buildpack stack from null, to a value", t, func() { + expectedPayload := `{"stack":"cflinuxfs2"}` + setup(MockRoute{"PUT", "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", []string{buildpackUpdatePayload}, "", 400, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpack := Buildpack{ + Guid: "c92b6f5f-d2a4-413a-b515-647d059723aa", + c: client, + } + buildpackRequest := &BuildpackRequest{} + buildpackRequest.SetStack("cflinuxfs2") + err = buildpack.Update(buildpackRequest) + So(err, ShouldNotBeNil) + }) + Convey("Updating without a stack specified doesn't change anything", t, func() { + expectedPayload := `{"name":"new-name"}` + setup(MockRoute{"PUT", "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", []string{buildpackUpdatePayload}, "", 400, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpack := Buildpack{ + Guid: "c92b6f5f-d2a4-413a-b515-647d059723aa", + c: client, + } + buildpackRequest := &BuildpackRequest{} + buildpackRequest.SetName("new-name") + err = buildpack.Update(buildpackRequest) + So(err, ShouldNotBeNil) + }) +} + +func TestCreateBuildpack(t *testing.T) { + Convey("Creating a buildpack succeeds", t, func() { + expectedPayload := `{"name":"test-buildpack","enabled":true,"locked":true,"position":10,"stack":"cflinuxfs2"}` + setup(MockRoute{"POST", "/v2/buildpacks", []string{buildpackCreatePayload}, "", 200, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpackRequest := &BuildpackRequest{} + buildpackRequest.SetName("test-buildpack") + buildpackRequest.Lock() + buildpackRequest.Enable() + buildpackRequest.SetPosition(10) + buildpackRequest.SetStack("cflinuxfs2") + + bp, err := client.CreateBuildpack(buildpackRequest) + So(err, ShouldBeNil) + So(bp.Guid, ShouldEqual, "c92b6f5f-d2a4-413a-b515-647d059723aa") + So(bp.Name, ShouldEqual, "test-buildpack") + So(bp.Enabled, ShouldBeTrue) + So(bp.Locked, ShouldBeFalse) + So(bp.Position, ShouldEqual, 10) + So(bp.Stack, ShouldEqual, "cflinuxfs2") + }) + Convey("Creating a buildpack doesn't accidentally unlock, rename, disable, or reorder the buildpack", t, func() { + expectedPayload := `{"name":"test-buildpack"}` + setup(MockRoute{"POST", "/v2/buildpacks", []string{buildpackCreatePayload}, "", 200, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpackRequest := &BuildpackRequest{} + buildpackRequest.SetName("test-buildpack") + + bp, err := client.CreateBuildpack(buildpackRequest) + So(err, ShouldBeNil) + So(bp, ShouldNotBeNil) + }) + Convey("Creating a buildpack as unlocked/disabled/order 0 works", t, func() { + expectedPayload := `{"name":"test-buildpack","enabled":false,"locked":false,"position":0}` + setup(MockRoute{"POST", "/v2/buildpacks", []string{buildpackCreatePayload}, "", 200, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpackRequest := &BuildpackRequest{} + buildpackRequest.SetName("test-buildpack") + buildpackRequest.Unlock() + buildpackRequest.Disable() + buildpackRequest.SetPosition(0) + + bp, err := client.CreateBuildpack(buildpackRequest) + So(err, ShouldBeNil) + So(bp, ShouldNotBeNil) + }) + Convey("Creating a buildpack returns an error in the event of failure", t, func() { + expectedPayload := `{"name":"test-buildpack"}` + setup(MockRoute{"POST", "/v2/buildpacks", []string{buildpackCreatePayload}, "", 400, "", &expectedPayload}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpackRequest := &BuildpackRequest{} + buildpackRequest.SetName("test-buildpack") + + bp, err := client.CreateBuildpack(buildpackRequest) + So(err, ShouldNotBeNil) + So(bp, ShouldBeNil) + }) + Convey("Creating a buildpack fails if the request has no name set", t, func() { + setup(MockRoute{"POST", "/v2/buildpacks", []string{buildpackCreatePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + buildpackRequest := &BuildpackRequest{} + bp, err := client.CreateBuildpack(buildpackRequest) + So(err, ShouldNotBeNil) + So(bp, ShouldBeNil) + }) +} + +func TestDeleteBuildpack(t *testing.T) { + Convey("Delete buildpack synchronously", t, func() { + setup(MockRoute{"DELETE", "/v2/buildpacks/b2a35f0c-d5ad-4a59-bea7-461711d96b0d", []string{""}, "", 204, "async=false", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteBuildpack("b2a35f0c-d5ad-4a59-bea7-461711d96b0d", false) + So(err, ShouldBeNil) + }) + + Convey("Delete buildpack asynchronously", t, func() { + setup(MockRoute{"DELETE", "/v2/buildpacks/b2a35f0c-d5ad-4a59-bea7-461711d96b0d", []string{""}, "", 202, "async=true", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteBuildpack("b2a35f0c-d5ad-4a59-bea7-461711d96b0d", true) + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/cf_error.go b/third_party/go-cfclient/cf_error.go new file mode 100644 index 000000000000..77a0454a3a3d --- /dev/null +++ b/third_party/go-cfclient/cf_error.go @@ -0,0 +1,6119 @@ +package cfclient + +// Code generated by go generate. DO NOT EDIT. +// This file was generated by robots at +// 2022-01-11 09:36:11.804559 +1030 ACDT m=+0.186550187 + +import ( + stderrors "errors" + + pkgerrors "github.com/pkg/errors" +) + +// NewInvalidAuthTokenError returns a new CloudFoundryError +// that IsInvalidAuthTokenError will return true for +func NewInvalidAuthTokenError() CloudFoundryError { + return CloudFoundryError{ + Code: 1000, + ErrorCode: "CF-InvalidAuthToken", + Description: "Invalid Auth Token", + } +} + +// IsInvalidAuthTokenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 1000 +// - HTTP code: 401 +// - message: "Invalid Auth Token" +func IsInvalidAuthTokenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 1000 +} + +// NewMessageParseError returns a new CloudFoundryError +// that IsMessageParseError will return true for +func NewMessageParseError() CloudFoundryError { + return CloudFoundryError{ + Code: 1001, + ErrorCode: "CF-MessageParseError", + Description: "Request invalid due to parse error: %s", + } +} + +// IsMessageParseError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 1001 +// - HTTP code: 400 +// - message: "Request invalid due to parse error: %s" +func IsMessageParseError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 1001 +} + +// NewInvalidRelationError returns a new CloudFoundryError +// that IsInvalidRelationError will return true for +func NewInvalidRelationError() CloudFoundryError { + return CloudFoundryError{ + Code: 1002, + ErrorCode: "CF-InvalidRelation", + Description: "%s", + } +} + +// IsInvalidRelationError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 1002 +// - HTTP code: 400 +// - message: "%s" +func IsInvalidRelationError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 1002 +} + +// NewInvalidContentTypeError returns a new CloudFoundryError +// that IsInvalidContentTypeError will return true for +func NewInvalidContentTypeError() CloudFoundryError { + return CloudFoundryError{ + Code: 1003, + ErrorCode: "CF-InvalidContentType", + Description: "Invalid content type, expected: %s", + } +} + +// IsInvalidContentTypeError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 1003 +// - HTTP code: 400 +// - message: "Invalid content type, expected: %s" +func IsInvalidContentTypeError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 1003 +} + +// NewBadRequestError returns a new CloudFoundryError +// that IsBadRequestError will return true for +func NewBadRequestError() CloudFoundryError { + return CloudFoundryError{ + Code: 1004, + ErrorCode: "CF-BadRequest", + Description: "Bad request: %s", + } +} + +// IsBadRequestError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 1004 +// - HTTP code: 400 +// - message: "Bad request: %s" +func IsBadRequestError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 1004 +} + +// NewNotFoundError returns a new CloudFoundryError +// that IsNotFoundError will return true for +func NewNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 10000, + ErrorCode: "CF-NotFound", + Description: "Unknown request", + } +} + +// IsNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10000 +// - HTTP code: 404 +// - message: "Unknown request" +func IsNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10000 +} + +// NewServerError returns a new CloudFoundryError +// that IsServerError will return true for +func NewServerError() CloudFoundryError { + return CloudFoundryError{ + Code: 10001, + ErrorCode: "CF-ServerError", + Description: "Server error", + } +} + +// IsServerError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10001 +// - HTTP code: 500 +// - message: "Server error" +func IsServerError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10001 +} + +// NewNotAuthenticatedError returns a new CloudFoundryError +// that IsNotAuthenticatedError will return true for +func NewNotAuthenticatedError() CloudFoundryError { + return CloudFoundryError{ + Code: 10002, + ErrorCode: "CF-NotAuthenticated", + Description: "Authentication error", + } +} + +// IsNotAuthenticatedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10002 +// - HTTP code: 401 +// - message: "Authentication error" +func IsNotAuthenticatedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10002 +} + +// NewNotAuthorizedError returns a new CloudFoundryError +// that IsNotAuthorizedError will return true for +func NewNotAuthorizedError() CloudFoundryError { + return CloudFoundryError{ + Code: 10003, + ErrorCode: "CF-NotAuthorized", + Description: "You are not authorized to perform the requested action", + } +} + +// IsNotAuthorizedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10003 +// - HTTP code: 403 +// - message: "You are not authorized to perform the requested action" +func IsNotAuthorizedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10003 +} + +// NewInvalidRequestError returns a new CloudFoundryError +// that IsInvalidRequestError will return true for +func NewInvalidRequestError() CloudFoundryError { + return CloudFoundryError{ + Code: 10004, + ErrorCode: "CF-InvalidRequest", + Description: "The request is invalid", + } +} + +// IsInvalidRequestError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10004 +// - HTTP code: 400 +// - message: "The request is invalid" +func IsInvalidRequestError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10004 +} + +// NewBadQueryParameterError returns a new CloudFoundryError +// that IsBadQueryParameterError will return true for +func NewBadQueryParameterError() CloudFoundryError { + return CloudFoundryError{ + Code: 10005, + ErrorCode: "CF-BadQueryParameter", + Description: "The query parameter is invalid: %s", + } +} + +// IsBadQueryParameterError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10005 +// - HTTP code: 400 +// - message: "The query parameter is invalid: %s" +func IsBadQueryParameterError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10005 +} + +// NewAssociationNotEmptyError returns a new CloudFoundryError +// that IsAssociationNotEmptyError will return true for +func NewAssociationNotEmptyError() CloudFoundryError { + return CloudFoundryError{ + Code: 10006, + ErrorCode: "CF-AssociationNotEmpty", + Description: "Please delete the %s associations for your %s.", + } +} + +// IsAssociationNotEmptyError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10006 +// - HTTP code: 400 +// - message: "Please delete the %s associations for your %s." +func IsAssociationNotEmptyError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10006 +} + +// NewInsufficientScopeError returns a new CloudFoundryError +// that IsInsufficientScopeError will return true for +func NewInsufficientScopeError() CloudFoundryError { + return CloudFoundryError{ + Code: 10007, + ErrorCode: "CF-InsufficientScope", + Description: "Your token lacks the necessary scopes to access this resource.", + } +} + +// IsInsufficientScopeError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10007 +// - HTTP code: 403 +// - message: "Your token lacks the necessary scopes to access this resource." +func IsInsufficientScopeError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10007 +} + +// NewUnprocessableEntityError returns a new CloudFoundryError +// that IsUnprocessableEntityError will return true for +func NewUnprocessableEntityError() CloudFoundryError { + return CloudFoundryError{ + Code: 10008, + ErrorCode: "CF-UnprocessableEntity", + Description: "%s", + } +} + +// IsUnprocessableEntityError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10008 +// - HTTP code: 422 +// - message: "%s" +func IsUnprocessableEntityError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10008 +} + +// NewUnableToPerformError returns a new CloudFoundryError +// that IsUnableToPerformError will return true for +func NewUnableToPerformError() CloudFoundryError { + return CloudFoundryError{ + Code: 10009, + ErrorCode: "CF-UnableToPerform", + Description: "%s could not be completed: %s", + } +} + +// IsUnableToPerformError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10009 +// - HTTP code: 400 +// - message: "%s could not be completed: %s" +func IsUnableToPerformError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10009 +} + +// NewResourceNotFoundError returns a new CloudFoundryError +// that IsResourceNotFoundError will return true for +func NewResourceNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 10010, + ErrorCode: "CF-ResourceNotFound", + Description: "%s", + } +} + +// IsResourceNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10010 +// - HTTP code: 404 +// - message: "%s" +func IsResourceNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10010 +} + +// NewDatabaseError returns a new CloudFoundryError +// that IsDatabaseError will return true for +func NewDatabaseError() CloudFoundryError { + return CloudFoundryError{ + Code: 10011, + ErrorCode: "CF-DatabaseError", + Description: "Database error", + } +} + +// IsDatabaseError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10011 +// - HTTP code: 500 +// - message: "Database error" +func IsDatabaseError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10011 +} + +// NewOrderByParameterInvalidError returns a new CloudFoundryError +// that IsOrderByParameterInvalidError will return true for +func NewOrderByParameterInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 10012, + ErrorCode: "CF-OrderByParameterInvalid", + Description: "Cannot order by: %s", + } +} + +// IsOrderByParameterInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10012 +// - HTTP code: 500 +// - message: "Cannot order by: %s" +func IsOrderByParameterInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10012 +} + +// NewRateLimitExceededError returns a new CloudFoundryError +// that IsRateLimitExceededError will return true for +func NewRateLimitExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 10013, + ErrorCode: "CF-RateLimitExceeded", + Description: "Rate Limit Exceeded", + } +} + +// IsRateLimitExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10013 +// - HTTP code: 429 +// - message: "Rate Limit Exceeded" +func IsRateLimitExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10013 +} + +// NewIPBasedRateLimitExceededError returns a new CloudFoundryError +// that IsIPBasedRateLimitExceededError will return true for +func NewIPBasedRateLimitExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 10014, + ErrorCode: "CF-IPBasedRateLimitExceeded", + Description: "Rate Limit Exceeded: Unauthenticated requests from this IP address have exceeded the limit. Please log in.", + } +} + +// IsIPBasedRateLimitExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10014 +// - HTTP code: 429 +// - message: "Rate Limit Exceeded: Unauthenticated requests from this IP address have exceeded the limit. Please log in." +func IsIPBasedRateLimitExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10014 +} + +// NewServiceUnavailableError returns a new CloudFoundryError +// that IsServiceUnavailableError will return true for +func NewServiceUnavailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 10015, + ErrorCode: "CF-ServiceUnavailable", + Description: "%s", + } +} + +// IsServiceUnavailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10015 +// - HTTP code: 503 +// - message: "%s" +func IsServiceUnavailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10015 +} + +// NewServiceBrokerRateLimitExceededError returns a new CloudFoundryError +// that IsServiceBrokerRateLimitExceededError will return true for +func NewServiceBrokerRateLimitExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 10016, + ErrorCode: "CF-ServiceBrokerRateLimitExceeded", + Description: "Service broker concurrent request limit exceeded", + } +} + +// IsServiceBrokerRateLimitExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 10016 +// - HTTP code: 429 +// - message: "Service broker concurrent request limit exceeded" +func IsServiceBrokerRateLimitExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 10016 +} + +// NewUserInvalidError returns a new CloudFoundryError +// that IsUserInvalidError will return true for +func NewUserInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 20001, + ErrorCode: "CF-UserInvalid", + Description: "The user info is invalid: %s", + } +} + +// IsUserInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 20001 +// - HTTP code: 400 +// - message: "The user info is invalid: %s" +func IsUserInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 20001 +} + +// NewUaaIdTakenError returns a new CloudFoundryError +// that IsUaaIdTakenError will return true for +func NewUaaIdTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 20002, + ErrorCode: "CF-UaaIdTaken", + Description: "The UAA ID is taken: %s", + } +} + +// IsUaaIdTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 20002 +// - HTTP code: 400 +// - message: "The UAA ID is taken: %s" +func IsUaaIdTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 20002 +} + +// NewUserNotFoundError returns a new CloudFoundryError +// that IsUserNotFoundError will return true for +func NewUserNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 20003, + ErrorCode: "CF-UserNotFound", + Description: "The user could not be found: %s", + } +} + +// IsUserNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 20003 +// - HTTP code: 404 +// - message: "The user could not be found: %s" +func IsUserNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 20003 +} + +// NewUaaUnavailableError returns a new CloudFoundryError +// that IsUaaUnavailableError will return true for +func NewUaaUnavailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 20004, + ErrorCode: "CF-UaaUnavailable", + Description: "The UAA service is currently unavailable", + } +} + +// IsUaaUnavailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 20004 +// - HTTP code: 503 +// - message: "The UAA service is currently unavailable" +func IsUaaUnavailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 20004 +} + +// NewUaaEndpointDisabledError returns a new CloudFoundryError +// that IsUaaEndpointDisabledError will return true for +func NewUaaEndpointDisabledError() CloudFoundryError { + return CloudFoundryError{ + Code: 20005, + ErrorCode: "CF-UaaEndpointDisabled", + Description: "The UAA endpoint needed is disabled", + } +} + +// IsUaaEndpointDisabledError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 20005 +// - HTTP code: 501 +// - message: "The UAA endpoint needed is disabled" +func IsUaaEndpointDisabledError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 20005 +} + +// NewUserIsInMultipleOriginsError returns a new CloudFoundryError +// that IsUserIsInMultipleOriginsError will return true for +func NewUserIsInMultipleOriginsError() CloudFoundryError { + return CloudFoundryError{ + Code: 20006, + ErrorCode: "CF-UserIsInMultipleOrigins", + Description: "The user exists in multiple origins. Specify an origin for the requested user from: %s", + } +} + +// IsUserIsInMultipleOriginsError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 20006 +// - HTTP code: 400 +// - message: "The user exists in multiple origins. Specify an origin for the requested user from: %s" +func IsUserIsInMultipleOriginsError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 20006 +} + +// NewUserWithOriginNotFoundError returns a new CloudFoundryError +// that IsUserWithOriginNotFoundError will return true for +func NewUserWithOriginNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 20007, + ErrorCode: "CF-UserWithOriginNotFound", + Description: "The user could not be found, %s", + } +} + +// IsUserWithOriginNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 20007 +// - HTTP code: 404 +// - message: "The user could not be found, %s" +func IsUserWithOriginNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 20007 +} + +// NewOutOfRouterGroupPortsError returns a new CloudFoundryError +// that IsOutOfRouterGroupPortsError will return true for +func NewOutOfRouterGroupPortsError() CloudFoundryError { + return CloudFoundryError{ + Code: 21008, + ErrorCode: "CF-OutOfRouterGroupPorts", + Description: "There are no more ports available for router group: %s. Please contact your administrator for more information.", + } +} + +// IsOutOfRouterGroupPortsError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 21008 +// - HTTP code: 403 +// - message: "There are no more ports available for router group: %s. Please contact your administrator for more information." +func IsOutOfRouterGroupPortsError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 21008 +} + +// NewOrganizationInvalidError returns a new CloudFoundryError +// that IsOrganizationInvalidError will return true for +func NewOrganizationInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 30001, + ErrorCode: "CF-OrganizationInvalid", + Description: "The organization info is invalid: %s", + } +} + +// IsOrganizationInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 30001 +// - HTTP code: 400 +// - message: "The organization info is invalid: %s" +func IsOrganizationInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 30001 +} + +// NewOrganizationNameTakenError returns a new CloudFoundryError +// that IsOrganizationNameTakenError will return true for +func NewOrganizationNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 30002, + ErrorCode: "CF-OrganizationNameTaken", + Description: "The organization name is taken: %s", + } +} + +// IsOrganizationNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 30002 +// - HTTP code: 400 +// - message: "The organization name is taken: %s" +func IsOrganizationNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 30002 +} + +// NewOrganizationNotFoundError returns a new CloudFoundryError +// that IsOrganizationNotFoundError will return true for +func NewOrganizationNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 30003, + ErrorCode: "CF-OrganizationNotFound", + Description: "The organization could not be found: %s", + } +} + +// IsOrganizationNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 30003 +// - HTTP code: 404 +// - message: "The organization could not be found: %s" +func IsOrganizationNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 30003 +} + +// NewLastManagerInOrgError returns a new CloudFoundryError +// that IsLastManagerInOrgError will return true for +func NewLastManagerInOrgError() CloudFoundryError { + return CloudFoundryError{ + Code: 30004, + ErrorCode: "CF-LastManagerInOrg", + Description: "Cannot remove last Org Manager in org", + } +} + +// IsLastManagerInOrgError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 30004 +// - HTTP code: 403 +// - message: "Cannot remove last Org Manager in org" +func IsLastManagerInOrgError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 30004 +} + +// NewLastBillingManagerInOrgError returns a new CloudFoundryError +// that IsLastBillingManagerInOrgError will return true for +func NewLastBillingManagerInOrgError() CloudFoundryError { + return CloudFoundryError{ + Code: 30005, + ErrorCode: "CF-LastBillingManagerInOrg", + Description: "Cannot remove last Billing Manager in org", + } +} + +// IsLastBillingManagerInOrgError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 30005 +// - HTTP code: 403 +// - message: "Cannot remove last Billing Manager in org" +func IsLastBillingManagerInOrgError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 30005 +} + +// NewLastUserInOrgError returns a new CloudFoundryError +// that IsLastUserInOrgError will return true for +func NewLastUserInOrgError() CloudFoundryError { + return CloudFoundryError{ + Code: 30006, + ErrorCode: "CF-LastUserInOrg", + Description: "Cannot remove last User in org", + } +} + +// IsLastUserInOrgError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 30006 +// - HTTP code: 403 +// - message: "Cannot remove last User in org" +func IsLastUserInOrgError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 30006 +} + +// NewOrganizationAlreadySetError returns a new CloudFoundryError +// that IsOrganizationAlreadySetError will return true for +func NewOrganizationAlreadySetError() CloudFoundryError { + return CloudFoundryError{ + Code: 30007, + ErrorCode: "CF-OrganizationAlreadySet", + Description: "Cannot change organization", + } +} + +// IsOrganizationAlreadySetError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 30007 +// - HTTP code: 400 +// - message: "Cannot change organization" +func IsOrganizationAlreadySetError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 30007 +} + +// NewSpaceInvalidError returns a new CloudFoundryError +// that IsSpaceInvalidError will return true for +func NewSpaceInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 40001, + ErrorCode: "CF-SpaceInvalid", + Description: "The app space info is invalid: %s", + } +} + +// IsSpaceInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 40001 +// - HTTP code: 400 +// - message: "The app space info is invalid: %s" +func IsSpaceInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 40001 +} + +// NewSpaceNameTakenError returns a new CloudFoundryError +// that IsSpaceNameTakenError will return true for +func NewSpaceNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 40002, + ErrorCode: "CF-SpaceNameTaken", + Description: "The app space name is taken: %s", + } +} + +// IsSpaceNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 40002 +// - HTTP code: 400 +// - message: "The app space name is taken: %s" +func IsSpaceNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 40002 +} + +// NewSpaceUserNotInOrgError returns a new CloudFoundryError +// that IsSpaceUserNotInOrgError will return true for +func NewSpaceUserNotInOrgError() CloudFoundryError { + return CloudFoundryError{ + Code: 40003, + ErrorCode: "CF-SpaceUserNotInOrg", + Description: "The app space and the user are not in the same org: %s", + } +} + +// IsSpaceUserNotInOrgError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 40003 +// - HTTP code: 400 +// - message: "The app space and the user are not in the same org: %s" +func IsSpaceUserNotInOrgError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 40003 +} + +// NewSpaceNotFoundError returns a new CloudFoundryError +// that IsSpaceNotFoundError will return true for +func NewSpaceNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 40004, + ErrorCode: "CF-SpaceNotFound", + Description: "The app space could not be found: %s", + } +} + +// IsSpaceNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 40004 +// - HTTP code: 404 +// - message: "The app space could not be found: %s" +func IsSpaceNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 40004 +} + +// NewServiceInstanceNameEmptyError returns a new CloudFoundryError +// that IsServiceInstanceNameEmptyError will return true for +func NewServiceInstanceNameEmptyError() CloudFoundryError { + return CloudFoundryError{ + Code: 60001, + ErrorCode: "CF-ServiceInstanceNameEmpty", + Description: "Service instance name is required.", + } +} + +// IsServiceInstanceNameEmptyError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60001 +// - HTTP code: 400 +// - message: "Service instance name is required." +func IsServiceInstanceNameEmptyError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60001 +} + +// NewServiceInstanceNameTakenError returns a new CloudFoundryError +// that IsServiceInstanceNameTakenError will return true for +func NewServiceInstanceNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 60002, + ErrorCode: "CF-ServiceInstanceNameTaken", + Description: "The service instance name is taken: %s", + } +} + +// IsServiceInstanceNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60002 +// - HTTP code: 400 +// - message: "The service instance name is taken: %s" +func IsServiceInstanceNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60002 +} + +// NewServiceInstanceInvalidError returns a new CloudFoundryError +// that IsServiceInstanceInvalidError will return true for +func NewServiceInstanceInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 60003, + ErrorCode: "CF-ServiceInstanceInvalid", + Description: "The service instance is invalid: %s", + } +} + +// IsServiceInstanceInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60003 +// - HTTP code: 400 +// - message: "The service instance is invalid: %s" +func IsServiceInstanceInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60003 +} + +// NewServiceInstanceNotFoundError returns a new CloudFoundryError +// that IsServiceInstanceNotFoundError will return true for +func NewServiceInstanceNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 60004, + ErrorCode: "CF-ServiceInstanceNotFound", + Description: "The service instance could not be found: %s", + } +} + +// IsServiceInstanceNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60004 +// - HTTP code: 404 +// - message: "The service instance could not be found: %s" +func IsServiceInstanceNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60004 +} + +// NewServiceInstanceQuotaExceededError returns a new CloudFoundryError +// that IsServiceInstanceQuotaExceededError will return true for +func NewServiceInstanceQuotaExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 60005, + ErrorCode: "CF-ServiceInstanceQuotaExceeded", + Description: "You have exceeded your organization's services limit.", + } +} + +// IsServiceInstanceQuotaExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60005 +// - HTTP code: 400 +// - message: "You have exceeded your organization's services limit." +func IsServiceInstanceQuotaExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60005 +} + +// NewPreviouslyUsedAs_ServiceInstancePaidQuotaExceededError returns a new CloudFoundryError +// that IsPreviouslyUsedAs_ServiceInstancePaidQuotaExceededError will return true for +func NewPreviouslyUsedAs_ServiceInstancePaidQuotaExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 60006, + ErrorCode: "CF-PreviouslyUsedAs_ServiceInstancePaidQuotaExceeded", + Description: "You have exceeded your organization's services limit.", + } +} + +// IsPreviouslyUsedAs_ServiceInstancePaidQuotaExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60006 +// - HTTP code: 400 +// - message: "You have exceeded your organization's services limit." +func IsPreviouslyUsedAs_ServiceInstancePaidQuotaExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60006 +} + +// NewServiceInstanceServicePlanNotAllowedError returns a new CloudFoundryError +// that IsServiceInstanceServicePlanNotAllowedError will return true for +func NewServiceInstanceServicePlanNotAllowedError() CloudFoundryError { + return CloudFoundryError{ + Code: 60007, + ErrorCode: "CF-ServiceInstanceServicePlanNotAllowed", + Description: "The service instance cannot be created because paid service plans are not allowed.", + } +} + +// IsServiceInstanceServicePlanNotAllowedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60007 +// - HTTP code: 400 +// - message: "The service instance cannot be created because paid service plans are not allowed." +func IsServiceInstanceServicePlanNotAllowedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60007 +} + +// NewServiceInstanceDuplicateNotAllowedError returns a new CloudFoundryError +// that IsServiceInstanceDuplicateNotAllowedError will return true for +func NewServiceInstanceDuplicateNotAllowedError() CloudFoundryError { + return CloudFoundryError{ + Code: 60008, + ErrorCode: "CF-ServiceInstanceDuplicateNotAllowed", + Description: "An instance of this service is already present in this space. Some services only support one instance per space.", + } +} + +// IsServiceInstanceDuplicateNotAllowedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60008 +// - HTTP code: 400 +// - message: "An instance of this service is already present in this space. Some services only support one instance per space." +func IsServiceInstanceDuplicateNotAllowedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60008 +} + +// NewServiceInstanceNameTooLongError returns a new CloudFoundryError +// that IsServiceInstanceNameTooLongError will return true for +func NewServiceInstanceNameTooLongError() CloudFoundryError { + return CloudFoundryError{ + Code: 60009, + ErrorCode: "CF-ServiceInstanceNameTooLong", + Description: "You have requested an invalid service instance name. Names are limited to 255 characters.", + } +} + +// IsServiceInstanceNameTooLongError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60009 +// - HTTP code: 400 +// - message: "You have requested an invalid service instance name. Names are limited to 255 characters." +func IsServiceInstanceNameTooLongError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60009 +} + +// NewServiceInstanceOrganizationNotAuthorizedError returns a new CloudFoundryError +// that IsServiceInstanceOrganizationNotAuthorizedError will return true for +func NewServiceInstanceOrganizationNotAuthorizedError() CloudFoundryError { + return CloudFoundryError{ + Code: 60010, + ErrorCode: "CF-ServiceInstanceOrganizationNotAuthorized", + Description: "A service instance for the selected plan cannot be created in this organization. The plan is visible because another organization you belong to has access to it.", + } +} + +// IsServiceInstanceOrganizationNotAuthorizedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60010 +// - HTTP code: 403 +// - message: "A service instance for the selected plan cannot be created in this organization. The plan is visible because another organization you belong to has access to it." +func IsServiceInstanceOrganizationNotAuthorizedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60010 +} + +// NewServiceInstanceDeprovisionFailedError returns a new CloudFoundryError +// that IsServiceInstanceDeprovisionFailedError will return true for +func NewServiceInstanceDeprovisionFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 60011, + ErrorCode: "CF-ServiceInstanceDeprovisionFailed", + Description: "The service broker reported an error during deprovisioning: %s", + } +} + +// IsServiceInstanceDeprovisionFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60011 +// - HTTP code: 409 +// - message: "The service broker reported an error during deprovisioning: %s" +func IsServiceInstanceDeprovisionFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60011 +} + +// NewServiceInstanceSpaceQuotaExceededError returns a new CloudFoundryError +// that IsServiceInstanceSpaceQuotaExceededError will return true for +func NewServiceInstanceSpaceQuotaExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 60012, + ErrorCode: "CF-ServiceInstanceSpaceQuotaExceeded", + Description: "You have exceeded your space's services limit.", + } +} + +// IsServiceInstanceSpaceQuotaExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60012 +// - HTTP code: 400 +// - message: "You have exceeded your space's services limit." +func IsServiceInstanceSpaceQuotaExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60012 +} + +// NewServiceInstanceServicePlanNotAllowedBySpaceQuotaError returns a new CloudFoundryError +// that IsServiceInstanceServicePlanNotAllowedBySpaceQuotaError will return true for +func NewServiceInstanceServicePlanNotAllowedBySpaceQuotaError() CloudFoundryError { + return CloudFoundryError{ + Code: 60013, + ErrorCode: "CF-ServiceInstanceServicePlanNotAllowedBySpaceQuota", + Description: "The service instance cannot be created because paid service plans are not allowed for your space.", + } +} + +// IsServiceInstanceServicePlanNotAllowedBySpaceQuotaError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60013 +// - HTTP code: 400 +// - message: "The service instance cannot be created because paid service plans are not allowed for your space." +func IsServiceInstanceServicePlanNotAllowedBySpaceQuotaError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60013 +} + +// NewServiceInstanceSpaceChangeNotAllowedError returns a new CloudFoundryError +// that IsServiceInstanceSpaceChangeNotAllowedError will return true for +func NewServiceInstanceSpaceChangeNotAllowedError() CloudFoundryError { + return CloudFoundryError{ + Code: 60014, + ErrorCode: "CF-ServiceInstanceSpaceChangeNotAllowed", + Description: "Cannot update space for service instance.", + } +} + +// IsServiceInstanceSpaceChangeNotAllowedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60014 +// - HTTP code: 400 +// - message: "Cannot update space for service instance." +func IsServiceInstanceSpaceChangeNotAllowedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60014 +} + +// NewServiceInstanceTagsTooLongError returns a new CloudFoundryError +// that IsServiceInstanceTagsTooLongError will return true for +func NewServiceInstanceTagsTooLongError() CloudFoundryError { + return CloudFoundryError{ + Code: 60015, + ErrorCode: "CF-ServiceInstanceTagsTooLong", + Description: "Combined length of tags for service %s must be 2048 characters or less.", + } +} + +// IsServiceInstanceTagsTooLongError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60015 +// - HTTP code: 400 +// - message: "Combined length of tags for service %s must be 2048 characters or less." +func IsServiceInstanceTagsTooLongError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60015 +} + +// NewAsyncServiceInstanceOperationInProgressError returns a new CloudFoundryError +// that IsAsyncServiceInstanceOperationInProgressError will return true for +func NewAsyncServiceInstanceOperationInProgressError() CloudFoundryError { + return CloudFoundryError{ + Code: 60016, + ErrorCode: "CF-AsyncServiceInstanceOperationInProgress", + Description: "An operation for service instance %s is in progress.", + } +} + +// IsAsyncServiceInstanceOperationInProgressError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60016 +// - HTTP code: 409 +// - message: "An operation for service instance %s is in progress." +func IsAsyncServiceInstanceOperationInProgressError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60016 +} + +// NewServiceInstanceRouteBindingSpaceMismatchError returns a new CloudFoundryError +// that IsServiceInstanceRouteBindingSpaceMismatchError will return true for +func NewServiceInstanceRouteBindingSpaceMismatchError() CloudFoundryError { + return CloudFoundryError{ + Code: 60017, + ErrorCode: "CF-ServiceInstanceRouteBindingSpaceMismatch", + Description: "The service instance and the route are in different spaces.", + } +} + +// IsServiceInstanceRouteBindingSpaceMismatchError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60017 +// - HTTP code: 400 +// - message: "The service instance and the route are in different spaces." +func IsServiceInstanceRouteBindingSpaceMismatchError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60017 +} + +// NewServiceInstanceSpaceNotAuthorizedError returns a new CloudFoundryError +// that IsServiceInstanceSpaceNotAuthorizedError will return true for +func NewServiceInstanceSpaceNotAuthorizedError() CloudFoundryError { + return CloudFoundryError{ + Code: 60018, + ErrorCode: "CF-ServiceInstanceSpaceNotAuthorized", + Description: "A service instance for the selected plan cannot be created in this space.", + } +} + +// IsServiceInstanceSpaceNotAuthorizedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60018 +// - HTTP code: 403 +// - message: "A service instance for the selected plan cannot be created in this space." +func IsServiceInstanceSpaceNotAuthorizedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60018 +} + +// NewServiceInstanceRouteServiceURLInvalidError returns a new CloudFoundryError +// that IsServiceInstanceRouteServiceURLInvalidError will return true for +func NewServiceInstanceRouteServiceURLInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 60019, + ErrorCode: "CF-ServiceInstanceRouteServiceURLInvalid", + Description: "The route service URL is invalid: %s", + } +} + +// IsServiceInstanceRouteServiceURLInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60019 +// - HTTP code: 400 +// - message: "The route service URL is invalid: %s" +func IsServiceInstanceRouteServiceURLInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60019 +} + +// NewServiceInstanceRouteServiceRequiresDiegoError returns a new CloudFoundryError +// that IsServiceInstanceRouteServiceRequiresDiegoError will return true for +func NewServiceInstanceRouteServiceRequiresDiegoError() CloudFoundryError { + return CloudFoundryError{ + Code: 60020, + ErrorCode: "CF-ServiceInstanceRouteServiceRequiresDiego", + Description: "Route services are only supported for apps on Diego. Unbind the service instance from the route or enable Diego for the app.", + } +} + +// IsServiceInstanceRouteServiceRequiresDiegoError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60020 +// - HTTP code: 400 +// - message: "Route services are only supported for apps on Diego. Unbind the service instance from the route or enable Diego for the app." +func IsServiceInstanceRouteServiceRequiresDiegoError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60020 +} + +// NewServiceInstanceRouteServiceDisabledError returns a new CloudFoundryError +// that IsServiceInstanceRouteServiceDisabledError will return true for +func NewServiceInstanceRouteServiceDisabledError() CloudFoundryError { + return CloudFoundryError{ + Code: 60021, + ErrorCode: "CF-ServiceInstanceRouteServiceDisabled", + Description: "Support for route services is disabled", + } +} + +// IsServiceInstanceRouteServiceDisabledError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60021 +// - HTTP code: 403 +// - message: "Support for route services is disabled" +func IsServiceInstanceRouteServiceDisabledError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60021 +} + +// NewAppPortMappingRequiresDiegoError returns a new CloudFoundryError +// that IsAppPortMappingRequiresDiegoError will return true for +func NewAppPortMappingRequiresDiegoError() CloudFoundryError { + return CloudFoundryError{ + Code: 60022, + ErrorCode: "CF-AppPortMappingRequiresDiego", + Description: "App ports are supported for Diego apps only.", + } +} + +// IsAppPortMappingRequiresDiegoError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60022 +// - HTTP code: 400 +// - message: "App ports are supported for Diego apps only." +func IsAppPortMappingRequiresDiegoError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60022 +} + +// NewRoutePortNotEnabledOnAppError returns a new CloudFoundryError +// that IsRoutePortNotEnabledOnAppError will return true for +func NewRoutePortNotEnabledOnAppError() CloudFoundryError { + return CloudFoundryError{ + Code: 60023, + ErrorCode: "CF-RoutePortNotEnabledOnApp", + Description: "Routes can only be mapped to ports already enabled for the application.", + } +} + +// IsRoutePortNotEnabledOnAppError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60023 +// - HTTP code: 400 +// - message: "Routes can only be mapped to ports already enabled for the application." +func IsRoutePortNotEnabledOnAppError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60023 +} + +// NewMultipleAppPortsMappedDiegoToDeaError returns a new CloudFoundryError +// that IsMultipleAppPortsMappedDiegoToDeaError will return true for +func NewMultipleAppPortsMappedDiegoToDeaError() CloudFoundryError { + return CloudFoundryError{ + Code: 60024, + ErrorCode: "CF-MultipleAppPortsMappedDiegoToDea", + Description: "The app has routes mapped to multiple ports. Multiple ports are supported for Diego only. Please unmap routes from all but one app port. Multiple routes can be mapped to the same port if desired.", + } +} + +// IsMultipleAppPortsMappedDiegoToDeaError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60024 +// - HTTP code: 400 +// - message: "The app has routes mapped to multiple ports. Multiple ports are supported for Diego only. Please unmap routes from all but one app port. Multiple routes can be mapped to the same port if desired." +func IsMultipleAppPortsMappedDiegoToDeaError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60024 +} + +// NewVolumeMountServiceDisabledError returns a new CloudFoundryError +// that IsVolumeMountServiceDisabledError will return true for +func NewVolumeMountServiceDisabledError() CloudFoundryError { + return CloudFoundryError{ + Code: 60025, + ErrorCode: "CF-VolumeMountServiceDisabled", + Description: "Support for volume mount services is disabled", + } +} + +// IsVolumeMountServiceDisabledError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60025 +// - HTTP code: 403 +// - message: "Support for volume mount services is disabled" +func IsVolumeMountServiceDisabledError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60025 +} + +// NewDockerAppToDeaError returns a new CloudFoundryError +// that IsDockerAppToDeaError will return true for +func NewDockerAppToDeaError() CloudFoundryError { + return CloudFoundryError{ + Code: 60026, + ErrorCode: "CF-DockerAppToDea", + Description: "Docker apps cannot run on DEAs", + } +} + +// IsDockerAppToDeaError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60026 +// - HTTP code: 400 +// - message: "Docker apps cannot run on DEAs" +func IsDockerAppToDeaError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60026 +} + +// NewServiceInstanceRecursiveDeleteFailedError returns a new CloudFoundryError +// that IsServiceInstanceRecursiveDeleteFailedError will return true for +func NewServiceInstanceRecursiveDeleteFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 60027, + ErrorCode: "CF-ServiceInstanceRecursiveDeleteFailed", + Description: "Deletion of service instance %s failed because one or more associated resources could not be deleted.%s", + } +} + +// IsServiceInstanceRecursiveDeleteFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60027 +// - HTTP code: 502 +// - message: "Deletion of service instance %s failed because one or more associated resources could not be deleted.\n\n%s" +func IsServiceInstanceRecursiveDeleteFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60027 +} + +// NewManagedServiceInstanceNotFoundError returns a new CloudFoundryError +// that IsManagedServiceInstanceNotFoundError will return true for +func NewManagedServiceInstanceNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 60028, + ErrorCode: "CF-ManagedServiceInstanceNotFound", + Description: "The service instance could not be found: %s", + } +} + +// IsManagedServiceInstanceNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60028 +// - HTTP code: 404 +// - message: "The service instance could not be found: %s" +func IsManagedServiceInstanceNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60028 +} + +// NewServiceInstanceWithInaccessiblePlanNotUpdateableError returns a new CloudFoundryError +// that IsServiceInstanceWithInaccessiblePlanNotUpdateableError will return true for +func NewServiceInstanceWithInaccessiblePlanNotUpdateableError() CloudFoundryError { + return CloudFoundryError{ + Code: 60029, + ErrorCode: "CF-ServiceInstanceWithInaccessiblePlanNotUpdateable", + Description: "Cannot update %s of a service instance that belongs to inaccessible plan", + } +} + +// IsServiceInstanceWithInaccessiblePlanNotUpdateableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60029 +// - HTTP code: 403 +// - message: "Cannot update %s of a service instance that belongs to inaccessible plan" +func IsServiceInstanceWithInaccessiblePlanNotUpdateableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60029 +} + +// NewServiceInstanceProvisionFailedError returns a new CloudFoundryError +// that IsServiceInstanceProvisionFailedError will return true for +func NewServiceInstanceProvisionFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 60030, + ErrorCode: "CF-ServiceInstanceProvisionFailed", + Description: "The service broker reported an error during provisioning: %s", + } +} + +// IsServiceInstanceProvisionFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 60030 +// - HTTP code: 400 +// - message: "The service broker reported an error during provisioning: %s" +func IsServiceInstanceProvisionFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 60030 +} + +// NewRuntimeInvalidError returns a new CloudFoundryError +// that IsRuntimeInvalidError will return true for +func NewRuntimeInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 70001, + ErrorCode: "CF-RuntimeInvalid", + Description: "The runtime is invalid: %s", + } +} + +// IsRuntimeInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 70001 +// - HTTP code: 400 +// - message: "The runtime is invalid: %s" +func IsRuntimeInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 70001 +} + +// NewRuntimeNameTakenError returns a new CloudFoundryError +// that IsRuntimeNameTakenError will return true for +func NewRuntimeNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 70002, + ErrorCode: "CF-RuntimeNameTaken", + Description: "The runtime name is taken: %s", + } +} + +// IsRuntimeNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 70002 +// - HTTP code: 400 +// - message: "The runtime name is taken: %s" +func IsRuntimeNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 70002 +} + +// NewRuntimeNotFoundError returns a new CloudFoundryError +// that IsRuntimeNotFoundError will return true for +func NewRuntimeNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 70003, + ErrorCode: "CF-RuntimeNotFound", + Description: "The runtime could not be found: %s", + } +} + +// IsRuntimeNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 70003 +// - HTTP code: 404 +// - message: "The runtime could not be found: %s" +func IsRuntimeNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 70003 +} + +// NewFrameworkInvalidError returns a new CloudFoundryError +// that IsFrameworkInvalidError will return true for +func NewFrameworkInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 80001, + ErrorCode: "CF-FrameworkInvalid", + Description: "The framework is invalid: %s", + } +} + +// IsFrameworkInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 80001 +// - HTTP code: 400 +// - message: "The framework is invalid: %s" +func IsFrameworkInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 80001 +} + +// NewFrameworkNameTakenError returns a new CloudFoundryError +// that IsFrameworkNameTakenError will return true for +func NewFrameworkNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 80002, + ErrorCode: "CF-FrameworkNameTaken", + Description: "The framework name is taken: %s", + } +} + +// IsFrameworkNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 80002 +// - HTTP code: 400 +// - message: "The framework name is taken: %s" +func IsFrameworkNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 80002 +} + +// NewFrameworkNotFoundError returns a new CloudFoundryError +// that IsFrameworkNotFoundError will return true for +func NewFrameworkNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 80003, + ErrorCode: "CF-FrameworkNotFound", + Description: "The framework could not be found: %s", + } +} + +// IsFrameworkNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 80003 +// - HTTP code: 404 +// - message: "The framework could not be found: %s" +func IsFrameworkNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 80003 +} + +// NewServiceBindingInvalidError returns a new CloudFoundryError +// that IsServiceBindingInvalidError will return true for +func NewServiceBindingInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 90001, + ErrorCode: "CF-ServiceBindingInvalid", + Description: "The service binding is invalid: %s", + } +} + +// IsServiceBindingInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 90001 +// - HTTP code: 400 +// - message: "The service binding is invalid: %s" +func IsServiceBindingInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 90001 +} + +// NewServiceBindingDifferentSpacesError returns a new CloudFoundryError +// that IsServiceBindingDifferentSpacesError will return true for +func NewServiceBindingDifferentSpacesError() CloudFoundryError { + return CloudFoundryError{ + Code: 90002, + ErrorCode: "CF-ServiceBindingDifferentSpaces", + Description: "The app and the service are not in the same app space: %s", + } +} + +// IsServiceBindingDifferentSpacesError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 90002 +// - HTTP code: 400 +// - message: "The app and the service are not in the same app space: %s" +func IsServiceBindingDifferentSpacesError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 90002 +} + +// NewServiceBindingAppServiceTakenError returns a new CloudFoundryError +// that IsServiceBindingAppServiceTakenError will return true for +func NewServiceBindingAppServiceTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 90003, + ErrorCode: "CF-ServiceBindingAppServiceTaken", + Description: "%s", + } +} + +// IsServiceBindingAppServiceTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 90003 +// - HTTP code: 400 +// - message: "%s" +func IsServiceBindingAppServiceTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 90003 +} + +// NewServiceBindingNotFoundError returns a new CloudFoundryError +// that IsServiceBindingNotFoundError will return true for +func NewServiceBindingNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 90004, + ErrorCode: "CF-ServiceBindingNotFound", + Description: "The service binding could not be found: %s", + } +} + +// IsServiceBindingNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 90004 +// - HTTP code: 404 +// - message: "The service binding could not be found: %s" +func IsServiceBindingNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 90004 +} + +// NewUnbindableServiceError returns a new CloudFoundryError +// that IsUnbindableServiceError will return true for +func NewUnbindableServiceError() CloudFoundryError { + return CloudFoundryError{ + Code: 90005, + ErrorCode: "CF-UnbindableService", + Description: "The service instance doesn't support binding.", + } +} + +// IsUnbindableServiceError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 90005 +// - HTTP code: 400 +// - message: "The service instance doesn't support binding." +func IsUnbindableServiceError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 90005 +} + +// NewInvalidLoggingServiceBindingError returns a new CloudFoundryError +// that IsInvalidLoggingServiceBindingError will return true for +func NewInvalidLoggingServiceBindingError() CloudFoundryError { + return CloudFoundryError{ + Code: 90006, + ErrorCode: "CF-InvalidLoggingServiceBinding", + Description: "The service is attempting to stream logs from your application, but is not registered as a logging service. Please contact the service provider.", + } +} + +// IsInvalidLoggingServiceBindingError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 90006 +// - HTTP code: 502 +// - message: "The service is attempting to stream logs from your application, but is not registered as a logging service. Please contact the service provider." +func IsInvalidLoggingServiceBindingError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 90006 +} + +// NewServiceFetchBindingParametersNotSupportedError returns a new CloudFoundryError +// that IsServiceFetchBindingParametersNotSupportedError will return true for +func NewServiceFetchBindingParametersNotSupportedError() CloudFoundryError { + return CloudFoundryError{ + Code: 90007, + ErrorCode: "CF-ServiceFetchBindingParametersNotSupported", + Description: "This service does not support fetching service binding parameters.", + } +} + +// IsServiceFetchBindingParametersNotSupportedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 90007 +// - HTTP code: 400 +// - message: "This service does not support fetching service binding parameters." +func IsServiceFetchBindingParametersNotSupportedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 90007 +} + +// NewAsyncServiceBindingOperationInProgressError returns a new CloudFoundryError +// that IsAsyncServiceBindingOperationInProgressError will return true for +func NewAsyncServiceBindingOperationInProgressError() CloudFoundryError { + return CloudFoundryError{ + Code: 90008, + ErrorCode: "CF-AsyncServiceBindingOperationInProgress", + Description: "An operation for the service binding between app %s and service instance %s is in progress.", + } +} + +// IsAsyncServiceBindingOperationInProgressError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 90008 +// - HTTP code: 409 +// - message: "An operation for the service binding between app %s and service instance %s is in progress." +func IsAsyncServiceBindingOperationInProgressError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 90008 +} + +// NewAppInvalidError returns a new CloudFoundryError +// that IsAppInvalidError will return true for +func NewAppInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 100001, + ErrorCode: "CF-AppInvalid", + Description: "The app is invalid: %s", + } +} + +// IsAppInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 100001 +// - HTTP code: 400 +// - message: "The app is invalid: %s" +func IsAppInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 100001 +} + +// NewAppNameTakenError returns a new CloudFoundryError +// that IsAppNameTakenError will return true for +func NewAppNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 100002, + ErrorCode: "CF-AppNameTaken", + Description: "The app name is taken: %s", + } +} + +// IsAppNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 100002 +// - HTTP code: 400 +// - message: "The app name is taken: %s" +func IsAppNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 100002 +} + +// NewAppNotFoundError returns a new CloudFoundryError +// that IsAppNotFoundError will return true for +func NewAppNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 100004, + ErrorCode: "CF-AppNotFound", + Description: "The app could not be found: %s", + } +} + +// IsAppNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 100004 +// - HTTP code: 404 +// - message: "The app could not be found: %s" +func IsAppNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 100004 +} + +// NewAppMemoryQuotaExceededError returns a new CloudFoundryError +// that IsAppMemoryQuotaExceededError will return true for +func NewAppMemoryQuotaExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 100005, + ErrorCode: "CF-AppMemoryQuotaExceeded", + Description: "You have exceeded your organization's memory limit: %s", + } +} + +// IsAppMemoryQuotaExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 100005 +// - HTTP code: 400 +// - message: "You have exceeded your organization's memory limit: %s" +func IsAppMemoryQuotaExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 100005 +} + +// NewAppMemoryInvalidError returns a new CloudFoundryError +// that IsAppMemoryInvalidError will return true for +func NewAppMemoryInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 100006, + ErrorCode: "CF-AppMemoryInvalid", + Description: "You have specified an invalid amount of memory for your application.", + } +} + +// IsAppMemoryInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 100006 +// - HTTP code: 400 +// - message: "You have specified an invalid amount of memory for your application." +func IsAppMemoryInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 100006 +} + +// NewQuotaInstanceMemoryLimitExceededError returns a new CloudFoundryError +// that IsQuotaInstanceMemoryLimitExceededError will return true for +func NewQuotaInstanceMemoryLimitExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 100007, + ErrorCode: "CF-QuotaInstanceMemoryLimitExceeded", + Description: "You have exceeded the instance memory limit for your organization's quota.", + } +} + +// IsQuotaInstanceMemoryLimitExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 100007 +// - HTTP code: 400 +// - message: "You have exceeded the instance memory limit for your organization's quota." +func IsQuotaInstanceMemoryLimitExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 100007 +} + +// NewQuotaInstanceLimitExceededError returns a new CloudFoundryError +// that IsQuotaInstanceLimitExceededError will return true for +func NewQuotaInstanceLimitExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 100008, + ErrorCode: "CF-QuotaInstanceLimitExceeded", + Description: "You have exceeded the instance limit for your organization's quota.", + } +} + +// IsQuotaInstanceLimitExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 100008 +// - HTTP code: 400 +// - message: "You have exceeded the instance limit for your organization's quota." +func IsQuotaInstanceLimitExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 100008 +} + +// NewAppMemoryInsufficientForSidecarsError returns a new CloudFoundryError +// that IsAppMemoryInsufficientForSidecarsError will return true for +func NewAppMemoryInsufficientForSidecarsError() CloudFoundryError { + return CloudFoundryError{ + Code: 100009, + ErrorCode: "CF-AppMemoryInsufficientForSidecars", + Description: "The requested memory allocation is not large enough to run all of your sidecar processes.", + } +} + +// IsAppMemoryInsufficientForSidecarsError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 100009 +// - HTTP code: 400 +// - message: "The requested memory allocation is not large enough to run all of your sidecar processes." +func IsAppMemoryInsufficientForSidecarsError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 100009 +} + +// NewServicePlanInvalidError returns a new CloudFoundryError +// that IsServicePlanInvalidError will return true for +func NewServicePlanInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 110001, + ErrorCode: "CF-ServicePlanInvalid", + Description: "The service plan is invalid: %s", + } +} + +// IsServicePlanInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 110001 +// - HTTP code: 400 +// - message: "The service plan is invalid: %s" +func IsServicePlanInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 110001 +} + +// NewServicePlanNameTakenError returns a new CloudFoundryError +// that IsServicePlanNameTakenError will return true for +func NewServicePlanNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 110002, + ErrorCode: "CF-ServicePlanNameTaken", + Description: "The service plan name is taken: %s", + } +} + +// IsServicePlanNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 110002 +// - HTTP code: 400 +// - message: "The service plan name is taken: %s" +func IsServicePlanNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 110002 +} + +// NewServicePlanNotFoundError returns a new CloudFoundryError +// that IsServicePlanNotFoundError will return true for +func NewServicePlanNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 110003, + ErrorCode: "CF-ServicePlanNotFound", + Description: "The service plan could not be found: %s", + } +} + +// IsServicePlanNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 110003 +// - HTTP code: 404 +// - message: "The service plan could not be found: %s" +func IsServicePlanNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 110003 +} + +// NewServicePlanNotUpdateableError returns a new CloudFoundryError +// that IsServicePlanNotUpdateableError will return true for +func NewServicePlanNotUpdateableError() CloudFoundryError { + return CloudFoundryError{ + Code: 110004, + ErrorCode: "CF-ServicePlanNotUpdateable", + Description: "The service does not support changing plans.", + } +} + +// IsServicePlanNotUpdateableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 110004 +// - HTTP code: 400 +// - message: "The service does not support changing plans." +func IsServicePlanNotUpdateableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 110004 +} + +// NewServiceInvalidError returns a new CloudFoundryError +// that IsServiceInvalidError will return true for +func NewServiceInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 120001, + ErrorCode: "CF-ServiceInvalid", + Description: "The service is invalid: %s", + } +} + +// IsServiceInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 120001 +// - HTTP code: 400 +// - message: "The service is invalid: %s" +func IsServiceInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 120001 +} + +// NewServiceLabelTakenError returns a new CloudFoundryError +// that IsServiceLabelTakenError will return true for +func NewServiceLabelTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 120002, + ErrorCode: "CF-ServiceLabelTaken", + Description: "The service label is taken: %s", + } +} + +// IsServiceLabelTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 120002 +// - HTTP code: 400 +// - message: "The service label is taken: %s" +func IsServiceLabelTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 120002 +} + +// NewServiceNotFoundError returns a new CloudFoundryError +// that IsServiceNotFoundError will return true for +func NewServiceNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 120003, + ErrorCode: "CF-ServiceNotFound", + Description: "The service could not be found: %s", + } +} + +// IsServiceNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 120003 +// - HTTP code: 404 +// - message: "The service could not be found: %s" +func IsServiceNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 120003 +} + +// NewServiceFetchInstanceParametersNotSupportedError returns a new CloudFoundryError +// that IsServiceFetchInstanceParametersNotSupportedError will return true for +func NewServiceFetchInstanceParametersNotSupportedError() CloudFoundryError { + return CloudFoundryError{ + Code: 120004, + ErrorCode: "CF-ServiceFetchInstanceParametersNotSupported", + Description: "This service does not support fetching service instance parameters.", + } +} + +// IsServiceFetchInstanceParametersNotSupportedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 120004 +// - HTTP code: 400 +// - message: "This service does not support fetching service instance parameters." +func IsServiceFetchInstanceParametersNotSupportedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 120004 +} + +// NewDomainInvalidError returns a new CloudFoundryError +// that IsDomainInvalidError will return true for +func NewDomainInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 130001, + ErrorCode: "CF-DomainInvalid", + Description: "The domain is invalid: %s", + } +} + +// IsDomainInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 130001 +// - HTTP code: 400 +// - message: "The domain is invalid: %s" +func IsDomainInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 130001 +} + +// NewDomainNotFoundError returns a new CloudFoundryError +// that IsDomainNotFoundError will return true for +func NewDomainNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 130002, + ErrorCode: "CF-DomainNotFound", + Description: "The domain could not be found: %s", + } +} + +// IsDomainNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 130002 +// - HTTP code: 404 +// - message: "The domain could not be found: %s" +func IsDomainNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 130002 +} + +// NewDomainNameTakenError returns a new CloudFoundryError +// that IsDomainNameTakenError will return true for +func NewDomainNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 130003, + ErrorCode: "CF-DomainNameTaken", + Description: "The domain name is taken: %s", + } +} + +// IsDomainNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 130003 +// - HTTP code: 400 +// - message: "The domain name is taken: %s" +func IsDomainNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 130003 +} + +// NewPathInvalidError returns a new CloudFoundryError +// that IsPathInvalidError will return true for +func NewPathInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 130004, + ErrorCode: "CF-PathInvalid", + Description: "The path is invalid: %s", + } +} + +// IsPathInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 130004 +// - HTTP code: 400 +// - message: "The path is invalid: %s" +func IsPathInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 130004 +} + +// NewTotalPrivateDomainsExceededError returns a new CloudFoundryError +// that IsTotalPrivateDomainsExceededError will return true for +func NewTotalPrivateDomainsExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 130005, + ErrorCode: "CF-TotalPrivateDomainsExceeded", + Description: "The number of private domains exceeds the quota for organization: %s", + } +} + +// IsTotalPrivateDomainsExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 130005 +// - HTTP code: 400 +// - message: "The number of private domains exceeds the quota for organization: %s" +func IsTotalPrivateDomainsExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 130005 +} + +// NewServiceDoesNotSupportRoutesError returns a new CloudFoundryError +// that IsServiceDoesNotSupportRoutesError will return true for +func NewServiceDoesNotSupportRoutesError() CloudFoundryError { + return CloudFoundryError{ + Code: 130006, + ErrorCode: "CF-ServiceDoesNotSupportRoutes", + Description: "This service does not support route binding.", + } +} + +// IsServiceDoesNotSupportRoutesError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 130006 +// - HTTP code: 400 +// - message: "This service does not support route binding." +func IsServiceDoesNotSupportRoutesError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 130006 +} + +// NewRouteAlreadyBoundToServiceInstanceError returns a new CloudFoundryError +// that IsRouteAlreadyBoundToServiceInstanceError will return true for +func NewRouteAlreadyBoundToServiceInstanceError() CloudFoundryError { + return CloudFoundryError{ + Code: 130007, + ErrorCode: "CF-RouteAlreadyBoundToServiceInstance", + Description: "A route may only be bound to a single service instance", + } +} + +// IsRouteAlreadyBoundToServiceInstanceError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 130007 +// - HTTP code: 400 +// - message: "A route may only be bound to a single service instance" +func IsRouteAlreadyBoundToServiceInstanceError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 130007 +} + +// NewServiceInstanceAlreadyBoundToSameRouteError returns a new CloudFoundryError +// that IsServiceInstanceAlreadyBoundToSameRouteError will return true for +func NewServiceInstanceAlreadyBoundToSameRouteError() CloudFoundryError { + return CloudFoundryError{ + Code: 130008, + ErrorCode: "CF-ServiceInstanceAlreadyBoundToSameRoute", + Description: "The route and service instance are already bound.", + } +} + +// IsServiceInstanceAlreadyBoundToSameRouteError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 130008 +// - HTTP code: 400 +// - message: "The route and service instance are already bound." +func IsServiceInstanceAlreadyBoundToSameRouteError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 130008 +} + +// NewInternalDomainCannotBeDeletedError returns a new CloudFoundryError +// that IsInternalDomainCannotBeDeletedError will return true for +func NewInternalDomainCannotBeDeletedError() CloudFoundryError { + return CloudFoundryError{ + Code: 130009, + ErrorCode: "CF-InternalDomainCannotBeDeleted", + Description: "The domain '%s' cannot be deleted. It is reserved by the platform.", + } +} + +// IsInternalDomainCannotBeDeletedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 130009 +// - HTTP code: 422 +// - message: "The domain '%s' cannot be deleted. It is reserved by the platform." +func IsInternalDomainCannotBeDeletedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 130009 +} + +// NewRouteServiceCannotBeBoundToInternalRouteError returns a new CloudFoundryError +// that IsRouteServiceCannotBeBoundToInternalRouteError will return true for +func NewRouteServiceCannotBeBoundToInternalRouteError() CloudFoundryError { + return CloudFoundryError{ + Code: 130010, + ErrorCode: "CF-RouteServiceCannotBeBoundToInternalRoute", + Description: "Route services cannot be bound to internal routes.", + } +} + +// IsRouteServiceCannotBeBoundToInternalRouteError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 130010 +// - HTTP code: 400 +// - message: "Route services cannot be bound to internal routes." +func IsRouteServiceCannotBeBoundToInternalRouteError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 130010 +} + +// NewLegacyApiWithoutDefaultSpaceError returns a new CloudFoundryError +// that IsLegacyApiWithoutDefaultSpaceError will return true for +func NewLegacyApiWithoutDefaultSpaceError() CloudFoundryError { + return CloudFoundryError{ + Code: 140001, + ErrorCode: "CF-LegacyApiWithoutDefaultSpace", + Description: "A legacy api call requiring a default app space was called, but no default app space is set for the user.", + } +} + +// IsLegacyApiWithoutDefaultSpaceError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 140001 +// - HTTP code: 400 +// - message: "A legacy api call requiring a default app space was called, but no default app space is set for the user." +func IsLegacyApiWithoutDefaultSpaceError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 140001 +} + +// NewAppPackageInvalidError returns a new CloudFoundryError +// that IsAppPackageInvalidError will return true for +func NewAppPackageInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 150001, + ErrorCode: "CF-AppPackageInvalid", + Description: "The app package is invalid: %s", + } +} + +// IsAppPackageInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 150001 +// - HTTP code: 400 +// - message: "The app package is invalid: %s" +func IsAppPackageInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 150001 +} + +// NewAppPackageNotFoundError returns a new CloudFoundryError +// that IsAppPackageNotFoundError will return true for +func NewAppPackageNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 150002, + ErrorCode: "CF-AppPackageNotFound", + Description: "The app package could not be found: %s", + } +} + +// IsAppPackageNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 150002 +// - HTTP code: 404 +// - message: "The app package could not be found: %s" +func IsAppPackageNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 150002 +} + +// NewInsufficientRunningResourcesAvailableError returns a new CloudFoundryError +// that IsInsufficientRunningResourcesAvailableError will return true for +func NewInsufficientRunningResourcesAvailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 150003, + ErrorCode: "CF-InsufficientRunningResourcesAvailable", + Description: "One or more instances could not be started because of insufficient running resources.", + } +} + +// IsInsufficientRunningResourcesAvailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 150003 +// - HTTP code: 503 +// - message: "One or more instances could not be started because of insufficient running resources." +func IsInsufficientRunningResourcesAvailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 150003 +} + +// NewPackageBitsAlreadyUploadedError returns a new CloudFoundryError +// that IsPackageBitsAlreadyUploadedError will return true for +func NewPackageBitsAlreadyUploadedError() CloudFoundryError { + return CloudFoundryError{ + Code: 150004, + ErrorCode: "CF-PackageBitsAlreadyUploaded", + Description: "Bits may be uploaded only once. Create a new package to upload different bits.", + } +} + +// IsPackageBitsAlreadyUploadedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 150004 +// - HTTP code: 400 +// - message: "Bits may be uploaded only once. Create a new package to upload different bits." +func IsPackageBitsAlreadyUploadedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 150004 +} + +// NewBlobstoreNotLocalError returns a new CloudFoundryError +// that IsBlobstoreNotLocalError will return true for +func NewBlobstoreNotLocalError() CloudFoundryError { + return CloudFoundryError{ + Code: 150005, + ErrorCode: "CF-BlobstoreNotLocal", + Description: "Downloading blobs can only be done directly to the blobstore.", + } +} + +// IsBlobstoreNotLocalError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 150005 +// - HTTP code: 400 +// - message: "Downloading blobs can only be done directly to the blobstore." +func IsBlobstoreNotLocalError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 150005 +} + +// NewBlobstoreUnavailableError returns a new CloudFoundryError +// that IsBlobstoreUnavailableError will return true for +func NewBlobstoreUnavailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 150006, + ErrorCode: "CF-BlobstoreUnavailable", + Description: "Failed to perform operation due to blobstore unavailability.", + } +} + +// IsBlobstoreUnavailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 150006 +// - HTTP code: 502 +// - message: "Failed to perform operation due to blobstore unavailability." +func IsBlobstoreUnavailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 150006 +} + +// NewBlobstoreError returns a new CloudFoundryError +// that IsBlobstoreError will return true for +func NewBlobstoreError() CloudFoundryError { + return CloudFoundryError{ + Code: 150007, + ErrorCode: "CF-BlobstoreError", + Description: "Failed to perform blobstore operation after three retries.", + } +} + +// IsBlobstoreError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 150007 +// - HTTP code: 500 +// - message: "Failed to perform blobstore operation after three retries." +func IsBlobstoreError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 150007 +} + +// NewDockerImageMissingError returns a new CloudFoundryError +// that IsDockerImageMissingError will return true for +func NewDockerImageMissingError() CloudFoundryError { + return CloudFoundryError{ + Code: 150008, + ErrorCode: "CF-DockerImageMissing", + Description: "Docker credentials can only be supplied for apps with a 'docker_image'", + } +} + +// IsDockerImageMissingError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 150008 +// - HTTP code: 400 +// - message: "Docker credentials can only be supplied for apps with a 'docker_image'" +func IsDockerImageMissingError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 150008 +} + +// NewAppRecursiveDeleteFailedError returns a new CloudFoundryError +// that IsAppRecursiveDeleteFailedError will return true for +func NewAppRecursiveDeleteFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 150009, + ErrorCode: "CF-AppRecursiveDeleteFailed", + Description: "Deletion of app %s failed because one or more associated resources could not be deleted.%s", + } +} + +// IsAppRecursiveDeleteFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 150009 +// - HTTP code: 502 +// - message: "Deletion of app %s failed because one or more associated resources could not be deleted.\n\n%s" +func IsAppRecursiveDeleteFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 150009 +} + +// NewAppBitsUploadInvalidError returns a new CloudFoundryError +// that IsAppBitsUploadInvalidError will return true for +func NewAppBitsUploadInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 160001, + ErrorCode: "CF-AppBitsUploadInvalid", + Description: "The app upload is invalid: %s", + } +} + +// IsAppBitsUploadInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 160001 +// - HTTP code: 400 +// - message: "The app upload is invalid: %s" +func IsAppBitsUploadInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 160001 +} + +// NewAppBitsCopyInvalidError returns a new CloudFoundryError +// that IsAppBitsCopyInvalidError will return true for +func NewAppBitsCopyInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 160002, + ErrorCode: "CF-AppBitsCopyInvalid", + Description: "The app copy is invalid: %s", + } +} + +// IsAppBitsCopyInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 160002 +// - HTTP code: 400 +// - message: "The app copy is invalid: %s" +func IsAppBitsCopyInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 160002 +} + +// NewAppResourcesFileModeInvalidError returns a new CloudFoundryError +// that IsAppResourcesFileModeInvalidError will return true for +func NewAppResourcesFileModeInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 160003, + ErrorCode: "CF-AppResourcesFileModeInvalid", + Description: "The resource file mode is invalid: %s", + } +} + +// IsAppResourcesFileModeInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 160003 +// - HTTP code: 400 +// - message: "The resource file mode is invalid: %s" +func IsAppResourcesFileModeInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 160003 +} + +// NewAppResourcesFilePathInvalidError returns a new CloudFoundryError +// that IsAppResourcesFilePathInvalidError will return true for +func NewAppResourcesFilePathInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 160004, + ErrorCode: "CF-AppResourcesFilePathInvalid", + Description: "The resource file path is invalid: %s", + } +} + +// IsAppResourcesFilePathInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 160004 +// - HTTP code: 400 +// - message: "The resource file path is invalid: %s" +func IsAppResourcesFilePathInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 160004 +} + +// NewStagingError returns a new CloudFoundryError +// that IsStagingError will return true for +func NewStagingError() CloudFoundryError { + return CloudFoundryError{ + Code: 170001, + ErrorCode: "CF-StagingError", + Description: "Staging error: %s", + } +} + +// IsStagingError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170001 +// - HTTP code: 400 +// - message: "Staging error: %s" +func IsStagingError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170001 +} + +// NewNotStagedError returns a new CloudFoundryError +// that IsNotStagedError will return true for +func NewNotStagedError() CloudFoundryError { + return CloudFoundryError{ + Code: 170002, + ErrorCode: "CF-NotStaged", + Description: "App has not finished staging", + } +} + +// IsNotStagedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170002 +// - HTTP code: 400 +// - message: "App has not finished staging" +func IsNotStagedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170002 +} + +// NewNoAppDetectedError returns a new CloudFoundryError +// that IsNoAppDetectedError will return true for +func NewNoAppDetectedError() CloudFoundryError { + return CloudFoundryError{ + Code: 170003, + ErrorCode: "CF-NoAppDetectedError", + Description: "An app was not successfully detected by any available buildpack", + } +} + +// IsNoAppDetectedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170003 +// - HTTP code: 400 +// - message: "An app was not successfully detected by any available buildpack" +func IsNoAppDetectedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170003 +} + +// NewBuildpackCompileFailedError returns a new CloudFoundryError +// that IsBuildpackCompileFailedError will return true for +func NewBuildpackCompileFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 170004, + ErrorCode: "CF-BuildpackCompileFailed", + Description: "App staging failed in the buildpack compile phase", + } +} + +// IsBuildpackCompileFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170004 +// - HTTP code: 400 +// - message: "App staging failed in the buildpack compile phase" +func IsBuildpackCompileFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170004 +} + +// NewBuildpackReleaseFailedError returns a new CloudFoundryError +// that IsBuildpackReleaseFailedError will return true for +func NewBuildpackReleaseFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 170005, + ErrorCode: "CF-BuildpackReleaseFailed", + Description: "App staging failed in the buildpack release phase", + } +} + +// IsBuildpackReleaseFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170005 +// - HTTP code: 400 +// - message: "App staging failed in the buildpack release phase" +func IsBuildpackReleaseFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170005 +} + +// NewNoBuildpacksFoundError returns a new CloudFoundryError +// that IsNoBuildpacksFoundError will return true for +func NewNoBuildpacksFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 170006, + ErrorCode: "CF-NoBuildpacksFound", + Description: "There are no buildpacks available", + } +} + +// IsNoBuildpacksFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170006 +// - HTTP code: 400 +// - message: "There are no buildpacks available" +func IsNoBuildpacksFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170006 +} + +// NewStagingTimeExpiredError returns a new CloudFoundryError +// that IsStagingTimeExpiredError will return true for +func NewStagingTimeExpiredError() CloudFoundryError { + return CloudFoundryError{ + Code: 170007, + ErrorCode: "CF-StagingTimeExpired", + Description: "Staging time expired: %s", + } +} + +// IsStagingTimeExpiredError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170007 +// - HTTP code: 504 +// - message: "Staging time expired: %s" +func IsStagingTimeExpiredError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170007 +} + +// NewInsufficientResourcesError returns a new CloudFoundryError +// that IsInsufficientResourcesError will return true for +func NewInsufficientResourcesError() CloudFoundryError { + return CloudFoundryError{ + Code: 170008, + ErrorCode: "CF-InsufficientResources", + Description: "Insufficient resources", + } +} + +// IsInsufficientResourcesError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170008 +// - HTTP code: 400 +// - message: "Insufficient resources" +func IsInsufficientResourcesError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170008 +} + +// NewNoCompatibleCellError returns a new CloudFoundryError +// that IsNoCompatibleCellError will return true for +func NewNoCompatibleCellError() CloudFoundryError { + return CloudFoundryError{ + Code: 170009, + ErrorCode: "CF-NoCompatibleCell", + Description: "Found no compatible cell", + } +} + +// IsNoCompatibleCellError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170009 +// - HTTP code: 400 +// - message: "Found no compatible cell" +func IsNoCompatibleCellError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170009 +} + +// NewStagerUnavailableError returns a new CloudFoundryError +// that IsStagerUnavailableError will return true for +func NewStagerUnavailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 170010, + ErrorCode: "CF-StagerUnavailable", + Description: "Stager is unavailable: %s", + } +} + +// IsStagerUnavailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170010 +// - HTTP code: 503 +// - message: "Stager is unavailable: %s" +func IsStagerUnavailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170010 +} + +// NewStagerError returns a new CloudFoundryError +// that IsStagerError will return true for +func NewStagerError() CloudFoundryError { + return CloudFoundryError{ + Code: 170011, + ErrorCode: "CF-StagerError", + Description: "Stager error: %s", + } +} + +// IsStagerError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170011 +// - HTTP code: 500 +// - message: "Stager error: %s" +func IsStagerError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170011 +} + +// NewRunnerInvalidRequestError returns a new CloudFoundryError +// that IsRunnerInvalidRequestError will return true for +func NewRunnerInvalidRequestError() CloudFoundryError { + return CloudFoundryError{ + Code: 170014, + ErrorCode: "CF-RunnerInvalidRequest", + Description: "Runner invalid request: %s", + } +} + +// IsRunnerInvalidRequestError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170014 +// - HTTP code: 500 +// - message: "Runner invalid request: %s" +func IsRunnerInvalidRequestError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170014 +} + +// NewRunnerUnavailableError returns a new CloudFoundryError +// that IsRunnerUnavailableError will return true for +func NewRunnerUnavailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 170015, + ErrorCode: "CF-RunnerUnavailable", + Description: "Runner is unavailable: %s", + } +} + +// IsRunnerUnavailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170015 +// - HTTP code: 503 +// - message: "Runner is unavailable: %s" +func IsRunnerUnavailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170015 +} + +// NewRunnerError returns a new CloudFoundryError +// that IsRunnerError will return true for +func NewRunnerError() CloudFoundryError { + return CloudFoundryError{ + Code: 170016, + ErrorCode: "CF-RunnerError", + Description: "Runner error: %s", + } +} + +// IsRunnerError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170016 +// - HTTP code: 500 +// - message: "Runner error: %s" +func IsRunnerError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170016 +} + +// NewStagingInProgressError returns a new CloudFoundryError +// that IsStagingInProgressError will return true for +func NewStagingInProgressError() CloudFoundryError { + return CloudFoundryError{ + Code: 170017, + ErrorCode: "CF-StagingInProgress", + Description: "Only one build can be STAGING at a time per application.", + } +} + +// IsStagingInProgressError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170017 +// - HTTP code: 422 +// - message: "Only one build can be STAGING at a time per application." +func IsStagingInProgressError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170017 +} + +// NewInvalidTaskAddressError returns a new CloudFoundryError +// that IsInvalidTaskAddressError will return true for +func NewInvalidTaskAddressError() CloudFoundryError { + return CloudFoundryError{ + Code: 170018, + ErrorCode: "CF-InvalidTaskAddress", + Description: "Invalid config: %s", + } +} + +// IsInvalidTaskAddressError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170018 +// - HTTP code: 500 +// - message: "Invalid config: %s" +func IsInvalidTaskAddressError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170018 +} + +// NewTaskError returns a new CloudFoundryError +// that IsTaskError will return true for +func NewTaskError() CloudFoundryError { + return CloudFoundryError{ + Code: 170019, + ErrorCode: "CF-TaskError", + Description: "Task failed: %s", + } +} + +// IsTaskError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170019 +// - HTTP code: 500 +// - message: "Task failed: %s" +func IsTaskError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170019 +} + +// NewTaskWorkersUnavailableError returns a new CloudFoundryError +// that IsTaskWorkersUnavailableError will return true for +func NewTaskWorkersUnavailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 170020, + ErrorCode: "CF-TaskWorkersUnavailable", + Description: "Task workers are unavailable: %s", + } +} + +// IsTaskWorkersUnavailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170020 +// - HTTP code: 503 +// - message: "Task workers are unavailable: %s" +func IsTaskWorkersUnavailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170020 +} + +// NewInvalidTaskRequestError returns a new CloudFoundryError +// that IsInvalidTaskRequestError will return true for +func NewInvalidTaskRequestError() CloudFoundryError { + return CloudFoundryError{ + Code: 170021, + ErrorCode: "CF-InvalidTaskRequest", + Description: "The task request is invalid: %s", + } +} + +// IsInvalidTaskRequestError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 170021 +// - HTTP code: 422 +// - message: "The task request is invalid: %s" +func IsInvalidTaskRequestError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 170021 +} + +// NewServiceGatewayError returns a new CloudFoundryError +// that IsServiceGatewayError will return true for +func NewServiceGatewayError() CloudFoundryError { + return CloudFoundryError{ + Code: 180002, + ErrorCode: "CF-ServiceGatewayError", + Description: "Service gateway internal error: %s", + } +} + +// IsServiceGatewayError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 180002 +// - HTTP code: 503 +// - message: "Service gateway internal error: %s" +func IsServiceGatewayError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 180002 +} + +// NewServiceNotImplementedError returns a new CloudFoundryError +// that IsServiceNotImplementedError will return true for +func NewServiceNotImplementedError() CloudFoundryError { + return CloudFoundryError{ + Code: 180003, + ErrorCode: "CF-ServiceNotImplemented", + Description: "Operation not supported for service", + } +} + +// IsServiceNotImplementedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 180003 +// - HTTP code: 501 +// - message: "Operation not supported for service" +func IsServiceNotImplementedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 180003 +} + +// NewSDSNotAvailableError returns a new CloudFoundryError +// that IsSDSNotAvailableError will return true for +func NewSDSNotAvailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 180004, + ErrorCode: "CF-SDSNotAvailable", + Description: "No serialization service backends available", + } +} + +// IsSDSNotAvailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 180004 +// - HTTP code: 501 +// - message: "No serialization service backends available" +func IsSDSNotAvailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 180004 +} + +// NewFileError returns a new CloudFoundryError +// that IsFileError will return true for +func NewFileError() CloudFoundryError { + return CloudFoundryError{ + Code: 190001, + ErrorCode: "CF-FileError", + Description: "File error: %s", + } +} + +// IsFileError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 190001 +// - HTTP code: 400 +// - message: "File error: %s" +func IsFileError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 190001 +} + +// NewStatsError returns a new CloudFoundryError +// that IsStatsError will return true for +func NewStatsError() CloudFoundryError { + return CloudFoundryError{ + Code: 200001, + ErrorCode: "CF-StatsError", + Description: "Stats error: %s", + } +} + +// IsStatsError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 200001 +// - HTTP code: 400 +// - message: "Stats error: %s" +func IsStatsError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 200001 +} + +// NewStatsUnavailableError returns a new CloudFoundryError +// that IsStatsUnavailableError will return true for +func NewStatsUnavailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 200002, + ErrorCode: "CF-StatsUnavailable", + Description: "Stats unavailable: %s", + } +} + +// IsStatsUnavailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 200002 +// - HTTP code: 503 +// - message: "Stats unavailable: %s" +func IsStatsUnavailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 200002 +} + +// NewAppStoppedStatsError returns a new CloudFoundryError +// that IsAppStoppedStatsError will return true for +func NewAppStoppedStatsError() CloudFoundryError { + return CloudFoundryError{ + Code: 200003, + ErrorCode: "CF-AppStoppedStatsError", + Description: "Could not fetch stats for stopped app: %s", + } +} + +// IsAppStoppedStatsError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 200003 +// - HTTP code: 400 +// - message: "Could not fetch stats for stopped app: %s" +func IsAppStoppedStatsError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 200003 +} + +// NewRouteInvalidError returns a new CloudFoundryError +// that IsRouteInvalidError will return true for +func NewRouteInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 210001, + ErrorCode: "CF-RouteInvalid", + Description: "The route is invalid: %s", + } +} + +// IsRouteInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 210001 +// - HTTP code: 400 +// - message: "The route is invalid: %s" +func IsRouteInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 210001 +} + +// NewRouteNotFoundError returns a new CloudFoundryError +// that IsRouteNotFoundError will return true for +func NewRouteNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 210002, + ErrorCode: "CF-RouteNotFound", + Description: "The route could not be found: %s", + } +} + +// IsRouteNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 210002 +// - HTTP code: 404 +// - message: "The route could not be found: %s" +func IsRouteNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 210002 +} + +// NewRouteHostTakenError returns a new CloudFoundryError +// that IsRouteHostTakenError will return true for +func NewRouteHostTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 210003, + ErrorCode: "CF-RouteHostTaken", + Description: "The host is taken: %s", + } +} + +// IsRouteHostTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 210003 +// - HTTP code: 400 +// - message: "The host is taken: %s" +func IsRouteHostTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 210003 +} + +// NewRoutePathTakenError returns a new CloudFoundryError +// that IsRoutePathTakenError will return true for +func NewRoutePathTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 210004, + ErrorCode: "CF-RoutePathTaken", + Description: "The path is taken: %s", + } +} + +// IsRoutePathTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 210004 +// - HTTP code: 400 +// - message: "The path is taken: %s" +func IsRoutePathTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 210004 +} + +// NewRoutePortTakenError returns a new CloudFoundryError +// that IsRoutePortTakenError will return true for +func NewRoutePortTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 210005, + ErrorCode: "CF-RoutePortTaken", + Description: "The port is taken: %s", + } +} + +// IsRoutePortTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 210005 +// - HTTP code: 400 +// - message: "The port is taken: %s" +func IsRoutePortTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 210005 +} + +// NewRouteMappingTakenError returns a new CloudFoundryError +// that IsRouteMappingTakenError will return true for +func NewRouteMappingTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 210006, + ErrorCode: "CF-RouteMappingTaken", + Description: "The route mapping is taken: %s", + } +} + +// IsRouteMappingTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 210006 +// - HTTP code: 400 +// - message: "The route mapping is taken: %s" +func IsRouteMappingTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 210006 +} + +// NewRouteMappingNotFoundError returns a new CloudFoundryError +// that IsRouteMappingNotFoundError will return true for +func NewRouteMappingNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 210007, + ErrorCode: "CF-RouteMappingNotFound", + Description: "The route mapping could not be found: %s", + } +} + +// IsRouteMappingNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 210007 +// - HTTP code: 404 +// - message: "The route mapping could not be found: %s" +func IsRouteMappingNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 210007 +} + +// NewRouterGroupNotFoundError returns a new CloudFoundryError +// that IsRouterGroupNotFoundError will return true for +func NewRouterGroupNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 210009, + ErrorCode: "CF-RouterGroupNotFound", + Description: "The router group could not be found: %s", + } +} + +// IsRouterGroupNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 210009 +// - HTTP code: 404 +// - message: "The router group could not be found: %s" +func IsRouterGroupNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 210009 +} + +// NewInstancesError returns a new CloudFoundryError +// that IsInstancesError will return true for +func NewInstancesError() CloudFoundryError { + return CloudFoundryError{ + Code: 220001, + ErrorCode: "CF-InstancesError", + Description: "Instances error: %s", + } +} + +// IsInstancesError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 220001 +// - HTTP code: 400 +// - message: "Instances error: %s" +func IsInstancesError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 220001 +} + +// NewInstancesUnavailableError returns a new CloudFoundryError +// that IsInstancesUnavailableError will return true for +func NewInstancesUnavailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 220002, + ErrorCode: "CF-InstancesUnavailable", + Description: "Instances information unavailable: %s", + } +} + +// IsInstancesUnavailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 220002 +// - HTTP code: 503 +// - message: "Instances information unavailable: %s" +func IsInstancesUnavailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 220002 +} + +// NewEventNotFoundError returns a new CloudFoundryError +// that IsEventNotFoundError will return true for +func NewEventNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 230002, + ErrorCode: "CF-EventNotFound", + Description: "Event could not be found: %s", + } +} + +// IsEventNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 230002 +// - HTTP code: 404 +// - message: "Event could not be found: %s" +func IsEventNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 230002 +} + +// NewQuotaDefinitionNotFoundError returns a new CloudFoundryError +// that IsQuotaDefinitionNotFoundError will return true for +func NewQuotaDefinitionNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 240001, + ErrorCode: "CF-QuotaDefinitionNotFound", + Description: "Quota Definition could not be found: %s", + } +} + +// IsQuotaDefinitionNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 240001 +// - HTTP code: 404 +// - message: "Quota Definition could not be found: %s" +func IsQuotaDefinitionNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 240001 +} + +// NewQuotaDefinitionNameTakenError returns a new CloudFoundryError +// that IsQuotaDefinitionNameTakenError will return true for +func NewQuotaDefinitionNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 240002, + ErrorCode: "CF-QuotaDefinitionNameTaken", + Description: "Quota Definition is taken: %s", + } +} + +// IsQuotaDefinitionNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 240002 +// - HTTP code: 400 +// - message: "Quota Definition is taken: %s" +func IsQuotaDefinitionNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 240002 +} + +// NewQuotaDefinitionInvalidError returns a new CloudFoundryError +// that IsQuotaDefinitionInvalidError will return true for +func NewQuotaDefinitionInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 240003, + ErrorCode: "CF-QuotaDefinitionInvalid", + Description: "Quota Definition is invalid: %s", + } +} + +// IsQuotaDefinitionInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 240003 +// - HTTP code: 400 +// - message: "Quota Definition is invalid: %s" +func IsQuotaDefinitionInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 240003 +} + +// NewQuotaDefinitionMemoryLimitInvalidError returns a new CloudFoundryError +// that IsQuotaDefinitionMemoryLimitInvalidError will return true for +func NewQuotaDefinitionMemoryLimitInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 240004, + ErrorCode: "CF-QuotaDefinitionMemoryLimitInvalid", + Description: "Quota Definition memory limit cannot be less than -1", + } +} + +// IsQuotaDefinitionMemoryLimitInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 240004 +// - HTTP code: 400 +// - message: "Quota Definition memory limit cannot be less than -1" +func IsQuotaDefinitionMemoryLimitInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 240004 +} + +// NewStackInvalidError returns a new CloudFoundryError +// that IsStackInvalidError will return true for +func NewStackInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 250001, + ErrorCode: "CF-StackInvalid", + Description: "The stack is invalid: %s", + } +} + +// IsStackInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 250001 +// - HTTP code: 400 +// - message: "The stack is invalid: %s" +func IsStackInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 250001 +} + +// NewStackNameTakenError returns a new CloudFoundryError +// that IsStackNameTakenError will return true for +func NewStackNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 250002, + ErrorCode: "CF-StackNameTaken", + Description: "The stack name is taken: %s", + } +} + +// IsStackNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 250002 +// - HTTP code: 400 +// - message: "The stack name is taken: %s" +func IsStackNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 250002 +} + +// NewStackNotFoundError returns a new CloudFoundryError +// that IsStackNotFoundError will return true for +func NewStackNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 250003, + ErrorCode: "CF-StackNotFound", + Description: "The stack could not be found: %s", + } +} + +// IsStackNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 250003 +// - HTTP code: 404 +// - message: "The stack could not be found: %s" +func IsStackNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 250003 +} + +// NewServicePlanVisibilityInvalidError returns a new CloudFoundryError +// that IsServicePlanVisibilityInvalidError will return true for +func NewServicePlanVisibilityInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 260001, + ErrorCode: "CF-ServicePlanVisibilityInvalid", + Description: "Service Plan Visibility is invalid: %s", + } +} + +// IsServicePlanVisibilityInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 260001 +// - HTTP code: 400 +// - message: "Service Plan Visibility is invalid: %s" +func IsServicePlanVisibilityInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 260001 +} + +// NewServicePlanVisibilityAlreadyExistsError returns a new CloudFoundryError +// that IsServicePlanVisibilityAlreadyExistsError will return true for +func NewServicePlanVisibilityAlreadyExistsError() CloudFoundryError { + return CloudFoundryError{ + Code: 260002, + ErrorCode: "CF-ServicePlanVisibilityAlreadyExists", + Description: "This combination of ServicePlan and Organization is already taken: %s", + } +} + +// IsServicePlanVisibilityAlreadyExistsError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 260002 +// - HTTP code: 400 +// - message: "This combination of ServicePlan and Organization is already taken: %s" +func IsServicePlanVisibilityAlreadyExistsError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 260002 +} + +// NewServicePlanVisibilityNotFoundError returns a new CloudFoundryError +// that IsServicePlanVisibilityNotFoundError will return true for +func NewServicePlanVisibilityNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 260003, + ErrorCode: "CF-ServicePlanVisibilityNotFound", + Description: "The service plan visibility could not be found: %s", + } +} + +// IsServicePlanVisibilityNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 260003 +// - HTTP code: 404 +// - message: "The service plan visibility could not be found: %s" +func IsServicePlanVisibilityNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 260003 +} + +// NewServiceBrokerInvalidError returns a new CloudFoundryError +// that IsServiceBrokerInvalidError will return true for +func NewServiceBrokerInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 270001, + ErrorCode: "CF-ServiceBrokerInvalid", + Description: "Service broker is invalid: %s", + } +} + +// IsServiceBrokerInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270001 +// - HTTP code: 400 +// - message: "Service broker is invalid: %s" +func IsServiceBrokerInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270001 +} + +// NewServiceBrokerNameTakenError returns a new CloudFoundryError +// that IsServiceBrokerNameTakenError will return true for +func NewServiceBrokerNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 270002, + ErrorCode: "CF-ServiceBrokerNameTaken", + Description: "The service broker name is taken", + } +} + +// IsServiceBrokerNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270002 +// - HTTP code: 400 +// - message: "The service broker name is taken" +func IsServiceBrokerNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270002 +} + +// NewServiceBrokerUrlTakenError returns a new CloudFoundryError +// that IsServiceBrokerUrlTakenError will return true for +func NewServiceBrokerUrlTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 270003, + ErrorCode: "CF-ServiceBrokerUrlTaken", + Description: "The service broker url is taken: %s", + } +} + +// IsServiceBrokerUrlTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270003 +// - HTTP code: 400 +// - message: "The service broker url is taken: %s" +func IsServiceBrokerUrlTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270003 +} + +// NewServiceBrokerNotFoundError returns a new CloudFoundryError +// that IsServiceBrokerNotFoundError will return true for +func NewServiceBrokerNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 270004, + ErrorCode: "CF-ServiceBrokerNotFound", + Description: "The service broker was not found: %s", + } +} + +// IsServiceBrokerNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270004 +// - HTTP code: 404 +// - message: "The service broker was not found: %s" +func IsServiceBrokerNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270004 +} + +// NewServiceBrokerNotRemovableError returns a new CloudFoundryError +// that IsServiceBrokerNotRemovableError will return true for +func NewServiceBrokerNotRemovableError() CloudFoundryError { + return CloudFoundryError{ + Code: 270010, + ErrorCode: "CF-ServiceBrokerNotRemovable", + Description: "Can not remove brokers that have associated service instances: %s", + } +} + +// IsServiceBrokerNotRemovableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270010 +// - HTTP code: 400 +// - message: "Can not remove brokers that have associated service instances: %s" +func IsServiceBrokerNotRemovableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270010 +} + +// NewServiceBrokerUrlInvalidError returns a new CloudFoundryError +// that IsServiceBrokerUrlInvalidError will return true for +func NewServiceBrokerUrlInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 270011, + ErrorCode: "CF-ServiceBrokerUrlInvalid", + Description: "%s is not a valid URL", + } +} + +// IsServiceBrokerUrlInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270011 +// - HTTP code: 400 +// - message: "%s is not a valid URL" +func IsServiceBrokerUrlInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270011 +} + +// NewServiceBrokerCatalogInvalidError returns a new CloudFoundryError +// that IsServiceBrokerCatalogInvalidError will return true for +func NewServiceBrokerCatalogInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 270012, + ErrorCode: "CF-ServiceBrokerCatalogInvalid", + Description: "Service broker catalog is invalid: %s", + } +} + +// IsServiceBrokerCatalogInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270012 +// - HTTP code: 502 +// - message: "Service broker catalog is invalid: %s" +func IsServiceBrokerCatalogInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270012 +} + +// NewServiceBrokerDashboardClientFailureError returns a new CloudFoundryError +// that IsServiceBrokerDashboardClientFailureError will return true for +func NewServiceBrokerDashboardClientFailureError() CloudFoundryError { + return CloudFoundryError{ + Code: 270013, + ErrorCode: "CF-ServiceBrokerDashboardClientFailure", + Description: "Service broker dashboard clients could not be modified: %s", + } +} + +// IsServiceBrokerDashboardClientFailureError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270013 +// - HTTP code: 502 +// - message: "Service broker dashboard clients could not be modified: %s" +func IsServiceBrokerDashboardClientFailureError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270013 +} + +// NewServiceBrokerAsyncRequiredError returns a new CloudFoundryError +// that IsServiceBrokerAsyncRequiredError will return true for +func NewServiceBrokerAsyncRequiredError() CloudFoundryError { + return CloudFoundryError{ + Code: 270014, + ErrorCode: "CF-ServiceBrokerAsyncRequired", + Description: "This service plan requires client support for asynchronous service operations.", + } +} + +// IsServiceBrokerAsyncRequiredError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270014 +// - HTTP code: 400 +// - message: "This service plan requires client support for asynchronous service operations." +func IsServiceBrokerAsyncRequiredError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270014 +} + +// NewServiceDashboardClientMissingUrlError returns a new CloudFoundryError +// that IsServiceDashboardClientMissingUrlError will return true for +func NewServiceDashboardClientMissingUrlError() CloudFoundryError { + return CloudFoundryError{ + Code: 270015, + ErrorCode: "CF-ServiceDashboardClientMissingUrl", + Description: "Service broker returned dashboard client configuration without a dashboard URL", + } +} + +// IsServiceDashboardClientMissingUrlError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270015 +// - HTTP code: 502 +// - message: "Service broker returned dashboard client configuration without a dashboard URL" +func IsServiceDashboardClientMissingUrlError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270015 +} + +// NewServiceBrokerUrlBasicAuthNotSupportedError returns a new CloudFoundryError +// that IsServiceBrokerUrlBasicAuthNotSupportedError will return true for +func NewServiceBrokerUrlBasicAuthNotSupportedError() CloudFoundryError { + return CloudFoundryError{ + Code: 270016, + ErrorCode: "CF-ServiceBrokerUrlBasicAuthNotSupported", + Description: "User name and password fields in the broker URI are not supported", + } +} + +// IsServiceBrokerUrlBasicAuthNotSupportedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270016 +// - HTTP code: 400 +// - message: "User name and password fields in the broker URI are not supported" +func IsServiceBrokerUrlBasicAuthNotSupportedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270016 +} + +// NewServiceBrokerRespondedAsyncWhenNotAllowedError returns a new CloudFoundryError +// that IsServiceBrokerRespondedAsyncWhenNotAllowedError will return true for +func NewServiceBrokerRespondedAsyncWhenNotAllowedError() CloudFoundryError { + return CloudFoundryError{ + Code: 270017, + ErrorCode: "CF-ServiceBrokerRespondedAsyncWhenNotAllowed", + Description: "The service broker responded asynchronously to a request, but the accepts_incomplete query parameter was false or not given.", + } +} + +// IsServiceBrokerRespondedAsyncWhenNotAllowedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270017 +// - HTTP code: 502 +// - message: "The service broker responded asynchronously to a request, but the accepts_incomplete query parameter was false or not given." +func IsServiceBrokerRespondedAsyncWhenNotAllowedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270017 +} + +// NewServiceBrokerConcurrencyError returns a new CloudFoundryError +// that IsServiceBrokerConcurrencyError will return true for +func NewServiceBrokerConcurrencyError() CloudFoundryError { + return CloudFoundryError{ + Code: 270018, + ErrorCode: "CF-ServiceBrokerConcurrencyError", + Description: "The service broker could not perform this operation in parallel with other running operations", + } +} + +// IsServiceBrokerConcurrencyError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270018 +// - HTTP code: 422 +// - message: "The service broker could not perform this operation in parallel with other running operations" +func IsServiceBrokerConcurrencyError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270018 +} + +// NewServiceBrokerCatalogIncompatibleError returns a new CloudFoundryError +// that IsServiceBrokerCatalogIncompatibleError will return true for +func NewServiceBrokerCatalogIncompatibleError() CloudFoundryError { + return CloudFoundryError{ + Code: 270019, + ErrorCode: "CF-ServiceBrokerCatalogIncompatible", + Description: "Service broker catalog is incompatible: %s", + } +} + +// IsServiceBrokerCatalogIncompatibleError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270019 +// - HTTP code: 502 +// - message: "Service broker catalog is incompatible: %s" +func IsServiceBrokerCatalogIncompatibleError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270019 +} + +// NewServiceBrokerRequestRejectedError returns a new CloudFoundryError +// that IsServiceBrokerRequestRejectedError will return true for +func NewServiceBrokerRequestRejectedError() CloudFoundryError { + return CloudFoundryError{ + Code: 270020, + ErrorCode: "CF-ServiceBrokerRequestRejected", + Description: "The service broker rejected the request. Status Code: %s. Please check that the URL points to a valid service broker.", + } +} + +// IsServiceBrokerRequestRejectedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270020 +// - HTTP code: 502 +// - message: "The service broker rejected the request. Status Code: %s. Please check that the URL points to a valid service broker." +func IsServiceBrokerRequestRejectedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270020 +} + +// NewServiceBrokerRequestMalformedError returns a new CloudFoundryError +// that IsServiceBrokerRequestMalformedError will return true for +func NewServiceBrokerRequestMalformedError() CloudFoundryError { + return CloudFoundryError{ + Code: 270021, + ErrorCode: "CF-ServiceBrokerRequestMalformed", + Description: "The service broker returned an invalid response: expected valid JSON object in body. Please check that the URL points to a valid service broker.", + } +} + +// IsServiceBrokerRequestMalformedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 270021 +// - HTTP code: 502 +// - message: "The service broker returned an invalid response: expected valid JSON object in body. Please check that the URL points to a valid service broker." +func IsServiceBrokerRequestMalformedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 270021 +} + +// NewBuildpackNameStackTakenError returns a new CloudFoundryError +// that IsBuildpackNameStackTakenError will return true for +func NewBuildpackNameStackTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 290000, + ErrorCode: "CF-BuildpackNameStackTaken", + Description: "The buildpack name %s is already in use for the stack %s", + } +} + +// IsBuildpackNameStackTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290000 +// - HTTP code: 422 +// - message: "The buildpack name %s is already in use for the stack %s" +func IsBuildpackNameStackTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290000 +} + +// NewBuildpackNameTakenError returns a new CloudFoundryError +// that IsBuildpackNameTakenError will return true for +func NewBuildpackNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 290001, + ErrorCode: "CF-BuildpackNameTaken", + Description: "The buildpack name is already in use: %s", + } +} + +// IsBuildpackNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290001 +// - HTTP code: 400 +// - message: "The buildpack name is already in use: %s" +func IsBuildpackNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290001 +} + +// NewBuildpackBitsUploadInvalidError returns a new CloudFoundryError +// that IsBuildpackBitsUploadInvalidError will return true for +func NewBuildpackBitsUploadInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 290002, + ErrorCode: "CF-BuildpackBitsUploadInvalid", + Description: "The buildpack upload is invalid: %s", + } +} + +// IsBuildpackBitsUploadInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290002 +// - HTTP code: 400 +// - message: "The buildpack upload is invalid: %s" +func IsBuildpackBitsUploadInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290002 +} + +// NewBuildpackInvalidError returns a new CloudFoundryError +// that IsBuildpackInvalidError will return true for +func NewBuildpackInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 290003, + ErrorCode: "CF-BuildpackInvalid", + Description: "Buildpack is invalid: %s", + } +} + +// IsBuildpackInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290003 +// - HTTP code: 400 +// - message: "Buildpack is invalid: %s" +func IsBuildpackInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290003 +} + +// NewCustomBuildpacksDisabledError returns a new CloudFoundryError +// that IsCustomBuildpacksDisabledError will return true for +func NewCustomBuildpacksDisabledError() CloudFoundryError { + return CloudFoundryError{ + Code: 290004, + ErrorCode: "CF-CustomBuildpacksDisabled", + Description: "Custom buildpacks are disabled", + } +} + +// IsCustomBuildpacksDisabledError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290004 +// - HTTP code: 400 +// - message: "Custom buildpacks are disabled" +func IsCustomBuildpacksDisabledError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290004 +} + +// NewBuildpackLockedError returns a new CloudFoundryError +// that IsBuildpackLockedError will return true for +func NewBuildpackLockedError() CloudFoundryError { + return CloudFoundryError{ + Code: 290005, + ErrorCode: "CF-BuildpackLocked", + Description: "The buildpack is locked", + } +} + +// IsBuildpackLockedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290005 +// - HTTP code: 409 +// - message: "The buildpack is locked" +func IsBuildpackLockedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290005 +} + +// NewJobTimeoutError returns a new CloudFoundryError +// that IsJobTimeoutError will return true for +func NewJobTimeoutError() CloudFoundryError { + return CloudFoundryError{ + Code: 290006, + ErrorCode: "CF-JobTimeout", + Description: "The job execution has timed out.", + } +} + +// IsJobTimeoutError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290006 +// - HTTP code: 524 +// - message: "The job execution has timed out." +func IsJobTimeoutError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290006 +} + +// NewSpaceDeleteTimeoutError returns a new CloudFoundryError +// that IsSpaceDeleteTimeoutError will return true for +func NewSpaceDeleteTimeoutError() CloudFoundryError { + return CloudFoundryError{ + Code: 290007, + ErrorCode: "CF-SpaceDeleteTimeout", + Description: "Deletion of space %s timed out before all resources within could be deleted", + } +} + +// IsSpaceDeleteTimeoutError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290007 +// - HTTP code: 524 +// - message: "Deletion of space %s timed out before all resources within could be deleted" +func IsSpaceDeleteTimeoutError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290007 +} + +// NewSpaceDeletionFailedError returns a new CloudFoundryError +// that IsSpaceDeletionFailedError will return true for +func NewSpaceDeletionFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 290008, + ErrorCode: "CF-SpaceDeletionFailed", + Description: "Deletion of space %s failed because one or more resources within could not be deleted.%s", + } +} + +// IsSpaceDeletionFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290008 +// - HTTP code: 502 +// - message: "Deletion of space %s failed because one or more resources within could not be deleted.\n\n%s" +func IsSpaceDeletionFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290008 +} + +// NewOrganizationDeleteTimeoutError returns a new CloudFoundryError +// that IsOrganizationDeleteTimeoutError will return true for +func NewOrganizationDeleteTimeoutError() CloudFoundryError { + return CloudFoundryError{ + Code: 290009, + ErrorCode: "CF-OrganizationDeleteTimeout", + Description: "Delete of organization %s timed out before all resources within could be deleted", + } +} + +// IsOrganizationDeleteTimeoutError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290009 +// - HTTP code: 524 +// - message: "Delete of organization %s timed out before all resources within could be deleted" +func IsOrganizationDeleteTimeoutError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290009 +} + +// NewOrganizationDeletionFailedError returns a new CloudFoundryError +// that IsOrganizationDeletionFailedError will return true for +func NewOrganizationDeletionFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 290010, + ErrorCode: "CF-OrganizationDeletionFailed", + Description: "Deletion of organization %s failed because one or more resources within could not be deleted.%s", + } +} + +// IsOrganizationDeletionFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290010 +// - HTTP code: 502 +// - message: "Deletion of organization %s failed because one or more resources within could not be deleted.\n\n%s" +func IsOrganizationDeletionFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290010 +} + +// NewNonrecursiveSpaceDeletionFailedError returns a new CloudFoundryError +// that IsNonrecursiveSpaceDeletionFailedError will return true for +func NewNonrecursiveSpaceDeletionFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 290011, + ErrorCode: "CF-NonrecursiveSpaceDeletionFailed", + Description: "Resource inside space %s must first be deleted, or specify recursive delete.", + } +} + +// IsNonrecursiveSpaceDeletionFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290011 +// - HTTP code: 400 +// - message: "Resource inside space %s must first be deleted, or specify recursive delete." +func IsNonrecursiveSpaceDeletionFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290011 +} + +// NewBitsServiceError returns a new CloudFoundryError +// that IsBitsServiceError will return true for +func NewBitsServiceError() CloudFoundryError { + return CloudFoundryError{ + Code: 290012, + ErrorCode: "CF-BitsServiceError", + Description: "The bits service returned an error: %s", + } +} + +// IsBitsServiceError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290012 +// - HTTP code: 500 +// - message: "The bits service returned an error: %s" +func IsBitsServiceError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290012 +} + +// NewSpaceRolesDeletionTimeoutError returns a new CloudFoundryError +// that IsSpaceRolesDeletionTimeoutError will return true for +func NewSpaceRolesDeletionTimeoutError() CloudFoundryError { + return CloudFoundryError{ + Code: 290013, + ErrorCode: "CF-SpaceRolesDeletionTimeout", + Description: "Deletion of roles for space %s timed out before all roles could be deleted", + } +} + +// IsSpaceRolesDeletionTimeoutError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290013 +// - HTTP code: 524 +// - message: "Deletion of roles for space %s timed out before all roles could be deleted" +func IsSpaceRolesDeletionTimeoutError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290013 +} + +// NewOrganizationRolesDeletionFailedError returns a new CloudFoundryError +// that IsOrganizationRolesDeletionFailedError will return true for +func NewOrganizationRolesDeletionFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 290014, + ErrorCode: "CF-OrganizationRolesDeletionFailed", + Description: "Failed to delete one or more roles for organization %s", + } +} + +// IsOrganizationRolesDeletionFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290014 +// - HTTP code: 502 +// - message: "Failed to delete one or more roles for organization %s" +func IsOrganizationRolesDeletionFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290014 +} + +// NewSpaceRolesDeletionFailedError returns a new CloudFoundryError +// that IsSpaceRolesDeletionFailedError will return true for +func NewSpaceRolesDeletionFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 290016, + ErrorCode: "CF-SpaceRolesDeletionFailed", + Description: "Failed to delete one or more roles for space %s", + } +} + +// IsSpaceRolesDeletionFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 290016 +// - HTTP code: 502 +// - message: "Failed to delete one or more roles for space %s" +func IsSpaceRolesDeletionFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 290016 +} + +// NewSecurityGroupInvalidError returns a new CloudFoundryError +// that IsSecurityGroupInvalidError will return true for +func NewSecurityGroupInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 300001, + ErrorCode: "CF-SecurityGroupInvalid", + Description: "The security group is invalid: %s", + } +} + +// IsSecurityGroupInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 300001 +// - HTTP code: 400 +// - message: "The security group is invalid: %s" +func IsSecurityGroupInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 300001 +} + +// NewSecurityGroupNotFoundError returns a new CloudFoundryError +// that IsSecurityGroupNotFoundError will return true for +func NewSecurityGroupNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 300002, + ErrorCode: "CF-SecurityGroupNotFound", + Description: "The security group could not be found: %s", + } +} + +// IsSecurityGroupNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 300002 +// - HTTP code: 404 +// - message: "The security group could not be found: %s" +func IsSecurityGroupNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 300002 +} + +// NewSecurityGroupStagingDefaultInvalidError returns a new CloudFoundryError +// that IsSecurityGroupStagingDefaultInvalidError will return true for +func NewSecurityGroupStagingDefaultInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 300003, + ErrorCode: "CF-SecurityGroupStagingDefaultInvalid", + Description: "The security group could not be found: %s", + } +} + +// IsSecurityGroupStagingDefaultInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 300003 +// - HTTP code: 400 +// - message: "The security group could not be found: %s" +func IsSecurityGroupStagingDefaultInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 300003 +} + +// NewSecurityGroupRunningDefaultInvalidError returns a new CloudFoundryError +// that IsSecurityGroupRunningDefaultInvalidError will return true for +func NewSecurityGroupRunningDefaultInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 300004, + ErrorCode: "CF-SecurityGroupRunningDefaultInvalid", + Description: "The security group could not be found: %s", + } +} + +// IsSecurityGroupRunningDefaultInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 300004 +// - HTTP code: 400 +// - message: "The security group could not be found: %s" +func IsSecurityGroupRunningDefaultInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 300004 +} + +// NewSecurityGroupNameTakenError returns a new CloudFoundryError +// that IsSecurityGroupNameTakenError will return true for +func NewSecurityGroupNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 300005, + ErrorCode: "CF-SecurityGroupNameTaken", + Description: "The security group name is taken: %s", + } +} + +// IsSecurityGroupNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 300005 +// - HTTP code: 400 +// - message: "The security group name is taken: %s" +func IsSecurityGroupNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 300005 +} + +// NewSpaceQuotaDefinitionInvalidError returns a new CloudFoundryError +// that IsSpaceQuotaDefinitionInvalidError will return true for +func NewSpaceQuotaDefinitionInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 310001, + ErrorCode: "CF-SpaceQuotaDefinitionInvalid", + Description: "Space Quota Definition is invalid: %s", + } +} + +// IsSpaceQuotaDefinitionInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 310001 +// - HTTP code: 400 +// - message: "Space Quota Definition is invalid: %s" +func IsSpaceQuotaDefinitionInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 310001 +} + +// NewSpaceQuotaDefinitionNameTakenError returns a new CloudFoundryError +// that IsSpaceQuotaDefinitionNameTakenError will return true for +func NewSpaceQuotaDefinitionNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 310002, + ErrorCode: "CF-SpaceQuotaDefinitionNameTaken", + Description: "The space quota definition name is taken: %s", + } +} + +// IsSpaceQuotaDefinitionNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 310002 +// - HTTP code: 400 +// - message: "The space quota definition name is taken: %s" +func IsSpaceQuotaDefinitionNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 310002 +} + +// NewSpaceQuotaMemoryLimitExceededError returns a new CloudFoundryError +// that IsSpaceQuotaMemoryLimitExceededError will return true for +func NewSpaceQuotaMemoryLimitExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 310003, + ErrorCode: "CF-SpaceQuotaMemoryLimitExceeded", + Description: "You have exceeded your space's memory limit: %s", + } +} + +// IsSpaceQuotaMemoryLimitExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 310003 +// - HTTP code: 400 +// - message: "You have exceeded your space's memory limit: %s" +func IsSpaceQuotaMemoryLimitExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 310003 +} + +// NewSpaceQuotaInstanceMemoryLimitExceededError returns a new CloudFoundryError +// that IsSpaceQuotaInstanceMemoryLimitExceededError will return true for +func NewSpaceQuotaInstanceMemoryLimitExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 310004, + ErrorCode: "CF-SpaceQuotaInstanceMemoryLimitExceeded", + Description: "You have exceeded the instance memory limit for your space's quota.", + } +} + +// IsSpaceQuotaInstanceMemoryLimitExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 310004 +// - HTTP code: 400 +// - message: "You have exceeded the instance memory limit for your space's quota." +func IsSpaceQuotaInstanceMemoryLimitExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 310004 +} + +// NewSpaceQuotaTotalRoutesExceededError returns a new CloudFoundryError +// that IsSpaceQuotaTotalRoutesExceededError will return true for +func NewSpaceQuotaTotalRoutesExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 310005, + ErrorCode: "CF-SpaceQuotaTotalRoutesExceeded", + Description: "You have exceeded the total routes for your space's quota.", + } +} + +// IsSpaceQuotaTotalRoutesExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 310005 +// - HTTP code: 400 +// - message: "You have exceeded the total routes for your space's quota." +func IsSpaceQuotaTotalRoutesExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 310005 +} + +// NewOrgQuotaTotalRoutesExceededError returns a new CloudFoundryError +// that IsOrgQuotaTotalRoutesExceededError will return true for +func NewOrgQuotaTotalRoutesExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 310006, + ErrorCode: "CF-OrgQuotaTotalRoutesExceeded", + Description: "You have exceeded the total routes for your organization's quota.", + } +} + +// IsOrgQuotaTotalRoutesExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 310006 +// - HTTP code: 400 +// - message: "You have exceeded the total routes for your organization's quota." +func IsOrgQuotaTotalRoutesExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 310006 +} + +// NewSpaceQuotaDefinitionNotFoundError returns a new CloudFoundryError +// that IsSpaceQuotaDefinitionNotFoundError will return true for +func NewSpaceQuotaDefinitionNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 310007, + ErrorCode: "CF-SpaceQuotaDefinitionNotFound", + Description: "Space Quota Definition could not be found: %s", + } +} + +// IsSpaceQuotaDefinitionNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 310007 +// - HTTP code: 404 +// - message: "Space Quota Definition could not be found: %s" +func IsSpaceQuotaDefinitionNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 310007 +} + +// NewSpaceQuotaInstanceLimitExceededError returns a new CloudFoundryError +// that IsSpaceQuotaInstanceLimitExceededError will return true for +func NewSpaceQuotaInstanceLimitExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 310008, + ErrorCode: "CF-SpaceQuotaInstanceLimitExceeded", + Description: "You have exceeded the instance limit for your space's quota.", + } +} + +// IsSpaceQuotaInstanceLimitExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 310008 +// - HTTP code: 400 +// - message: "You have exceeded the instance limit for your space's quota." +func IsSpaceQuotaInstanceLimitExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 310008 +} + +// NewOrgQuotaTotalReservedRoutePortsExceededError returns a new CloudFoundryError +// that IsOrgQuotaTotalReservedRoutePortsExceededError will return true for +func NewOrgQuotaTotalReservedRoutePortsExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 310009, + ErrorCode: "CF-OrgQuotaTotalReservedRoutePortsExceeded", + Description: "You have exceeded the total reserved route ports for your organization's quota.", + } +} + +// IsOrgQuotaTotalReservedRoutePortsExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 310009 +// - HTTP code: 400 +// - message: "You have exceeded the total reserved route ports for your organization's quota." +func IsOrgQuotaTotalReservedRoutePortsExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 310009 +} + +// NewSpaceQuotaTotalReservedRoutePortsExceededError returns a new CloudFoundryError +// that IsSpaceQuotaTotalReservedRoutePortsExceededError will return true for +func NewSpaceQuotaTotalReservedRoutePortsExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 310010, + ErrorCode: "CF-SpaceQuotaTotalReservedRoutePortsExceeded", + Description: "You have exceeded the total reserved route ports for your space's quota.", + } +} + +// IsSpaceQuotaTotalReservedRoutePortsExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 310010 +// - HTTP code: 400 +// - message: "You have exceeded the total reserved route ports for your space's quota." +func IsSpaceQuotaTotalReservedRoutePortsExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 310010 +} + +// NewDiegoDisabledError returns a new CloudFoundryError +// that IsDiegoDisabledError will return true for +func NewDiegoDisabledError() CloudFoundryError { + return CloudFoundryError{ + Code: 320001, + ErrorCode: "CF-DiegoDisabled", + Description: "Diego has not been enabled.", + } +} + +// IsDiegoDisabledError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 320001 +// - HTTP code: 400 +// - message: "Diego has not been enabled." +func IsDiegoDisabledError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 320001 +} + +// NewDiegoDockerBuildpackConflictError returns a new CloudFoundryError +// that IsDiegoDockerBuildpackConflictError will return true for +func NewDiegoDockerBuildpackConflictError() CloudFoundryError { + return CloudFoundryError{ + Code: 320002, + ErrorCode: "CF-DiegoDockerBuildpackConflict", + Description: "You cannot specify a custom buildpack and a docker image at the same time.", + } +} + +// IsDiegoDockerBuildpackConflictError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 320002 +// - HTTP code: 400 +// - message: "You cannot specify a custom buildpack and a docker image at the same time." +func IsDiegoDockerBuildpackConflictError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 320002 +} + +// NewDockerDisabledError returns a new CloudFoundryError +// that IsDockerDisabledError will return true for +func NewDockerDisabledError() CloudFoundryError { + return CloudFoundryError{ + Code: 320003, + ErrorCode: "CF-DockerDisabled", + Description: "Docker support has not been enabled.", + } +} + +// IsDockerDisabledError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 320003 +// - HTTP code: 400 +// - message: "Docker support has not been enabled." +func IsDockerDisabledError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 320003 +} + +// NewStagingBackendInvalidError returns a new CloudFoundryError +// that IsStagingBackendInvalidError will return true for +func NewStagingBackendInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 320004, + ErrorCode: "CF-StagingBackendInvalid", + Description: "The request staging completion endpoint only handles apps desired to stage on the Diego backend.", + } +} + +// IsStagingBackendInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 320004 +// - HTTP code: 403 +// - message: "The request staging completion endpoint only handles apps desired to stage on the Diego backend." +func IsStagingBackendInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 320004 +} + +// NewBackendSelectionNotAuthorizedError returns a new CloudFoundryError +// that IsBackendSelectionNotAuthorizedError will return true for +func NewBackendSelectionNotAuthorizedError() CloudFoundryError { + return CloudFoundryError{ + Code: 320005, + ErrorCode: "CF-BackendSelectionNotAuthorized", + Description: "You cannot select the backend on which to run this application", + } +} + +// IsBackendSelectionNotAuthorizedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 320005 +// - HTTP code: 403 +// - message: "You cannot select the backend on which to run this application" +func IsBackendSelectionNotAuthorizedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 320005 +} + +// NewRevisionsEnabledError returns a new CloudFoundryError +// that IsRevisionsEnabledError will return true for +func NewRevisionsEnabledError() CloudFoundryError { + return CloudFoundryError{ + Code: 320006, + ErrorCode: "CF-RevisionsEnabled", + Description: "V2 restaging is disabled when your app has revisions enabled", + } +} + +// IsRevisionsEnabledError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 320006 +// - HTTP code: 400 +// - message: "V2 restaging is disabled when your app has revisions enabled" +func IsRevisionsEnabledError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 320006 +} + +// NewFeatureFlagNotFoundError returns a new CloudFoundryError +// that IsFeatureFlagNotFoundError will return true for +func NewFeatureFlagNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 330000, + ErrorCode: "CF-FeatureFlagNotFound", + Description: "The feature flag could not be found: %s", + } +} + +// IsFeatureFlagNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 330000 +// - HTTP code: 404 +// - message: "The feature flag could not be found: %s" +func IsFeatureFlagNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 330000 +} + +// NewFeatureFlagInvalidError returns a new CloudFoundryError +// that IsFeatureFlagInvalidError will return true for +func NewFeatureFlagInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 330001, + ErrorCode: "CF-FeatureFlagInvalid", + Description: "The feature flag is invalid: %s", + } +} + +// IsFeatureFlagInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 330001 +// - HTTP code: 400 +// - message: "The feature flag is invalid: %s" +func IsFeatureFlagInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 330001 +} + +// NewFeatureDisabledError returns a new CloudFoundryError +// that IsFeatureDisabledError will return true for +func NewFeatureDisabledError() CloudFoundryError { + return CloudFoundryError{ + Code: 330002, + ErrorCode: "CF-FeatureDisabled", + Description: "Feature Disabled: %s", + } +} + +// IsFeatureDisabledError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 330002 +// - HTTP code: 403 +// - message: "Feature Disabled: %s" +func IsFeatureDisabledError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 330002 +} + +// NewUserProvidedServiceInstanceNotFoundError returns a new CloudFoundryError +// that IsUserProvidedServiceInstanceNotFoundError will return true for +func NewUserProvidedServiceInstanceNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 340001, + ErrorCode: "CF-UserProvidedServiceInstanceNotFound", + Description: "The service instance could not be found: %s", + } +} + +// IsUserProvidedServiceInstanceNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 340001 +// - HTTP code: 404 +// - message: "The service instance could not be found: %s" +func IsUserProvidedServiceInstanceNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 340001 +} + +// NewUserProvidedServiceInstanceHandlerNeededError returns a new CloudFoundryError +// that IsUserProvidedServiceInstanceHandlerNeededError will return true for +func NewUserProvidedServiceInstanceHandlerNeededError() CloudFoundryError { + return CloudFoundryError{ + Code: 340002, + ErrorCode: "CF-UserProvidedServiceInstanceHandlerNeeded", + Description: "Please use the User Provided Services API to manage this resource.", + } +} + +// IsUserProvidedServiceInstanceHandlerNeededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 340002 +// - HTTP code: 400 +// - message: "Please use the User Provided Services API to manage this resource." +func IsUserProvidedServiceInstanceHandlerNeededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 340002 +} + +// NewProcessInvalidError returns a new CloudFoundryError +// that IsProcessInvalidError will return true for +func NewProcessInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 350001, + ErrorCode: "CF-ProcessInvalid", + Description: "The process is invalid: %s", + } +} + +// IsProcessInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 350001 +// - HTTP code: 400 +// - message: "The process is invalid: %s" +func IsProcessInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 350001 +} + +// NewUnableToDeleteError returns a new CloudFoundryError +// that IsUnableToDeleteError will return true for +func NewUnableToDeleteError() CloudFoundryError { + return CloudFoundryError{ + Code: 350002, + ErrorCode: "CF-UnableToDelete", + Description: "Unable to perform delete action: %s", + } +} + +// IsUnableToDeleteError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 350002 +// - HTTP code: 400 +// - message: "Unable to perform delete action: %s" +func IsUnableToDeleteError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 350002 +} + +// NewProcessNotFoundError returns a new CloudFoundryError +// that IsProcessNotFoundError will return true for +func NewProcessNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 350003, + ErrorCode: "CF-ProcessNotFound", + Description: "The process could not be found: %s", + } +} + +// IsProcessNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 350003 +// - HTTP code: 404 +// - message: "The process could not be found: %s" +func IsProcessNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 350003 +} + +// NewServiceKeyNameTakenError returns a new CloudFoundryError +// that IsServiceKeyNameTakenError will return true for +func NewServiceKeyNameTakenError() CloudFoundryError { + return CloudFoundryError{ + Code: 360001, + ErrorCode: "CF-ServiceKeyNameTaken", + Description: "The service key name is taken: %s", + } +} + +// IsServiceKeyNameTakenError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 360001 +// - HTTP code: 400 +// - message: "The service key name is taken: %s" +func IsServiceKeyNameTakenError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 360001 +} + +// NewServiceKeyInvalidError returns a new CloudFoundryError +// that IsServiceKeyInvalidError will return true for +func NewServiceKeyInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 360002, + ErrorCode: "CF-ServiceKeyInvalid", + Description: "The service key is invalid: %s", + } +} + +// IsServiceKeyInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 360002 +// - HTTP code: 400 +// - message: "The service key is invalid: %s" +func IsServiceKeyInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 360002 +} + +// NewServiceKeyNotFoundError returns a new CloudFoundryError +// that IsServiceKeyNotFoundError will return true for +func NewServiceKeyNotFoundError() CloudFoundryError { + return CloudFoundryError{ + Code: 360003, + ErrorCode: "CF-ServiceKeyNotFound", + Description: "The service key could not be found: %s", + } +} + +// IsServiceKeyNotFoundError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 360003 +// - HTTP code: 404 +// - message: "The service key could not be found: %s" +func IsServiceKeyNotFoundError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 360003 +} + +// NewServiceKeyNotSupportedError returns a new CloudFoundryError +// that IsServiceKeyNotSupportedError will return true for +func NewServiceKeyNotSupportedError() CloudFoundryError { + return CloudFoundryError{ + Code: 360004, + ErrorCode: "CF-ServiceKeyNotSupported", + Description: "%s", + } +} + +// IsServiceKeyNotSupportedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 360004 +// - HTTP code: 400 +// - message: "%s" +func IsServiceKeyNotSupportedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 360004 +} + +// NewServiceKeyCredentialStoreUnavailableError returns a new CloudFoundryError +// that IsServiceKeyCredentialStoreUnavailableError will return true for +func NewServiceKeyCredentialStoreUnavailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 360005, + ErrorCode: "CF-ServiceKeyCredentialStoreUnavailable", + Description: "Credential store is unavailable", + } +} + +// IsServiceKeyCredentialStoreUnavailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 360005 +// - HTTP code: 503 +// - message: "Credential store is unavailable" +func IsServiceKeyCredentialStoreUnavailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 360005 +} + +// NewRoutingApiUnavailableError returns a new CloudFoundryError +// that IsRoutingApiUnavailableError will return true for +func NewRoutingApiUnavailableError() CloudFoundryError { + return CloudFoundryError{ + Code: 370001, + ErrorCode: "CF-RoutingApiUnavailable", + Description: "The Routing API is currently unavailable", + } +} + +// IsRoutingApiUnavailableError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 370001 +// - HTTP code: 503 +// - message: "The Routing API is currently unavailable" +func IsRoutingApiUnavailableError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 370001 +} + +// NewRoutingApiDisabledError returns a new CloudFoundryError +// that IsRoutingApiDisabledError will return true for +func NewRoutingApiDisabledError() CloudFoundryError { + return CloudFoundryError{ + Code: 370003, + ErrorCode: "CF-RoutingApiDisabled", + Description: "Routing API is disabled", + } +} + +// IsRoutingApiDisabledError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 370003 +// - HTTP code: 403 +// - message: "Routing API is disabled" +func IsRoutingApiDisabledError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 370003 +} + +// NewEnvironmentVariableGroupInvalidError returns a new CloudFoundryError +// that IsEnvironmentVariableGroupInvalidError will return true for +func NewEnvironmentVariableGroupInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 380001, + ErrorCode: "CF-EnvironmentVariableGroupInvalid", + Description: "The Environment Variable Group is invalid: %s", + } +} + +// IsEnvironmentVariableGroupInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 380001 +// - HTTP code: 400 +// - message: "The Environment Variable Group is invalid: %s" +func IsEnvironmentVariableGroupInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 380001 +} + +// NewDropletUploadInvalidError returns a new CloudFoundryError +// that IsDropletUploadInvalidError will return true for +func NewDropletUploadInvalidError() CloudFoundryError { + return CloudFoundryError{ + Code: 380002, + ErrorCode: "CF-DropletUploadInvalid", + Description: "The droplet upload is invalid: %s", + } +} + +// IsDropletUploadInvalidError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 380002 +// - HTTP code: 400 +// - message: "The droplet upload is invalid: %s" +func IsDropletUploadInvalidError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 380002 +} + +// NewServiceInstanceUnshareFailedError returns a new CloudFoundryError +// that IsServiceInstanceUnshareFailedError will return true for +func NewServiceInstanceUnshareFailedError() CloudFoundryError { + return CloudFoundryError{ + Code: 390001, + ErrorCode: "CF-ServiceInstanceUnshareFailed", + Description: "Unshare of service instance failed: %s", + } +} + +// IsServiceInstanceUnshareFailedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390001 +// - HTTP code: 502 +// - message: "Unshare of service instance failed: \n\n%s" +func IsServiceInstanceUnshareFailedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390001 +} + +// NewServiceInstanceDeletionSharesExistsError returns a new CloudFoundryError +// that IsServiceInstanceDeletionSharesExistsError will return true for +func NewServiceInstanceDeletionSharesExistsError() CloudFoundryError { + return CloudFoundryError{ + Code: 390002, + ErrorCode: "CF-ServiceInstanceDeletionSharesExists", + Description: "Service instances must be unshared before they can be deleted. Unsharing %s will automatically delete any bindings that have been made to applications in other spaces.", + } +} + +// IsServiceInstanceDeletionSharesExistsError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390002 +// - HTTP code: 422 +// - message: "Service instances must be unshared before they can be deleted. Unsharing %s will automatically delete any bindings that have been made to applications in other spaces." +func IsServiceInstanceDeletionSharesExistsError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390002 +} + +// NewSharedServiceInstanceCannotBeRenamedError returns a new CloudFoundryError +// that IsSharedServiceInstanceCannotBeRenamedError will return true for +func NewSharedServiceInstanceCannotBeRenamedError() CloudFoundryError { + return CloudFoundryError{ + Code: 390003, + ErrorCode: "CF-SharedServiceInstanceCannotBeRenamed", + Description: "Service instances that have been shared cannot be renamed", + } +} + +// IsSharedServiceInstanceCannotBeRenamedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390003 +// - HTTP code: 422 +// - message: "Service instances that have been shared cannot be renamed" +func IsSharedServiceInstanceCannotBeRenamedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390003 +} + +// NewSharedServiceInstanceNotUpdatableInTargetSpaceError returns a new CloudFoundryError +// that IsSharedServiceInstanceNotUpdatableInTargetSpaceError will return true for +func NewSharedServiceInstanceNotUpdatableInTargetSpaceError() CloudFoundryError { + return CloudFoundryError{ + Code: 390004, + ErrorCode: "CF-SharedServiceInstanceNotUpdatableInTargetSpace", + Description: "You cannot update service instances that have been shared with you", + } +} + +// IsSharedServiceInstanceNotUpdatableInTargetSpaceError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390004 +// - HTTP code: 403 +// - message: "You cannot update service instances that have been shared with you" +func IsSharedServiceInstanceNotUpdatableInTargetSpaceError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390004 +} + +// NewSharedServiceInstanceNotDeletableInTargetSpaceError returns a new CloudFoundryError +// that IsSharedServiceInstanceNotDeletableInTargetSpaceError will return true for +func NewSharedServiceInstanceNotDeletableInTargetSpaceError() CloudFoundryError { + return CloudFoundryError{ + Code: 390005, + ErrorCode: "CF-SharedServiceInstanceNotDeletableInTargetSpace", + Description: "You cannot delete service instances that have been shared with you", + } +} + +// IsSharedServiceInstanceNotDeletableInTargetSpaceError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390005 +// - HTTP code: 403 +// - message: "You cannot delete service instances that have been shared with you" +func IsSharedServiceInstanceNotDeletableInTargetSpaceError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390005 +} + +// NewMaintenanceInfoNotSupportedError returns a new CloudFoundryError +// that IsMaintenanceInfoNotSupportedError will return true for +func NewMaintenanceInfoNotSupportedError() CloudFoundryError { + return CloudFoundryError{ + Code: 390006, + ErrorCode: "CF-MaintenanceInfoNotSupported", + Description: "The service broker does not support upgrades for service instances created from this plan.", + } +} + +// IsMaintenanceInfoNotSupportedError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390006 +// - HTTP code: 422 +// - message: "The service broker does not support upgrades for service instances created from this plan." +func IsMaintenanceInfoNotSupportedError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390006 +} + +// NewMaintenanceInfoNotSemverError returns a new CloudFoundryError +// that IsMaintenanceInfoNotSemverError will return true for +func NewMaintenanceInfoNotSemverError() CloudFoundryError { + return CloudFoundryError{ + Code: 390007, + ErrorCode: "CF-MaintenanceInfoNotSemver", + Description: "maintenance_info.version should be a semantic version.", + } +} + +// IsMaintenanceInfoNotSemverError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390007 +// - HTTP code: 422 +// - message: "maintenance_info.version should be a semantic version." +func IsMaintenanceInfoNotSemverError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390007 +} + +// NewMaintenanceInfoNotUpdatableWhenChangingPlanError returns a new CloudFoundryError +// that IsMaintenanceInfoNotUpdatableWhenChangingPlanError will return true for +func NewMaintenanceInfoNotUpdatableWhenChangingPlanError() CloudFoundryError { + return CloudFoundryError{ + Code: 390008, + ErrorCode: "CF-MaintenanceInfoNotUpdatableWhenChangingPlan", + Description: "maintenance_info should not be changed when switching to different plan.", + } +} + +// IsMaintenanceInfoNotUpdatableWhenChangingPlanError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390008 +// - HTTP code: 422 +// - message: "maintenance_info should not be changed when switching to different plan." +func IsMaintenanceInfoNotUpdatableWhenChangingPlanError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390008 +} + +// NewMaintenanceInfoConflictError returns a new CloudFoundryError +// that IsMaintenanceInfoConflictError will return true for +func NewMaintenanceInfoConflictError() CloudFoundryError { + return CloudFoundryError{ + Code: 390009, + ErrorCode: "CF-MaintenanceInfoConflict", + Description: "maintenance_info.version requested is invalid. Please ensure the catalog is up to date and you are providing a version supported by this service plan.", + } +} + +// IsMaintenanceInfoConflictError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390009 +// - HTTP code: 422 +// - message: "maintenance_info.version requested is invalid. Please ensure the catalog is up to date and you are providing a version supported by this service plan." +func IsMaintenanceInfoConflictError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390009 +} + +// NewBuildpackStacksDontMatchError returns a new CloudFoundryError +// that IsBuildpackStacksDontMatchError will return true for +func NewBuildpackStacksDontMatchError() CloudFoundryError { + return CloudFoundryError{ + Code: 390011, + ErrorCode: "CF-BuildpackStacksDontMatch", + Description: "Uploaded buildpack stack (%s) does not match %s", + } +} + +// IsBuildpackStacksDontMatchError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390011 +// - HTTP code: 422 +// - message: "Uploaded buildpack stack (%s) does not match %s" +func IsBuildpackStacksDontMatchError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390011 +} + +// NewBuildpackStackDoesNotExistError returns a new CloudFoundryError +// that IsBuildpackStackDoesNotExistError will return true for +func NewBuildpackStackDoesNotExistError() CloudFoundryError { + return CloudFoundryError{ + Code: 390012, + ErrorCode: "CF-BuildpackStackDoesNotExist", + Description: "Uploaded buildpack stack (%s) does not exist", + } +} + +// IsBuildpackStackDoesNotExistError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390012 +// - HTTP code: 422 +// - message: "Uploaded buildpack stack (%s) does not exist" +func IsBuildpackStackDoesNotExistError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390012 +} + +// NewBuildpackZipError returns a new CloudFoundryError +// that IsBuildpackZipError will return true for +func NewBuildpackZipError() CloudFoundryError { + return CloudFoundryError{ + Code: 390013, + ErrorCode: "CF-BuildpackZipError", + Description: "Buildpack zip error: %s", + } +} + +// IsBuildpackZipError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390013 +// - HTTP code: 422 +// - message: "Buildpack zip error: %s" +func IsBuildpackZipError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390013 +} + +// NewDeploymentsDisabledError returns a new CloudFoundryError +// that IsDeploymentsDisabledError will return true for +func NewDeploymentsDisabledError() CloudFoundryError { + return CloudFoundryError{ + Code: 390014, + ErrorCode: "CF-DeploymentsDisabled", + Description: "Deployments cannot be created due to manifest property 'temporary_disable_deployments'", + } +} + +// IsDeploymentsDisabledError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390014 +// - HTTP code: 403 +// - message: "Deployments cannot be created due to manifest property 'temporary_disable_deployments'" +func IsDeploymentsDisabledError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390014 +} + +// NewNoCurrentEncryptionKeyError returns a new CloudFoundryError +// that IsNoCurrentEncryptionKeyError will return true for +func NewNoCurrentEncryptionKeyError() CloudFoundryError { + return CloudFoundryError{ + Code: 390015, + ErrorCode: "CF-NoCurrentEncryptionKey", + Description: "Please set the desired encryption key in the manifest at ‘cc.database_encryption.current_key_label’", + } +} + +// IsNoCurrentEncryptionKeyError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390015 +// - HTTP code: 422 +// - message: "Please set the desired encryption key in the manifest at ‘cc.database_encryption.current_key_label’" +func IsNoCurrentEncryptionKeyError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390015 +} + +// NewScaleDisabledDuringDeploymentError returns a new CloudFoundryError +// that IsScaleDisabledDuringDeploymentError will return true for +func NewScaleDisabledDuringDeploymentError() CloudFoundryError { + return CloudFoundryError{ + Code: 390016, + ErrorCode: "CF-ScaleDisabledDuringDeployment", + Description: "Cannot scale this process while a deployment is in flight.", + } +} + +// IsScaleDisabledDuringDeploymentError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390016 +// - HTTP code: 422 +// - message: "Cannot scale this process while a deployment is in flight." +func IsScaleDisabledDuringDeploymentError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390016 +} + +// NewProcessUpdateDisabledDuringDeploymentError returns a new CloudFoundryError +// that IsProcessUpdateDisabledDuringDeploymentError will return true for +func NewProcessUpdateDisabledDuringDeploymentError() CloudFoundryError { + return CloudFoundryError{ + Code: 390017, + ErrorCode: "CF-ProcessUpdateDisabledDuringDeployment", + Description: "Cannot update this process while a deployment is in flight.", + } +} + +// IsProcessUpdateDisabledDuringDeploymentError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390017 +// - HTTP code: 422 +// - message: "Cannot update this process while a deployment is in flight." +func IsProcessUpdateDisabledDuringDeploymentError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390017 +} + +// NewLabelLimitExceededError returns a new CloudFoundryError +// that IsLabelLimitExceededError will return true for +func NewLabelLimitExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 390020, + ErrorCode: "CF-LabelLimitExceeded", + Description: "Failed to add %d labels because it would exceed maximum of %d", + } +} + +// IsLabelLimitExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390020 +// - HTTP code: 422 +// - message: "Failed to add %d labels because it would exceed maximum of %d" +func IsLabelLimitExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390020 +} + +// NewAnnotationLimitExceededError returns a new CloudFoundryError +// that IsAnnotationLimitExceededError will return true for +func NewAnnotationLimitExceededError() CloudFoundryError { + return CloudFoundryError{ + Code: 390023, + ErrorCode: "CF-AnnotationLimitExceeded", + Description: "Failed to add %d annotations because it would exceed maximum of %d", + } +} + +// IsAnnotationLimitExceededError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390023 +// - HTTP code: 422 +// - message: "Failed to add %d annotations because it would exceed maximum of %d" +func IsAnnotationLimitExceededError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390023 +} + +// NewStopDisabledDuringDeploymentError returns a new CloudFoundryError +// that IsStopDisabledDuringDeploymentError will return true for +func NewStopDisabledDuringDeploymentError() CloudFoundryError { + return CloudFoundryError{ + Code: 390024, + ErrorCode: "CF-StopDisabledDuringDeployment", + Description: "Cannot stop the app while it is deploying, please cancel the deployment before stopping the app.", + } +} + +// IsStopDisabledDuringDeploymentError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 390024 +// - HTTP code: 422 +// - message: "Cannot stop the app while it is deploying, please cancel the deployment before stopping the app." +func IsStopDisabledDuringDeploymentError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 390024 +} + +// NewKubernetesRouteResourceError returns a new CloudFoundryError +// that IsKubernetesRouteResourceError will return true for +func NewKubernetesRouteResourceError() CloudFoundryError { + return CloudFoundryError{ + Code: 400001, + ErrorCode: "CF-KubernetesRouteResourceError", + Description: "Failed to create/update/delete Route resource with guid '%s' on Kubernetes", + } +} + +// IsKubernetesRouteResourceError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 400001 +// - HTTP code: 422 +// - message: "Failed to create/update/delete Route resource with guid '%s' on Kubernetes" +func IsKubernetesRouteResourceError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 400001 +} + +// NewKpackImageError returns a new CloudFoundryError +// that IsKpackImageError will return true for +func NewKpackImageError() CloudFoundryError { + return CloudFoundryError{ + Code: 400002, + ErrorCode: "CF-KpackImageError", + Description: "Failed to %s Image resource for staging: '%s'", + } +} + +// IsKpackImageError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 400002 +// - HTTP code: 422 +// - message: "Failed to %s Image resource for staging: '%s'" +func IsKpackImageError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 400002 +} + +// NewKpackBuilderError returns a new CloudFoundryError +// that IsKpackBuilderError will return true for +func NewKpackBuilderError() CloudFoundryError { + return CloudFoundryError{ + Code: 400003, + ErrorCode: "CF-KpackBuilderError", + Description: "Failed to %s Builder resource: '%s'", + } +} + +// IsKpackBuilderError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 400003 +// - HTTP code: 422 +// - message: "Failed to %s Builder resource: '%s'" +func IsKpackBuilderError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 400003 +} + +// NewEiriniLRPError returns a new CloudFoundryError +// that IsEiriniLRPError will return true for +func NewEiriniLRPError() CloudFoundryError { + return CloudFoundryError{ + Code: 410001, + ErrorCode: "CF-EiriniLRPError", + Description: "Failed to %s LRP resource: '%s'", + } +} + +// IsEiriniLRPError returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: 410001 +// - HTTP code: 422 +// - message: "Failed to %s LRP resource: '%s'" +func IsEiriniLRPError(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == 410001 +} + +func cloudFoundryError(err error) (cferr CloudFoundryError, ok bool) { + type causer interface { + Cause() error + } + if _, isCauser := err.(causer); isCauser { + cause := pkgerrors.Cause(err) + cferr, ok = cause.(CloudFoundryError) + } else { + ok = stderrors.As(err, &cferr) + } + return cferr, ok +} diff --git a/third_party/go-cfclient/cf_error_test.go b/third_party/go-cfclient/cf_error_test.go new file mode 100644 index 000000000000..d4fbd651d4ca --- /dev/null +++ b/third_party/go-cfclient/cf_error_test.go @@ -0,0 +1,37 @@ +package cfclient + +import ( + stderrors "errors" + "fmt" + "testing" + + pkgerrors "github.com/pkg/errors" +) + +func TestIsSpaceNotFoundError(t *testing.T) { + tests := []struct { + name string + error + want bool + }{ + {"std/errors error", stderrors.New("is not"), false}, + {"pkg/errors error", pkgerrors.New("is not"), false}, + {"unwrapped CloudFoundry error", CloudFoundryError{ + Code: 40004, + }, true}, + {"pkg wrapped CloudFoundry error", pkgerrors.Wrap(CloudFoundryError{ + Code: 40004, + }, ""), true}, + {"std wrapped CloudFoundry error", fmt.Errorf("%w", CloudFoundryError{ + Code: 40004, + }), true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := IsSpaceNotFoundError(tt.error) + if got != tt.want { + t.Errorf("got %v, want %v", got, tt.want) + } + }) + } +} diff --git a/third_party/go-cfclient/cf_test.go b/third_party/go-cfclient/cf_test.go new file mode 100644 index 000000000000..ff446dfb6d77 --- /dev/null +++ b/third_party/go-cfclient/cf_test.go @@ -0,0 +1,224 @@ +package cfclient + +import ( + "io/ioutil" + "net/http" + "net/http/httptest" + "net/url" + "strconv" + "strings" + "testing" + + "github.com/go-martini/martini" + "github.com/martini-contrib/render" +) + +var ( + mux *http.ServeMux + server *httptest.Server + fakeUAAServer *httptest.Server +) + +type MockRoute struct { + Method string + Endpoint string + Output []string + UserAgent string + Status int + QueryString string + PostForm *string +} + +type MockRouteWithRedirect struct { + MockRoute + RedirectLocation string +} + +func setup(mock MockRoute, t *testing.T) { + setupMultiple([]MockRoute{mock}, t) +} + +func setupWithRedirect(mock MockRouteWithRedirect, t *testing.T) { + setupMultipleWithRedirect([]MockRouteWithRedirect{mock}, t) +} + +func testQueryString(QueryString string, QueryStringExp string, t *testing.T) { + t.Helper() + if QueryStringExp == "" { + return + } + + value, _ := url.QueryUnescape(QueryString) + if QueryStringExp != value { + t.Errorf("Error: Query string '%s' should be equal to '%s'", QueryStringExp, value) + } +} + +func testUserAgent(UserAgent string, UserAgentExp string, t *testing.T) { + t.Helper() + if len(UserAgentExp) < 1 { + UserAgentExp = "Go-CF-client/1.1" + } + if UserAgent != UserAgentExp { + t.Errorf("Error: Agent %s should be equal to %s", UserAgent, UserAgentExp) + } +} + +func testReqBody(req *http.Request, postFormBody *string, t *testing.T) { + t.Helper() + if postFormBody != nil { + if body, err := ioutil.ReadAll(req.Body); err != nil { + t.Error("No request body but expected one") + } else { + defer req.Body.Close() + if strings.TrimSpace(string(body)) != strings.TrimSpace(*postFormBody) { + t.Errorf("Expected request body (%s) does not equal request body (%s)", *postFormBody, body) + } + } + } +} + +func testBodyContains(req *http.Request, expected *string, t *testing.T) { + t.Helper() + if expected != nil { + if body, err := ioutil.ReadAll(req.Body); err != nil { + t.Error("No request body but expected one") + } else { + defer req.Body.Close() + if !strings.Contains(string(body), *expected) { + t.Errorf("Expected request body (%s) was not found in actual request body (%s)", *expected, body) + } + } + } +} + +func setupMultiple(mockEndpoints []MockRoute, t *testing.T) { + mockEndpointsWithRedirect := make([]MockRouteWithRedirect, len(mockEndpoints)) + for i, mock := range mockEndpoints { + mockEndpointsWithRedirect[i] = MockRouteWithRedirect{ + MockRoute: mock, + RedirectLocation: "", + } + } + setupMultipleWithRedirect(mockEndpointsWithRedirect, t) +} + +func setupMultipleWithRedirect(mockEndpoints []MockRouteWithRedirect, t *testing.T) { + mux = http.NewServeMux() + server = httptest.NewServer(mux) + fakeUAAServer = FakeUAAServer(3) + m := martini.New() + m.Use(render.Renderer()) + r := martini.NewRouter() + for _, mock := range mockEndpoints { + method := mock.Method + endpoint := mock.Endpoint + output := mock.Output + if len(output) == 0 { + t.Fatal("Mock output cannot be an array of length 0, did you mean to use []string{\"\"}?") + } + userAgent := mock.UserAgent + status := mock.Status + queryString := mock.QueryString + postFormBody := mock.PostForm + redirectLocation := mock.RedirectLocation + switch method { + case "GET": + count := 0 + r.Get(endpoint, func(res http.ResponseWriter, req *http.Request) (int, string) { + testUserAgent(req.Header.Get("User-Agent"), userAgent, t) + testQueryString(req.URL.RawQuery, queryString, t) + if redirectLocation != "" { + res.Header().Add("Location", redirectLocation) + } + singleOutput := output[count] + count++ + return status, singleOutput + }) + case "POST": + r.Post(endpoint, func(req *http.Request) (int, string) { + testUserAgent(req.Header.Get("User-Agent"), userAgent, t) + testQueryString(req.URL.RawQuery, queryString, t) + testReqBody(req, postFormBody, t) + return status, output[0] + }) + case "DELETE": + r.Delete(endpoint, func(req *http.Request) (int, string) { + testUserAgent(req.Header.Get("User-Agent"), userAgent, t) + testQueryString(req.URL.RawQuery, queryString, t) + return status, output[0] + }) + case "PUT": + r.Put(endpoint, func(req *http.Request) (int, string) { + testUserAgent(req.Header.Get("User-Agent"), userAgent, t) + testQueryString(req.URL.RawQuery, queryString, t) + testReqBody(req, postFormBody, t) + return status, output[0] + }) + case "PATCH": + r.Patch(endpoint, func(req *http.Request) (int, string) { + testUserAgent(req.Header.Get("User-Agent"), userAgent, t) + testQueryString(req.URL.RawQuery, queryString, t) + testReqBody(req, postFormBody, t) + return status, output[0] + }) + case "PUT-FILE": + r.Put(endpoint, func(req *http.Request) (int, string) { + testUserAgent(req.Header.Get("User-Agent"), userAgent, t) + testBodyContains(req, postFormBody, t) + return status, output[0] + }) + } + } + r.Get("/v2/info", func(r render.Render) { + r.JSON(200, map[string]interface{}{ + "authorization_endpoint": fakeUAAServer.URL, + "token_endpoint": fakeUAAServer.URL, + "logging_endpoint": server.URL, + "name": "", + "build": "", + "support": "https://support.example.net", + "version": 0, + "description": "", + "min_cli_version": "6.23.0", + "min_recommended_cli_version": "6.23.0", + "api_version": "2.103.0", + "app_ssh_endpoint": "ssh.example.net:2222", + "app_ssh_host_key_fingerprint": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:01", + "app_ssh_oauth_client": "ssh-proxy", + "doppler_logging_endpoint": "wss://doppler.example.net:443", + "routing_endpoint": "https://api.example.net/routing", + }) + + }) + + m.Action(r.Handle) + mux.Handle("/", m) +} + +func FakeUAAServer(expiresIn int) *httptest.Server { + mux := http.NewServeMux() + server := httptest.NewServer(mux) + m := martini.New() + m.Use(render.Renderer()) + r := martini.NewRouter() + count := 1 + r.Post("/oauth/token", func(r render.Render) { + r.JSON(200, map[string]interface{}{ + "token_type": "bearer", + "access_token": "foobar" + strconv.Itoa(count), + "refresh_token": "barfoo", + "expires_in": expiresIn, + }) + count = count + 1 + }) + r.NotFound(func() string { return "" }) + m.Action(r.Handle) + mux.Handle("/", m) + return server +} + +func teardown() { + server.Close() + fakeUAAServer.Close() +} diff --git a/third_party/go-cfclient/client.go b/third_party/go-cfclient/client.go new file mode 100644 index 000000000000..951fb0c48466 --- /dev/null +++ b/third_party/go-cfclient/client.go @@ -0,0 +1,551 @@ +package cfclient + +import ( + "bytes" + "crypto/tls" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "os" + "path/filepath" + "strings" + + "time" + + "github.com/pkg/errors" + "golang.org/x/net/context" + "golang.org/x/oauth2" + "golang.org/x/oauth2/clientcredentials" +) + +// Client used to communicate with Cloud Foundry +type Client struct { + Config Config + Endpoint Endpoint +} + +type Endpoint struct { + DopplerEndpoint string `json:"doppler_logging_endpoint"` + LoggingEndpoint string `json:"logging_endpoint"` + AuthEndpoint string `json:"authorization_endpoint"` + TokenEndpoint string `json:"token_endpoint"` + AppSSHEndpoint string `json:"app_ssh_endpoint"` + AppSSHOauthClient string `json:"app_ssh_oauth_client"` +} + +// Config is used to configure the creation of a client +type Config struct { + ApiAddress string `json:"api_url"` + Username string `json:"user"` + Password string `json:"password"` + ClientID string `json:"client_id"` + ClientSecret string `json:"client_secret"` + SkipSslValidation bool `json:"skip_ssl_validation"` + HttpClient *http.Client + Token string `json:"auth_token"` + TokenSource oauth2.TokenSource + tokenSourceDeadline *time.Time + UserAgent string `json:"user_agent"` + Origin string `json:"-"` +} + +type LoginHint struct { + Origin string `json:"origin"` +} + +// Request is used to help build up a request +type Request struct { + method string + url string + params url.Values + body io.Reader + obj interface{} +} + +type cfHomeConfig struct { + AccessToken string + RefreshToken string + Target string + AuthorizationEndpoint string + OrganizationFields struct { + Name string + } + SpaceFields struct { + Name string + } + SSLDisabled bool +} + +func NewConfigFromCF() (*Config, error) { + return NewConfigFromCFHome("") +} + +func NewConfigFromCFHome(cfHomeDir string) (*Config, error) { + var err error + + if cfHomeDir == "" { + cfHomeDir = os.Getenv("CF_HOME") + if cfHomeDir == "" { + cfHomeDir, err = os.UserHomeDir() + if err != nil { + return nil, err + } + } + } + + cfHomeConfig, err := loadCFHomeConfig(cfHomeDir) + if err != nil { + return nil, err + } + + cfg := DefaultConfig() + cfg.Token = cfHomeConfig.AccessToken + cfg.ApiAddress = cfHomeConfig.Target + cfg.SkipSslValidation = cfHomeConfig.SSLDisabled + + return cfg, nil +} + +func loadCFHomeConfig(cfHomeDir string) (*cfHomeConfig, error) { + cfConfigDir := filepath.Join(cfHomeDir, ".cf") + cfJSON, err := ioutil.ReadFile(filepath.Join(cfConfigDir, "config.json")) + if err != nil { + return nil, err + } + + var cfg cfHomeConfig + err = json.Unmarshal(cfJSON, &cfg) + if err == nil { + if len(cfg.AccessToken) > len("bearer ") { + cfg.AccessToken = cfg.AccessToken[len("bearer "):] + } + } + + return &cfg, nil +} + +// DefaultConfig creates a default config object used by CF client +func DefaultConfig() *Config { + return &Config{ + ApiAddress: "http://api.bosh-lite.com", + Username: "admin", + Password: "admin", + Token: "", + SkipSslValidation: false, + HttpClient: http.DefaultClient, + UserAgent: "Go-CF-client/1.1", + } +} + +func DefaultEndpoint() *Endpoint { + return &Endpoint{ + DopplerEndpoint: "wss://doppler.10.244.0.34.xip.io:443", + LoggingEndpoint: "wss://loggregator.10.244.0.34.xip.io:443", + TokenEndpoint: "https://uaa.10.244.0.34.xip.io", + AuthEndpoint: "https://login.10.244.0.34.xip.io", + } +} + +// NewClient returns a new client +func NewClient(config *Config) (client *Client, err error) { + // bootstrap the config + defConfig := DefaultConfig() + + if len(config.ApiAddress) == 0 { + config.ApiAddress = defConfig.ApiAddress + } + + if len(config.Username) == 0 { + config.Username = defConfig.Username + } + + if len(config.Password) == 0 { + config.Password = defConfig.Password + } + + if len(config.Token) == 0 { + config.Token = defConfig.Token + } + + if len(config.UserAgent) == 0 { + config.UserAgent = defConfig.UserAgent + } + + if config.HttpClient == nil { + config.HttpClient = defConfig.HttpClient + } + + if config.HttpClient.Transport == nil { + config.HttpClient.Transport = shallowDefaultTransport() + } + + var tp *http.Transport + + switch t := config.HttpClient.Transport.(type) { + case *http.Transport: + tp = t + case *oauth2.Transport: + if bt, ok := t.Base.(*http.Transport); ok { + tp = bt + } + } + + if tp != nil { + if tp.TLSClientConfig == nil { + tp.TLSClientConfig = &tls.Config{} + } + tp.TLSClientConfig.InsecureSkipVerify = config.SkipSslValidation + } + + config.ApiAddress = strings.TrimRight(config.ApiAddress, "/") + + client = &Client{ + Config: *config, + } + + if err := client.refreshEndpoint(); err != nil { + return nil, err + } + + return client, nil +} + +func shallowDefaultTransport() *http.Transport { + defaultTransport := http.DefaultTransport.(*http.Transport) + return &http.Transport{ + Proxy: defaultTransport.Proxy, + TLSHandshakeTimeout: defaultTransport.TLSHandshakeTimeout, + ExpectContinueTimeout: defaultTransport.ExpectContinueTimeout, + } +} + +func getUserAuth(ctx context.Context, config Config, endpoint *Endpoint) (Config, error) { + authConfig := &oauth2.Config{ + ClientID: "cf", + Scopes: []string{""}, + Endpoint: oauth2.Endpoint{ + AuthURL: endpoint.AuthEndpoint + "/oauth/auth", + TokenURL: endpoint.TokenEndpoint + "/oauth/token", + }, + } + if config.Origin != "" { + loginHint := LoginHint{config.Origin} + origin, err := json.Marshal(loginHint) + if err != nil { + return config, errors.Wrap(err, "Error creating login_hint") + } + val := url.Values{} + val.Set("login_hint", string(origin)) + authConfig.Endpoint.TokenURL = fmt.Sprintf("%s?%s", authConfig.Endpoint.TokenURL, val.Encode()) + } + + token, err := authConfig.PasswordCredentialsToken(ctx, config.Username, config.Password) + if err != nil { + return config, errors.Wrap(err, "Error getting token") + } + + config.tokenSourceDeadline = &token.Expiry + config.TokenSource = authConfig.TokenSource(ctx, token) + config.HttpClient = oauth2.NewClient(ctx, config.TokenSource) + + return config, err +} + +func getClientAuth(ctx context.Context, config Config, endpoint *Endpoint) Config { + authConfig := &clientcredentials.Config{ + ClientID: config.ClientID, + ClientSecret: config.ClientSecret, + TokenURL: endpoint.TokenEndpoint + "/oauth/token", + } + + config.TokenSource = authConfig.TokenSource(ctx) + config.HttpClient = authConfig.Client(ctx) + return config +} + +// getUserTokenAuth initializes client credentials from existing bearer token. +func getUserTokenAuth(ctx context.Context, config Config, endpoint *Endpoint) Config { + authConfig := &oauth2.Config{ + ClientID: "cf", + Scopes: []string{""}, + Endpoint: oauth2.Endpoint{ + AuthURL: endpoint.AuthEndpoint + "/oauth/auth", + TokenURL: endpoint.TokenEndpoint + "/oauth/token", + }, + } + + // Token is expected to have no "bearer" prefix + token := &oauth2.Token{ + AccessToken: config.Token, + TokenType: "Bearer"} + + config.TokenSource = authConfig.TokenSource(ctx, token) + config.HttpClient = oauth2.NewClient(ctx, config.TokenSource) + + return config +} + +func getInfo(api string, httpClient *http.Client) (*Endpoint, error) { + var endpoint Endpoint + + if api == "" { + return DefaultEndpoint(), nil + } + + resp, err := httpClient.Get(api + "/v2/info") + if err != nil { + return nil, err + } + defer resp.Body.Close() + + err = decodeBody(resp, &endpoint) + if err != nil { + return nil, err + } + + return &endpoint, err +} + +// NewRequest is used to create a new Request +func (c *Client) NewRequest(method, path string) *Request { + r := &Request{ + method: method, + url: c.Config.ApiAddress + path, + params: make(map[string][]string), + } + return r +} + +// NewRequestWithBody is used to create a new request with +// arbigtrary body io.Reader. +func (c *Client) NewRequestWithBody(method, path string, body io.Reader) *Request { + r := c.NewRequest(method, path) + + // Set request body + r.body = body + + return r +} + +// DoRequest runs a request with our client +func (c *Client) DoRequest(r *Request) (*http.Response, error) { + req, err := r.toHTTP() + if err != nil { + return nil, err + } + return c.Do(req) +} + +// DoRequestWithoutRedirects executes the request without following redirects +func (c *Client) DoRequestWithoutRedirects(r *Request) (*http.Response, error) { + prevCheckRedirect := c.Config.HttpClient.CheckRedirect + c.Config.HttpClient.CheckRedirect = func(httpReq *http.Request, via []*http.Request) error { + return http.ErrUseLastResponse + } + defer func() { + c.Config.HttpClient.CheckRedirect = prevCheckRedirect + }() + return c.DoRequest(r) +} + +func (c *Client) Do(req *http.Request) (*http.Response, error) { + req.Header.Set("User-Agent", c.Config.UserAgent) + if req.Body != nil && req.Header.Get("Content-type") == "" { + req.Header.Set("Content-type", "application/json") + } + + resp, err := c.Config.HttpClient.Do(req) + if err != nil { + return nil, err + } + + if resp.StatusCode >= http.StatusBadRequest { + return c.handleError(resp) + } + + return resp, nil +} + +func (c *Client) handleError(resp *http.Response) (*http.Response, error) { + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + + if err != nil { + return resp, CloudFoundryHTTPError{ + StatusCode: resp.StatusCode, + Status: resp.Status, + Body: body, + } + } + + // Unmarshal V2 error response + if strings.HasPrefix(resp.Request.URL.Path, "/v2/") { + var cfErr CloudFoundryError + if err := json.Unmarshal(body, &cfErr); err != nil { + return resp, CloudFoundryHTTPError{ + StatusCode: resp.StatusCode, + Status: resp.Status, + Body: body, + } + } + return nil, cfErr + } + + // Unmarshal a V3 error response and convert it into a V2 model + var cfErrorsV3 CloudFoundryErrorsV3 + if err := json.Unmarshal(body, &cfErrorsV3); err != nil { + return resp, CloudFoundryHTTPError{ + StatusCode: resp.StatusCode, + Status: resp.Status, + Body: body, + } + } + return nil, NewCloudFoundryErrorFromV3Errors(cfErrorsV3) +} + +func (c *Client) refreshEndpoint() error { + // we want to keep the Timeout value from config.HttpClient + timeout := c.Config.HttpClient.Timeout + + ctx := context.Background() + ctx = context.WithValue(ctx, oauth2.HTTPClient, c.Config.HttpClient) + + endpoint, err := getInfo(c.Config.ApiAddress, oauth2.NewClient(ctx, nil)) + + if err != nil { + return errors.Wrap(err, "Could not get api /v2/info") + } + + switch { + case c.Config.Token != "": + c.Config = getUserTokenAuth(ctx, c.Config, endpoint) + case c.Config.ClientID != "": + c.Config = getClientAuth(ctx, c.Config, endpoint) + default: + c.Config, err = getUserAuth(ctx, c.Config, endpoint) + if err != nil { + return err + } + } + // make sure original Timeout value will be used + if c.Config.HttpClient.Timeout != timeout { + c.Config.HttpClient.Timeout = timeout + } + + c.Endpoint = *endpoint + return nil +} + +// toHTTP converts the request to an HTTP Request +func (r *Request) toHTTP() (*http.Request, error) { + + // Check if we should encode the body + if r.body == nil && r.obj != nil { + b, err := encodeBody(r.obj) + if err != nil { + return nil, err + } + r.body = b + } + + // Create the HTTP Request + return http.NewRequest(r.method, r.url, r.body) +} + +// decodeBody is used to JSON decode a body +func decodeBody(resp *http.Response, out interface{}) error { + defer resp.Body.Close() + dec := json.NewDecoder(resp.Body) + return dec.Decode(out) +} + +// encodeBody is used to encode a request body +func encodeBody(obj interface{}) (io.Reader, error) { + buf := bytes.NewBuffer(nil) + enc := json.NewEncoder(buf) + if err := enc.Encode(obj); err != nil { + return nil, err + } + return buf, nil +} + +func (c *Client) GetToken() (string, error) { + if c.Config.tokenSourceDeadline != nil && c.Config.tokenSourceDeadline.Before(time.Now()) { + if err := c.refreshEndpoint(); err != nil { + return "", err + } + } + + token, err := c.Config.TokenSource.Token() + if err != nil { + return "", errors.Wrap(err, "Error getting bearer token") + } + return "bearer " + token.AccessToken, nil +} + +var ErrPreventRedirect = errors.New("prevent-redirect") + +func (c *Client) GetSSHCode() (string, error) { + authorizeUrl, err := url.Parse(c.Endpoint.TokenEndpoint) + if err != nil { + return "", err + } + + values := url.Values{} + values.Set("response_type", "code") + values.Set("grant_type", "authorization_code") + values.Set("client_id", c.Endpoint.AppSSHOauthClient) // client_id,used by cf server + + authorizeUrl.Path = "/oauth/authorize" + authorizeUrl.RawQuery = values.Encode() + + req, err := http.NewRequest("GET", authorizeUrl.String(), nil) + if err != nil { + return "", err + } + + token, err := c.GetToken() + if err != nil { + return "", err + } + + req.Header.Add("authorization", token) + httpClient := &http.Client{ + CheckRedirect: func(req *http.Request, _ []*http.Request) error { + return ErrPreventRedirect + }, + Timeout: 30 * time.Second, + Transport: &http.Transport{ + DisableKeepAlives: true, + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: c.Config.SkipSslValidation, + }, + Proxy: http.ProxyFromEnvironment, + TLSHandshakeTimeout: 10 * time.Second, + }, + } + + resp, err := httpClient.Do(req) + if err == nil { + return "", errors.New("authorization server did not redirect with one time code") + } + defer resp.Body.Close() + if netErr, ok := err.(*url.Error); !ok || netErr.Err != ErrPreventRedirect { + return "", errors.New(fmt.Sprintf("error requesting one time code from server: %s", err.Error())) + } + + loc, err := resp.Location() + if err != nil { + return "", errors.New(fmt.Sprintf("error getting the redirected location: %s", err.Error())) + } + + codes := loc.Query()["code"] + if len(codes) != 1 { + return "", errors.New("unable to acquire one time code from authorization response") + } + + return codes[0], nil +} diff --git a/third_party/go-cfclient/client_test.go b/third_party/go-cfclient/client_test.go new file mode 100644 index 000000000000..6b7538cbbc37 --- /dev/null +++ b/third_party/go-cfclient/client_test.go @@ -0,0 +1,241 @@ +package cfclient + +import ( + "io/ioutil" + "net/http" + "os" + "path" + "testing" + "time" + + . "github.com/smartystreets/goconvey/convey" +) + +const cfCLIConfig = ` +{ + "ConfigVersion": 3, + "Target": "https://api.sys.example.com", + "APIVersion": "2.164.0", + "AuthorizationEndpoint": "https://login.sys.example.com", + "DopplerEndPoint": "wss://doppler.sys.example.com:443", + "UaaEndpoint": "https://uaa.sys.example.com", + "RoutingAPIEndpoint": "https://api.sys.example.com/routing", + "AccessToken": "bearer secret-bearer-token", + "SSHOAuthClient": "ssh-proxy", + "UAAOAuthClient": "cf", + "UAAOAuthClientSecret": "", + "UAAGrantType": "", + "RefreshToken": "secret-refresh-token", + "OrganizationFields": { + "GUID": "42754be1-f558-4d28-9c06-c706f6641245", + "Name": "system", + "QuotaDefinition": { + "guid": "", + "name": "", + "memory_limit": 0, + "instance_memory_limit": 0, + "total_routes": 0, + "total_services": 0, + "non_basic_services_allowed": false, + "app_instance_limit": 0, + "total_reserved_route_ports": 0 + } + }, + "SpaceFields": { + "GUID": "e42ccfe9-04bf-4cbc-ae16-f26741778a71", + "Name": "system", + "AllowSSH": true + }, + "SSLDisabled": true, + "AsyncTimeout": 0, + "Trace": "", + "ColorEnabled": "", + "Locale": "", + "PluginRepos": [ + { + "Name": "CF-Community", + "URL": "https://plugins.cloudfoundry.org" + } + ], + "MinCLIVersion": "6.23.0", + "MinRecommendedCLIVersion": "6.23.0" +} +` + +func TestNewConfigFromCFHome(t *testing.T) { + Convey("New config from CF_HOME", t, func() { + cfHomeDir, err := ioutil.TempDir("", "cf_home") + So(err, ShouldBeNil) + + configDir := path.Join(cfHomeDir, ".cf") + err = os.MkdirAll(configDir, 0744) + So(err, ShouldBeNil) + + configPath := path.Join(configDir, "config.json") + err = os.WriteFile(configPath, []byte(cfCLIConfig), 0744) + So(err, ShouldBeNil) + + cfg, err := NewConfigFromCFHome(cfHomeDir) + So(err, ShouldBeNil) + + So(cfg.Token, ShouldEqual, "secret-bearer-token") + So(cfg.ApiAddress, ShouldEqual, "https://api.sys.example.com") + So(cfg.SkipSslValidation, ShouldBeTrue) + }) +} + +func TestDefaultConfig(t *testing.T) { + Convey("Default config", t, func() { + c := DefaultConfig() + So(c.ApiAddress, ShouldEqual, "http://api.bosh-lite.com") + So(c.Username, ShouldEqual, "admin") + So(c.Password, ShouldEqual, "admin") + So(c.SkipSslValidation, ShouldEqual, false) + So(c.Token, ShouldEqual, "") + So(c.UserAgent, ShouldEqual, "Go-CF-client/1.1") + }) +} + +func TestRemovalofTrailingSlashOnAPIAddress(t *testing.T) { + Convey("Test removal of trailing slash of the API Address", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{listOrgsPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL + "/", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + So(client.Config.ApiAddress, ShouldNotEndWith, "/") + }) +} + +func TestMakeRequest(t *testing.T) { + Convey("Test making request b", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{listOrgsPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Username: "foo", + Password: "bar", + SkipSslValidation: true, + } + client, err := NewClient(c) + So(err, ShouldBeNil) + req := client.NewRequest("GET", "/v2/organizations") + resp, err := client.DoRequest(req) + So(err, ShouldBeNil) + So(resp, ShouldNotBeNil) + }) +} + +func TestMakeRequestFailure(t *testing.T) { + Convey("Test making request b", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{listOrgsPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Username: "foo", + Password: "bar", + SkipSslValidation: true, + } + client, err := NewClient(c) + So(err, ShouldBeNil) + req := client.NewRequest("GET", "/v2/organizations") + req.url = "%gh&%ij" + resp, err := client.DoRequest(req) + So(resp, ShouldBeNil) + So(err, ShouldNotBeNil) + }) +} + +func TestMakeRequestWithTimeout(t *testing.T) { + Convey("Test making request b", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{listOrgsPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Username: "foo", + Password: "bar", + SkipSslValidation: true, + HttpClient: &http.Client{Timeout: 10 * time.Nanosecond}, + } + client, err := NewClient(c) + So(err, ShouldNotBeNil) + So(client, ShouldBeNil) + }) +} + +func TestHTTPErrorHandling(t *testing.T) { + Convey("Test making request b", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{"502 Bad Gateway"}, "", 502, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Username: "foo", + Password: "bar", + SkipSslValidation: true, + } + client, err := NewClient(c) + So(err, ShouldBeNil) + req := client.NewRequest("GET", "/v2/organizations") + resp, err := client.DoRequest(req) + So(err, ShouldNotBeNil) + So(resp, ShouldNotBeNil) + + httpErr := err.(CloudFoundryHTTPError) + So(httpErr.StatusCode, ShouldEqual, 502) + So(httpErr.Status, ShouldEqual, "502 Bad Gateway") + So(string(httpErr.Body), ShouldEqual, "502 Bad Gateway") + }) +} + +func TestTokenRefresh(t *testing.T) { + Convey("Test making request", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{listOrgsPayload}, "", 200, "", nil}, t) + fakeUAAServer = FakeUAAServer(1) + c := &Config{ + ApiAddress: server.URL, + Username: "foo", + Password: "bar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + token, err := client.GetToken() + So(err, ShouldBeNil) + So(token, ShouldEqual, "bearer foobar2") + + for i := 0; i < 5; i++ { + token, _ = client.GetToken() + if token == "bearer foobar3" { + break + } + time.Sleep(time.Second) + } + So(token, ShouldEqual, "bearer foobar3") + }) +} + +func TestEndpointRefresh(t *testing.T) { + Convey("Test expiring endpoint", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{listOrgsPayload}, "", 200, "", nil}, t) + fakeUAAServer = FakeUAAServer(0) + + c := &Config{ + ApiAddress: server.URL, + Username: "foo", + Password: "bar", + } + + client, err := NewClient(c) + So(err, ShouldBeNil) + + lastTokenSource := client.Config.TokenSource + for i := 1; i < 5; i++ { + _, err := client.GetToken() + So(err, ShouldBeNil) + So(client.Config.TokenSource, ShouldNotEqual, lastTokenSource) + lastTokenSource = client.Config.TokenSource + } + }) +} diff --git a/third_party/go-cfclient/domains.go b/third_party/go-cfclient/domains.go new file mode 100644 index 000000000000..b33e767a7b3b --- /dev/null +++ b/third_party/go-cfclient/domains.go @@ -0,0 +1,314 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/pkg/errors" +) + +type DomainsResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []DomainResource `json:"resources"` +} + +type SharedDomainsResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []SharedDomainResource `json:"resources"` +} + +type DomainResource struct { + Meta Meta `json:"metadata"` + Entity Domain `json:"entity"` +} + +type SharedDomainResource struct { + Meta Meta `json:"metadata"` + Entity SharedDomain `json:"entity"` +} + +type Domain struct { + Guid string `json:"guid"` + Name string `json:"name"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + OwningOrganizationGuid string `json:"owning_organization_guid"` + OwningOrganizationUrl string `json:"owning_organization_url"` + SharedOrganizationsUrl string `json:"shared_organizations_url"` + c *Client +} + +type SharedDomain struct { + Guid string `json:"guid"` + Name string `json:"name"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + RouterGroupGuid string `json:"router_group_guid"` + RouterGroupType string `json:"router_group_type"` + Internal bool `json:"internal"` + c *Client +} + +func (c *Client) ListDomainsByQuery(query url.Values) ([]Domain, error) { + var domains []Domain + requestURL := "/v2/private_domains?" + query.Encode() + for { + var domainResp DomainsResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting domains") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading domains request") + } + + err = json.Unmarshal(resBody, &domainResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling domains") + } + for _, domain := range domainResp.Resources { + domain.Entity.Guid = domain.Meta.Guid + domain.Entity.CreatedAt = domain.Meta.CreatedAt + domain.Entity.UpdatedAt = domain.Meta.UpdatedAt + domain.Entity.c = c + domains = append(domains, domain.Entity) + } + requestURL = domainResp.NextUrl + if requestURL == "" { + break + } + } + return domains, nil +} + +func (c *Client) ListDomains() ([]Domain, error) { + return c.ListDomainsByQuery(nil) +} + +func (c *Client) ListSharedDomainsByQuery(query url.Values) ([]SharedDomain, error) { + var domains []SharedDomain + requestURL := "/v2/shared_domains?" + query.Encode() + for { + var domainResp SharedDomainsResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting shared domains") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading shared domains request") + } + + err = json.Unmarshal(resBody, &domainResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling shared domains") + } + for _, domain := range domainResp.Resources { + domain.Entity.Guid = domain.Meta.Guid + domain.Entity.CreatedAt = domain.Meta.CreatedAt + domain.Entity.UpdatedAt = domain.Meta.UpdatedAt + domain.Entity.c = c + domains = append(domains, domain.Entity) + } + requestURL = domainResp.NextUrl + if requestURL == "" { + break + } + } + return domains, nil +} + +func (c *Client) ListSharedDomains() ([]SharedDomain, error) { + return c.ListSharedDomainsByQuery(nil) +} + +func (c *Client) GetSharedDomainByGuid(guid string) (SharedDomain, error) { + r := c.NewRequest("GET", "/v2/shared_domains/"+guid) + resp, err := c.DoRequest(r) + if err != nil { + return SharedDomain{}, errors.Wrap(err, "Error requesting shared domain") + } + defer resp.Body.Close() + retval, err := c.handleSharedDomainResp(resp) + return *retval, err +} + +func (c *Client) CreateSharedDomain(name string, internal bool, router_group_guid string) (*SharedDomain, error) { + req := c.NewRequest("POST", "/v2/shared_domains") + params := map[string]interface{}{ + "name": name, + "internal": internal, + } + + if strings.TrimSpace(router_group_guid) != "" { + params["router_group_guid"] = router_group_guid + } + + req.obj = params + + resp, err := c.DoRequest(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, errors.Wrapf(err, "Error creating shared domain %s, response code: %d", name, resp.StatusCode) + } + return c.handleSharedDomainResp(resp) +} + +func (c *Client) DeleteSharedDomain(guid string, async bool) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/shared_domains/%s?async=%t", guid, async))) + if err != nil { + return err + } + defer resp.Body.Close() + if (async && (resp.StatusCode != http.StatusAccepted)) || (!async && (resp.StatusCode != http.StatusNoContent)) { + return errors.Wrapf(err, "Error deleting organization %s, response code: %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) GetDomainByName(name string) (Domain, error) { + q := url.Values{} + q.Set("q", "name:"+name) + domains, err := c.ListDomainsByQuery(q) + if err != nil { + return Domain{}, errors.Wrapf(err, "Error during domain lookup %s", name) + } + if len(domains) == 0 { + cfErr := NewDomainNotFoundError() + cfErr.Description = fmt.Sprintf(cfErr.Description, name) + return Domain{}, cfErr + } + return domains[0], nil +} + +func (c *Client) GetDomainByGuid(guid string) (Domain, error) { + r := c.NewRequest("GET", "/v2/private_domains/"+guid) + resp, err := c.DoRequest(r) + if err != nil { + return Domain{}, errors.Wrap(err, "Error requesting private domain") + } + defer resp.Body.Close() + retval, err := c.handleDomainResp(resp) + return *retval, err +} + +func (c *Client) GetSharedDomainByName(name string) (SharedDomain, error) { + q := url.Values{} + q.Set("q", "name:"+name) + domains, err := c.ListSharedDomainsByQuery(q) + if err != nil { + return SharedDomain{}, errors.Wrapf(err, "Error during shared domain lookup %s", name) + } + if len(domains) == 0 { + cfErr := NewDomainNotFoundError() + cfErr.Description = fmt.Sprintf(cfErr.Description, name) + return SharedDomain{}, cfErr + } + return domains[0], nil +} + +func (c *Client) CreateDomain(name, orgGuid string) (*Domain, error) { + req := c.NewRequest("POST", "/v2/private_domains") + req.obj = map[string]interface{}{ + "name": name, + "owning_organization_guid": orgGuid, + } + resp, err := c.DoRequest(req) + if err != nil { + return nil, err + } + if resp.StatusCode != http.StatusCreated { + return nil, errors.Wrapf(err, "Error creating domain %s, response code: %d", name, resp.StatusCode) + } + return c.handleDomainResp(resp) +} + +func (c *Client) DeleteDomain(guid string) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/private_domains/%s", guid))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting domain %s, response code: %d", guid, resp.StatusCode) + } + return nil +} +func (c *Client) handleDomainResp(resp *http.Response) (*Domain, error) { + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return nil, err + } + var domainResource DomainResource + err = json.Unmarshal(body, &domainResource) + if err != nil { + return nil, err + } + return c.mergeDomainResource(domainResource), nil +} + +func (c *Client) handleSharedDomainResp(resp *http.Response) (*SharedDomain, error) { + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return nil, err + } + var domainResource SharedDomainResource + err = json.Unmarshal(body, &domainResource) + if err != nil { + return nil, err + } + return c.mergeSharedDomainResource(domainResource), nil +} + +func (c *Client) getDomainsResponse(requestURL string) (DomainsResponse, error) { + var domainResp DomainsResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return DomainsResponse{}, errors.Wrap(err, "Error requesting domains") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return DomainsResponse{}, errors.Wrap(err, "Error reading domains request") + } + err = json.Unmarshal(resBody, &domainResp) + if err != nil { + return DomainsResponse{}, errors.Wrap(err, "Error unmarshalling org") + } + return domainResp, nil +} + +func (c *Client) mergeDomainResource(domainResource DomainResource) *Domain { + domainResource.Entity.Guid = domainResource.Meta.Guid + domainResource.Entity.c = c + domainResource.Entity.CreatedAt = domainResource.Meta.CreatedAt + domainResource.Entity.UpdatedAt = domainResource.Meta.UpdatedAt + return &domainResource.Entity +} + +func (c *Client) mergeSharedDomainResource(domainResource SharedDomainResource) *SharedDomain { + domainResource.Entity.Guid = domainResource.Meta.Guid + domainResource.Entity.c = c + domainResource.Entity.CreatedAt = domainResource.Meta.CreatedAt + domainResource.Entity.UpdatedAt = domainResource.Meta.UpdatedAt + return &domainResource.Entity +} diff --git a/third_party/go-cfclient/domains_test.go b/third_party/go-cfclient/domains_test.go new file mode 100644 index 000000000000..d1099b9c066a --- /dev/null +++ b/third_party/go-cfclient/domains_test.go @@ -0,0 +1,278 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListDomains(t *testing.T) { + Convey("List domains", t, func() { + setup(MockRoute{"GET", "/v2/private_domains", []string{listDomainsPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + domains, err := client.ListDomains() + So(err, ShouldBeNil) + + So(len(domains), ShouldEqual, 4) + So(domains[0].Guid, ShouldEqual, "b2a35f0c-d5ad-4a59-bea7-461711d96b0d") + So(domains[0].Name, ShouldEqual, "vcap.me") + So(domains[0].OwningOrganizationGuid, ShouldEqual, "4cf3bc47-eccd-4662-9322-7833c3bdcded") + So(domains[0].OwningOrganizationUrl, ShouldEqual, "/v2/organizations/4cf3bc47-eccd-4662-9322-7833c3bdcded") + So(domains[0].SharedOrganizationsUrl, ShouldEqual, "/v2/private_domains/b2a35f0c-d5ad-4a59-bea7-461711d96b0d/shared_organizations") + }) +} + +func TestListSharedDomains(t *testing.T) { + Convey("List shared domains", t, func() { + setup(MockRoute{"GET", "/v2/shared_domains", []string{listSharedDomainsPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + domains, err := client.ListSharedDomains() + So(err, ShouldBeNil) + + So(len(domains), ShouldEqual, 1) + So(domains[0].Guid, ShouldEqual, "91977695-8ad9-40db-858f-4df782603ec3") + So(domains[0].Name, ShouldEqual, "domain-49.example.com") + So(domains[0].RouterGroupGuid, ShouldEqual, "my-random-guid") + So(domains[0].RouterGroupType, ShouldEqual, "tcp") + }) + + Convey("List shared domain by guid", t, func() { + setup(MockRoute{"GET", "/v2/shared_domains/91977695-8ad9-40db-858f-4df782603ec3", []string{listSharedDomainByGuidPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + domain, err := client.GetSharedDomainByGuid("91977695-8ad9-40db-858f-4df782603ec3") + So(err, ShouldBeNil) + + So(domain.Guid, ShouldEqual, "91977695-8ad9-40db-858f-4df782603ec3") + So(domain.Name, ShouldEqual, "apps.some.random.cf.installation.example.com") + So(domain.CreatedAt, ShouldEqual, "2016-06-08T16:41:37Z") + So(domain.UpdatedAt, ShouldEqual, "2016-06-08T16:41:26Z") + }) + +} + +func TestGetDomainByName(t *testing.T) { + Convey("Get domain by name", t, func() { + setup(MockRoute{"GET", "/v2/private_domains", []string{listDomainsPayload}, "", 200, "q=name:vcap.me", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + domain, err := client.GetDomainByName("vcap.me") + So(err, ShouldBeNil) + + So(domain.Guid, ShouldEqual, "b2a35f0c-d5ad-4a59-bea7-461711d96b0d") + So(domain.Name, ShouldEqual, "vcap.me") + }) + Convey("Get domain by name with an endpoint that returns a 404", t, func() { + setup(MockRoute{"GET", "/v2/private_domains", []string{listDomainsEmptyResponse}, "", 404, "q=name:vcap.me", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + _, listErr := client.GetDomainByName("vcap.me") + So(listErr, ShouldNotBeNil) + }) + Convey("Get domain by name for a non-existing domain", t, func() { + setup(MockRoute{"GET", "/v2/private_domains", []string{listDomainsEmptyResponse}, "", 200, "q=name:idontexist", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + _, listErr := client.GetDomainByName("idontexist") + So(listErr, ShouldNotBeNil) + }) + Convey("Get private domain by guid", t, func() { + setup(MockRoute{"GET", "/v2/private_domains/b2a35f0c-d5ad-4a59-bea7-461711d96b0d", []string{listDomainByGuidPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + domain, err := client.GetDomainByGuid("b2a35f0c-d5ad-4a59-bea7-461711d96b0d") + So(err, ShouldBeNil) + + So(domain.Guid, ShouldEqual, "b2a35f0c-d5ad-4a59-bea7-461711d96b0d") + So(domain.Name, ShouldEqual, "vcap.me") + So(domain.CreatedAt, ShouldEqual, "2016-06-08T16:41:39Z") + So(domain.UpdatedAt, ShouldEqual, "2016-06-08T16:41:26Z") + }) +} + +func TestGetSharedDomainByName(t *testing.T) { + Convey("Get shared domain by name", t, func() { + setup(MockRoute{"GET", "/v2/shared_domains", []string{listSharedDomainsPayload}, "", 200, "q=name:domain-49.example.com", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + domain, err := client.GetSharedDomainByName("domain-49.example.com") + So(err, ShouldBeNil) + + So(domain.Guid, ShouldEqual, "91977695-8ad9-40db-858f-4df782603ec3") + So(domain.Name, ShouldEqual, "domain-49.example.com") + }) + Convey("Get shared domain by name with an endpoint that returns a 404", t, func() { + setup(MockRoute{"GET", "/v2/shared_domains", []string{listDomainsEmptyResponse}, "", 404, "q=name:domain-49.example.com", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + _, listErr := client.GetSharedDomainByName("domain-49.example.com") + So(listErr, ShouldNotBeNil) + }) + Convey("Get shared domain by name for a non-existing domain", t, func() { + setup(MockRoute{"GET", "/v2/shared_domains", []string{listDomainsEmptyResponse}, "", 200, "q=name:idontexist", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + _, listErr := client.GetSharedDomainByName("idontexist") + So(listErr, ShouldNotBeNil) + }) +} + +func TestCreateDomain(t *testing.T) { + Convey("Create domain", t, func() { + setup(MockRoute{"POST", "/v2/private_domains", []string{postDomainPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + domain, err := client.CreateDomain("exmaple.com", "8483e4f1-d3a3-43e2-ab8c-b05ea40ef8db") + So(err, ShouldBeNil) + + So(domain.Guid, ShouldEqual, "b98aeca1-22b9-49f9-8428-3ace9ea2ba11") + }) +} + +func TestCreateSharedDomain(t *testing.T) { + Convey("Create external shared domain", t, func() { + setup(MockRoute{"POST", "/v2/shared_domains", []string{postExternalSharedDomainPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + domain, err := client.CreateSharedDomain("shared-example.com", false, "8483e4f1-d3a3-43e2-ab8c-b05ea40ef8db") + So(err, ShouldBeNil) + So(domain.Internal, ShouldBeFalse) + So(domain.RouterGroupType, ShouldEqual, "tcp") + }) + + Convey("Create external shared domain", t, func() { + setup(MockRoute{"POST", "/v2/shared_domains", []string{postInternalSharedDomainPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + domain, err := client.CreateSharedDomain("shared-example.com", false, "8483e4f1-d3a3-43e2-ab8c-b05ea40ef8db") + So(err, ShouldBeNil) + So(domain.Internal, ShouldBeTrue) + So(domain.RouterGroupType, ShouldBeBlank) + }) +} + +func TestDeleteDomain(t *testing.T) { + Convey("Delete domain", t, func() { + setup(MockRoute{"DELETE", "/v2/private_domains/b2a35f0c-d5ad-4a59-bea7-461711d96b0d", []string{""}, "", 204, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteDomain("b2a35f0c-d5ad-4a59-bea7-461711d96b0d") + So(err, ShouldBeNil) + }) +} + +func TestDeleteSharedDomain(t *testing.T) { + Convey("Delete shared domain synchronously", t, func() { + setup(MockRoute{"DELETE", "/v2/shared_domains/b2a35f0c-d5ad-4a59-bea7-461711d96b0d", []string{""}, "", 204, "async=false", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteSharedDomain("b2a35f0c-d5ad-4a59-bea7-461711d96b0d", false) + So(err, ShouldBeNil) + }) + + Convey("Delete shared domain synchronously", t, func() { + setup(MockRoute{"DELETE", "/v2/shared_domains/b2a35f0c-d5ad-4a59-bea7-461711d96b0d", []string{""}, "", 202, "async=true", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteSharedDomain("b2a35f0c-d5ad-4a59-bea7-461711d96b0d", true) + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/environmentvariablegroups.go b/third_party/go-cfclient/environmentvariablegroups.go new file mode 100644 index 000000000000..4d8da1825f8b --- /dev/null +++ b/third_party/go-cfclient/environmentvariablegroups.go @@ -0,0 +1,64 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" +) + +type EnvironmentVariableGroup map[string]interface{} + +func (c *Client) GetRunningEnvironmentVariableGroup() (EnvironmentVariableGroup, error) { + return c.getEnvironmentVariableGroup(true) +} + +func (c *Client) GetStagingEnvironmentVariableGroup() (EnvironmentVariableGroup, error) { + return c.getEnvironmentVariableGroup(false) +} + +func (c *Client) getEnvironmentVariableGroup(running bool) (EnvironmentVariableGroup, error) { + evgType := "staging" + if running { + evgType = "running" + } + + req := c.NewRequest("GET", fmt.Sprintf("/v2/config/environment_variable_groups/%s", evgType)) + resp, err := c.DoRequest(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + evg := EnvironmentVariableGroup{} + err = json.NewDecoder(resp.Body).Decode(&evg) + return evg, err +} + +func (c *Client) SetRunningEnvironmentVariableGroup(evg EnvironmentVariableGroup) error { + return c.setEnvironmentVariableGroup(evg, true) +} + +func (c *Client) SetStagingEnvironmentVariableGroup(evg EnvironmentVariableGroup) error { + return c.setEnvironmentVariableGroup(evg, false) +} + +func (c *Client) setEnvironmentVariableGroup(evg EnvironmentVariableGroup, running bool) error { + evgType := "staging" + if running { + evgType = "running" + } + + marshalled, err := json.Marshal(evg) + if err != nil { + return err + } + + req := c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/config/environment_variable_groups/%s", evgType), bytes.NewBuffer(marshalled)) + resp, err := c.DoRequest(req) + if err != nil { + return err + } + defer resp.Body.Close() + + return nil +} diff --git a/third_party/go-cfclient/environmentvariablegroups_test.go b/third_party/go-cfclient/environmentvariablegroups_test.go new file mode 100644 index 000000000000..97ab1b7c4f7c --- /dev/null +++ b/third_party/go-cfclient/environmentvariablegroups_test.go @@ -0,0 +1,83 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestEnvionmentVariableGroups(t *testing.T) { + Convey("List Running Environment Variable Group", t, func() { + setup(MockRoute{"GET", "/v2/config/environment_variable_groups/running", []string{getEVGPayload}, "", 200, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + evg, err := client.GetRunningEnvironmentVariableGroup() + So(err, ShouldBeNil) + So(evg["foo"], ShouldEqual, "bar") + So(evg["val"], ShouldEqual, 3) + }) + + Convey("List Staging Environment Variable Group", t, func() { + setup(MockRoute{"GET", "/v2/config/environment_variable_groups/staging", []string{getEVGPayload}, "", 200, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + evg, err := client.GetStagingEnvironmentVariableGroup() + So(err, ShouldBeNil) + So(evg["foo"], ShouldEqual, "bar") + So(evg["val"], ShouldEqual, 3) + }) + + Convey("Set Running Environment Variable Group", t, func() { + setup(MockRoute{"PUT", "/v2/config/environment_variable_groups/running", []string{getEVGPayload}, "", 200, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + body := EnvironmentVariableGroup{ + "foo": "bar", + "val": 3, + } + + err = client.SetRunningEnvironmentVariableGroup(body) + So(err, ShouldBeNil) + }) + + Convey("Set Staging Environment Variable Group", t, func() { + setup(MockRoute{"PUT", "/v2/config/environment_variable_groups/staging", []string{getEVGPayload}, "", 200, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + body := EnvironmentVariableGroup{ + "foo": "bar", + "val": 3, + } + + err = client.SetStagingEnvironmentVariableGroup(body) + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/error.go b/third_party/go-cfclient/error.go new file mode 100644 index 000000000000..e4decdf88be0 --- /dev/null +++ b/third_party/go-cfclient/error.go @@ -0,0 +1,54 @@ +package cfclient + +//go:generate go run gen_error.go + +import ( + "fmt" +) + +type CloudFoundryError struct { + Code int `json:"code"` + ErrorCode string `json:"error_code"` + Description string `json:"description"` +} + +type CloudFoundryErrorsV3 struct { + Errors []CloudFoundryErrorV3 `json:"errors"` +} + +type CloudFoundryErrorV3 struct { + Code int `json:"code"` + Title string `json:"title"` + Detail string `json:"detail"` +} + +// CF APIs v3 can return multiple errors, we take the first one and convert it into a V2 model +func NewCloudFoundryErrorFromV3Errors(cfErrorsV3 CloudFoundryErrorsV3) CloudFoundryError { + if len(cfErrorsV3.Errors) == 0 { + return CloudFoundryError{ + 0, + "GO-Client-No-Errors", + "No Errors in response from V3", + } + } + + return CloudFoundryError{ + cfErrorsV3.Errors[0].Code, + cfErrorsV3.Errors[0].Title, + cfErrorsV3.Errors[0].Detail, + } +} + +func (cfErr CloudFoundryError) Error() string { + return fmt.Sprintf("cfclient error (%s|%d): %s", cfErr.ErrorCode, cfErr.Code, cfErr.Description) +} + +type CloudFoundryHTTPError struct { + StatusCode int + Status string + Body []byte +} + +func (e CloudFoundryHTTPError) Error() string { + return fmt.Sprintf("cfclient: HTTP error (%d): %s", e.StatusCode, e.Status) +} diff --git a/third_party/go-cfclient/events.go b/third_party/go-cfclient/events.go new file mode 100644 index 000000000000..6c42c565b297 --- /dev/null +++ b/third_party/go-cfclient/events.go @@ -0,0 +1,95 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/url" + + "github.com/pkg/errors" +) + +// EventsResponse is a type that wraps a collection of event resources. +type EventsResponse struct { + TotalResults int `json:"total_results"` + Pages int `json:"total_pages"` + NextURL string `json:"next_url"` + Resources []EventResource `json:"resources"` +} + +// EventResource is a type that contains metadata and the entity for an event. +type EventResource struct { + Meta Meta `json:"metadata"` + Entity Event `json:"entity"` +} + +// Event is a type that contains event data. +type Event struct { + GUID string `json:"guid"` + Type string `json:"type"` + CreatedAt string `json:"created_at"` + Actor string `json:"actor"` + ActorType string `json:"actor_type"` + ActorName string `json:"actor_name"` + ActorUsername string `json:"actor_username"` + Actee string `json:"actee"` + ActeeType string `json:"actee_type"` + ActeeName string `json:"actee_name"` + OrganizationGUID string `json:"organization_guid"` + SpaceGUID string `json:"space_guid"` + Metadata map[string]interface{} `json:"metadata"` + c *Client +} + +// ListEventsByQuery lists all events matching the provided query. +func (c *Client) ListEventsByQuery(query url.Values) ([]Event, error) { + var events []Event + requestURL := fmt.Sprintf("/v2/events?%s", query.Encode()) + for { + var eventResp EventsResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "error requesting events") + } + defer resp.Body.Close() + if err := json.NewDecoder(resp.Body).Decode(&eventResp); err != nil { + return nil, errors.Wrap(err, "error unmarshaling events") + } + for _, e := range eventResp.Resources { + e.Entity.GUID = e.Meta.Guid + e.Entity.CreatedAt = e.Meta.CreatedAt + e.Entity.c = c + events = append(events, e.Entity) + } + requestURL = eventResp.NextURL + if requestURL == "" { + break + } + } + return events, nil +} + +// ListEvents lists all unfiltered events. +func (c *Client) ListEvents() ([]Event, error) { + return c.ListEventsByQuery(nil) +} + +// TotalEventsByQuery returns the number of events matching the provided query. +func (c *Client) TotalEventsByQuery(query url.Values) (int, error) { + r := c.NewRequest("GET", fmt.Sprintf("/v2/events?%s", query.Encode())) + resp, err := c.DoRequest(r) + if err != nil { + return 0, errors.Wrap(err, "error requesting events") + } + defer resp.Body.Close() + var apiResp EventsResponse + if err := json.NewDecoder(resp.Body).Decode(&apiResp); err != nil { + return 0, errors.Wrap(err, "error unmarshaling events") + } + return apiResp.TotalResults, nil +} + +// TotalEvents returns the number of unfiltered events. +func (c *Client) TotalEvents() (int, error) { + return c.TotalEventsByQuery(nil) +} diff --git a/third_party/go-cfclient/events_test.go b/third_party/go-cfclient/events_test.go new file mode 100644 index 000000000000..cdaf67ea1eb4 --- /dev/null +++ b/third_party/go-cfclient/events_test.go @@ -0,0 +1,57 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListEvents(t *testing.T) { + Convey("List Events", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/events", []string{listEventsPage1Payload}, "", 200, "", nil}, + {"GET", "/v2/events-2", []string{listEventsPage2Payload}, "", 200, "page=2", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + events, err := client.ListEvents() + So(err, ShouldBeNil) + + So(len(events), ShouldEqual, 4) + So(events[0].GUID, ShouldEqual, "b8ede8e1-afc8-40a1-baae-236a0a77b27b") + So(events[0].Actor, ShouldEqual, "guid-008640fc-d316-4602-9251-c8d09bbdc750") + So(events[0].CreatedAt, ShouldEqual, "2016-06-08T16:41:23Z") + So(events[0].Metadata, ShouldHaveLength, 3) + So(events[0].Metadata["name-188"], ShouldEqual, "value-188") + So(events[0].Metadata["name-189"], ShouldEqual, 189) + So(events[0].Metadata["name-190"], ShouldEqual, true) + }) +} + +func TestTotalEvents(t *testing.T) { + Convey("Total Events", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/events", []string{totalEventsPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + total, err := client.TotalEvents() + So(err, ShouldBeNil) + + So(total, ShouldEqual, 4) + }) +} diff --git a/third_party/go-cfclient/gen_error.go b/third_party/go-cfclient/gen_error.go new file mode 100644 index 000000000000..948d1d6f98be --- /dev/null +++ b/third_party/go-cfclient/gen_error.go @@ -0,0 +1,151 @@ +//go:build tools +// +build tools + +package main + +import ( + "bytes" + "go/format" + "io/ioutil" + "log" + "net/http" + "sort" + "strings" + "text/template" + "time" + + "go.yaml.in/yaml/v2" +) + +type ( + CFCode int + HTTPCode int +) + +type Definition struct { + CFCode `yaml:"-"` + Name string `yaml:"name"` + HTTPCode `yaml:"http_code"` + Message string `yaml:"message"` +} + +func main() { + log.SetFlags(log.Lshortfile) + const url = "https://raw.githubusercontent.com/cloudfoundry/cloud_controller_ng/master/errors/v2.yml" + resp, err := http.Get(url) + if err != nil { + log.Fatal(err) + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + log.Fatal(err) + } + + var m map[CFCode]Definition + + if err := yaml.Unmarshal(body, &m); err != nil { + log.Fatal(err) + } + + var definitions []Definition + + for c, d := range m { + d.CFCode = c + definitions = append(definitions, d) + } + + sort.Slice(definitions, func(i, j int) bool { + return definitions[i].CFCode < definitions[j].CFCode + }) + + buf := &bytes.Buffer{} + + if err := packageTemplate.Execute(buf, struct { + Timestamp time.Time + Definitions []Definition + }{ + Timestamp: time.Now(), + Definitions: definitions, + }); err != nil { + log.Fatal(err) + } + + dst, err := format.Source(buf.Bytes()) + if err != nil { + log.Printf("%s", buf.Bytes()) + log.Fatal(err) + } + + if err := ioutil.WriteFile("cf_error.go", dst, 0600); err != nil { + log.Fatal(err) + } +} + +// destutter ensures that s does not end in "Error". +func destutter(s string) string { + return strings.TrimSuffix(s, "Error") +} + +// cleanMessage removes any characters which will cause go generate to fail +func cleanMessage(s string) string { + return strings.Replace(s, "\n", "", -1) +} + +var packageTemplate = template.Must(template.New("").Funcs(template.FuncMap{ + "destutter": destutter, + "cleanMessage": cleanMessage, +}).Parse(` +package cfclient + +// Code generated by go generate. DO NOT EDIT. +// This file was generated by robots at +// {{ .Timestamp }} + +import ( + stderrors "errors" + + pkgerrors "github.com/pkg/errors" +) + +{{- range .Definitions }} +{{$isMethod := printf "Is%sError" (.Name | destutter) }} +{{$newMethod := printf "New%sError" (.Name | destutter) }} +// {{ $newMethod }} returns a new CloudFoundryError +// that {{ $isMethod }} will return true for +func {{ $newMethod }}() CloudFoundryError { + return CloudFoundryError{ + Code: {{ .CFCode }}, + ErrorCode: "CF-{{ .Name }}", + Description: "{{ .Message | cleanMessage }}", + } +} + +// {{ $isMethod }} returns a boolean indicating whether +// the error is known to report the Cloud Foundry error: +// - Cloud Foundry code: {{ .CFCode }} +// - HTTP code: {{ .HTTPCode }} +// - message: {{ printf "%q" .Message }} +func Is{{ .Name | destutter }}Error(err error) bool { + cferr, ok := cloudFoundryError(err) + if !ok { + return false + } + return cferr.Code == {{ .CFCode }} +} +{{- end }} + +func cloudFoundryError(err error) (cferr CloudFoundryError, ok bool) { + type causer interface { + Cause() error + } + if _, isCauser := err.(causer); isCauser { + cause := pkgerrors.Cause(err) + cferr, ok = cause.(CloudFoundryError) + } else { + ok = stderrors.As(err, &cferr) + } + return cferr, ok +} +`)) diff --git a/third_party/go-cfclient/go.mod b/third_party/go-cfclient/go.mod new file mode 100644 index 000000000000..1bc95082cf4c --- /dev/null +++ b/third_party/go-cfclient/go.mod @@ -0,0 +1,19 @@ +module github.com/cloudfoundry-community/go-cfclient/v2 + +go 1.15 + +require ( + github.com/Masterminds/semver v1.4.2 + github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect + github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.8 // indirect + github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11 + github.com/oxtoacart/bpool v0.0.0-20150712133111-4e1c5567d7c2 // indirect + github.com/pkg/errors v0.8.1 + github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a + go.yaml.in/yaml/v2 v2.4.4 + golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 + golang.org/x/oauth2 v0.0.0-20190130055435-99b60b757ec1 + google.golang.org/protobuf v1.28.0 // indirect +) diff --git a/third_party/go-cfclient/go.sum b/third_party/go-cfclient/go.sum new file mode 100644 index 000000000000..415e910d6b0b --- /dev/null +++ b/third_party/go-cfclient/go.sum @@ -0,0 +1,54 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q= +github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= +github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk= +github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11 h1:YFh+sjyJTMQSYjKwM4dFKhJPJC/wfo98tPUc17HdoYw= +github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11/go.mod h1:Ah2dBMoxZEqk118as2T4u4fjfXarE0pPnMJaArZQZsI= +github.com/oxtoacart/bpool v0.0.0-20150712133111-4e1c5567d7c2 h1:CXwSGu/LYmbjEab5aMCs5usQRVBGThelUKBNnoSOuso= +github.com/oxtoacart/bpool v0.0.0-20150712133111-4e1c5567d7c2/go.mod h1:L3UMQOThbttwfYRNFOWLLVXMhk5Lkio4GGOtw5UrxS0= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= +go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/oauth2 v0.0.0-20190130055435-99b60b757ec1 h1:VeAkjQVzKLmu+JnFcK96TPbkuaTIqwGGAzQ9hgwPjVg= +golang.org/x/oauth2 v0.0.0-20190130055435-99b60b757ec1/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/third_party/go-cfclient/info.go b/third_party/go-cfclient/info.go new file mode 100644 index 000000000000..5e204d495512 --- /dev/null +++ b/third_party/go-cfclient/info.go @@ -0,0 +1,104 @@ +package cfclient + +import ( + "encoding/json" + + "github.com/Masterminds/semver" + "github.com/pkg/errors" +) + +// Info is metadata about a Cloud Foundry deployment +type Info struct { + Name string `json:"name"` + Build string `json:"build"` + Support string `json:"support"` + Version int `json:"version"` + Description string `json:"description"` + AuthorizationEndpoint string `json:"authorization_endpoint"` + TokenEndpoint string `json:"token_endpoint"` + MinCLIVersion string `json:"min_cli_version"` + MinRecommendedCLIVersion string `json:"min_recommended_cli_version"` + APIVersion string `json:"api_version"` + AppSSHEndpoint string `json:"app_ssh_endpoint"` + AppSSHHostKeyFingerprint string `json:"app_ssh_host_key_fingerprint"` + AppSSHOauthClient string `json:"app_ssh_oauth_client"` + DopplerLoggingEndpoint string `json:"doppler_logging_endpoint"` + RoutingEndpoint string `json:"routing_endpoint"` + User string `json:"user,omitempty"` +} + +type V3Version struct { + Links struct { + CCV3 struct { + Meta struct { + Version string `json:"version"` + } `json:"meta"` + } `json:"cloud_controller_v3"` + } `json:"links"` +} + +// GetInfo retrieves Info from the Cloud Controller API +func (c *Client) GetInfo() (*Info, error) { + r := c.NewRequest("GET", "/v2/info") + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting info") + } + defer resp.Body.Close() + var i Info + err = json.NewDecoder(resp.Body).Decode(&i) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshalling info") + } + return &i, nil +} + +func (c *Client) SupportsMetadataAPI() (bool, error) { + r := c.NewRequest("GET", "/") + resp, err := c.DoRequest(r) + if err != nil { + return false, errors.Wrap(err, "Error requesting info") + } + defer resp.Body.Close() + var v3 V3Version + err = json.NewDecoder(resp.Body).Decode(&v3) + if err != nil { + return false, errors.Wrap(err, "Error unmarshalling info") + } + + minimumSupportedVersion := semver.MustParse("3.66.0") + actualVersion, err := semver.NewVersion(v3.Links.CCV3.Meta.Version) + if err != nil { + return false, errors.Wrap(err, "Error parsing semver") + } + if !actualVersion.LessThan(minimumSupportedVersion) { + return true, nil + } + + return false, nil +} + +func (c *Client) SupportsSpaceSupporterRole() (bool, error) { + r := c.NewRequest("GET", "/") + resp, err := c.DoRequest(r) + if err != nil { + return false, errors.Wrap(err, "Error requesting info") + } + defer resp.Body.Close() + var v3 V3Version + err = json.NewDecoder(resp.Body).Decode(&v3) + if err != nil { + return false, errors.Wrap(err, "Error unmarshalling info") + } + + minimumSupportedVersion := semver.MustParse("3.102.0") + actualVersion, err := semver.NewVersion(v3.Links.CCV3.Meta.Version) + if err != nil { + return false, errors.Wrap(err, "Error parsing semver") + } + if !actualVersion.LessThan(minimumSupportedVersion) { + return true, nil + } + + return false, nil +} diff --git a/third_party/go-cfclient/info_test.go b/third_party/go-cfclient/info_test.go new file mode 100644 index 000000000000..867c1ebbc22a --- /dev/null +++ b/third_party/go-cfclient/info_test.go @@ -0,0 +1,249 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestGetInfo(t *testing.T) { + Convey("Get info", t, func() { + setupMultiple(nil, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + info, err := client.GetInfo() + So(err, ShouldBeNil) + + So(info.MinCLIVersion, ShouldEqual, "6.23.0") + }) + + Convey("Doesn't support metadata api", t, func() { + setupMultiple([]MockRoute{ + { + Method: "GET", + Endpoint: "/", + Status: 200, + Output: []string{`{ + "links": { + "cloud_controller_v3": { + "href": "https://api.dev.cfdev.sh/v3", + "meta": { + "version": "3.65.0" + } + } + } + }`}, + }, + }, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + supports, err := client.SupportsMetadataAPI() + So(err, ShouldBeNil) + + So(supports, ShouldEqual, false) + }) + + Convey("Support metadata api", t, func() { + setupMultiple([]MockRoute{ + { + Method: "GET", + Endpoint: "/", + Status: 200, + Output: []string{`{ + "links": { + "cloud_controller_v3": { + "href": "https://api.dev.cfdev.sh/v3", + "meta": { + "version": "3.66.0" + } + } + } + }`}, + }, + }, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + supports, err := client.SupportsMetadataAPI() + So(err, ShouldBeNil) + + So(supports, ShouldEqual, true) + }) + + Convey("CAPI reports a version that is not semver", t, func() { + setupMultiple([]MockRoute{ + { + Method: "GET", + Endpoint: "/", + Status: 200, + Output: []string{`{ + "links": { + "cloud_controller_v3": { + "href": "https://api.dev.cfdev.sh/v3", + "meta": { + "version": "non-semver" + } + } + } + }`}, + }, + }, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + _, err = client.SupportsMetadataAPI() + So(err, ShouldBeError) + }) + + Convey("the api version is lexicographically smaller than the required version, but is larger in semver", t, func() { + setupMultiple([]MockRoute{ + { + Method: "GET", + Endpoint: "/", + Status: 200, + Output: []string{`{ + "links": { + "cloud_controller_v3": { + "href": "https://api.dev.cfdev.sh/v3", + "meta": { + "version": "3.101.0" + } + } + } + }`}, + }, + }, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + supports, err := client.SupportsMetadataAPI() + So(err, ShouldBeNil) + + So(supports, ShouldEqual, true) + }) + + Convey("Supports space supporter min version", t, func() { + setupMultiple([]MockRoute{ + { + Method: "GET", + Endpoint: "/", + Status: 200, + Output: []string{`{ + "links": { + "cloud_controller_v3": { + "href": "https://api.dev.cfdev.sh/v3", + "meta": { + "version": "3.102.0" + } + } + } + }`}, + }, + }, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + supports, err := client.SupportsSpaceSupporterRole() + So(err, ShouldBeNil) + + So(supports, ShouldEqual, true) + }) + + Convey("Supports space supporter greater than min version", t, func() { + setupMultiple([]MockRoute{ + { + Method: "GET", + Endpoint: "/", + Status: 200, + Output: []string{`{ + "links": { + "cloud_controller_v3": { + "href": "https://api.dev.cfdev.sh/v3", + "meta": { + "version": "3.103.0" + } + } + } + }`}, + }, + }, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + supports, err := client.SupportsSpaceSupporterRole() + So(err, ShouldBeNil) + + So(supports, ShouldEqual, true) + }) + + Convey("Does not supports space supporter", t, func() { + setupMultiple([]MockRoute{ + { + Method: "GET", + Endpoint: "/", + Status: 200, + Output: []string{`{ + "links": { + "cloud_controller_v3": { + "href": "https://api.dev.cfdev.sh/v3", + "meta": { + "version": "3.101.0" + } + } + } + }`}, + }, + }, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + supports, err := client.SupportsSpaceSupporterRole() + So(err, ShouldBeNil) + + So(supports, ShouldEqual, false) + }) +} diff --git a/third_party/go-cfclient/isolationsegments.go b/third_party/go-cfclient/isolationsegments.go new file mode 100644 index 000000000000..5635df6088fa --- /dev/null +++ b/third_party/go-cfclient/isolationsegments.go @@ -0,0 +1,263 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "time" + + "github.com/pkg/errors" +) + +type IsolationSegment struct { + GUID string `json:"guid"` + Name string `json:"name"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + c *Client +} + +type IsolationSegementResponse struct { + GUID string `json:"guid"` + Name string `json:"name"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + Links struct { + Self struct { + Href string `json:"href"` + } `json:"self"` + Spaces struct { + Href string `json:"href"` + } `json:"spaces"` + Organizations struct { + Href string `json:"href"` + } `json:"organizations"` + } `json:"links"` +} + +type ListIsolationSegmentsResponse struct { + Pagination Pagination `json:"pagination"` + Resources []IsolationSegementResponse `json:"resources"` +} + +func (c *Client) CreateIsolationSegment(name string) (*IsolationSegment, error) { + req := c.NewRequest("POST", "/v3/isolation_segments") + req.obj = map[string]interface{}{ + "name": name, + } + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while creating isolation segment") + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("Error creating isolation segment %s, response code: %d", name, resp.StatusCode) + } + return respBodyToIsolationSegment(resp.Body, c) +} + +func respBodyToIsolationSegment(body io.ReadCloser, c *Client) (*IsolationSegment, error) { + bodyRaw, err := ioutil.ReadAll(body) + if err != nil { + return nil, err + } + isr := IsolationSegementResponse{} + err = json.Unmarshal(bodyRaw, &isr) + if err != nil { + return nil, err + } + + return &IsolationSegment{ + GUID: isr.GUID, + Name: isr.Name, + CreatedAt: isr.CreatedAt, + UpdatedAt: isr.UpdatedAt, + c: c, + }, nil +} + +func (c *Client) GetIsolationSegmentByGUID(guid string) (*IsolationSegment, error) { + var isr IsolationSegementResponse + r := c.NewRequest("GET", "/v3/isolation_segments/"+guid) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting isolation segment by GUID") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading isolation segment response body") + } + + err = json.Unmarshal(resBody, &isr) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshalling isolation segment response") + } + return &IsolationSegment{Name: isr.Name, GUID: isr.GUID, CreatedAt: isr.CreatedAt, UpdatedAt: isr.UpdatedAt, c: c}, nil +} + +func (c *Client) ListIsolationSegmentsByQuery(query url.Values) ([]IsolationSegment, error) { + var iss []IsolationSegment + requestURL := "/v3/isolation_segments" + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + for { + var isr ListIsolationSegmentsResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting isolation segments") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading isolation segment request") + } + + err = json.Unmarshal(resBody, &isr) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshalling isolation segment") + } + + for _, is := range isr.Resources { + iss = append(iss, IsolationSegment{ + Name: is.Name, + GUID: is.GUID, + CreatedAt: is.CreatedAt, + UpdatedAt: is.UpdatedAt, + c: c, + }) + } + + requestURL = isr.Pagination.Next.Href + if requestURL == "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, err + } + } + return iss, nil +} + +func (c *Client) ListIsolationSegments() ([]IsolationSegment, error) { + return c.ListIsolationSegmentsByQuery(nil) +} + +// TODO listOrgsForIsolationSegments +// TODO listSpacesForIsolationSegments +// TODO setDefaultIsolationSegmentForOrg + +func (c *Client) DeleteIsolationSegmentByGUID(guid string) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v3/isolation_segments/%s", guid))) + if err != nil { + return errors.Wrap(err, "Error during sending DELETE request for isolation segments") + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return fmt.Errorf("Error deleting isolation segment %s, response code: %d", guid, resp.StatusCode) + } + return nil +} + +func (i *IsolationSegment) Delete() error { + return i.c.DeleteIsolationSegmentByGUID(i.GUID) +} + +func (c *Client) AddIsolationSegmentToOrg(isolationSegmentGUID, orgGUID string) error { + isoSegment := IsolationSegment{GUID: isolationSegmentGUID, c: c} + return isoSegment.AddOrg(orgGUID) +} + +func (c *Client) RemoveIsolationSegmentFromOrg(isolationSegmentGUID, orgGUID string) error { + isoSegment := IsolationSegment{GUID: isolationSegmentGUID, c: c} + return isoSegment.RemoveOrg(orgGUID) +} + +func (c *Client) AddIsolationSegmentToSpace(isolationSegmentGUID, spaceGUID string) error { + isoSegment := IsolationSegment{GUID: isolationSegmentGUID, c: c} + return isoSegment.AddSpace(spaceGUID) +} + +func (c *Client) RemoveIsolationSegmentFromSpace(isolationSegmentGUID, spaceGUID string) error { + isoSegment := IsolationSegment{GUID: isolationSegmentGUID, c: c} + return isoSegment.RemoveSpace(spaceGUID) +} + +func (i *IsolationSegment) AddOrg(orgGuid string) error { + if i == nil || i.c == nil { + return errors.New("No communication handle.") + } + req := i.c.NewRequest("POST", fmt.Sprintf("/v3/isolation_segments/%s/relationships/organizations", i.GUID)) + type Entry struct { + GUID string `json:"guid"` + } + req.obj = map[string]interface{}{ + "data": []Entry{{GUID: orgGuid}}, + } + resp, err := i.c.DoRequest(req) + if err != nil { + return errors.Wrap(err, "Error during adding org to isolation segment") + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("Error adding org %s to isolation segment %s, response code: %d", orgGuid, i.Name, resp.StatusCode) + } + return nil +} + +func (i *IsolationSegment) RemoveOrg(orgGuid string) error { + if i == nil || i.c == nil { + return errors.New("No communication handle.") + } + req := i.c.NewRequest("DELETE", fmt.Sprintf("/v3/isolation_segments/%s/relationships/organizations/%s", i.GUID, orgGuid)) + resp, err := i.c.DoRequest(req) + if err != nil { + return errors.Wrapf(err, "Error during removing org %s in isolation segment %s", orgGuid, i.Name) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return fmt.Errorf("Error deleting org %s in isolation segment %s, response code: %d", orgGuid, i.Name, resp.StatusCode) + } + return nil +} + +func (i *IsolationSegment) AddSpace(spaceGuid string) error { + if i == nil || i.c == nil { + return errors.New("No communication handle.") + } + req := i.c.NewRequest("PUT", fmt.Sprintf("/v2/spaces/%s", spaceGuid)) + req.obj = map[string]interface{}{ + "isolation_segment_guid": i.GUID, + } + resp, err := i.c.DoRequest(req) + if err != nil { + return errors.Wrapf(err, "Error during adding space %s to isolation segment %s", spaceGuid, i.Name) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return fmt.Errorf("Error adding space to isolation segment %s, response code: %d", i.Name, resp.StatusCode) + } + return nil +} + +func (i *IsolationSegment) RemoveSpace(spaceGuid string) error { + if i == nil || i.c == nil { + return errors.New("No communication handle.") + } + req := i.c.NewRequest("DELETE", fmt.Sprintf("/v2/spaces/%s/isolation_segment", spaceGuid)) + resp, err := i.c.DoRequest(req) + if err != nil { + return errors.Wrapf(err, "Error during deleting space %s in isolation segment %s", spaceGuid, i.Name) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return fmt.Errorf("Error deleting space %s from isolation segment %s, response code: %d", spaceGuid, i.Name, resp.StatusCode) + } + return nil +} diff --git a/third_party/go-cfclient/isolationsegments_test.go b/third_party/go-cfclient/isolationsegments_test.go new file mode 100644 index 000000000000..749526e4765a --- /dev/null +++ b/third_party/go-cfclient/isolationsegments_test.go @@ -0,0 +1,184 @@ +package cfclient + +import ( + "net/http" + "testing" + "time" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestCreateIsolationSegment(t *testing.T) { + Convey("Create Isolation Segment", t, func() { + mocks := []MockRoute{ + {"POST", "/v3/isolation_segments", []string{createIsolationSegmentPayload}, "", http.StatusCreated, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + name := "TheKittenIsTheShark" + + isolationsegment, err := client.CreateIsolationSegment(name) + So(err, ShouldBeNil) + + So(isolationsegment.Name, ShouldEqual, name) + So(isolationsegment.GUID, ShouldEqual, "323f211e-fea3-4161-9bd1-615392327913") + So(isolationsegment.CreatedAt.String(), ShouldEqual, time.Date(2016, 10, 19, 20, 25, 04, 0, time.FixedZone("UTC", 0)).String()) + So(isolationsegment.UpdatedAt.String(), ShouldEqual, time.Date(2016, 11, 8, 16, 41, 26, 0, time.FixedZone("UTC", 0)).String()) + }) +} + +func TestGetIsolationSegmentByGUID(t *testing.T) { + Convey("Request existing Isolation Segment", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/isolation_segments/323f211e-fea3-4161-9bd1-615392327913", []string{createIsolationSegmentPayload}, "", http.StatusOK, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + name := "TheKittenIsTheShark" + + isolationsegment, err := client.GetIsolationSegmentByGUID("323f211e-fea3-4161-9bd1-615392327913") + So(err, ShouldBeNil) + + So(isolationsegment.Name, ShouldEqual, name) + So(isolationsegment.GUID, ShouldEqual, "323f211e-fea3-4161-9bd1-615392327913") + So(isolationsegment.CreatedAt.String(), ShouldEqual, time.Date(2016, 10, 19, 20, 25, 04, 0, time.FixedZone("UTC", 0)).String()) + So(isolationsegment.UpdatedAt.String(), ShouldEqual, time.Date(2016, 11, 8, 16, 41, 26, 0, time.FixedZone("UTC", 0)).String()) + }) + + Convey("Request non-existing Isolation Segment", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/isolation_segments/323f211e-fea3-4161--9bd1-615392327913", []string{createIsolationSegmentPayload}, "", http.StatusOK, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + isolationsegment, err := client.GetIsolationSegmentByGUID("does not exit") + So(err, ShouldNotBeNil) + So(isolationsegment, ShouldBeNil) + }) +} + +func TestListIsolationSegments(t *testing.T) { + Convey("Request list of all Isolation Segments", t, func() { + setup(MockRoute{"GET", "/v3/isolation_segments", []string{listIsolationSegmentsPayloadPage1, listIsolationSegmentsPayloadPage2}, "", http.StatusOK, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + isolationsegment, err := client.ListIsolationSegments() + So(err, ShouldBeNil) + So(isolationsegment, ShouldNotBeNil) + So(len(isolationsegment), ShouldEqual, 4) + + So(isolationsegment[0].Name, ShouldEqual, "shared") + So(isolationsegment[0].GUID, ShouldEqual, "033b4c58-12bb-499a-b05d-4b6fc9e2993b") + So(isolationsegment[0].CreatedAt.String(), ShouldEqual, time.Date(2017, 4, 2, 11, 22, 4, 0, time.FixedZone("UTC", 0)).String()) + So(isolationsegment[0].UpdatedAt.String(), ShouldEqual, time.Date(2017, 4, 2, 11, 22, 4, 0, time.FixedZone("UTC", 0)).String()) + + So(isolationsegment[1].Name, ShouldEqual, "my_segment") + So(isolationsegment[1].GUID, ShouldEqual, "23d0baf4-9d3c-44d8-b2dc-1767bcdad1e0") + So(isolationsegment[1].CreatedAt.String(), ShouldEqual, time.Date(2017, 4, 7, 11, 20, 16, 0, time.FixedZone("UTC", 0)).String()) + So(isolationsegment[1].UpdatedAt.String(), ShouldEqual, time.Date(2017, 4, 7, 11, 20, 16, 0, time.FixedZone("UTC", 0)).String()) + + So(isolationsegment[2].Name, ShouldEqual, "shared1") + So(isolationsegment[2].GUID, ShouldEqual, "abcdefg12-12bb-499a-b05d-4b6fc9e2993b") + So(isolationsegment[2].CreatedAt.String(), ShouldEqual, time.Date(2017, 5, 2, 11, 22, 4, 0, time.FixedZone("UTC", 0)).String()) + So(isolationsegment[2].UpdatedAt.String(), ShouldEqual, time.Date(2017, 5, 2, 11, 22, 4, 0, time.FixedZone("UTC", 0)).String()) + + So(isolationsegment[3].Name, ShouldEqual, "my_segment1") + So(isolationsegment[3].GUID, ShouldEqual, "abcdef123-9d3c-44d8-b2dc-1767bcdad1e0") + So(isolationsegment[3].CreatedAt.String(), ShouldEqual, time.Date(2017, 5, 7, 11, 20, 16, 0, time.FixedZone("UTC", 0)).String()) + So(isolationsegment[3].UpdatedAt.String(), ShouldEqual, time.Date(2017, 5, 7, 11, 20, 16, 0, time.FixedZone("UTC", 0)).String()) + }) +} + +func TestDeleteIsolationSegmentByGUID(t *testing.T) { + Convey("Delete an Isolation Segment by GUID", t, func() { + mocks := []MockRoute{ + {"DELETE", "/v3/isolation_segments/033b4c58-12bb-499a-b05d-4b6fc9e2993b", []string{""}, "", http.StatusNoContent, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteIsolationSegmentByGUID("033b4c58-12bb-499a-b05d-4b6fc9e2993b") + So(err, ShouldBeNil) + + err = client.DeleteIsolationSegmentByGUID("theKittenIsTheShark") + So(err, ShouldNotBeNil) + }) +} + +func TestIsolationSegmentMethods(t *testing.T) { + + postData := `{"data":[{"guid":"theKittenIsTheShark"}]}` + + Convey("Request list of all Isolation Segments", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/isolation_segments", []string{listIsolationSegmentsPayload}, "", http.StatusOK, "", nil}, + {"DELETE", "/v3/isolation_segments/033b4c58-12bb-499a-b05d-4b6fc9e2993b", []string{""}, "", http.StatusNoContent, "", nil}, + {"POST", "/v3/isolation_segments/033b4c58-12bb-499a-b05d-4b6fc9e2993b/relationships/organizations", []string{""}, "", http.StatusOK, "", &postData}, + {"DELETE", "/v3/isolation_segments/033b4c58-12bb-499a-b05d-4b6fc9e2993b/relationships/organizations/theKittenIsTheShark", []string{""}, "", http.StatusNoContent, "", nil}, + {"PUT", "/v2/spaces/theKittenIsTheShark", []string{""}, "", http.StatusCreated, "", nil}, + {"DELETE", "/v2/spaces/theKittenIsTheShark/isolation_segment", []string{""}, "", http.StatusNoContent, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + isolationsegment, err := client.ListIsolationSegments() + + So(err, ShouldBeNil) + So(isolationsegment, ShouldNotBeNil) + So(len(isolationsegment), ShouldEqual, 2) + + errAddOrg := isolationsegment[0].AddOrg("theKittenIsTheShark") + So(errAddOrg, ShouldBeNil) + + errRemOrg := isolationsegment[0].RemoveOrg("theKittenIsTheShark") + So(errRemOrg, ShouldBeNil) + + errAddSpace := isolationsegment[0].AddSpace("theKittenIsTheShark") + So(errAddSpace, ShouldBeNil) + + errRemSpace := isolationsegment[0].RemoveSpace("theKittenIsTheShark") + So(errRemSpace, ShouldBeNil) + + errDel := isolationsegment[0].Delete() + So(errDel, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/metadata.go b/third_party/go-cfclient/metadata.go new file mode 100644 index 000000000000..661944baf9ab --- /dev/null +++ b/third_party/go-cfclient/metadata.go @@ -0,0 +1,165 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "strings" + + "github.com/pkg/errors" +) + +type MetadataHolder struct { + Metadata Metadata `json:"metadata"` +} + +type Metadata struct { + Annotations map[string]interface{} `json:"annotations"` + Labels map[string]interface{} `json:"labels"` +} + +func (m *Metadata) AddAnnotation(key string, value string) { + if m.Annotations == nil { + m.Annotations = make(map[string]interface{}) + } + m.Annotations[key] = value +} + +func (m *Metadata) RemoveAnnotation(key string) { + if m.Annotations == nil { + m.Annotations = make(map[string]interface{}) + } + m.Annotations[key] = nil +} + +func (m *Metadata) AddLabel(prefix, key string, value string) { + if m.Labels == nil { + m.Labels = make(map[string]interface{}) + } + if len(prefix) > 0 { + m.Labels[fmt.Sprintf("%s/%s", prefix, key)] = value + } else { + m.Labels[key] = value + } +} + +func (m *Metadata) RemoveLabel(prefix, key string) { + if m.Labels == nil { + m.Labels = make(map[string]interface{}) + } + if len(prefix) > 0 { + m.Labels[fmt.Sprintf("%s/%s", prefix, key)] = nil + } else { + m.Labels[key] = nil + } +} + +func (m *Metadata) Clear() *Metadata { + metadata := &Metadata{} + for key := range m.Annotations { + if strings.Contains(key, "/") { + metadata.RemoveAnnotation(strings.Split(key, "/")[1]) + } + metadata.RemoveAnnotation(key) + } + for key := range m.Labels { + metadata.RemoveLabel("", key) + } + return metadata +} + +func (c *Client) UpdateOrgMetadata(orgGUID string, metadata Metadata) error { + holder := MetadataHolder{} + holder.Metadata = metadata + requestURL := fmt.Sprintf("/v3/organizations/%s", orgGUID) + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(holder) + if err != nil { + return err + } + r := c.NewRequestWithBody("PATCH", requestURL, buf) + resp, err := c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return errors.Wrapf(err, "Error updating metadata for org %s, response code: %d", orgGUID, resp.StatusCode) + } + return nil +} + +func (c *Client) UpdateSpaceMetadata(spaceGUID string, metadata Metadata) error { + holder := MetadataHolder{} + holder.Metadata = metadata + requestURL := fmt.Sprintf("/v3/spaces/%s", spaceGUID) + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(holder) + if err != nil { + return err + } + r := c.NewRequestWithBody("PATCH", requestURL, buf) + resp, err := c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return errors.Wrapf(err, "Error updating metadata for space %s, response code: %d", spaceGUID, resp.StatusCode) + } + return nil +} + +func (c *Client) OrgMetadata(orgGUID string) (*Metadata, error) { + requestURL := fmt.Sprintf("/v3/organizations/%s", orgGUID) + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return &Metadata{}, errors.Wrap(err, "Error requesting space info") + } + defer resp.Body.Close() + return c.handleMetadataResp(resp) +} + +func (c *Client) SpaceMetadata(spaceGUID string) (*Metadata, error) { + requestURL := fmt.Sprintf("/v3/spaces/%s", spaceGUID) + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return &Metadata{}, errors.Wrap(err, "Error requesting space info") + } + defer resp.Body.Close() + return c.handleMetadataResp(resp) +} + +func (c *Client) RemoveOrgMetadata(orgGUID string) error { + metadata, err := c.OrgMetadata(orgGUID) + if err != nil { + return err + } + return c.UpdateOrgMetadata(orgGUID, *metadata.Clear()) +} + +func (c *Client) RemoveSpaceMetadata(spaceGUID string) error { + metadata, err := c.SpaceMetadata(spaceGUID) + if err != nil { + return err + } + return c.UpdateSpaceMetadata(spaceGUID, *metadata.Clear()) +} + +func (c *Client) handleMetadataResp(resp *http.Response) (*Metadata, error) { + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return &Metadata{}, err + } + var metadataResource MetadataHolder + err = json.Unmarshal(body, &metadataResource) + if err != nil { + return &Metadata{}, err + } + return &metadataResource.Metadata, nil +} diff --git a/third_party/go-cfclient/metadata_test.go b/third_party/go-cfclient/metadata_test.go new file mode 100644 index 000000000000..2aee3f564038 --- /dev/null +++ b/third_party/go-cfclient/metadata_test.go @@ -0,0 +1,189 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestUpdateOrgMetadata(t *testing.T) { + Convey("Set metadata on org", t, func() { + updateOrgMetadatPayload := `{"metadata":{"annotations":{"hello":"world"},"labels":{"foo":"bar"}}}` + mocks := []MockRoute{ + {"PATCH", "/v3/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{""}, "", 200, "", &updateOrgMetadatPayload}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + metadata := Metadata{} + metadata.AddAnnotation("hello", "world") + metadata.AddLabel("", "foo", "bar") + + err = client.UpdateOrgMetadata("3b6f763f-aae1-4177-9b93-f2de6f2a48f2", metadata) + So(err, ShouldBeNil) + }) + + Convey("Remove metadata on org", t, func() { + updateOrgMetadatPayload := `{"metadata":{"annotations":{"hello":null},"labels":{"foo":null}}}` + mocks := []MockRoute{ + {"PATCH", "/v3/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{""}, "", 200, "", &updateOrgMetadatPayload}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + metadata := Metadata{} + metadata.RemoveAnnotation("hello") + metadata.RemoveLabel("", "foo") + + err = client.UpdateOrgMetadata("3b6f763f-aae1-4177-9b93-f2de6f2a48f2", metadata) + So(err, ShouldBeNil) + }) +} +func TestUpdateSpaceMetadata(t *testing.T) { + Convey("Set metadata on org", t, func() { + updateSpaceMetadataPayload := `{"metadata":{"annotations":{"hello":"world"},"labels":{"foo":"bar"}}}` + mocks := []MockRoute{ + {"PATCH", "/v3/spaces/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{""}, "", 200, "", &updateSpaceMetadataPayload}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + metadata := Metadata{} + metadata.AddAnnotation("hello", "world") + metadata.AddLabel("", "foo", "bar") + + err = client.UpdateSpaceMetadata("3b6f763f-aae1-4177-9b93-f2de6f2a48f2", metadata) + So(err, ShouldBeNil) + }) + + Convey("Remove metadata on space", t, func() { + updateSpaceMetadataPayload := `{"metadata":{"annotations":{"hello":null},"labels":{"foo":null}}}` + mocks := []MockRoute{ + {"PATCH", "/v3/spaces/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{""}, "", 200, "", &updateSpaceMetadataPayload}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + metadata := Metadata{} + metadata.RemoveAnnotation("hello") + metadata.RemoveLabel("", "foo") + + err = client.UpdateSpaceMetadata("3b6f763f-aae1-4177-9b93-f2de6f2a48f2", metadata) + So(err, ShouldBeNil) + }) +} + +func TestSpaceMetadata(t *testing.T) { + Convey("Getting space metadata", t, func() { + spaceMetadataPayload := `{"guid": "3b6f763f-aae1-4177-9b93-f2de6f2a48f2","name": "space2","metadata":{"annotations":{"hello":"world"},"labels":{"foo":"bar"}}}` + mocks := []MockRoute{ + {"GET", "/v3/spaces/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{spaceMetadataPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + metadata, err := client.SpaceMetadata("3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + So(err, ShouldBeNil) + So(metadata, ShouldNotBeNil) + So(metadata.Labels, ShouldContainKey, "foo") + So(metadata.Annotations, ShouldContainKey, "hello") + }) + +} + +func TestOrgMetadata(t *testing.T) { + Convey("Getting org metadata", t, func() { + orgMetadataPayload := `{"guid": "3b6f763f-aae1-4177-9b93-f2de6f2a48f2","name": "space2","metadata":{"annotations":{"hello":"world"},"labels":{"foo":"bar"}}}` + mocks := []MockRoute{ + {"GET", "/v3/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{orgMetadataPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + metadata, err := client.OrgMetadata("3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + So(err, ShouldBeNil) + So(metadata, ShouldNotBeNil) + So(metadata.Labels, ShouldContainKey, "foo") + So(metadata.Annotations, ShouldContainKey, "hello") + }) +} + +func TestRemoveOrgMetadata(t *testing.T) { + Convey("Removing org metadata", t, func() { + orgMetadataPayload := `{"guid": "3b6f763f-aae1-4177-9b93-f2de6f2a48f2","name": "space2","metadata":{"annotations":{"hello":"world","prefix/foo":"bar"},"labels":{"foo":"bar"}}}` + updateMetadataPayload := `{"metadata":{"annotations":{"foo":null,"hello":null,"prefix/foo":null},"labels":{"foo":null}}}` + mocks := []MockRoute{ + {"GET", "/v3/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{orgMetadataPayload}, "", 200, "", nil}, + {"PATCH", "/v3/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{""}, "", 200, "", &updateMetadataPayload}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.RemoveOrgMetadata("3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + So(err, ShouldBeNil) + }) +} + +func TestRemoveSpaceMetadata(t *testing.T) { + Convey("Removing org metadata", t, func() { + spaceMetadataPayload := `{"guid": "3b6f763f-aae1-4177-9b93-f2de6f2a48f2","name": "space2","metadata":{"annotations":{"hello":"world","prefix/foo":"bar"},"labels":{"foo":"bar"}}}` + updateMetadataPayload := `{"metadata":{"annotations":{"foo":null,"hello":null,"prefix/foo":null},"labels":{"foo":null}}}` + mocks := []MockRoute{ + {"GET", "/v3/spaces/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{spaceMetadataPayload}, "", 200, "", nil}, + {"PATCH", "/v3/spaces/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{""}, "", 200, "", &updateMetadataPayload}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.RemoveSpaceMetadata("3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/org_quotas.go b/third_party/go-cfclient/org_quotas.go new file mode 100644 index 000000000000..f9a866ecddad --- /dev/null +++ b/third_party/go-cfclient/org_quotas.go @@ -0,0 +1,187 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type OrgQuotasResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []OrgQuotasResource `json:"resources"` +} + +type OrgQuotasResource struct { + Meta Meta `json:"metadata"` + Entity OrgQuota `json:"entity"` +} + +type OrgQuotaRequest struct { + Name string `json:"name"` + NonBasicServicesAllowed bool `json:"non_basic_services_allowed"` + TotalServices int `json:"total_services"` + TotalRoutes int `json:"total_routes"` + TotalPrivateDomains int `json:"total_private_domains"` + MemoryLimit int `json:"memory_limit"` + TrialDBAllowed bool `json:"trial_db_allowed"` + InstanceMemoryLimit int `json:"instance_memory_limit"` + AppInstanceLimit int `json:"app_instance_limit"` + AppTaskLimit int `json:"app_task_limit"` + TotalServiceKeys int `json:"total_service_keys"` + TotalReservedRoutePorts int `json:"total_reserved_route_ports"` +} + +type OrgQuota struct { + Guid string `json:"guid"` + Name string `json:"name"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + NonBasicServicesAllowed bool `json:"non_basic_services_allowed"` + TotalServices int `json:"total_services"` + TotalRoutes int `json:"total_routes"` + TotalPrivateDomains int `json:"total_private_domains"` + MemoryLimit int `json:"memory_limit"` + TrialDBAllowed bool `json:"trial_db_allowed"` + InstanceMemoryLimit int `json:"instance_memory_limit"` + AppInstanceLimit int `json:"app_instance_limit"` + AppTaskLimit int `json:"app_task_limit"` + TotalServiceKeys int `json:"total_service_keys"` + TotalReservedRoutePorts int `json:"total_reserved_route_ports"` + c *Client +} + +func (c *Client) ListOrgQuotasByQuery(query url.Values) ([]OrgQuota, error) { + var orgQuotas []OrgQuota + requestURL := "/v2/quota_definitions?" + query.Encode() + for { + orgQuotasResp, err := c.getOrgQuotasResponse(requestURL) + if err != nil { + return []OrgQuota{}, err + } + for _, org := range orgQuotasResp.Resources { + org.Entity.Guid = org.Meta.Guid + org.Entity.CreatedAt = org.Meta.CreatedAt + org.Entity.UpdatedAt = org.Meta.UpdatedAt + org.Entity.c = c + orgQuotas = append(orgQuotas, org.Entity) + } + requestURL = orgQuotasResp.NextUrl + if requestURL == "" { + break + } + } + return orgQuotas, nil +} + +func (c *Client) ListOrgQuotas() ([]OrgQuota, error) { + return c.ListOrgQuotasByQuery(nil) +} + +func (c *Client) GetOrgQuotaByName(name string) (OrgQuota, error) { + q := url.Values{} + q.Set("q", "name:"+name) + orgQuotas, err := c.ListOrgQuotasByQuery(q) + if err != nil { + return OrgQuota{}, err + } + if len(orgQuotas) != 1 { + return OrgQuota{}, fmt.Errorf("Unable to find org quota " + name) + } + return orgQuotas[0], nil +} + +func (c *Client) getOrgQuotasResponse(requestURL string) (OrgQuotasResponse, error) { + var orgQuotasResp OrgQuotasResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return OrgQuotasResponse{}, errors.Wrap(err, "Error requesting org quotas") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return OrgQuotasResponse{}, errors.Wrap(err, "Error reading org quotas body") + } + err = json.Unmarshal(resBody, &orgQuotasResp) + if err != nil { + return OrgQuotasResponse{}, errors.Wrap(err, "Error unmarshalling org quotas") + } + return orgQuotasResp, nil +} + +func (c *Client) CreateOrgQuota(orgQuote OrgQuotaRequest) (*OrgQuota, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(orgQuote) + if err != nil { + return nil, err + } + r := c.NewRequestWithBody("POST", "/v2/quota_definitions", buf) + resp, err := c.DoRequest(r) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return c.handleOrgQuotaResp(resp) +} + +func (c *Client) UpdateOrgQuota(orgQuotaGUID string, orgQuota OrgQuotaRequest) (*OrgQuota, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(orgQuota) + if err != nil { + return nil, err + } + r := c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/quota_definitions/%s", orgQuotaGUID), buf) + resp, err := c.DoRequest(r) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return c.handleOrgQuotaResp(resp) +} + +func (c *Client) DeleteOrgQuota(guid string, async bool) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/quota_definitions/%s?async=%t", guid, async))) + if err != nil { + return err + } + defer resp.Body.Close() + if (async && (resp.StatusCode != http.StatusAccepted)) || (!async && (resp.StatusCode != http.StatusNoContent)) { + return errors.Wrapf(err, "Error deleting organization %s, response code: %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) handleOrgQuotaResp(resp *http.Response) (*OrgQuota, error) { + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return nil, err + } + var orgQuotasResource OrgQuotasResource + err = json.Unmarshal(body, &orgQuotasResource) + if err != nil { + return nil, err + } + return c.mergeOrgQuotaResource(orgQuotasResource), nil +} + +func (c *Client) mergeOrgQuotaResource(orgQuotaResource OrgQuotasResource) *OrgQuota { + orgQuotaResource.Entity.Guid = orgQuotaResource.Meta.Guid + orgQuotaResource.Entity.CreatedAt = orgQuotaResource.Meta.CreatedAt + orgQuotaResource.Entity.UpdatedAt = orgQuotaResource.Meta.UpdatedAt + orgQuotaResource.Entity.c = c + return &orgQuotaResource.Entity +} diff --git a/third_party/go-cfclient/org_quotas_test.go b/third_party/go-cfclient/org_quotas_test.go new file mode 100644 index 000000000000..f06a6aa0bebb --- /dev/null +++ b/third_party/go-cfclient/org_quotas_test.go @@ -0,0 +1,148 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListOrgQuotas(t *testing.T) { + Convey("List Org Quotas", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/quota_definitions", []string{listOrgQuotasPayloadPage1}, "", 200, "", nil}, + {"GET", "/v2/quota_definitions_page_2", []string{listOrgQuotasPayloadPage2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + orgQuotas, err := client.ListOrgQuotas() + So(err, ShouldBeNil) + + So(len(orgQuotas), ShouldEqual, 2) + So(orgQuotas[0].Guid, ShouldEqual, "6f9d3100-44ab-49e2-a4f8-9d7d67651ae7") + So(orgQuotas[0].Name, ShouldEqual, "test-1") + So(orgQuotas[0].NonBasicServicesAllowed, ShouldEqual, true) + So(orgQuotas[0].TotalServices, ShouldEqual, -1) + So(orgQuotas[0].TotalRoutes, ShouldEqual, 100) + So(orgQuotas[0].TotalPrivateDomains, ShouldEqual, -1) + So(orgQuotas[0].MemoryLimit, ShouldEqual, 102400) + So(orgQuotas[0].TrialDBAllowed, ShouldEqual, false) + So(orgQuotas[0].InstanceMemoryLimit, ShouldEqual, -1) + So(orgQuotas[0].AppInstanceLimit, ShouldEqual, -1) + So(orgQuotas[0].AppTaskLimit, ShouldEqual, -1) + So(orgQuotas[0].TotalServiceKeys, ShouldEqual, -1) + So(orgQuotas[0].TotalReservedRoutePorts, ShouldEqual, -1) + }) +} + +func TestGetOrgQuotaByName(t *testing.T) { + Convey("Get Org Quota By Name", t, func() { + setup(MockRoute{"GET", "/v2/quota_definitions", []string{listOrgQuotasPayloadPage2}, "", 200, "q=name:default2", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + orgQuota, err := client.GetOrgQuotaByName("default2") + So(err, ShouldBeNil) + + So(orgQuota.Guid, ShouldEqual, "a537761f-9d93-4b30-af17-3d73dbca181b") + So(orgQuota.Name, ShouldEqual, "test-2") + So(orgQuota.NonBasicServicesAllowed, ShouldEqual, false) + So(orgQuota.TotalServices, ShouldEqual, 10) + So(orgQuota.TotalRoutes, ShouldEqual, 20) + So(orgQuota.TotalPrivateDomains, ShouldEqual, 30) + So(orgQuota.MemoryLimit, ShouldEqual, 40) + So(orgQuota.TrialDBAllowed, ShouldEqual, true) + So(orgQuota.InstanceMemoryLimit, ShouldEqual, 50) + So(orgQuota.AppInstanceLimit, ShouldEqual, 60) + So(orgQuota.AppTaskLimit, ShouldEqual, 70) + So(orgQuota.TotalServiceKeys, ShouldEqual, 80) + So(orgQuota.TotalReservedRoutePorts, ShouldEqual, 90) + }) +} + +func TestCreateOrgQuota(t *testing.T) { + Convey("Create Org Quota", t, func() { + setup(MockRoute{"POST", "/v2/quota_definitions", []string{orgQuotaPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + orgQuotaRequest := OrgQuotaRequest{ + Name: "test-2", + } + + orgQuota, err := client.CreateOrgQuota(orgQuotaRequest) + So(err, ShouldBeNil) + + So(orgQuota.Name, ShouldEqual, "test-2") + + }) +} + +func TestUpdateOrgQuota(t *testing.T) { + Convey("Create Update Quota", t, func() { + setup(MockRoute{"PUT", "/v2/quota_definitions/9ffd7c5c-d83c-4786-b399-b7bd54883977", []string{orgQuotaPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + orgQuotaRequest := OrgQuotaRequest{ + Name: "test-2", + } + + orgQuota, err := client.UpdateOrgQuota("9ffd7c5c-d83c-4786-b399-b7bd54883977", orgQuotaRequest) + So(err, ShouldBeNil) + + So(orgQuota.Name, ShouldEqual, "test-2") + + }) +} + +func TestDeleteOrgQuota(t *testing.T) { + Convey("Delete org quota synchronously", t, func() { + setup(MockRoute{"DELETE", "/v2/quota_definitions/b2a35f0c-d5ad-4a59-bea7-461711d96b0d", []string{""}, "", 204, "async=false", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteOrgQuota("b2a35f0c-d5ad-4a59-bea7-461711d96b0d", false) + So(err, ShouldBeNil) + }) + + Convey("Delete org quota asynchronously", t, func() { + setup(MockRoute{"DELETE", "/v2/quota_definitions/b2a35f0c-d5ad-4a59-bea7-461711d96b0d", []string{""}, "", 202, "async=true", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteOrgQuota("b2a35f0c-d5ad-4a59-bea7-461711d96b0d", true) + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/orgs.go b/third_party/go-cfclient/orgs.go new file mode 100644 index 000000000000..d2e656b79f35 --- /dev/null +++ b/third_party/go-cfclient/orgs.go @@ -0,0 +1,847 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type OrgResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []OrgResource `json:"resources"` +} + +type OrgResource struct { + Meta Meta `json:"metadata"` + Entity Org `json:"entity"` +} + +type OrgUserResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextURL string `json:"next_url"` + Resources []UserResource `json:"resources"` +} + +type Org struct { + Guid string `json:"guid"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Name string `json:"name"` + Status string `json:"status"` + QuotaDefinitionGuid string `json:"quota_definition_guid"` + DefaultIsolationSegmentGuid string `json:"default_isolation_segment_guid"` + c *Client +} + +type OrgSummary struct { + Guid string `json:"guid"` + Name string `json:"name"` + Status string `json:"status"` + Spaces []OrgSummarySpaces `json:"spaces"` +} + +type OrgSummarySpaces struct { + Guid string `json:"guid"` + Name string `json:"name"` + ServiceCount int `json:"service_count"` + AppCount int `json:"app_count"` + MemDevTotal int `json:"mem_dev_total"` + MemProdTotal int `json:"mem_prod_total"` +} + +type OrgRequest struct { + Name string `json:"name"` + Status string `json:"status,omitempty"` + QuotaDefinitionGuid string `json:"quota_definition_guid,omitempty"` + DefaultIsolationSegmentGuid string `json:"default_isolation_segment_guid,omitempty"` +} + +func (c *Client) ListOrgsByQuery(query url.Values) ([]Org, error) { + var orgs []Org + requestURL := "/v2/organizations?" + query.Encode() + for { + orgResp, err := c.getOrgResponse(requestURL) + if err != nil { + return []Org{}, err + } + for _, org := range orgResp.Resources { + orgs = append(orgs, c.mergeOrgResource(org)) + } + requestURL = orgResp.NextUrl + if requestURL == "" || query.Get("page") != "" { + break + } + } + return orgs, nil +} + +func (c *Client) ListOrgs() ([]Org, error) { + return c.ListOrgsByQuery(nil) +} + +func (c *Client) GetOrgByName(name string) (Org, error) { + var org Org + q := url.Values{} + q.Set("q", "name:"+name) + orgs, err := c.ListOrgsByQuery(q) + if err != nil { + return org, err + } + if len(orgs) == 0 { + cfErr := NewOrganizationNotFoundError() + cfErr.Description = fmt.Sprintf(cfErr.Description, name) + return org, cfErr + } + return orgs[0], nil +} + +func (c *Client) GetOrgByGuid(guid string) (Org, error) { + var orgRes OrgResource + r := c.NewRequest("GET", "/v2/organizations/"+guid) + resp, err := c.DoRequest(r) + if err != nil { + return Org{}, err + } + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return Org{}, err + } + err = json.Unmarshal(body, &orgRes) + if err != nil { + return Org{}, err + } + return c.mergeOrgResource(orgRes), nil +} + +func (c *Client) OrgSpaces(guid string) ([]Space, error) { + return c.fetchSpaces(fmt.Sprintf("/v2/organizations/%s/spaces", guid), url.Values{}) +} + +func (o *Org) Summary() (OrgSummary, error) { + var orgSummary OrgSummary + requestURL := fmt.Sprintf("/v2/organizations/%s/summary", o.Guid) + r := o.c.NewRequest("GET", requestURL) + resp, err := o.c.DoRequest(r) + if err != nil { + return OrgSummary{}, errors.Wrap(err, "Error requesting org summary") + } + resBody, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return OrgSummary{}, errors.Wrap(err, "Error reading org summary body") + } + err = json.Unmarshal(resBody, &orgSummary) + if err != nil { + return OrgSummary{}, errors.Wrap(err, "Error unmarshalling org summary") + } + return orgSummary, nil +} + +func (o *Org) Quota() (*OrgQuota, error) { + var orgQuota *OrgQuota + var orgQuotaResource OrgQuotasResource + if o.QuotaDefinitionGuid == "" { + return nil, nil + } + requestURL := fmt.Sprintf("/v2/quota_definitions/%s", o.QuotaDefinitionGuid) + r := o.c.NewRequest("GET", requestURL) + resp, err := o.c.DoRequest(r) + if err != nil { + return &OrgQuota{}, errors.Wrap(err, "Error requesting org quota") + } + resBody, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return &OrgQuota{}, errors.Wrap(err, "Error reading org quota body") + } + err = json.Unmarshal(resBody, &orgQuotaResource) + if err != nil { + return &OrgQuota{}, errors.Wrap(err, "Error unmarshalling org quota") + } + orgQuota = &orgQuotaResource.Entity + orgQuota.Guid = orgQuotaResource.Meta.Guid + orgQuota.c = o.c + return orgQuota, nil +} + +func (c *Client) ListOrgUsersByQuery(orgGUID string, query url.Values) ([]User, error) { + var users []User + requestURL := fmt.Sprintf("/v2/organizations/%s/users?%s", orgGUID, query.Encode()) + for { + omResp, err := c.getOrgUserResponse(requestURL) + if err != nil { + return []User{}, err + } + for _, u := range omResp.Resources { + users = append(users, c.mergeUserResource(u)) + } + requestURL = omResp.NextURL + if requestURL == "" { + break + } + } + return users, nil +} + +func (c *Client) ListOrgUsers(orgGUID string) ([]User, error) { + return c.ListOrgUsersByQuery(orgGUID, nil) +} + +func (c *Client) listOrgRolesByQuery(orgGUID, role string, query url.Values) ([]User, error) { + var users []User + requestURL := fmt.Sprintf("/v2/organizations/%s/%s?%s", orgGUID, role, query.Encode()) + for { + omResp, err := c.getOrgUserResponse(requestURL) + if err != nil { + return []User{}, err + } + for _, u := range omResp.Resources { + users = append(users, c.mergeUserResource(u)) + } + requestURL = omResp.NextURL + if requestURL == "" { + break + } + } + return users, nil +} + +func (c *Client) ListOrgManagersByQuery(orgGUID string, query url.Values) ([]User, error) { + return c.listOrgRolesByQuery(orgGUID, "managers", query) +} + +func (c *Client) ListOrgManagers(orgGUID string) ([]User, error) { + return c.ListOrgManagersByQuery(orgGUID, nil) +} + +func (c *Client) ListOrgAuditorsByQuery(orgGUID string, query url.Values) ([]User, error) { + return c.listOrgRolesByQuery(orgGUID, "auditors", query) +} + +func (c *Client) ListOrgAuditors(orgGUID string) ([]User, error) { + return c.ListOrgAuditorsByQuery(orgGUID, nil) +} + +func (c *Client) ListOrgBillingManagersByQuery(orgGUID string, query url.Values) ([]User, error) { + return c.listOrgRolesByQuery(orgGUID, "billing_managers", query) +} + +func (c *Client) ListOrgBillingManagers(orgGUID string) ([]User, error) { + return c.ListOrgBillingManagersByQuery(orgGUID, nil) +} + +func (c *Client) AssociateOrgManager(orgGUID, userGUID string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateManager(userGUID) +} + +func (c *Client) AssociateOrgManagerByUsername(orgGUID, name string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateManagerByUsername(name) +} + +func (c *Client) AssociateOrgManagerByUsernameAndOrigin(orgGUID, name, origin string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateManagerByUsernameAndOrigin(name, origin) +} + +func (c *Client) AssociateOrgUser(orgGUID, userGUID string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateUser(userGUID) +} + +func (c *Client) AssociateOrgAuditor(orgGUID, userGUID string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateAuditor(userGUID) +} + +func (c *Client) AssociateOrgUserByUsername(orgGUID, name string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateUserByUsername(name) +} + +func (c *Client) AssociateOrgUserByUsernameAndOrigin(orgGUID, name, origin string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateUserByUsernameAndOrigin(name, origin) +} + +func (c *Client) AssociateOrgAuditorByUsername(orgGUID, name string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateAuditorByUsername(name) +} + +func (c *Client) AssociateOrgAuditorByUsernameAndOrigin(orgGUID, name, origin string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateAuditorByUsernameAndOrigin(name, origin) +} + +func (c *Client) AssociateOrgBillingManager(orgGUID, userGUID string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateBillingManager(userGUID) +} + +func (c *Client) AssociateOrgBillingManagerByUsername(orgGUID, name string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateBillingManagerByUsername(name) +} + +func (c *Client) AssociateOrgBillingManagerByUsernameAndOrigin(orgGUID, name, origin string) (Org, error) { + org := Org{Guid: orgGUID, c: c} + return org.AssociateBillingManagerByUsernameAndOrigin(name, origin) +} + +func (c *Client) RemoveOrgManager(orgGUID, userGUID string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveManager(userGUID) +} + +func (c *Client) RemoveOrgManagerByUsername(orgGUID, name string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveManagerByUsername(name) +} + +func (c *Client) RemoveOrgManagerByUsernameAndOrigin(orgGUID, name, origin string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveManagerByUsernameAndOrigin(name, origin) +} + +func (c *Client) RemoveOrgUser(orgGUID, userGUID string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveUser(userGUID) +} + +func (c *Client) RemoveOrgAuditor(orgGUID, userGUID string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveAuditor(userGUID) +} + +func (c *Client) RemoveOrgUserByUsername(orgGUID, name string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveUserByUsername(name) +} + +func (c *Client) RemoveOrgUserByUsernameAndOrigin(orgGUID, name, origin string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveUserByUsernameAndOrigin(name, origin) +} + +func (c *Client) RemoveOrgAuditorByUsername(orgGUID, name string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveAuditorByUsername(name) +} + +func (c *Client) RemoveOrgAuditorByUsernameAndOrigin(orgGUID, name, origin string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveAuditorByUsernameAndOrigin(name, origin) +} + +func (c *Client) RemoveOrgBillingManager(orgGUID, userGUID string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveBillingManager(userGUID) +} + +func (c *Client) RemoveOrgBillingManagerByUsername(orgGUID, name string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveBillingManagerByUsername(name) +} + +func (c *Client) RemoveOrgBillingManagerByUsernameAndOrigin(orgGUID, name, origin string) error { + org := Org{Guid: orgGUID, c: c} + return org.RemoveBillingManagerByUsernameAndOrigin(name, origin) +} + +func (c *Client) ListOrgSpaceQuotas(orgGUID string) ([]SpaceQuota, error) { + org := Org{Guid: orgGUID, c: c} + return org.ListSpaceQuotas() +} + +func (c *Client) ListOrgPrivateDomains(orgGUID string) ([]Domain, error) { + org := Org{Guid: orgGUID, c: c} + return org.ListPrivateDomains() +} + +func (c *Client) ShareOrgPrivateDomain(orgGUID, privateDomainGUID string) (*Domain, error) { + org := Org{Guid: orgGUID, c: c} + return org.SharePrivateDomain(privateDomainGUID) +} + +func (c *Client) UnshareOrgPrivateDomain(orgGUID, privateDomainGUID string) error { + org := Org{Guid: orgGUID, c: c} + return org.UnsharePrivateDomain(privateDomainGUID) +} + +func (o *Org) ListSpaceQuotas() ([]SpaceQuota, error) { + var spaceQuotas []SpaceQuota + requestURL := fmt.Sprintf("/v2/organizations/%s/space_quota_definitions", o.Guid) + for { + spaceQuotasResp, err := o.c.getSpaceQuotasResponse(requestURL) + if err != nil { + return []SpaceQuota{}, err + } + for _, resource := range spaceQuotasResp.Resources { + spaceQuotas = append(spaceQuotas, *o.c.mergeSpaceQuotaResource(resource)) + } + requestURL = spaceQuotasResp.NextUrl + if requestURL == "" { + break + } + } + return spaceQuotas, nil +} + +func (o *Org) ListPrivateDomains() ([]Domain, error) { + var domains []Domain + requestURL := fmt.Sprintf("/v2/organizations/%s/private_domains", o.Guid) + for { + domainsResp, err := o.c.getDomainsResponse(requestURL) + if err != nil { + return []Domain{}, err + } + for _, resource := range domainsResp.Resources { + domains = append(domains, *o.c.mergeDomainResource(resource)) + } + requestURL = domainsResp.NextUrl + if requestURL == "" { + break + } + } + return domains, nil +} + +func (o *Org) SharePrivateDomain(privateDomainGUID string) (*Domain, error) { + requestURL := fmt.Sprintf("/v2/organizations/%s/private_domains/%s", o.Guid, privateDomainGUID) + r := o.c.NewRequest("PUT", requestURL) + resp, err := o.c.DoRequest(r) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, errors.Wrapf(err, "Error sharing domain %s for org %s, response code: %d", privateDomainGUID, o.Guid, resp.StatusCode) + } + return o.c.handleDomainResp(resp) +} + +func (o *Org) UnsharePrivateDomain(privateDomainGUID string) error { + requestURL := fmt.Sprintf("/v2/organizations/%s/private_domains/%s", o.Guid, privateDomainGUID) + r := o.c.NewRequest("DELETE", requestURL) + resp, err := o.c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error unsharing domain %s for org %s, response code: %d", privateDomainGUID, o.Guid, resp.StatusCode) + } + return nil +} + +func (o *Org) associateRole(userGUID, role string) (Org, error) { + requestURL := fmt.Sprintf("/v2/organizations/%s/%s/%s", o.Guid, role, userGUID) + r := o.c.NewRequest("PUT", requestURL) + resp, err := o.c.DoRequest(r) + if err != nil { + return Org{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return Org{}, errors.Wrapf(err, "Error associating %s %s, response code: %d", role, userGUID, resp.StatusCode) + } + return o.c.handleOrgResp(resp) +} + +func (o *Org) associateRoleByUsernameAndOrigin(name, role, origin string) (Org, error) { + requestURL := fmt.Sprintf("/v2/organizations/%s/%s", o.Guid, role) + buf := bytes.NewBuffer(nil) + payload := make(map[string]string) + payload["username"] = name + if origin != "" { + payload["origin"] = origin + } + err := json.NewEncoder(buf).Encode(payload) + if err != nil { + return Org{}, err + } + r := o.c.NewRequestWithBody("PUT", requestURL, buf) + resp, err := o.c.DoRequest(r) + if err != nil { + return Org{}, err + } + if resp.StatusCode != http.StatusCreated { + return Org{}, errors.Wrapf(err, "Error associating %s %s, response code: %d", role, name, resp.StatusCode) + } + return o.c.handleOrgResp(resp) +} + +func (o *Org) AssociateManager(userGUID string) (Org, error) { + return o.associateRole(userGUID, "managers") +} + +func (o *Org) AssociateManagerByUsername(name string) (Org, error) { + return o.associateRoleByUsernameAndOrigin(name, "managers", "") +} + +func (o *Org) AssociateManagerByUsernameAndOrigin(name, origin string) (Org, error) { + return o.associateRoleByUsernameAndOrigin(name, "managers", origin) +} + +func (o *Org) AssociateUser(userGUID string) (Org, error) { + requestURL := fmt.Sprintf("/v2/organizations/%s/users/%s", o.Guid, userGUID) + r := o.c.NewRequest("PUT", requestURL) + resp, err := o.c.DoRequest(r) + if err != nil { + return Org{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return Org{}, errors.Wrapf(err, "Error associating user %s, response code: %d", userGUID, resp.StatusCode) + } + return o.c.handleOrgResp(resp) +} + +func (o *Org) AssociateAuditor(userGUID string) (Org, error) { + return o.associateRole(userGUID, "auditors") +} + +func (o *Org) AssociateAuditorByUsername(name string) (Org, error) { + return o.associateRoleByUsernameAndOrigin(name, "auditors", "") +} + +func (o *Org) AssociateAuditorByUsernameAndOrigin(name, origin string) (Org, error) { + return o.associateRoleByUsernameAndOrigin(name, "auditors", origin) +} + +func (o *Org) AssociateBillingManager(userGUID string) (Org, error) { + return o.associateRole(userGUID, "billing_managers") +} + +func (o *Org) AssociateBillingManagerByUsername(name string) (Org, error) { + return o.associateRoleByUsernameAndOrigin(name, "billing_managers", "") +} +func (o *Org) AssociateBillingManagerByUsernameAndOrigin(name, origin string) (Org, error) { + return o.associateRoleByUsernameAndOrigin(name, "billing_managers", origin) +} + +func (o *Org) AssociateUserByUsername(name string) (Org, error) { + return o.associateUserByUsernameAndOrigin(name, "") +} + +func (o *Org) AssociateUserByUsernameAndOrigin(name, origin string) (Org, error) { + return o.associateUserByUsernameAndOrigin(name, origin) +} + +func (o *Org) associateUserByUsernameAndOrigin(name, origin string) (Org, error) { + requestURL := fmt.Sprintf("/v2/organizations/%s/users", o.Guid) + buf := bytes.NewBuffer(nil) + payload := make(map[string]string) + payload["username"] = name + if origin != "" { + payload["origin"] = origin + } + err := json.NewEncoder(buf).Encode(payload) + if err != nil { + return Org{}, err + } + r := o.c.NewRequestWithBody("PUT", requestURL, buf) + resp, err := o.c.DoRequest(r) + if err != nil { + return Org{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return Org{}, errors.Wrapf(err, "Error associating user %s, response code: %d", name, resp.StatusCode) + } + return o.c.handleOrgResp(resp) +} + +func (o *Org) removeRole(userGUID, role string) error { + requestURL := fmt.Sprintf("/v2/organizations/%s/%s/%s", o.Guid, role, userGUID) + r := o.c.NewRequest("DELETE", requestURL) + resp, err := o.c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error removing %s %s, response code: %d", role, userGUID, resp.StatusCode) + } + return nil +} + +func (o *Org) removeRoleByUsernameAndOrigin(name, role, origin string) error { + var requestURL string + var method string + buf := bytes.NewBuffer(nil) + payload := make(map[string]string) + payload["username"] = name + if origin != "" { + requestURL = fmt.Sprintf("/v2/organizations/%s/%s/remove", o.Guid, role) + method = "POST" + payload["origin"] = origin + } else { + requestURL = fmt.Sprintf("/v2/organizations/%s/%s", o.Guid, role) + method = "DELETE" + } + err := json.NewEncoder(buf).Encode(payload) + if err != nil { + return err + } + + r := o.c.NewRequestWithBody(method, requestURL, buf) + resp, err := o.c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error removing manager %s, response code: %d", name, resp.StatusCode) + } + return nil +} + +func (o *Org) RemoveManager(userGUID string) error { + return o.removeRole(userGUID, "managers") +} + +func (o *Org) RemoveManagerByUsername(name string) error { + return o.removeRoleByUsernameAndOrigin(name, "managers", "") +} +func (o *Org) RemoveManagerByUsernameAndOrigin(name, origin string) error { + return o.removeRoleByUsernameAndOrigin(name, "managers", origin) +} + +func (o *Org) RemoveAuditor(userGUID string) error { + return o.removeRole(userGUID, "auditors") +} + +func (o *Org) RemoveAuditorByUsername(name string) error { + return o.removeRoleByUsernameAndOrigin(name, "auditors", "") +} +func (o *Org) RemoveAuditorByUsernameAndOrigin(name, origin string) error { + return o.removeRoleByUsernameAndOrigin(name, "auditors", origin) +} + +func (o *Org) RemoveBillingManager(userGUID string) error { + return o.removeRole(userGUID, "billing_managers") +} + +func (o *Org) RemoveBillingManagerByUsername(name string) error { + return o.removeRoleByUsernameAndOrigin(name, "billing_managers", "") +} + +func (o *Org) RemoveBillingManagerByUsernameAndOrigin(name, origin string) error { + return o.removeRoleByUsernameAndOrigin(name, "billing_managers", origin) +} + +func (o *Org) RemoveUser(userGUID string) error { + requestURL := fmt.Sprintf("/v2/organizations/%s/users/%s", o.Guid, userGUID) + r := o.c.NewRequest("DELETE", requestURL) + resp, err := o.c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error removing user %s, response code: %d", userGUID, resp.StatusCode) + } + return nil +} + +func (o *Org) RemoveUserByUsername(name string) error { + return o.removeUserByUsernameAndOrigin(name, "") +} + +func (o *Org) RemoveUserByUsernameAndOrigin(name, origin string) error { + return o.removeUserByUsernameAndOrigin(name, origin) +} + +func (o *Org) removeUserByUsernameAndOrigin(name, origin string) error { + var requestURL string + var method string + buf := bytes.NewBuffer(nil) + payload := make(map[string]string) + payload["username"] = name + if origin != "" { + payload["origin"] = origin + requestURL = fmt.Sprintf("/v2/organizations/%s/users/remove", o.Guid) + method = "POST" + } else { + requestURL = fmt.Sprintf("/v2/organizations/%s/users", o.Guid) + method = "DELETE" + } + err := json.NewEncoder(buf).Encode(payload) + if err != nil { + return err + } + r := o.c.NewRequestWithBody(method, requestURL, buf) + resp, err := o.c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error removing user %s, response code: %d", name, resp.StatusCode) + } + return nil +} + +func (c *Client) CreateOrg(req OrgRequest) (Org, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(req) + if err != nil { + return Org{}, err + } + r := c.NewRequestWithBody("POST", "/v2/organizations", buf) + resp, err := c.DoRequest(r) + if err != nil { + return Org{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return Org{}, errors.Wrapf(err, "Error creating organization, response code: %d", resp.StatusCode) + } + return c.handleOrgResp(resp) +} + +func (c *Client) UpdateOrg(orgGUID string, orgRequest OrgRequest) (Org, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(orgRequest) + if err != nil { + return Org{}, err + } + r := c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/organizations/%s", orgGUID), buf) + resp, err := c.DoRequest(r) + if err != nil { + return Org{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return Org{}, errors.Wrapf(err, "Error updating organization, response code: %d", resp.StatusCode) + } + return c.handleOrgResp(resp) +} + +func (c *Client) DeleteOrg(guid string, recursive, async bool) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/organizations/%s?recursive=%t&async=%t", guid, recursive, async))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting organization %s, response code: %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) getOrgResponse(requestURL string) (OrgResponse, error) { + var orgResp OrgResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return OrgResponse{}, errors.Wrap(err, "Error requesting orgs") + } + resBody, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return OrgResponse{}, errors.Wrap(err, "Error reading org request") + } + err = json.Unmarshal(resBody, &orgResp) + if err != nil { + return OrgResponse{}, errors.Wrap(err, "Error unmarshalling org") + } + return orgResp, nil +} + +func (c *Client) fetchOrgs(requestURL string) ([]Org, error) { + var orgs []Org + for { + orgResp, err := c.getOrgResponse(requestURL) + if err != nil { + return []Org{}, err + } + for _, org := range orgResp.Resources { + orgs = append(orgs, c.mergeOrgResource(org)) + } + requestURL = orgResp.NextUrl + if requestURL == "" { + break + } + } + return orgs, nil +} + +func (c *Client) handleOrgResp(resp *http.Response) (Org, error) { + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return Org{}, err + } + var orgResource OrgResource + err = json.Unmarshal(body, &orgResource) + if err != nil { + return Org{}, err + } + return c.mergeOrgResource(orgResource), nil +} + +func (c *Client) getOrgUserResponse(requestURL string) (OrgUserResponse, error) { + var omResp OrgUserResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return OrgUserResponse{}, errors.Wrap(err, "error requesting org managers") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return OrgUserResponse{}, errors.Wrap(err, "error reading org managers response body") + } + if err := json.Unmarshal(resBody, &omResp); err != nil { + return OrgUserResponse{}, errors.Wrap(err, "error unmarshaling org managers") + } + return omResp, nil +} + +func (c *Client) mergeOrgResource(org OrgResource) Org { + org.Entity.Guid = org.Meta.Guid + org.Entity.CreatedAt = org.Meta.CreatedAt + org.Entity.UpdatedAt = org.Meta.UpdatedAt + org.Entity.c = c + return org.Entity +} + +func (c *Client) DefaultIsolationSegmentForOrg(orgGUID, isolationSegmentGUID string) error { + return c.updateOrgDefaultIsolationSegment(orgGUID, map[string]interface{}{"guid": isolationSegmentGUID}) +} + +func (c *Client) ResetDefaultIsolationSegmentForOrg(orgGUID string) error { + return c.updateOrgDefaultIsolationSegment(orgGUID, nil) +} + +func (c *Client) updateOrgDefaultIsolationSegment(orgGUID string, data interface{}) error { + requestURL := fmt.Sprintf("/v3/organizations/%s/relationships/default_isolation_segment", orgGUID) + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(map[string]interface{}{"data": data}) + if err != nil { + return err + } + r := c.NewRequestWithBody("PATCH", requestURL, buf) + resp, err := c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return errors.Wrapf(err, "Error setting default isolation segment for org %s, response code: %d", orgGUID, resp.StatusCode) + } + return nil +} diff --git a/third_party/go-cfclient/orgs_test.go b/third_party/go-cfclient/orgs_test.go new file mode 100644 index 000000000000..f2cbae34e61f --- /dev/null +++ b/third_party/go-cfclient/orgs_test.go @@ -0,0 +1,1004 @@ +package cfclient + +import ( + "github.com/pkg/errors" + "net/url" + "reflect" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListOrgs(t *testing.T) { + Convey("List Orgs", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{listOrgsPayload, listOrgsPayloadPage2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + orgs, err := client.ListOrgs() + So(err, ShouldBeNil) + + So(len(orgs), ShouldEqual, 4) + So(orgs[0].Guid, ShouldEqual, "a537761f-9d93-4b30-af17-3d73dbca181b") + So(orgs[0].Name, ShouldEqual, "demo") + }) +} + +func TestListOrgsByQuery(t *testing.T) { + Convey("List Orgs", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{listOrgsPayload, listOrgsPayloadPage2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + var query = url.Values{ + "results-per-page": []string{ + "2", + }, + } + orgs, err := client.ListOrgsByQuery(query) + So(err, ShouldBeNil) + + So(len(orgs), ShouldEqual, 4) + So(orgs[0].Guid, ShouldEqual, "a537761f-9d93-4b30-af17-3d73dbca181b") + So(orgs[0].Name, ShouldEqual, "demo") + }) +} + +func TestGetOrgByName(t *testing.T) { + Convey("Get org by name", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{getOrgByNamePayload}, "", 200, "q=name:demo77", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org, err := client.GetOrgByName("demo77") + So(err, ShouldBeNil) + + So(org.Guid, ShouldEqual, "4156a4a0-6092-40ab-98bf-114051d1561d") + So(org.Name, ShouldEqual, "demo77") + }) +} + +func TestGetOrgByNameNotFound(t *testing.T) { + Convey("Get org by name not found", t, func() { + setup(MockRoute{"GET", "/v2/organizations", []string{emptyResources}, "", 200, "q=name:does-not-exist", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org, err := client.GetOrgByName("does-not-exist") + So(err, ShouldNotBeNil) + So(IsOrganizationNotFoundError(err), ShouldBeTrue) + + cause := errors.Cause(err) + cfErr, ok := cause.(CloudFoundryError) + if !ok { + t.Fatalf("Expected an error of type CloudFoundryError, but got %s", reflect.TypeOf(err)) + } + So(cfErr.ErrorCode, ShouldEqual, "CF-OrganizationNotFound") + So(cfErr.Code, ShouldEqual, 30003) + So(cfErr.Description, ShouldEqual, "The organization could not be found: does-not-exist") + + So(org.Guid, ShouldEqual, "") + So(org.Name, ShouldEqual, "") + }) +} + +func TestGetOrgByGuid(t *testing.T) { + Convey("Get org by GUID", t, func() { + setup(MockRoute{"GET", "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b", []string{orgByGuidPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org, err := client.GetOrgByGuid("1c0e6074-777f-450e-9abc-c42f39d9b75b") + So(err, ShouldBeNil) + + So(org.Guid, ShouldEqual, "1c0e6074-777f-450e-9abc-c42f39d9b75b") + So(org.Name, ShouldEqual, "name-1716") + }) +} + +func TestOrgSpaces(t *testing.T) { + Convey("Get spaces by org", t, func() { + setup(MockRoute{"GET", "/v2/organizations/foo/spaces", []string{orgSpacesPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaces, err := client.OrgSpaces("foo") + So(err, ShouldBeNil) + + So(len(spaces), ShouldEqual, 1) + So(spaces[0].Guid, ShouldEqual, "b8aff561-175d-45e8-b1e7-67e2aedb03b6") + So(spaces[0].Name, ShouldEqual, "test") + }) +} + +func TestListOrgUsers(t *testing.T) { + Convey("Get Org Users for an org", t, func() { + setup(MockRoute{"GET", "/v2/organizations/foo/users", []string{listOrgPeoplePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + users, err := client.ListOrgUsers("foo") + So(err, ShouldBeNil) + So(len(users), ShouldEqual, 2) + So(users[0].Username, ShouldEqual, "user1") + So(users[1].Username, ShouldEqual, "user2") + }) +} + +func TestListOrgManagers(t *testing.T) { + Convey("Get Org Managers for an org", t, func() { + setup(MockRoute{"GET", "/v2/organizations/foo/managers", []string{listOrgPeoplePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + managers, err := client.ListOrgManagers("foo") + So(err, ShouldBeNil) + So(len(managers), ShouldEqual, 2) + So(managers[0].Username, ShouldEqual, "user1") + So(managers[1].Username, ShouldEqual, "user2") + }) +} + +func TestListOrgAuditors(t *testing.T) { + Convey("Get Org Auditors for an org", t, func() { + setup(MockRoute{"GET", "/v2/organizations/foo/auditors", []string{listOrgPeoplePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + users, err := client.ListOrgAuditors("foo") + So(err, ShouldBeNil) + So(len(users), ShouldEqual, 2) + So(users[0].Username, ShouldEqual, "user1") + So(users[1].Username, ShouldEqual, "user2") + }) +} +func TestListBillingManagers(t *testing.T) { + Convey("Get Billing Manager for an org", t, func() { + setup(MockRoute{"GET", "/v2/organizations/foo/billing_managers", []string{listOrgPeoplePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + managers, err := client.ListOrgBillingManagers("foo") + So(err, ShouldBeNil) + So(len(managers), ShouldEqual, 2) + So(managers[0].Username, ShouldEqual, "user1") + So(managers[1].Username, ShouldEqual, "user2") + }) +} + +func TestOrgSummary(t *testing.T) { + Convey("Get org summary", t, func() { + setup(MockRoute{"GET", "/v2/organizations/06dcedd4-1f24-49a6-adc1-cce9131a1b2c/summary", []string{orgSummaryPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "06dcedd4-1f24-49a6-adc1-cce9131a1b2c", + c: client, + } + summary, err := org.Summary() + So(err, ShouldBeNil) + + So(summary.Guid, ShouldEqual, "06dcedd4-1f24-49a6-adc1-cce9131a1b2c") + So(summary.Name, ShouldEqual, "system") + So(summary.Status, ShouldEqual, "active") + + spaces := summary.Spaces + So(len(spaces), ShouldEqual, 1) + So(spaces[0].Guid, ShouldEqual, "494d8b64-8181-4183-a6d3-6279db8fec6e") + So(spaces[0].Name, ShouldEqual, "test") + So(spaces[0].ServiceCount, ShouldEqual, 1) + So(spaces[0].AppCount, ShouldEqual, 2) + So(spaces[0].MemDevTotal, ShouldEqual, 32) + So(spaces[0].MemProdTotal, ShouldEqual, 64) + }) +} + +func TestOrgQuota(t *testing.T) { + Convey("Get org quota", t, func() { + setup(MockRoute{"GET", "/v2/quota_definitions/a537761f-9d93-4b30-af17-3d73dbca181b", []string{orgQuotaPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + QuotaDefinitionGuid: "a537761f-9d93-4b30-af17-3d73dbca181b", + c: client, + } + orgQuota, err := org.Quota() + So(err, ShouldBeNil) + + So(orgQuota.Guid, ShouldEqual, "a537761f-9d93-4b30-af17-3d73dbca181b") + So(orgQuota.Name, ShouldEqual, "test-2") + So(orgQuota.NonBasicServicesAllowed, ShouldEqual, false) + So(orgQuota.TotalServices, ShouldEqual, 10) + So(orgQuota.TotalRoutes, ShouldEqual, 20) + So(orgQuota.TotalPrivateDomains, ShouldEqual, 30) + So(orgQuota.MemoryLimit, ShouldEqual, 40) + So(orgQuota.TrialDBAllowed, ShouldEqual, true) + So(orgQuota.InstanceMemoryLimit, ShouldEqual, 50) + So(orgQuota.AppInstanceLimit, ShouldEqual, 60) + So(orgQuota.AppTaskLimit, ShouldEqual, 70) + So(orgQuota.TotalServiceKeys, ShouldEqual, 80) + So(orgQuota.TotalReservedRoutePorts, ShouldEqual, 90) + }) +} + +func TestCreateOrg(t *testing.T) { + Convey("Create org", t, func() { + setup(MockRoute{"POST", "/v2/organizations", []string{createOrgPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org, err := client.CreateOrg(OrgRequest{Name: "my-org"}) + So(err, ShouldBeNil) + So(org.Guid, ShouldEqual, "22b3b0a0-6511-47e5-8f7a-93bbd2ff446e") + }) +} + +func TestUpdateOrg(t *testing.T) { + Convey("Update org", t, func() { + setup(MockRoute{"PUT", "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e", []string{createOrgPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org, err := client.UpdateOrg("22b3b0a0-6511-47e5-8f7a-93bbd2ff446e", OrgRequest{Name: "my-org"}) + So(err, ShouldBeNil) + So(org.Guid, ShouldEqual, "22b3b0a0-6511-47e5-8f7a-93bbd2ff446e") + }) +} + +func TestDeleteOrg(t *testing.T) { + Convey("Delete org", t, func() { + setup(MockRoute{"DELETE", "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b", []string{""}, "", 204, "recursive=false&async=false", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteOrg("a537761f-9d93-4b30-af17-3d73dbca181b", false, false) + So(err, ShouldBeNil) + }) +} + +func TestAssociateManager(t *testing.T) { + Convey("Associate manager", t, func() { + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers/user-guid", []string{associateOrgUserPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateManager("user-guid") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateAuditor(t *testing.T) { + Convey("Associate auditor", t, func() { + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors/user-guid", []string{associateOrgUserPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateAuditor("user-guid") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateBillingManager(t *testing.T) { + Convey("Associate billing manager", t, func() { + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/billing_managers/user-guid", []string{associateOrgUserPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateBillingManager("user-guid") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateUser(t *testing.T) { + Convey("Associate user", t, func() { + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/users/user-guid", []string{associateOrgUserPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateUser("user-guid") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateManagerByUsername(t *testing.T) { + Convey("Associate manager by username", t, func() { + expectedBody := `{"username":"user-name"}` + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers", []string{associateOrgUserPayload}, "", 201, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateManagerByUsername("user-name") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateManagerByUsernameAndOrigin(t *testing.T) { + Convey("Associate manager by username and origin", t, func() { + expectedBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers", []string{associateOrgUserPayload}, "", 201, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateManagerByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateAuditorByUsername(t *testing.T) { + Convey("Associate auditor by username", t, func() { + expectedBody := `{"username":"user-name"}` + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors", []string{associateOrgUserPayload}, "", 201, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateAuditorByUsername("user-name") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateAuditorByUsernameAndOrigin(t *testing.T) { + Convey("Associate auditor by username and origin", t, func() { + expectedBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors", []string{associateOrgUserPayload}, "", 201, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateAuditorByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateBillingManagerByUsername(t *testing.T) { + Convey("Associate billing manager by username", t, func() { + expectedBody := `{"username":"user-name"}` + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/billing_managers", []string{associateOrgUserPayload}, "", 201, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateBillingManagerByUsername("user-name") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateBillingManagerByUsernameAndOrigin(t *testing.T) { + Convey("Associate billing manager by username and origin", t, func() { + expectedBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/billing_managers", []string{associateOrgUserPayload}, "", 201, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateBillingManagerByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateUserByUsername(t *testing.T) { + Convey("Associate user by username", t, func() { + expectedBody := `{"username":"user-name"}` + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/users", []string{associateOrgUserPayload}, "", 201, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateUserByUsername("user-name") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateUserByUsernameAndOrigin(t *testing.T) { + Convey("Associate user by username and origin", t, func() { + expectedBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/users", []string{associateOrgUserPayload}, "", 201, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newOrg, err := org.AssociateUserByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestRemoveManager(t *testing.T) { + Convey("Remove manager", t, func() { + setup(MockRoute{"DELETE", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers/user-guid", []string{""}, "", 204, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveManager("user-guid") + So(err, ShouldBeNil) + }) +} + +func TestRemoveAuditor(t *testing.T) { + Convey("Remove auditor", t, func() { + setup(MockRoute{"DELETE", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors/user-guid", []string{""}, "", 204, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveAuditor("user-guid") + So(err, ShouldBeNil) + }) +} + +func TestRemoveBillingManager(t *testing.T) { + Convey("Remove billing manager", t, func() { + setup(MockRoute{"DELETE", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/billing_managers/user-guid", []string{""}, "", 204, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveBillingManager("user-guid") + So(err, ShouldBeNil) + }) +} + +func TestRemoveUser(t *testing.T) { + Convey("Remove user", t, func() { + setup(MockRoute{"DELETE", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/users/user-guid", []string{""}, "", 204, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveUser("user-guid") + So(err, ShouldBeNil) + }) +} + +func TestRemoveManagerByUsername(t *testing.T) { + Convey("Remove manager by username", t, func() { + expectedBody := `{"username":"user-name"}` + setup(MockRoute{"DELETE", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers", []string{""}, "", 204, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveManagerByUsername("user-name") + So(err, ShouldBeNil) + }) +} + +func TestRemoveManagerByUsernameAndOrigin(t *testing.T) { + Convey("Remove manager by username and origin", t, func() { + expectedBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"POST", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers/remove", []string{""}, "", 204, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveManagerByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + }) +} + +func TestRemoveAuditorByUsername(t *testing.T) { + Convey("Remove auditor by username", t, func() { + expectedBody := `{"username":"user-name"}` + setup(MockRoute{"DELETE", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors", []string{""}, "", 204, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveAuditorByUsername("user-name") + So(err, ShouldBeNil) + }) +} +func TestRemoveAuditorByUsernameAndOrigin(t *testing.T) { + Convey("Remove auditor by username", t, func() { + expectedBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"POST", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors/remove", []string{""}, "", 204, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveAuditorByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + }) +} + +func TestRemoveBillingManagerByUsername(t *testing.T) { + Convey("Remove billing manager by username", t, func() { + expectedBody := `{"username":"user-name"}` + setup(MockRoute{"DELETE", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/billing_managers", []string{""}, "", 204, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveBillingManagerByUsername("user-name") + So(err, ShouldBeNil) + }) +} + +func TestRemoveBillingManagerByUsernameAndOrigin(t *testing.T) { + Convey("Remove billing manager by username and origin", t, func() { + expectedBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"POST", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/billing_managers/remove", []string{""}, "", 204, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveBillingManagerByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + }) +} + +func TestRemoveUserByUsername(t *testing.T) { + Convey("Remove user by username", t, func() { + expectedBody := `{"username":"user-name"}` + setup(MockRoute{"DELETE", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/users", []string{""}, "", 204, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveUserByUsername("user-name") + So(err, ShouldBeNil) + }) +} + +func TestRemoveUserByUsernameAndOrigin(t *testing.T) { + Convey("Remove user by username and origin", t, func() { + expectedBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"POST", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/users/remove", []string{""}, "", 204, "", &expectedBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + org := &Org{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = org.RemoveUserByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + }) +} + +func TestListOrgSpaceQuotas(t *testing.T) { + Convey("List Org Space Quotas", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/organizations/06dcedd4-1f24-49a6-adc1-cce9131a1b2c/space_quota_definitions", []string{listSpaceQuotasPayloadPage1}, "", 200, "", nil}, + {"GET", "/v2/space_quota_definitions_page_2", []string{listSpaceQuotasPayloadPage2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaceQuotas, err := client.ListOrgSpaceQuotas("06dcedd4-1f24-49a6-adc1-cce9131a1b2c") + So(err, ShouldBeNil) + + So(len(spaceQuotas), ShouldEqual, 2) + So(spaceQuotas[0].Guid, ShouldEqual, "889aa2ed-a883-4cc0-abe5-804b2503f15d") + So(spaceQuotas[0].Name, ShouldEqual, "test-1") + So(spaceQuotas[0].NonBasicServicesAllowed, ShouldEqual, true) + So(spaceQuotas[0].TotalServices, ShouldEqual, -1) + So(spaceQuotas[0].TotalRoutes, ShouldEqual, 100) + So(spaceQuotas[0].MemoryLimit, ShouldEqual, 102400) + So(spaceQuotas[0].InstanceMemoryLimit, ShouldEqual, -1) + So(spaceQuotas[0].AppInstanceLimit, ShouldEqual, -1) + So(spaceQuotas[0].AppTaskLimit, ShouldEqual, -1) + So(spaceQuotas[0].TotalServiceKeys, ShouldEqual, -1) + So(spaceQuotas[0].TotalReservedRoutePorts, ShouldEqual, -1) + }) +} + +func TestListOrgPrivateDomains(t *testing.T) { + Convey("List Org Space Quotas", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/organizations/06dcedd4-1f24-49a6-adc1-cce9131a1b2c/private_domains", []string{listDomainsPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + privateDomains, err := client.ListOrgPrivateDomains("06dcedd4-1f24-49a6-adc1-cce9131a1b2c") + So(err, ShouldBeNil) + + So(len(privateDomains), ShouldEqual, 4) + + }) +} + +func TestShareOrgPrivateDomain(t *testing.T) { + Convey("Share Org Private Domain", t, func() { + mocks := []MockRoute{ + {"PUT", "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/private_domains/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{sharePrivateDomainPayload}, "", 201, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + domain, err := client.ShareOrgPrivateDomain("3b6f763f-aae1-4177-9b93-f2de6f2a48f2", "3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + So(err, ShouldBeNil) + + So(domain.Guid, ShouldEqual, "3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + + }) +} + +func TestUnshareOrgPrivateDomain(t *testing.T) { + Convey("Unshare Org Private Domain", t, func() { + mocks := []MockRoute{ + {"DELETE", "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/private_domains/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", []string{sharePrivateDomainPayload}, "", 201, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.UnshareOrgPrivateDomain("3b6f763f-aae1-4177-9b93-f2de6f2a48f2", "3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + So(err, ShouldBeNil) + + }) +} + +func TestDefaultIsolationSegmentForOrg(t *testing.T) { + Convey("set Default IsolationSegment", t, func() { + defaultIsolationSegmentPayload := `{"data":{"guid":"3b6f763f-aae1-4177-9b93-f2de6f2a48f2"}}` + mocks := []MockRoute{ + {"PATCH", "/v3/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/relationships/default_isolation_segment", []string{""}, "", 200, "", &defaultIsolationSegmentPayload}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DefaultIsolationSegmentForOrg("3b6f763f-aae1-4177-9b93-f2de6f2a48f2", "3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + So(err, ShouldBeNil) + + }) +} + +func TestResetDefaultIsolationSegmentForOrg(t *testing.T) { + Convey("Reset Default IsolationSegment", t, func() { + resetIsolationSegmentPayload := `{"data":null}` + mocks := []MockRoute{ + {"PATCH", "/v3/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/relationships/default_isolation_segment", []string{""}, "", 200, "", &resetIsolationSegmentPayload}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.ResetDefaultIsolationSegmentForOrg("3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + So(err, ShouldBeNil) + + }) +} diff --git a/third_party/go-cfclient/payloads_test.go b/third_party/go-cfclient/payloads_test.go new file mode 100644 index 000000000000..e1b8ffcd9169 --- /dev/null +++ b/third_party/go-cfclient/payloads_test.go @@ -0,0 +1,8481 @@ +package cfclient + +const listEventsPage1Payload = `{ + "total_results": 4, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/events-2?page=2", + "resources": [ + { + "metadata": { + "guid": "b8ede8e1-afc8-40a1-baae-236a0a77b27b", + "url": "/v2/events/b8ede8e1-afc8-40a1-baae-236a0a77b27b", + "created_at": "2016-06-08T16:41:23Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "type": "name-167", + "actor": "guid-008640fc-d316-4602-9251-c8d09bbdc750", + "actor_type": "name-168", + "actor_name": "name-169", + "actee": "guid-e7790fa4-be2b-4a0f-aa82-c124342b0bb4", + "actee_type": "name-170", + "actee_name": "name-171", + "timestamp": "2016-06-08T16:41:23Z", + "metadata": { + "name-188": "value-188", + "name-189": 189, + "name-190": true + }, + "space_guid": "3a1368e7-e3b7-46af-a98d-57b9c71445e7", + "organization_guid": "86aa12ee-8c4f-4b26-b391-2be6c1730dbc" + } + }, + { + "metadata": { + "guid": "2ccf53a8-d0eb-4807-9bb9-7dd844e65267", + "url": "/v2/events/2ccf53a8-d0eb-4807-9bb9-7dd844e65267", + "created_at": "2016-06-08T16:41:23Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "type": "name-175", + "actor": "guid-52cb38f4-d52d-4201-87e3-8e5650efc8c1", + "actor_type": "name-176", + "actor_name": "name-177", + "actee": "guid-5c4214a1-f295-42ae-bd92-38e7cb8be538", + "actee_type": "name-178", + "actee_name": "name-179", + "timestamp": "2016-06-08T16:41:23Z", + "metadata": { + + }, + "space_guid": "10f0fd9d-dd68-428e-8e93-c00bb8eff0a6", + "organization_guid": "aa3fdaaa-42c8-4141-bc22-9792c37aa62f" + } + }, + { + "metadata": { + "guid": "4f9b1fef-2ce4-4877-85e1-0da9114a92cb", + "url": "/v2/events/4f9b1fef-2ce4-4877-85e1-0da9114a92cb", + "created_at": "2016-06-08T16:41:23Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "type": "name-183", + "actor": "guid-d3be7ed1-1c08-43f6-a20d-5cd9287492e1", + "actor_type": "name-184", + "actor_name": "name-185", + "actee": "guid-9844795f-943d-47ed-a997-2c04ee611f5a", + "actee_type": "name-186", + "actee_name": "name-187", + "timestamp": "2016-06-08T16:41:23Z", + "metadata": { + + }, + "space_guid": "f9ef235c-25df-4aa1-bcb4-15eec6f92146", + "organization_guid": "24a920db-f551-46af-bf73-e1db972f652a" + } + } + ] +}` + +const listEventsPage2Payload = `{ + "total_results": 4, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "4f9b1fef-2ce4-4877-85e1-0da9114a92cb", + "url": "/v2/events/4f9b1fef-2ce4-4877-85e1-0da9114a92cb", + "created_at": "2016-06-08T16:41:23Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "type": "name-183", + "actor": "guid-d3be7ed1-1c08-43f6-a20d-5cd9287492e1", + "actor_type": "name-184", + "actor_name": "name-185", + "actee": "guid-9844795f-943d-47ed-a997-2c04ee611f5a", + "actee_type": "name-186", + "actee_name": "name-187", + "timestamp": "2016-06-08T16:41:23Z", + "metadata": { + + }, + "space_guid": "f9ef235c-25df-4aa1-bcb4-15eec6f92146", + "organization_guid": "24a920db-f551-46af-bf73-e1db972f652a" + } + } + ] +}` + +const totalEventsPayload = `{ + "total_results": 4, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [] +}` + +const listOrgsPayload = `{ +"total_results": 4, +"total_pages": 2, +"prev_url": null, +"next_url": "/v2/organizations?results-per-page=2&page=2", +"resources": [ + { + "metadata": { + "guid": "a537761f-9d93-4b30-af17-3d73dbca181b", + "url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b", + "created_at": "2014-09-24T13:54:53+00:00", + "updated_at": null + }, + "entity": { + "name": "demo", + "billing_enabled": false, + "quota_definition_guid": "183599e0-d535-4559-8675-7b6ddb5cc42d", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/183599e0-d535-4559-8675-7b6ddb5cc42d", + "spaces_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/spaces", + "domains_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/domains", + "private_domains_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/private_domains", + "users_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/users", + "managers_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/managers", + "billing_managers_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/billing_managers", + "auditors_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/auditors", + "app_events_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/app_events", + "space_quota_definitions_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/space_quota_definitions" + } + }, + { + "metadata": { + "guid": "da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "created_at": "2014-09-26T13:36:41+00:00", + "updated_at": null + }, + "entity": { + "name": "test", + "billing_enabled": false, + "quota_definition_guid": "183599e0-d535-4559-8675-7b6ddb5cc42d", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/183599e0-d535-4559-8675-7b6ddb5cc42d", + "spaces_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/spaces", + "domains_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/domains", + "private_domains_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/private_domains", + "users_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/users", + "managers_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/managers", + "billing_managers_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/billing_managers", + "auditors_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/auditors", + "app_events_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/app_events", + "space_quota_definitions_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/space_quota_definitions" + } + } +] +}` + +const listOrgsPayloadPage2 = `{ +"total_results": 4, +"total_pages": 2, +"prev_url": null, +"next_url": null, +"resources": [ + { + "metadata": { + "guid": "a537761f-9d93-4b30-af17-3d73dbca181b", + "url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b", + "created_at": "2014-09-24T13:54:53+00:00", + "updated_at": null + }, + "entity": { + "name": "demo", + "billing_enabled": false, + "quota_definition_guid": "183599e0-d535-4559-8675-7b6ddb5cc42d", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/183599e0-d535-4559-8675-7b6ddb5cc42d", + "spaces_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/spaces", + "domains_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/domains", + "private_domains_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/private_domains", + "users_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/users", + "managers_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/managers", + "billing_managers_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/billing_managers", + "auditors_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/auditors", + "app_events_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/app_events", + "space_quota_definitions_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b/space_quota_definitions" + } + }, + { + "metadata": { + "guid": "da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "created_at": "2014-09-26T13:36:41+00:00", + "updated_at": null + }, + "entity": { + "name": "test", + "billing_enabled": false, + "quota_definition_guid": "183599e0-d535-4559-8675-7b6ddb5cc42d", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/183599e0-d535-4559-8675-7b6ddb5cc42d", + "spaces_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/spaces", + "domains_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/domains", + "private_domains_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/private_domains", + "users_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/users", + "managers_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/managers", + "billing_managers_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/billing_managers", + "auditors_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/auditors", + "app_events_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/app_events", + "space_quota_definitions_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/space_quota_definitions" + } + } +] +}` + +const getOrgByNamePayload = `{ +"total_results": 1, +"total_pages": 1, +"prev_url": null, +"next_url": null, +"resources": [ + { + "metadata": { + "guid": "4156a4a0-6092-40ab-98bf-114051d1561d", + "url": "/v2/organizations/4156a4a0-6092-40ab-98bf-114051d1561d", + "created_at": "2014-09-24T13:54:53+00:00", + "updated_at": null + }, + "entity": { + "name": "demo77", + "billing_enabled": false, + "quota_definition_guid": "183599e0-d535-4559-8675-7b6ddb5cc42d", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/183599e0-d535-4559-8675-7b6ddb5cc42d", + "spaces_url": "/v2/organizations/4156a4a0-6092-40ab-98bf-114051d1561d/spaces", + "domains_url": "/v2/organizations/4156a4a0-6092-40ab-98bf-114051d1561d/domains", + "private_domains_url": "/v2/organizations/4156a4a0-6092-40ab-98bf-114051d1561d/private_domains", + "users_url": "/v2/organizations/4156a4a0-6092-40ab-98bf-114051d1561d/users", + "managers_url": "/v2/organizations/4156a4a0-6092-40ab-98bf-114051d1561d/managers", + "billing_managers_url": "/v2/organizations/4156a4a0-6092-40ab-98bf-114051d1561d/billing_managers", + "auditors_url": "/v2/organizations/4156a4a0-6092-40ab-98bf-114051d1561d/auditors", + "app_events_url": "/v2/organizations/4156a4a0-6092-40ab-98bf-114051d1561d/app_events", + "space_quota_definitions_url": "/v2/organizations/4156a4a0-6092-40ab-98bf-114051d1561d/space_quota_definitions" + } + } +] +}` + +const listOrgPeoplePayload = ` +{ + "total_results": 2, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "uaa-id-231", + "url": "/v2/users/uaa-id-231", + "created_at": "2016-06-08T16:41:34Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "admin": false, + "active": false, + "default_space_guid": null, + "username": "user1", + "spaces_url": "/v2/users/uaa-id-231/spaces", + "organizations_url": "/v2/users/uaa-id-231/organizations", + "managed_organizations_url": "/v2/users/uaa-id-231/managed_organizations", + "billing_managed_organizations_url": "/v2/users/uaa-id-231/billing_managed_organizations", + "audited_organizations_url": "/v2/users/uaa-id-231/audited_organizations", + "managed_spaces_url": "/v2/users/uaa-id-231/managed_spaces", + "audited_spaces_url": "/v2/users/uaa-id-231/audited_spaces" + } + }, + { + "metadata": { + "guid": "uaa-id-232", + "url": "/v2/users/uaa-id-232", + "created_at": "2016-06-08T16:41:34Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "admin": false, + "active": false, + "default_space_guid": null, + "username": "user2", + "spaces_url": "/v2/users/uaa-id-232/spaces", + "organizations_url": "/v2/users/uaa-id-232/organizations", + "managed_organizations_url": "/v2/users/uaa-id-232/managed_organizations", + "billing_managed_organizations_url": "/v2/users/uaa-id-232/billing_managed_organizations", + "audited_organizations_url": "/v2/users/uaa-id-232/audited_organizations", + "managed_spaces_url": "/v2/users/uaa-id-232/managed_spaces", + "audited_spaces_url": "/v2/users/uaa-id-232/audited_spaces" + } + } + ] +} +` + +const orgByGuidPayload = `{ + "metadata": { + "guid": "1c0e6074-777f-450e-9abc-c42f39d9b75b", + "url": "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b", + "created_at": "2016-06-08T16:41:33Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-1716", + "billing_enabled": false, + "quota_definition_guid": "769e777f-92b6-4ba0-9e48-5f77e6293670", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/769e777f-92b6-4ba0-9e48-5f77e6293670", + "spaces_url": "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b/spaces", + "domains_url": "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b/domains", + "private_domains_url": "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b/private_domains", + "users_url": "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b/users", + "managers_url": "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b/managers", + "billing_managers_url": "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b/billing_managers", + "auditors_url": "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b/auditors", + "app_events_url": "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b/app_events", + "space_quota_definitions_url": "/v2/organizations/1c0e6074-777f-450e-9abc-c42f39d9b75b/space_quota_definitions" + } +}` + +const createOrgPayload = `{ + "metadata": { + "guid": "22b3b0a0-6511-47e5-8f7a-93bbd2ff446e", + "url": "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e", + "created_at": "2016-06-08T16:41:33Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "my-org-name", + "billing_enabled": false, + "quota_definition_guid": "b7887f5c-34bb-40c5-9778-577572e4fb2d", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/b7887f5c-34bb-40c5-9778-577572e4fb2d", + "spaces_url": "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e/spaces", + "domains_url": "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e/domains", + "private_domains_url": "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e/private_domains", + "users_url": "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e/users", + "managers_url": "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e/managers", + "billing_managers_url": "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e/billing_managers", + "auditors_url": "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e/auditors", + "app_events_url": "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e/app_events", + "space_quota_definitions_url": "/v2/organizations/22b3b0a0-6511-47e5-8f7a-93bbd2ff446e/space_quota_definitions" + } +}` + +const orgSpacesPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "b8aff561-175d-45e8-b1e7-67e2aedb03b6", + "url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6", + "created_at": "2014-11-12T17:56:22+00:00", + "updated_at": null + }, + "entity": { + "name": "test", + "organization_guid": "0c69f181-2d31-4326-ac33-be2b114a5f99", + "space_quota_definition_guid": null, + "organization_url": "/v2/organizations/0c69f181-2d31-4326-ac33-be2b114a5f99", + "developers_url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6/developers", + "managers_url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6/managers", + "auditors_url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6/auditors", + "apps_url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6/apps", + "routes_url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6/routes", + "domains_url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6/domains", + "service_instances_url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6/service_instances", + "app_events_url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6/app_events", + "events_url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6/events", + "security_groups_url": "/v2/spaces/b8aff561-175d-45e8-b1e7-67e2aedb03b6/security_groups" + } + } + ] +}` + +const orgSummaryPayload = `{ + "guid": "06dcedd4-1f24-49a6-adc1-cce9131a1b2c", + "name": "system", + "status": "active", + "spaces": [ + { + "guid": "494d8b64-8181-4183-a6d3-6279db8fec6e", + "name": "test", + "service_count": 1, + "app_count": 2, + "mem_dev_total": 32, + "mem_prod_total": 64 + } + ] +}` + +const orgQuotaPayload = `{ + "metadata": { + "guid": "a537761f-9d93-4b30-af17-3d73dbca181b", + "url": "/v2/quota_definitions/a537761f-9d93-4b30-af17-3d73dbca181b", + "created_at": "2017-01-18T16:39:10Z", + "updated_at": "2017-01-18T16:46:20Z" + }, + "entity": { + "name": "test-2", + "non_basic_services_allowed": false, + "total_services": 10, + "total_routes": 20, + "total_private_domains": 30, + "memory_limit": 40, + "trial_db_allowed": true, + "instance_memory_limit": 50, + "app_instance_limit": 60, + "app_task_limit": 70, + "total_service_keys": 80, + "total_reserved_route_ports": 90 + } +}` + +const associateOrgUserPayload = `{ + "metadata": { + "guid": "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + "url": "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56", + "created_at": "2016-06-08T16:41:34Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-1735", + "billing_enabled": false, + "quota_definition_guid": "84eed1c7-cc2d-4823-a578-081fef03ba7d", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/84eed1c7-cc2d-4823-a578-081fef03ba7d", + "spaces_url": "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/spaces", + "domains_url": "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/domains", + "private_domains_url": "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/private_domains", + "users_url": "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/users", + "managers_url": "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers", + "billing_managers_url": "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/billing_managers", + "auditors_url": "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors", + "app_events_url": "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/app_events", + "space_quota_definitions_url": "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/space_quota_definitions" + } +}` + +const listOrgQuotasPayloadPage1 = `{ + "total_results": 2, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/quota_definitions_page_2", + "resources": [ + { + "metadata": { + "guid": "6f9d3100-44ab-49e2-a4f8-9d7d67651ae7", + "url": "/v2/quota_definitions/6f9d3100-44ab-49e2-a4f8-9d7d67651ae7", + "created_at": "2017-01-18T16:39:10Z", + "updated_at": "2017-01-18T16:46:20Z" + }, + "entity": { + "name": "test-1", + "non_basic_services_allowed": true, + "total_services": -1, + "total_routes": 100, + "total_private_domains": -1, + "memory_limit": 102400, + "trial_db_allowed": false, + "instance_memory_limit": -1, + "app_instance_limit": -1, + "app_task_limit": -1, + "total_service_keys": -1, + "total_reserved_route_ports": -1 + } + } + ] +}` + +const listOrgQuotasPayloadPage2 = `{ + "total_results": 2, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "a537761f-9d93-4b30-af17-3d73dbca181b", + "url": "/v2/quota_definitions/a537761f-9d93-4b30-af17-3d73dbca181b", + "created_at": "2017-01-18T16:39:10Z", + "updated_at": "2017-01-18T16:46:20Z" + }, + "entity": { + "name": "test-2", + "non_basic_services_allowed": false, + "total_services": 10, + "total_routes": 20, + "total_private_domains": 30, + "memory_limit": 40, + "trial_db_allowed": true, + "instance_memory_limit": 50, + "app_instance_limit": 60, + "app_task_limit": 70, + "total_service_keys": 80, + "total_reserved_route_ports": 90 + } + } + ] +}` + +const emptyResources = `{ + "total_results": 0, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [] +}` + +const listSpacesPayload = `{ + "total_results": 8, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/spacesPage2", + "resources": [ + { + "metadata": { + "guid": "8efd7c5c-d83c-4786-b399-b7bd548839e1", + "url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1", + "created_at": "2014-09-24T13:54:54+00:00", + "updated_at": "2014-09-24T13:54:54+00:00" + }, + "entity": { + "name": "dev", + "organization_guid": "a537761f-9d93-4b30-af17-3d73dbca181b", + "space_quota_definition_guid": null, + "organization_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b", + "developers_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/developers", + "managers_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/managers", + "auditors_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/auditors", + "apps_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/apps", + "routes_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/routes", + "domains_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/domains", + "service_instances_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/service_instances", + "app_events_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/app_events", + "events_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/events", + "security_groups_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/security_groups" + } + }, + { + "metadata": { + "guid": "657b5923-7de0-486a-9928-b4d78ee24931", + "url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931", + "created_at": "2014-09-26T13:37:31+00:00", + "updated_at": "2014-09-26T13:37:31+00:00" + }, + "entity": { + "name": "demo", + "organization_guid": "da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "space_quota_definition_guid": null, + "organization_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "developers_url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931/developers", + "managers_url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931/managers", + "auditors_url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931/auditors", + "apps_url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931/apps", + "routes_url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931/routes", + "domains_url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931/domains", + "service_instances_url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931/service_instances", + "app_events_url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931/app_events", + "events_url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931/events", + "security_groups_url": "/v2/spaces/657b5923-7de0-486a-9928-b4d78ee24931/security_groups" + } + } + ] +}` + +const listSpacesPayloadPage2 = `{ + "total_results": 8, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "9ffd7c5c-d83c-4786-b399-b7bd54883977", + "url": "/v2/spaces/9ffd7c5c-d83c-4786-b399-b7bd54883977", + "created_at": "2014-09-24T13:54:54+00:00", + "updated_at": "2014-09-24T13:54:54+00:00" + }, + "entity": { + "name": "test", + "organization_guid": "a537761f-9d93-4b30-af17-3d73dbca181b", + "space_quota_definition_guid": null, + "organization_url": "/v2/organizations/b737761f-9d93-4b30-af17-3d73dbca18aa", + "developers_url": "/v2/spaces/9ffd7c5c-d83c-4786-b399-b7bd54883977/developers", + "managers_url": "/v2/spaces/9ffd7c5c-d83c-4786-b399-b7bd54883977/managers", + "auditors_url": "/v2/spaces/9ffd7c5c-d83c-4786-b399-b7bd54883977/auditors", + "apps_url": "/v2/spaces/9ffd7c5c-d83c-4786-b399-b7bd54883977/apps", + "routes_url": "/v2/spaces/9ffd7c5c-d83c-4786-b399-b7bd54883977/routes", + "domains_url": "/v2/spaces/9ffd7c5c-d83c-4786-b399-b7bd54883977/domains", + "service_instances_url": "/v2/spaces/9ffd7c5c-d83c-4786-b399-b7bd54883977/service_inst2ances", + "app_events_url": "/v2/spaces/9ffd7c5c-d83c-4786-b399-b7bd54883977/app_events", + "events_url": "/v2/spaces/9ffd7c5c-d83c-4786-b399-b7bd54883977/events", + "security_groups_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/security_groups" + } + }, + { + "metadata": { + "guid": "329b5923-7de0-486a-9928-b4d78ee24982", + "url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982", + "created_at": "2014-09-26T13:37:31+00:00", + "updated_at": "2014-09-26T13:37:31+00:00" + }, + "entity": { + "name": "prod", + "organization_guid": "da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "space_quota_definition_guid": null, + "organization_url": "/v2/organizations/ad0dba14-6064-4f7a-b15a-ff9e677e492b", + "developers_url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982/developers", + "managers_url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982/managers", + "auditors_url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982/auditors", + "apps_url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982/apps", + "routes_url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982/routes", + "domains_url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982/domains", + "service_instances_url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982/service_instances", + "app_events_url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982/app_events", + "events_url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982/events", + "security_groups_url": "/v2/spaces/329b5923-7de0-486a-9928-b4d78ee24982/security_groups" + } + } + ] +}` + +const listSpacePeoplePayload = `{ + "total_results": 2, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "uaa-id-411", + "url": "/v2/users/uaa-id-411", + "created_at": "2016-06-08T16:41:42Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "admin": false, + "active": false, + "default_space_guid": null, + "username": "user1", + "spaces_url": "/v2/users/uaa-id-411/spaces", + "organizations_url": "/v2/users/uaa-id-411/organizations", + "managed_organizations_url": "/v2/users/uaa-id-411/managed_organizations", + "billing_managed_organizations_url": "/v2/users/uaa-id-411/billing_managed_organizations", + "audited_organizations_url": "/v2/users/uaa-id-411/audited_organizations", + "managed_spaces_url": "/v2/users/uaa-id-411/managed_spaces", + "audited_spaces_url": "/v2/users/uaa-id-411/audited_spaces" + } + }, + { + "metadata": { + "guid": "uaa-id-412", + "url": "/v2/users/uaa-id-412", + "created_at": "2016-06-08T16:41:42Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "admin": false, + "active": false, + "default_space_guid": null, + "username": "user2", + "spaces_url": "/v2/users/uaa-id-412/spaces", + "organizations_url": "/v2/users/uaa-id-412/organizations", + "managed_organizations_url": "/v2/users/uaa-id-412/managed_organizations", + "billing_managed_organizations_url": "/v2/users/uaa-id-412/billing_managed_organizations", + "audited_organizations_url": "/v2/users/uaa-id-412/audited_organizations", + "managed_spaces_url": "/v2/users/uaa-id-412/managed_spaces", + "audited_spaces_url": "/v2/users/uaa-id-412/audited_spaces" + } + } + ] +}` + +const listSpaceServiceInstancesPayload = `{ + "total_results": 2, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "9547e9ed-e460-4abe-bda3-7070b9835917", + "url": "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917", + "created_at": "2016-06-08T16:41:41Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-2104", + "credentials": { + "creds-key-60": "creds-val-60" + }, + "service_plan_guid": "fcf57f7f-3c51-49b2-b252-dc24e0f7dcab", + "space_guid": "f858c6b3-f6b1-4ae8-81dd-8e8747657fbe", + "gateway_data": null, + "dashboard_url": null, + "type": "managed_service_instance", + "last_operation": null, + "tags": [ + + ], + "maintenance_info": {}, + "space_url": "/v2/spaces/f858c6b3-f6b1-4ae8-81dd-8e8747657fbe", + "service_plan_url": "/v2/service_plans/fcf57f7f-3c51-49b2-b252-dc24e0f7dcab", + "service_bindings_url": "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/service_bindings", + "service_keys_url": "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/service_keys", + "routes_url": "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/routes", + "shared_from_url": "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/shared_from", + "shared_to_url": "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/shared_to", + "service_instance_parameters_url": "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/parameters" + } + }, + { + "metadata": { + "guid": "07d2f44a-9031-11ec-b909-0242ac120002", + "url": "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002", + "created_at": "2016-07-08T16:41:41Z", + "updated_at": "2016-07-08T16:41:26Z" + }, + "entity": { + "name": "name-2105", + "credentials": { + "creds-key-61": "creds-val-61" + }, + "service_plan_guid": "22b3ae01-280d-41aa-9e97-68d47680003d", + "space_guid": "f858c6b3-f6b1-4ae8-81dd-8e8747657fbe", + "gateway_data": null, + "dashboard_url": null, + "type": "managed_service_instance", + "last_operation": null, + "tags": [ + + ], + "maintenance_info": {}, + "space_url": "/v2/spaces/f858c6b3-f6b1-4ae8-81dd-8e8747657fbe", + "service_plan_url": "/v2/service_plans/22b3ae01-280d-41aa-9e97-68d47680003d", + "service_bindings_url": "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/service_bindings", + "service_keys_url": "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/service_keys", + "routes_url": "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/routes", + "shared_from_url": "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/shared_from", + "shared_to_url": "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/shared_to", + "service_instance_parameters_url": "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/parameters" + } + } + ] +}` + +const spaceByGuidPayload = `{ + "metadata": { + "guid": "8efd7c5c-d83c-4786-b399-b7bd548839e1", + "url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1", + "created_at": "2014-09-24T13:54:54+00:00", + "updated_at": null + }, + "entity": { + "name": "dev", + "organization_guid": "a537761f-9d93-4b30-af17-3d73dbca181b", + "space_quota_definition_guid": null, + "organization_url": "/v2/organizations/a537761f-9d93-4b30-af17-3d73dbca181b", + "developers_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/developers", + "managers_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/managers", + "auditors_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/auditors", + "apps_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/apps", + "routes_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/routes", + "domains_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/domains", + "service_instances_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/service_instances", + "app_events_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/app_events", + "events_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/events", + "security_groups_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/security_groups" + } +}` + +const associateSpaceUserPayload = `{ + "metadata": { + "guid": "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + "url": "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56", + "created_at": "2016-06-08T16:41:34Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-1735", + "organization_guid": "227161e2-667b-483f-9821-77257a38997f", + "space_quota_definition_guid": null, + "allow_ssh": true, + "organization_url": "/v2/organizations/227161e2-667b-483f-9821-77257a38997f", + "developers_url": "/v2/spaces/20e7a265-f50d-4c14-ac7e-42c52f9d9cd7/developers", + "managers_url": "/v2/spaces/20e7a265-f50d-4c14-ac7e-42c52f9d9cd7/managers", + "auditors_url": "/v2/spaces/20e7a265-f50d-4c14-ac7e-42c52f9d9cd7/auditors", + "apps_url": "/v2/spaces/20e7a265-f50d-4c14-ac7e-42c52f9d9cd7/apps", + "routes_url": "/v2/spaces/20e7a265-f50d-4c14-ac7e-42c52f9d9cd7/routes", + "domains_url": "/v2/spaces/20e7a265-f50d-4c14-ac7e-42c52f9d9cd7/domains", + "service_instances_url": "/v2/spaces/20e7a265-f50d-4c14-ac7e-42c52f9d9cd7/service_instances", + "app_events_url": "/v2/spaces/20e7a265-f50d-4c14-ac7e-42c52f9d9cd7/app_events", + "events_url": "/v2/spaces/20e7a265-f50d-4c14-ac7e-42c52f9d9cd7/events", + "security_groups_url": "/v2/spaces/20e7a265-f50d-4c14-ac7e-42c52f9d9cd7/security_groups" + } +}` + +const appSummaryPayload = `{ + "guid": "b5f0d1bd-a3a9-40a4-af1a-312ad26e5379", + "urls": [ + "test-app.local.pcfdev.io" + ], + "routes": [ + { + "guid": "0b44af3e-77e0-4821-abd6-18d8c79309e6", + "host": "test-app", + "port": null, + "path": "", + "domain": { + "guid": "0b183484-45cc-4855-94d4-892f80f20c13", + "name": "local.pcfdev.io" + } + } + ], + "service_count": 1, + "service_names": [ + "test-service" + ], + "running_instances": 1, + "name": "test-app", + "production": false, + "space_guid": "494d8b64-8181-4183-a6d3-6279db8fec6e", + "stack_guid": "67e019a3-322a-407a-96e0-178e95bd0e55", + "buildpack": "ruby_buildpack", + "detected_buildpack": "", + "detected_buildpack_guid": "d5860c89-fb0a-49f4-a8b7-3220ff91c91d", + "environment_json": {}, + "memory": 256, + "instances": 1, + "disk_quota": 512, + "state": "STARTED", + "version": "fa47ec0a-adba-4cc5-b0ee-a8570dc49b3d", + "command": null, + "console": false, + "debug": null, + "staging_task_id": "a21d69a7-0878-4841-ab53-4b515397dc27", + "package_state": "STAGED", + "health_check_type": "port", + "health_check_timeout": null, + "staging_failed_reason": null, + "staging_failed_description": null, + "diego": true, + "docker_image": null, + "package_updated_at": "2017-02-05T12:18:04Z", + "detected_start_command": "rackup -p $PORT", + "enable_ssh": true, + "docker_credentials_json": { + "redacted_message": "[PRIVATE DATA HIDDEN]" + }, + "ports": null +}` + +const spaceSummaryPayload = `{ + "guid": "494d8b64-8181-4183-a6d3-6279db8fec6e", + "name": "test", + "apps": [ + { + "guid": "b5f0d1bd-a3a9-40a4-af1a-312ad26e5379", + "urls": [ + "test-app.local.pcfdev.io" + ], + "routes": [ + { + "guid": "0b44af3e-77e0-4821-abd6-18d8c79309e6", + "host": "test-app", + "port": null, + "path": "", + "domain": { + "guid": "0b183484-45cc-4855-94d4-892f80f20c13", + "name": "local.pcfdev.io" + } + } + ], + "service_count": 1, + "service_names": [ + "test-service" + ], + "running_instances": 1, + "name": "test-app", + "production": false, + "space_guid": "494d8b64-8181-4183-a6d3-6279db8fec6e", + "stack_guid": "67e019a3-322a-407a-96e0-178e95bd0e55", + "buildpack": "ruby_buildpack", + "detected_buildpack": "", + "detected_buildpack_guid": "d5860c89-fb0a-49f4-a8b7-3220ff91c91d", + "environment_json": {}, + "memory": 256, + "instances": 1, + "disk_quota": 512, + "state": "STARTED", + "version": "fa47ec0a-adba-4cc5-b0ee-a8570dc49b3d", + "command": null, + "console": false, + "debug": null, + "staging_task_id": "a21d69a7-0878-4841-ab53-4b515397dc27", + "package_state": "STAGED", + "health_check_type": "port", + "health_check_timeout": null, + "staging_failed_reason": null, + "staging_failed_description": null, + "diego": true, + "docker_image": null, + "package_updated_at": "2017-02-05T12:18:04Z", + "detected_start_command": "rackup -p $PORT", + "enable_ssh": true, + "docker_credentials_json": { + "redacted_message": "[PRIVATE DATA HIDDEN]" + }, + "ports": null + } + ], + "services": [ + { + "guid": "3c5c758c-6b76-46f6-89d5-677909bfc975", + "name": "test-service", + "bound_app_count": 1, + "last_operation": { + "type": "create", + "state": "succeeded", + "description": "", + "updated_at": "2017-02-05T11:56:14Z", + "created_at": "2017-02-05T11:56:14Z" + }, + "dashboard_url": null, + "service_broker_name": "broker-name", + "maintenance_info": { + "version": "1.0.0", + "description": "OS image update.\nExpect downtime." + }, + "service_plan": { + "guid": "25e717d2-59a1-4cd2-a792-04508f816776", + "name": "test-plan", + "maintenance_info": { + "version": "2.0.0", + "description": "Stemcell update.\nExpect downtime." + }, + "service": { + "guid": "84c238f4-3961-4b10-8406-9003374c1f2b", + "label": "test-service", + "provider": null, + "version": null + } + } + } + ] +}` + +const spaceRolesPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "uaa-id-363", + "url": "/v2/users/uaa-id-363", + "created_at": "2016-06-08T16:41:40Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "admin": false, + "active": false, + "default_space_guid": null, + "username": "everything@example.com", + "space_roles": [ + "space_developer", + "space_manager", + "space_auditor" + ], + "spaces_url": "/v2/users/uaa-id-363/spaces", + "organizations_url": "/v2/users/uaa-id-363/organizations", + "managed_organizations_url": "/v2/users/uaa-id-363/managed_organizations", + "billing_managed_organizations_url": "/v2/users/uaa-id-363/billing_managed_organizations", + "audited_organizations_url": "/v2/users/uaa-id-363/audited_organizations", + "managed_spaces_url": "/v2/users/uaa-id-363/managed_spaces", + "audited_spaces_url": "/v2/users/uaa-id-363/audited_spaces" + } + } + ] +}` + +const listV3SpaceRolesBySpaceGUIDPayload = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&space_guids=spaceGUID1" + }, + "last": { + "href": "https://api.example.org/v3/roles?page=2&per_page=2&space_guids=spaceGUID1" + }, + "next": { + "href": "https://api.example.org/v3/rolespage2?page=2&per_page=2&space_guids=spaceGUID1" + }, + "previous": null + }, + "resources": [ + { + "guid": "roleGUID1", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "space_developer", + "relationships": { + "user": { + "data": { + "guid": "userGUID1" + } + }, + "space": { + "data": { + "guid": "spaceGUID1" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID1" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID1" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID1" + } + } + }, + { + "guid": "roleGUID2", + "created_at": "2047-11-10T17:19:12Z", + "updated_at": "2047-11-10T17:19:12Z", + "type": "space_auditor", + "relationships": { + "user": { + "data": { + "guid": "userGUID2" + } + }, + "space": { + "data": { + "guid": "spaceGUID1" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID2" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID2" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID1" + } + } + } + ] +}` + +const listV3SpaceRolesBySpaceGuidPayloadPage2 = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&space_guids=spaceGUID1" + }, + "last": { + "href": "https://api.example.org/v3/rolespage2?page=2&per_page=2&space_guids=spaceGUID1" + }, + "next": null, + "previous": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&space_guids=spaceGUID1" + } + }, + "resources": [ + { + "guid": "roleGUID3", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "space_manager", + "relationships": { + "user": { + "data": { + "guid": "userGUID2" + } + }, + "space": { + "data": { + "guid": "spaceGUID1" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID3" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID2" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID1" + } + } + } + ] +}` + +const listV3SpaceRoleUsersBySpaceGUIDPayload = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&space_guids=spaceGUID1" + }, + "last": { + "href": "https://api.example.org/v3/roles?page=2&per_page=2&include=user&space_guids=spaceGUID1" + }, + "next": { + "href": "https://api.example.org/v3/rolespage2?page=2&per_page=2&include=user&space_guids=spaceGUID1" + }, + "previous": null + }, + "resources": [ + { + "guid": "roleGUID1", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "space_supporter", + "relationships": { + "user": { + "data": { + "guid": "userGUID1" + } + }, + "space": { + "data": { + "guid": "spaceGUID1" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID1" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID1" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID1" + } + } + }, + { + "guid": "roleGUID2", + "created_at": "2047-11-10T17:19:12Z", + "updated_at": "2047-11-10T17:19:12Z", + "type": "space_supporter", + "relationships": { + "user": { + "data": { + "guid": "userGUID2" + } + }, + "space": { + "data": { + "guid": "spaceGUID1" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID2" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID2" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID1" + } + } + } + ], + "included": { + "users": [ + { + "guid": "userGUID1", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user1", + "presentation_name": "user1", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID1" + } + } + }, + { + "guid": "userGUID2", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user2", + "presentation_name": "user2", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID2" + } + } + } + ] + } +}` + +const listV3SpaceRoleUsersBySpaceGUIDPayloadPage2 = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&space_guids=spaceGUID1" + }, + "last": { + "href": "https://api.example.org/v3/rolespage2?page=2&per_page=2&include=user&space_guids=spaceGUID1" + }, + "next": null, + "previous": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&space_guids=spaceGUID1" + } + }, + "resources": [ + { + "guid": "roleGUID3", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "space_supporter", + "relationships": { + "user": { + "data": { + "guid": "userGUID2" + } + }, + "space": { + "data": { + "guid": "spaceGUID1" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID3" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID2" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID1" + } + } + } + ], + "included": { + "users": [ + { + "guid": "userGUID3", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user3", + "presentation_name": "user3", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID3" + } + } + } + ] + } +}` + +const listV3SpaceRolesBySpaceGUIDAndTypePayload = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&space_guids=spaceGUID1&types=space_supporter" + }, + "last": { + "href": "https://api.example.org/v3/roles?page=2&per_page=2&include=user&space_guids=spaceGUID1&types=space_supporter" + }, + "next": { + "href": "https://api.example.org/v3/rolespage2?page=2&per_page=2&include=user&space_guids=spaceGUID1&types=space_supporter" + }, + "previous": null + }, + "resources": [ + { + "guid": "roleGUID1", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "space_supporter", + "relationships": { + "user": { + "data": { + "guid": "userGUID1" + } + }, + "space": { + "data": { + "guid": "spaceGUID1" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID1" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID1" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID1" + } + } + }, + { + "guid": "roleGUID2", + "created_at": "2047-11-10T17:19:12Z", + "updated_at": "2047-11-10T17:19:12Z", + "type": "space_supporter", + "relationships": { + "user": { + "data": { + "guid": "userGUID2" + } + }, + "space": { + "data": { + "guid": "spaceGUID1" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID2" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID2" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID1" + } + } + } + ], + "included": { + "users": [ + { + "guid": "userGUID1", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user1", + "presentation_name": "user1", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID1" + } + } + }, + { + "guid": "userGUID2", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user2", + "presentation_name": "user2", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID2" + } + } + } + ] + } +}` + +const listV3SpaceRolesBySpaceGuidAndTypePayloadPage2 = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&space_guids=spaceGUID1&types=space_supporter" + }, + "last": { + "href": "https://api.example.org/v3/rolespage2?page=2&per_page=2&include=user&space_guids=spaceGUID1&types=space_supporter" + }, + "next": null, + "previous": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&space_guids=spaceGUID1&types=space_supporter" + } + }, + "resources": [ + { + "guid": "roleGUID3", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "space_supporter", + "relationships": { + "user": { + "data": { + "guid": "userGUID2" + } + }, + "space": { + "data": { + "guid": "spaceGUID1" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID3" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID2" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID1" + } + } + } + ], + "included": { + "users": [ + { + "guid": "userGUID3", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user3", + "presentation_name": "user3", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID3" + } + } + } + ] + } +}` + +const listV3OrganizationRolesByOrganizationGUIDPayload = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&organization_guids=orgGUID1" + }, + "last": { + "href": "https://api.example.org/v3/roles?page=2&per_page=2&include=user&organization_guids=orgGUID1" + }, + "next": { + "href": "https://api.example.org/v3/rolespage2?page=2&per_page=2&include=user&organization_guids=orgGUID1" + }, + "previous": null + }, + "resources": [ + { + "guid": "roleGUID1", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "organization_auditor", + "relationships": { + "user": { + "data": { + "guid": "userGUID1" + } + }, + "space": { + "data": null + }, + "organization": { + "data": { + "guid": "orgGUID1" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID1" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID1" + }, + "org": { + "href": "https://api.example.org/v3/organization/orgGUID1" + } + } + }, + { + "guid": "roleGUID2", + "created_at": "2047-11-10T17:19:12Z", + "updated_at": "2047-11-10T17:19:12Z", + "type": "organization_auditor", + "relationships": { + "user": { + "data": { + "guid": "userGUID2" + } + }, + "space": { + "data": null + }, + "organization": { + "data": { + "guid": "orgGUID1" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID2" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID2" + }, + "organization": { + "href": "https://api.example.org/v3/organization/orgGUID1" + } + } + } + ], + "included": { + "users": [ + { + "guid": "userGUID1", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user1", + "presentation_name": "user1", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID1" + } + } + }, + { + "guid": "userGUID2", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user2", + "presentation_name": "user2", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID2" + } + } + } + ] + } +}` + +const listV3OrganizationRolesByOrganizationGuidPayloadPage2 = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&organiziation_guids=orgGUID1" + }, + "last": { + "href": "https://api.example.org/v3/rolespage2?page=2&per_page=2&include=user&organiziation_guids=orgGUID1" + }, + "next": null, + "previous": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&organiziation_guids=orgGUID1" + } + }, + "resources": [ + { + "guid": "roleGUID3", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "organization_auditor", + "relationships": { + "user": { + "data": { + "guid": "userGUID2" + } + }, + "space": { + "data": null + }, + "organization": { + "data": { + "guid": "spaceGUID1" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID3" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID2" + }, + "organization": { + "href": "https://api.example.org/v3/organization/orgGUID1" + } + } + } + ], + "included": { + "users": [ + { + "guid": "userGUID3", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user3", + "presentation_name": "user3", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID3" + } + } + } + ] + } +}` + +const listV3OrganizationRolesByOrganizationGUIDAndTypePayload = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&organization_guids=orgGUID1&types=organization_auditor" + }, + "last": { + "href": "https://api.example.org/v3/roles?page=2&per_page=2&include=user&organization_guids=orgGUID1&types=organization_auditor" + }, + "next": { + "href": "https://api.example.org/v3/rolespage2?page=2&per_page=2&include=user&organization_guids=orgGUID1&types=organization_auditor" + }, + "previous": null + }, + "resources": [ + { + "guid": "roleGUID1", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "organization_auditor", + "relationships": { + "user": { + "data": { + "guid": "userGUID1" + } + }, + "space": { + "data": null + }, + "organization": { + "data": { + "guid": "orgGUID1" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID1" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID1" + }, + "org": { + "href": "https://api.example.org/v3/organization/orgGUID1" + } + } + }, + { + "guid": "roleGUID2", + "created_at": "2047-11-10T17:19:12Z", + "updated_at": "2047-11-10T17:19:12Z", + "type": "organization_auditor", + "relationships": { + "user": { + "data": { + "guid": "userGUID2" + } + }, + "space": { + "data": null + }, + "organization": { + "data": { + "guid": "orgGUID1" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID2" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID2" + }, + "organization": { + "href": "https://api.example.org/v3/organization/orgGUID1" + } + } + } + ], + "included": { + "users": [ + { + "guid": "userGUID1", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user1", + "presentation_name": "user1", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID1" + } + } + }, + { + "guid": "userGUID2", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user2", + "presentation_name": "user2", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID2" + } + } + } + ] + } +}` + +const listV3OrganizationRolesByOrganizationGuidAndTypePayloadPage2 = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&organiziation_guids=orgGUID1&types=organization_auditor" + }, + "last": { + "href": "https://api.example.org/v3/rolespage2?page=2&per_page=2&include=user&organiziation_guids=orgGUID1&types=organization_auditor" + }, + "next": null, + "previous": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&include=user&organiziation_guids=orgGUID1&types=organization_auditor" + } + }, + "resources": [ + { + "guid": "roleGUID3", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "organization_auditor", + "relationships": { + "user": { + "data": { + "guid": "userGUID2" + } + }, + "space": { + "data": null + }, + "organization": { + "data": { + "guid": "spaceGUID1" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID3" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID2" + }, + "organization": { + "href": "https://api.example.org/v3/organization/orgGUID1" + } + } + } + ], + "included": { + "users": [ + { + "guid": "userGUID3", + "created_at": "2022-05-25T23:57:45Z", + "updated_at": "2022-05-25T23:57:45Z", + "username": "user3", + "presentation_name": "user3", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/userGUID3" + } + } + } + ] + } +}` + +const listV3SpaceRolesByUserGuidPayload = `{ + "pagination": { + "total_results": 2, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=2&user_guids=userGUID1" + }, + "last": { + "href": "https://api.example.org/v3/roles?page=2&per_page=2&user_guids=userGUID1" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "roleGUID1", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "space_developer", + "relationships": { + "user": { + "data": { + "guid": "userGUID1" + } + }, + "space": { + "data": { + "guid": "spaceGUID1" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID1" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID1" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID1" + } + } + }, + { + "guid": "roleGUID4", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "space_manager", + "relationships": { + "user": { + "data": { + "guid": "userGUID1" + } + }, + "space": { + "data": { + "guid": "spaceGUID2" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID4" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID1" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID2" + } + } + } + ] +}` + +const listV3spaceRolesBySpaceAndUserGuidPayload = `{ + "pagination": { + "total_results": 1, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/roles?page=1&per_page=1&space_guids=spaceGUID2&user_guids=userGUID1" + }, + "last": { + "href": "https://api.example.org/v3/roles?page=1&per_page=1&space_guids=spaceGUID2&user_guids=userGUID1" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "roleGUID4", + "created_at": "2019-10-10T17:19:12Z", + "updated_at": "2019-10-10T17:19:12Z", + "type": "space_manager", + "relationships": { + "user": { + "data": { + "guid": "userGUID1" + } + }, + "space": { + "data": { + "guid": "spaceGUID2" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/roleGUID4" + }, + "user": { + "href": "https://api.example.org/v3/users/userGUID1" + }, + "space": { + "href": "https://api.example.org/v3/spaces/spaceGUID2" + } + } + } + ] +}` + +const spaceQuotaPayload = `{ + "metadata": { + "guid": "9ffd7c5c-d83c-4786-b399-b7bd54883977", + "url": "/v2/space_quota_definitions/9ffd7c5c-d83c-4786-b399-b7bd54883977", + "created_at": "2017-02-04T18:11:49Z", + "updated_at": "2017-02-04T18:11:49Z" + }, + "entity": { + "name": "test-2", + "organization_guid": "06dcedd4-1f24-49a6-adc1-cce9131a1b2c", + "non_basic_services_allowed": false, + "total_services": 10, + "total_routes": 20, + "memory_limit": 30, + "instance_memory_limit": 40, + "app_instance_limit": 50, + "app_task_limit": 60, + "total_service_keys": 70, + "total_reserved_route_ports": 80, + "organization_url": "/v2/organizations/06dcedd4-1f24-49a6-adc1-cce9131a1b2c", + "spaces_url": "/v2/space_quota_definitions/9ffd7c5c-d83c-4786-b399-b7bd54883977/spaces" + } +}` + +const listSpaceQuotasPayloadPage1 = `{ + "total_results": 2, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/space_quota_definitions_page_2", + "resources": [ + { + "metadata": { + "guid": "889aa2ed-a883-4cc0-abe5-804b2503f15d", + "url": "/v2/space_quota_definitions/889aa2ed-a883-4cc0-abe5-804b2503f15d", + "created_at": "2017-02-04T18:11:49Z", + "updated_at": "2017-02-04T18:11:49Z" + }, + "entity": { + "name": "test-1", + "organization_guid": "06dcedd4-1f24-49a6-adc1-cce9131a1b2c", + "non_basic_services_allowed": true, + "total_services": -1, + "total_routes": 100, + "memory_limit": 102400, + "instance_memory_limit": -1, + "app_instance_limit": -1, + "app_task_limit": -1, + "total_service_keys": -1, + "total_reserved_route_ports": -1, + "organization_url": "/v2/organizations/06dcedd4-1f24-49a6-adc1-cce9131a1b2c", + "spaces_url": "/v2/space_quota_definitions/889aa2ed-a883-4cc0-abe5-804b2503f15d/spaces" + } + } + ] +}` + +const listSpaceQuotasPayloadPage2 = `{ + "total_results": 2, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "9ffd7c5c-d83c-4786-b399-b7bd54883977", + "url": "/v2/space_quota_definitions/9ffd7c5c-d83c-4786-b399-b7bd54883977", + "created_at": "2017-02-04T18:11:49Z", + "updated_at": "2017-02-04T18:11:49Z" + }, + "entity": { + "name": "test-2", + "organization_guid": "06dcedd4-1f24-49a6-adc1-cce9131a1b2c", + "non_basic_services_allowed": false, + "total_services": 10, + "total_routes": 20, + "memory_limit": 30, + "instance_memory_limit": 40, + "app_instance_limit": 50, + "app_task_limit": 60, + "total_service_keys": 70, + "total_reserved_route_ports": 80, + "organization_url": "/v2/organizations/06dcedd4-1f24-49a6-adc1-cce9131a1b2c", + "spaces_url": "/v2/space_quota_definitions/9ffd7c5c-d83c-4786-b399-b7bd54883977/spaces" + } + } + ] +}` + +const listSecGroupsPayload = `{ + "total_results": 28, + "total_pages": 1, + "prev_url": null, + "next_url": "/v2/security_groupsPage2", + "resources": [ + { + "metadata": { + "guid": "af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c", + "url": "/v2/security_groups/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c", + "created_at": "2015-12-04T11:15:55Z", + "updated_at": null + }, + "entity": { + "name": "secgroup-test", + "rules": [ + { + "destination": "1.1.1.1", + "ports": "443,4443", + "protocol": "tcp" + }, + { + "destination": "1.2.3.4", + "ports": "1111", + "protocol": "udp" + } + ], + "running_default": true, + "staging_default": true, + "spaces_url": "/v2/security_groups/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/spaces", + "spaces": [] + } + } + ] +}` + +const listSecGroupsPayloadPage2 = `{ + "total_results": 28, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "f9ad202b-76dd-44ec-b7c2-fd2417a561e8", + "url": "/v2/security_groups/f9ad202b-76dd-44ec-b7c2-fd2417a561e8", + "created_at": "2015-12-04T11:15:55Z", + "updated_at": null + }, + "entity": { + "name": "secgroup-test2", + "rules": [ + { + "destination": "2.2.2.2", + "ports": "2222", + "protocol": "udp" + }, + { + "destination": "4.3.2.1", + "ports": "443,4443", + "protocol": "tcp" + } + ], + "running_default": false, + "staging_default": false, + "spaces_url": "/v2/security_groups/f9ad202b-76dd-44ec-b7c2-fd2417a561e8/spaces", + "spaces": [ + { + "metadata": { + "guid": "e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4", + "url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4", + "created_at": "2014-10-27T10:49:37Z", + "updated_at": "2015-01-21T15:30:52Z" + }, + "entity": { + "name": "space-test", + "organization_guid": "82338ba1-bc08-4576-aad1-9a5b4693b386", + "space_quota_definition_guid": null, + "allow_ssh": true, + "organization_url": "/v2/organizations/82338ba1-bc08-4576-aad1-9a5b4693b386", + "developers_url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4/developers", + "managers_url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4/managers", + "auditors_url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4/auditors", + "apps_url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4/apps", + "routes_url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4/routes", + "domains_url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4/domains", + "service_instances_url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4/service_instances", + "app_events_url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4/app_events", + "events_url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4/events", + "security_groups_url": "/v2/spaces/e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4/security_groups" + } + }, + { + "metadata": { + "guid": "a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333", + "url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333", + "created_at": "2014-10-27T10:49:37Z", + "updated_at": "2015-01-21T15:30:52Z" + }, + "entity": { + "name": "space-test2", + "organization_guid": "82338ba1-bc08-4576-aad1-9a5b4693b386", + "space_quota_definition_guid": null, + "allow_ssh": true, + "organization_url": "/v2/organizations/82338ba1-bc08-4576-aad1-9a5b4693b386", + "developers_url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333/developers", + "managers_url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333/managers", + "auditors_url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333/auditors", + "apps_url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333/apps", + "routes_url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333/routes", + "domains_url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333/domains", + "service_instances_url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333/service_instances", + "app_events_url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333/app_events", + "events_url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333/events", + "security_groups_url": "/v2/spaces/a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333/security_groups" + } + }, + { + "metadata": { + "guid": "c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1", + "url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1", + "created_at": "2014-10-27T10:49:37Z", + "updated_at": "2015-01-21T15:30:52Z" + }, + "entity": { + "name": "space-test3", + "organization_guid": "82338ba1-bc08-4576-aad1-9a5b4693b386", + "space_quota_definition_guid": null, + "allow_ssh": true, + "organization_url": "/v2/organizations/82338ba1-bc08-4576-aad1-9a5b4693b386", + "developers_url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1/developers", + "managers_url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1/managers", + "auditors_url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1/auditors", + "apps_url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1/apps", + "routes_url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1/routes", + "domains_url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1/domains", + "service_instances_url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1/service_instances", + "app_events_url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1/app_events", + "events_url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1/events", + "security_groups_url": "/v2/spaces/c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1/security_groups" + } + } + ] + } + } + ] +}` + +const listRunningSecGroupsPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "3014fb5b-cb2c-4ac5-952c-e3a7e04ab028", + "url": "/v2/config/running_security_groups/3014fb5b-cb2c-4ac5-952c-e3a7e04ab028", + "created_at": "2016-06-08T16:41:21Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-6", + "rules": [ + { + "protocol": "udp", + "ports": "8080", + "destination": "198.41.191.47/1" + } + ], + "running_default": true, + "staging_default": false + } + } + ] +}` + +const listStagingSecGroupsPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "611bd883-4b93-403f-af92-3283de22e3f0", + "url": "/v2/config/staging_security_groups/611bd883-4b93-403f-af92-3283de22e3f0", + "created_at": "2016-06-08T16:41:27Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-1372", + "rules": [ + { + "protocol": "udp", + "ports": "8080", + "destination": "198.41.191.47/1" + } + ], + "running_default": false, + "staging_default": true + } + } + ] +}` + +const listV3SecurityGroupsPayload = `{ + "pagination": { + "total_results": 2, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/security_groups?page=1&per_page=50" + }, + "last": { + "href": "https://api.example.org/v3/security_groups?page=1&per_page=50" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "guid-1", + "name": "my-group1", + "globally_enabled": { + "running": true, + "staging": false + }, + "rules": [ + { + "protocol": "tcp", + "destination": "1.2.3.4/10", + "ports": "443,80,8080" + }, + { + "protocol": "icmp", + "destination": "1.2.3.4/12", + "type": 8, + "code": 0, + "description": "test-desc-1" + } + ], + "relationships": { + "staging_spaces": { + "data": [ + { "guid": "space-guid-1" }, + { "guid": "space-guid-2" } + ] + }, + "running_spaces": { + "data": [] + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/security_groups/guid-1" + } + } + }, + { + "guid": "guid-2", + "name": "my-group2", + "globally_enabled": { + "running": false, + "staging": true + }, + "rules": [ + { + "protocol": "tcp", + "destination": "1.2.3.4/14", + "ports": "443,80,8080" + }, + { + "protocol": "icmp", + "destination": "1.2.3.4/16", + "type": 5, + "code": 0, + "description": "test-desc-2" + } + ], + "relationships": { + "staging_spaces": { + "data": [ + { "guid": "space-guid-3" }, + { "guid": "space-guid-4" } + ] + }, + "running_spaces": { + "data": [ + { "guid": "space-guid-5" }, + { "guid": "space-guid-6" } + ] + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/security_groups/guid-2" + } + } + } + ] +}` + +const listV3SecurityGroupsByGuidPayload = `{ + "pagination": { + "total_results": 1, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/security_groups?page=1&per_page=50" + }, + "last": { + "href": "https://api.example.org/v3/security_groups?page=1&per_page=50" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "guid-1", + "name": "my-group1", + "globally_enabled": { + "running": true, + "staging": false + }, + "rules": [ + { + "protocol": "tcp", + "destination": "1.2.3.4/10", + "ports": "443,80,8080" + }, + { + "protocol": "icmp", + "destination": "1.2.3.4/12", + "type": 8, + "code": 0, + "description": "test-desc-1" + } + ], + "relationships": { + "staging_spaces": { + "data": [ + { "guid": "space-guid-1" }, + { "guid": "space-guid-2" } + ] + }, + "running_spaces": { + "data": [] + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/security_groups/guid-1" + } + } + } + ] +}` + +const genericV3SecurityGroupPayload = `{ + "guid": "guid-1", + "name": "my-sec-group", + "globally_enabled": { + "running": true, + "staging": false + }, + "rules": [ + { + "protocol": "tcp", + "destination": "10.10.10.0/24", + "ports": "443,80,8080" + }, + { + "protocol": "icmp", + "destination": "10.10.11.0/24", + "type": 8, + "code": 0, + "description": "Allow ping requests to private services" + } + ], + "relationships": { + "staging_spaces": { + "data": [] + }, + "running_spaces": { + "data": [ + { "guid": "space-guid-1" }, + { "guid": "space-guid-2" } + ] + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/security_groups/guid-1" + } + } +}` + +const listAppsPayload = `{ + "total_results": 28, + "total_pages": 1, + "prev_url": null, + "next_url": "/v2/appsPage2", + "resources": [ + { + "metadata": { + "guid": "af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c", + "url": "/v2/apps/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c", + "created_at": "2014-10-10T21:03:13+00:00", + "updated_at": "2014-11-10T14:07:31+00:00" + }, + "entity": { + "name": "app-test", + "production": false, + "space_guid": "8efd7c5c-d83c-4786-b399-b7bd548839e1", + "stack_guid": "2c531037-68a2-4e2c-a9e0-71f9d0abf0d4", + "buildpack": "https://github.com/cloudfoundry/buildpack-go.git", + "detected_buildpack": "", + "detected_buildpack_guid": "0d22f6a1-76c5-417f-ac6c-d9d21463ecbc", + "environment_json": { + "FOOBAR": "QUX" + }, + "memory": 256, + "instances": 1, + "disk_quota": 1024, + "state": "STARTED", + "version": "97ef1272-9eb6-4839-9df1-5ed4f55b5c45", + "command": null, + "console": false, + "debug": null, + "staging_task_id": "5879c8d06a10491a879734162000def8", + "package_state": "PENDING", + "health_check_http_endpoint": null, + "health_check_type": "port", + "health_check_timeout": null, + "staging_failed_reason": null, + "staging_failed_description": null, + "diego": true, + "docker_image": null, + "package_updated_at": "2014-11-10T14:08:50+00:00", + "detected_start_command": "app-launching-service-broker", + "enable_ssh": true, + "docker_credentials_json": { + "redacted_message": "[PRIVATE DATA HIDDEN]" + }, + "ports": [ + 8080 + ], + "space_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1", + "stack_url": "/v2/stacks/2c531037-68a2-4e2c-a9e0-71f9d0abf0d4", + "events_url": "/v2/apps/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/events", + "service_bindings_url": "/v2/apps/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/service_bindings", + "routes_url": "/v2/apps/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/routes" + } + } + ] +}` + +const listAppsPayloadPage2 = `{ + "total_results": 28, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "f9ad202b-76dd-44ec-b7c2-fd2417a561e8", + "url": "/v2/apps/f9ad202b-76dd-44ec-b7c2-fd2417a561e8", + "created_at": "2014-10-10T21:03:13+00:00", + "updated_at": "2014-11-10T14:07:31+00:00" + }, + "entity": { + "name": "app-test2", + "production": false, + "space_guid": "8efd7c5c-d83c-4786-b399-b7bd548839e1", + "stack_guid": "2c531037-68a2-4e2c-a9e0-71f9d0abf0d4", + "buildpack": "https://github.com/cloudfoundry/buildpack-go.git", + "detected_buildpack": null, + "environment_json": { + "FOOBAR": "QUX" + }, + "memory": 256, + "instances": 1, + "disk_quota": 1024, + "state": "STARTED", + "version": "97ef1272-9eb6-4839-9df1-5ed4f55b5c45", + "command": null, + "console": false, + "debug": null, + "staging_task_id": "5879c8d06a10491a879734162000def8", + "package_state": "PENDING", + "health_check_timeout": null, + "staging_failed_reason": null, + "docker_image": null, + "package_updated_at": "2014-11-10T14:08:50+00:00", + "detected_start_command": "app-launching-service-broker", + "space_url": "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1", + "stack_url": "/v2/stacks/2c531037-68a2-4e2c-a9e0-71f9d0abf0d4", + "events_url": "/v2/apps/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/events", + "service_bindings_url": "/v2/apps/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/service_bindings", + "routes_url": "/v2/apps/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/routes" + } + } + ] +}` + +const appPayload = `{ + "metadata": { + "guid": "9902530c-c634-4864-a189-71d763cb12e2", + "url": "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2", + "created_at": "2014-11-07T23:11:39+00:00", + "updated_at": "2014-11-07T23:12:03+00:00" + }, + "entity": { + "name": "test-env", + "production": false, + "space_guid": "a72fa1e8-c694-47b3-85f2-55f61fd00d73", + "stack_guid": "2c531037-68a2-4e2c-a9e0-71f9d0abf0d4", + "buildpack": null, + "detected_buildpack": "Ruby", + "environment_json": {}, + "memory": 256, + "instances": 1, + "disk_quota": 1024, + "state": "STARTED", + "version": "0d2f5607-ab6a-4abd-91fe-222cde1ea0f8", + "command": null, + "console": false, + "debug": null, + "staging_task_id": "46267d4a98ae4f4390aed29975453d60", + "package_state": "STAGED", + "health_check_timeout": null, + "staging_failed_reason": null, + "docker_image": null, + "package_updated_at": "2014-11-07T23:12:58+00:00", + "detected_start_command": "rackup -p $PORT", + "space_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73", + "stack_url": "/v2/stacks/2c531037-68a2-4e2c-a9e0-71f9d0abf0d4", + "events_url": "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/events", + "service_bindings_url": "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/service_bindings", + "routes_url": "/v2/apps/9902530c-c634-4864-a189-71d763cb12e2/routes" + } +}` + +const appEnvPayload = `{ + "staging_env_json": { + "STAGING_ENV": "staging_value" + }, + "running_env_json": { + "RUNNING_ENV": "running_value" + }, + "environment_json": { + "env_var": "env_val" + }, + "system_env_json": { + "VCAP_SERVICES": { + "abc": 123 + } + }, + "application_env_json": { + "VCAP_APPLICATION": { + "limits": { + "fds": 16384, + "mem": 1024, + "disk": 1024 + }, + "application_name": "name-2245", + "application_uris": [ + + ], + "name": "name-2245", + "space_name": "name-2246", + "space_id": "3309d44f-78ae-4058-99e1-c50469d1e043", + "uris": [ + + ], + "users": null, + "application_id": "a7c47787-a982-467c-95d7-9ab17cbcc918", + "version": "ed59723c-d691-4d4f-ac5b-f174266c988f", + "application_version": "ed59723c-d691-4d4f-ac5b-f174266c988f" + } + } +}` + +const appPayloadWithEnvironment = `{ + "metadata": { + }, + "entity": { + "environment_json": {"string": "string", "int": 1} + } +}` + +const appInstancePayload = `{ + "0": { + "state": "RUNNING", + "since": 1455210430.5104606, + "debug_ip": null, + "debug_port": null, + "console_ip": null, + "console_port": null + }, + "1": { + "state": "RUNNING", + "since": 1455210430.3912115, + "debug_ip": null, + "debug_port": null, + "console_ip": null, + "console_port": null + } +}` + +const appInstanceUnhealthyPayload = `{ + "0": { + "state": "RUNNING", + "since": 1455210430.5104606, + "debug_ip": null, + "debug_port": null, + "console_ip": null, + "console_port": null + }, + "1": { + "state": "STARTING", + "since": 1455210430.3912115, + "debug_ip": null, + "debug_port": null, + "console_ip": null, + "console_port": null + } +}` + +const appStatsPayload = `{ + "0": { + "state": "RUNNING", + "stats": { + "name": "example-app", + "uris": [ + "example-app.example.com", + "example-app-route2.example.com" + ], + "host": "192.168.1.100", + "port": 61297, + "uptime": 411118, + "mem_quota": 536870912, + "disk_quota": 1073741824, + "fds_quota": 16384, + "usage": { + "time": "2016-09-17 15:46:17 +0000", + "cpu": 0.36580239597146486, + "mem": 518123520, + "disk": 151150592 + } + } + }, + "1": { + "state": "RUNNING", + "stats": { + "name": "example-app", + "uris": [ + "example-app.example.com", + "example-app-route2.example.com" + ], + "host": "192.168.1.101", + "port": 61388, + "uptime": 419568, + "mem_quota": 536870912, + "disk_quota": 1073741824, + "fds_quota": 16384, + "usage": { + "time": "2016-09-17T15:46:17Z", + "cpu": 0.33857742931636664, + "mem": 530731008, + "disk": 151150592 + } + } + }, + "2": { + "state": "RUNNING", + "stats": { + "name": "example-app", + "uris": [ + "example-app.example.com", + "example-app-route2.example.com" + ], + "host": "192.168.1.102", + "port": 61389, + "uptime": 419568, + "mem_quota": 536870912, + "disk_quota": 1073741824, + "fds_quota": 16384, + "usage": { + "time": "2017-04-06T20:32:19.273294439Z", + "cpu": 0.33857742931636664, + "mem": 530731008, + "disk": 151150592 + } + } + }, + "3": { + "state": "RUNNING", + "stats": { + "name": "example-app", + "uris": [ + "example-app.example.com", + "example-app-route2.example.com" + ], + "host": "192.168.1.102", + "port": 61389, + "uptime": 419568, + "mem_quota": 536870912, + "disk_quota": 1073741824, + "fds_quota": 16384, + "usage": { + "time": "2017-04-12 15:27:44 UTC", + "cpu": 0.33857742931636664, + "mem": 530731008, + "disk": 151150592 + } + } + } +}` + +const appRoutesPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "311d34d1-c045-4853-845f-05132377ad7d", + "url": "/v2/routes/311d34d1-c045-4853-845f-05132377ad7d", + "created_at": "2016-06-08T16:41:44Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "host": "host-36", + "path": "/foo", + "domain_guid": "40a499f7-198a-4289-9aa2-605ba43f92ee", + "space_guid": "c7c0dd06-b078-43d7-adcb-3974cd785fdd", + "service_instance_guid": null, + "port": null, + "domain_url": "/v2/private_domains/40a499f7-198a-4289-9aa2-605ba43f92ee", + "space_url": "/v2/spaces/c7c0dd06-b078-43d7-adcb-3974cd785fdd", + "apps_url": "/v2/routes/311d34d1-c045-4853-845f-05132377ad7d/apps", + "route_mappings_url": "/v2/routes/311d34d1-c045-4853-845f-05132377ad7d/route_mappings" + } + } + ] +}` + +const spacePayload = `{ + "metadata": { + "guid": "a72fa1e8-c694-47b3-85f2-55f61fd00d73", + "url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73", + "created_at": "2014-11-03T16:47:24+00:00", + "updated_at": null + }, + "entity": { + "name": "test-space", + "organization_guid": "da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "space_quota_definition_guid": null, + "organization_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "developers_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73/developers", + "managers_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73/managers", + "auditors_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73/auditors", + "apps_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73/apps", + "routes_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73/routes", + "domains_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73/domains", + "service_instances_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73/service_instances", + "app_events_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73/app_events", + "events_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73/events", + "security_groups_url": "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73/security_groups" + } +}` + +const spaceServiceOfferingsPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "6ec97e21-e879-4f72-9a80-8ec550ffec30", + "url": "/v2/services/6ec97e21-e879-4f72-9a80-8ec550ffec30", + "created_at": "2017-10-03T23:47:16Z", + "updated_at": "2017-10-10T20:53:28Z" + }, + "entity": { + "label": "cool-service", + "provider": null, + "url": null, + "description": "Cool service for CF", + "long_description": null, + "version": null, + "info_url": null, + "active": 1, + "bindable": 1, + "unique_id": "beb05948-0fa8-48bf-bfb2-7b09e6687d37", + "extra": "{\"displayName\":\"Super cool service\",\"longDescription\":\"Very cool service.\",\"documentationUrl\":\"https://readthedocs.org\"}", + "tags": [ + "cool" + ], + "requires": [ + + ], + "documentation_url": null, + "service_broker_guid": "6b3da2f0-c530-4f2b-8fd2-7cd68a21e907", + "plan_updateable": 1, + "service_plans_url": "/v2/services/6ec97e21-e879-4f72-9a80-8ec550ffec30/service_plans" + } + } + ] +}` + +const orgPayload = `{ + "metadata": { + "guid": "da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2", + "created_at": "2014-09-26T13:36:41+00:00", + "updated_at": null + }, + "entity": { + "name": "test-org", + "billing_enabled": false, + "quota_definition_guid": "183599e0-d535-4559-8675-7b6ddb5cc42d", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/183599e0-d535-4559-8675-7b6ddb5cc42d", + "spaces_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/spaces", + "domains_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/domains", + "private_domains_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/private_domains", + "users_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/users", + "managers_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/managers", + "billing_managers_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/billing_managers", + "auditors_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/auditors", + "app_events_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/app_events", + "space_quota_definitions_url": "/v2/organizations/da0dba14-6064-4f7a-b15a-ff9e677e49b2/space_quota_definitions" + } +}` + +const listServiceBindingsPayloadPage1 = `{ + "total_results": 2, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/service_bindings2", + "resources": [ + { + "metadata": { + "guid": "aa599bb3-4811-405a-bbe3-a68c7c55afc8", + "url": "/v2/service_bindings/aa599bb3-4811-405a-bbe3-a68c7c55afc8", + "created_at": "2016-06-08T16:41:43Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "app_guid": "b26e7e98-f002-41a8-a663-1b60f808a92a", + "service_instance_guid": "bde206e0-1ee8-48ad-b794-44c857633d50", + "credentials": { + "creds-key-66": "creds-val-66" + }, + "binding_options": { + + }, + "gateway_data": null, + "gateway_name": "", + "syslog_drain_url": null, + "volume_mounts": [ + + ], + "app_url": "/v2/apps/b26e7e98-f002-41a8-a663-1b60f808a92a", + "service_instance_url": "/v2/service_instances/bde206e0-1ee8-48ad-b794-44c857633d50" + } + } + ] +}` + +const listServiceBindingsPayloadPage2 = `{ + "total_results": 2, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "8201b87d-b273-4fdf-8dd4-4b42ce970cc7", + "url": "/v2/service_bindings/aa599bb3-4811-405a-bbe3-a68c7c55afc8", + "created_at": "2016-06-08T16:41:43Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "app_guid": "636bbf83-5b54-488d-9528-066f680a99dc", + "service_instance_guid": "c3023201-44f5-4dc8-a903-c69c9eba9809", + "credentials": { + "creds-key-66": "creds-val-66" + }, + "binding_options": { + + }, + "gateway_data": null, + "gateway_name": "", + "syslog_drain_url": null, + "volume_mounts": [ + + ], + "app_url": "/v2/apps/636bbf83-5b54-488d-9528-066f680a99dc", + "service_instance_url": "/v2/service_instances/c3023201-44f5-4dc8-a903-c69c9eba9809" + } + } + ] +}` + +const serviceBindingByGuidPayload = `{ + "metadata": { + "guid": "foo-bar-baz", + "url": "/v2/service_bindings/foo-bar-baz", + "created_at": "2017-06-22T03:46:24Z", + "updated_at": "2017-06-22T03:46:24Z" + }, + "entity": { + "app_guid": "app-bar-baz", + "service_instance_guid": "instance-bar-baz", + "credentials": { + "host": "host.bar.baz", + "port": 5432 + }, + "binding_options": { + }, + "gateway_data": null, + "gateway_name": "", + "syslog_drain_url": null, + "volume_mounts": [ + ], + "app_url": "/v2/apps/app-bar-baz", + "service_instance_url": "/v2/service_instances/instance-bar-baz" + } +} +` + +const setV3AppEnvironmentVariablesPayload = `{ + "var": { + "RAILS_ENV": "production", + "DEBUG": "false" + }, + "links": { + "self": { + "href": "https://api.example.org/v3/apps/[guid]/environment_variables" + }, + "app": { + "href": "https://api.example.org/v3/apps/[guid]" + } + } +}` + +const listServicePlansPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "6fecf53b-7553-4cb3-b97e-930f9c4e3385", + "url": "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385", + "created_at": "2016-06-08T16:41:30Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-1575", + "free": false, + "description": "desc-109", + "service_guid": "1ccab853-87c9-45a6-bf99-603032d17fe5", + "extra": null, + "unique_id": "1bc2884c-ee3d-4f82-a78b-1a657f79aeac", + "public": true, + "active": true, + "bindable": true, + "plan_updateable": true, + "service_url": "/v2/services/1ccab853-87c9-45a6-bf99-603032d17fe5", + "service_instances_url": "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385/service_instances" + } + } + ] +}` + +const getServicePlanByGuidPayload = `{ + "metadata": { + "guid": "6fecf53b-7553-4cb3-b97e-930f9c4e3385", + "url": "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385", + "created_at": "2016-06-08T16:41:30Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-1575", + "free": false, + "description": "desc-109", + "service_guid": "1ccab853-87c9-45a6-bf99-603032d17fe5", + "extra": null, + "unique_id": "1bc2884c-ee3d-4f82-a78b-1a657f79aeac", + "public": true, + "active": true, + "bindable": true, + "plan_updateable": true, + "service_url": "/v2/services/1ccab853-87c9-45a6-bf99-603032d17fe5", + "service_instances_url": "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385/service_instances" + } +} +` + +const privateServicePlanPayload = `{ + "metadata": { + "guid": "6fecf53b-7553-4cb3-b97e-930f9c4e3385", + "url": "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385", + "created_at": "2016-06-08T16:41:30Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-1575", + "free": false, + "description": "desc-109", + "service_guid": "1ccab853-87c9-45a6-bf99-603032d17fe5", + "extra": null, + "unique_id": "1bc2884c-ee3d-4f82-a78b-1a657f79aeac", + "public": false, + "active": true, + "bindable": true, + "plan_updateable": true, + "service_url": "/v2/services/1ccab853-87c9-45a6-bf99-603032d17fe5", + "service_instances_url": "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385/service_instances" + } +} +` + +const listServicePayload = `{ + "total_results": 22, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "a3d76c01-c08a-4505-b06d-8603265682a3", + "url": "/v2/services/a3d76c01-c08a-4505-b06d-8603265682a3", + "created_at": "2014-09-24T14:10:51+00:00", + "updated_at": "2014-10-08T00:06:30+00:00" + }, + "entity": { + "label": "nats", + "provider": null, + "url": null, + "description": "NATS is a lightweight cloud messaging system", + "long_description": null, + "version": null, + "info_url": null, + "active": true, + "bindable": true, + "unique_id": "b9310aba-2fa4-11e4-b626-a6c5e4d22fb7", + "extra": "", + "tags": [ + "nats", + "mbus", + "pubsub" + ], + "requires": [], + "documentation_url": null, + "service_broker_guid": "a4bdf03a-f0c4-43f9-9c77-f434da91404f", + "plan_updateable": false, + "service_plans_url": "/v2/services/a3d76c01-c08a-4505-b06d-8603265682a3/service_plans" + } + }, + { + "metadata": { + "guid": "ab9ad9c8-1f51-463a-ae3a-5082e9f04ae6", + "url": "/v2/services/ab9ad9c8-1f51-463a-ae3a-5082e9f04ae6", + "created_at": "2014-09-24T14:10:51+00:00", + "updated_at": "2014-10-08T00:06:30+00:00" + }, + "entity": { + "label": "etcd", + "provider": null, + "url": null, + "description": "Etcd key-value storage", + "long_description": null, + "version": null, + "info_url": null, + "active": true, + "bindable": true, + "unique_id": "211411a0-2da1-11e4-852f-a6c5e4d22fb7", + "extra": "", + "tags": [ + "etcd", + "keyvalue", + "etcd-0.4.6" + ], + "requires": [], + "documentation_url": null, + "service_broker_guid": "a4bdf03a-f0c4-43f9-9c77-f434da91404f", + "plan_updateable": false, + "service_plans_url": "/v2/services/ab9ad9c8-1f51-463a-ae3a-5082e9f04ae6/service_plans" + } + } + ] +}` + +const listServicePlanVisibilitiesPayload = `{ + "total_results": 4, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "d1b5ea55-f354-4f43-b52e-53045747adb9", + "url": "/v2/service_plan_visibilities/d1b5ea55-f354-4f43-b52e-53045747adb9", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "service_plan_guid": "62cb572c-e9ca-4c9f-b822-8292db1d9a96", + "organization_guid": "81df84f3-8ce0-4c92-990a-3760b6ff66bd", + "service_plan_url": "/v2/service_plans/62cb572c-e9ca-4c9f-b822-8292db1d9a96", + "organization_url": "/v2/organizations/81df84f3-8ce0-4c92-990a-3760b6ff66bd" + } + }, + { + "metadata": { + "guid": "332331a3-7b6c-413b-a2e4-edf90ac47fa9", + "url": "/v2/service_plan_visibilities/332331a3-7b6c-413b-a2e4-edf90ac47fa9", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "service_plan_guid": "c505f2ec-81ed-4091-b194-b8e905f32b24", + "organization_guid": "99b61b74-09d6-47db-9568-a835e42d0a1d", + "service_plan_url": "/v2/service_plans/c505f2ec-81ed-4091-b194-b8e905f32b24", + "organization_url": "/v2/organizations/99b61b74-09d6-47db-9568-a835e42d0a1d" + } + } + ] +}` + +const postServicePlanVisibilityPayload = `{ + "metadata": { + "guid": "f740b01a-4afe-4435-aedd-0a8308a7e7d6", + "url": "/v2/service_plan_visibilities/f740b01a-4afe-4435-aedd-0a8308a7e7d6", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "service_plan_guid": "ab5780a9-ac8e-4412-9496-4512e865011a", + "organization_guid": "55d0ff39-dac9-431f-ba6d-83f37381f1c3", + "service_plan_url": "/v2/service_plans/ab5780a9-ac8e-4412-9496-4512e865011a", + "organization_url": "/v2/organizations/55d0ff39-dac9-431f-ba6d-83f37381f1c3" + } +}` + +const listAppsCreatedEventPayload = `{ + "total_results": 3, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/events2", + "resources": [ + { + "metadata": { + "guid": "49ab122b-82b9-4623-8a13-24e585e32e66", + "url": "/v2/events/49ab122b-82b9-4623-8a13-24e585e32e66", + "created_at": "2016-02-26T13:00:21Z", + "updated_at": null + }, + "entity": { + "type": "audit.app.update", + "actor": "fbf30c43-436e-40e4-8ace-31970b52ce89", + "actor_type": "user", + "actor_name": "team-toad@sap.com", + "actee": "3ca436ff-67a8-468a-8c7d-27ec68a6cfe5", + "actee_type": "app", + "actee_name": "authentication-v1-pre-blue", + "timestamp": "2016-02-26T13:00:21Z", + "metadata": { + "request": { + "state": "STOPPED" + } + }, + "space_guid": "08582a96-cbef-463c-822e-bda8d4284cc7", + "organization_guid": "bfdcdf09-a3b8-46f4-ab74-d494efefe5b4" + } + }, + { + "metadata": { + "guid": "49ab122b-82b9-4623-8a13-24e585e32e66", + "url": "/v2/events/49ab122b-82b9-4623-8a13-24e585e32e66", + "created_at": "2016-02-26T13:00:21Z", + "updated_at": "2016-02-26T13:00:21Z" + }, + "entity": { + "type": "app.crash", + "actor": "fbf30c43-436e-40e4-8ace-31970b52ce89", + "actor_type": "app", + "actor_name": "authentication-v1-pre-blue", + "actee": "3ca436ff-67a8-468a-8c7d-27ec68a6cfe5", + "actee_type": "app", + "actee_name": "authentication-v1-pre-blue", + "timestamp": "2016-02-26T13:00:21Z", + "metadata": { + "instance": "", + "index": 0, + "exit_description": "2 error(s) occurred:\n\n* 1 error(s) occurred:\n\n* Exited with status 4\n* 2 error(s) occurred:\n\n* cancelled\n* cancelled", + "reason": "CRASHED" + }, + "space_guid": "08582a96-cbef-463c-822e-bda8d4284cc7", + "organization_guid": "bfdcdf09-a3b8-46f4-ab74-d494efefe5b4" + } + } + ] + }` +const listAppsCreatedEventPayload2 = `{ + "total_results": 3, + "total_pages": 2, + "prev_url": "/v2/events", + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "8e8f83c7-3fc3-4127-9359-ae391380b971", + "url": "/v2/events/8e8f83c7-3fc3-4127-9359-ae391380b971", + "created_at": "2016-02-26T13:00:21Z", + "updated_at": null + }, + "entity": { + "type": "audit.app.update", + "actor": "fbf30c43-436e-40e4-8ace-31970b52ce89", + "actor_type": "user", + "actor_name": "team-toad@sap.com", + "actee": "3ca436ff-67a8-468a-8c7d-27ec68a6cfe5", + "actee_type": "app", + "actee_name": "authentication-v1-pre-blue", + "timestamp": "2016-02-26T13:00:21Z", + "metadata": { + "request": { + "health_check_timeout": 180, + "buildpack": "nodejs_buildpack", + "command": "PRIVATE DATA HIDDEN", + "state": "STARTED" + } + }, + "space_guid": "08582a96-cbef-463c-822e-bda8d4284cc7", + "organization_guid": "bfdcdf09-a3b8-46f4-ab74-d494efefe5b4" + } + } + ] + }` + +var serviceInstancePayload = `{ + "metadata": { + "guid": "8423ca96-90ad-411f-b77a-0907844949fc", + "url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc", + "created_at": "2016-10-21T18:22:56Z", + "updated_at": "2016-10-21T18:22:56Z" + }, + "entity": { + "name": "fortunes-db", + "credentials": {}, + "service_guid": "440ce9d9-b108-4bbe-80b4-08338f3cc25b", + "service_plan_guid": "f48419f7-4717-4706-86e4-a24973848a77", + "space_guid": "21e5fdc7-5131-4743-8447-6373cf336a77", + "gateway_data": null, + "dashboard_url": "https://p-mysql.system.example.com/manage/instances/8423ca96-90ad-411f-b77a-0907844949fc", + "type": "managed_service_instance", + "last_operation": { + "type": "create", + "state": "succeeded", + "description": "", + "updated_at": null, + "created_at": "2016-10-21T18:22:56Z" + }, + "tags": [], + "space_url": "/v2/spaces/21e5fdc7-5131-4743-8447-6373cf336a77", + "service_plan_url": "/v2/service_plans/f48419f7-4717-4706-86e4-a24973848a77", + "service_bindings_url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/service_bindings", + "service_keys_url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/service_keys", + "routes_url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/routes", + "service_url": "/v2/services/440ce9d9-b108-4bbe-80b4-08338f3cc25b" + } +}` + +var serviceInstanceParamsPayload = `{ + "foo": "bar", + "baz": 42 +}` + +var listServiceInstancePayload = `{ + "total_results": 2, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "8423ca96-90ad-411f-b77a-0907844949fc", + "url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc", + "created_at": "2016-10-21T18:22:56Z", + "updated_at": null + }, + "entity": { + "name": "fortunes-db", + "credentials": {}, + "service_guid": "440ce9d9-b108-4bbe-80b4-08338f3cc25b", + "service_plan_guid": "f48419f7-4717-4706-86e4-a24973848a77", + "space_guid": "21e5fdc7-5131-4743-8447-6373cf336a77", + "gateway_data": null, + "dashboard_url": "https://p-mysql.system.example.com/manage/instances/8423ca96-90ad-411f-b77a-0907844949fc", + "type": "managed_service_instance", + "last_operation": { + "type": "create", + "state": "succeeded", + "description": "", + "updated_at": null, + "created_at": "2016-10-21T18:22:56Z" + }, + "tags": [], + "space_url": "/v2/spaces/21e5fdc7-5131-4743-8447-6373cf336a77", + "service_plan_url": "/v2/service_plans/f48419f7-4717-4706-86e4-a24973848a77", + "service_bindings_url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/service_bindings", + "service_keys_url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/service_keys", + "routes_url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/routes", + "service_url": "/v2/services/440ce9d9-b108-4bbe-80b4-08338f3cc25b" + } + }, + { + "metadata": { + "guid": "8423ca96-90ad-411f-b77a-0907844949fc", + "url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc", + "created_at": "2016-10-21T18:22:56Z", + "updated_at": null + }, + "entity": { + "name": "fortunes-db", + "credentials": {}, + "service_guid": "440ce9d9-b108-4bbe-80b4-08338f3cc25b", + "service_plan_guid": "f48419f7-4717-4706-86e4-a24973848a77", + "space_guid": "21e5fdc7-5131-4743-8447-6373cf336a77", + "gateway_data": null, + "dashboard_url": "https://p-mysql.system.example.com/manage/instances/8423ca96-90ad-411f-b77a-0907844949fc", + "type": "managed_service_instance", + "last_operation": { + "type": "create", + "state": "succeeded", + "description": "", + "updated_at": null, + "created_at": "2016-10-21T18:22:56Z" + }, + "tags": [], + "space_url": "/v2/spaces/21e5fdc7-5131-4743-8447-6373cf336a77", + "service_plan_url": "/v2/service_plans/f48419f7-4717-4706-86e4-a24973848a77", + "service_bindings_url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/service_bindings", + "service_keys_url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/service_keys", + "routes_url": "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/routes", + "service_url": "/v2/services/440ce9d9-b108-4bbe-80b4-08338f3cc25b" + } + } + ] +}` + +const userProvidedServiceInstancePayload = `{ + "metadata": { + "guid": "e9358711-0ad9-4f2a-b3dc-289d47c17c87", + "url": "/v2/user_provided_service_instances/e9358711-0ad9-4f2a-b3dc-289d47c17c87", + "created_at": "2016-06-08T16:41:33Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-1700", + "credentials": { + "creds-key-58": "creds-val-58" + }, + "space_guid": "22236d1a-d9c7-44b7-bdad-2bb079a6c4a1", + "type": "user_provided_service_instance", + "syslog_drain_url": "https://foo.com/url-104", + "route_service_url": null, + "space_url": "/v2/spaces/22236d1a-d9c7-44b7-bdad-2bb079a6c4a1", + "service_bindings_url": "/v2/user_provided_service_instances/e9358711-0ad9-4f2a-b3dc-289d47c17c87/service_bindings", + "routes_url": "/v2/user_provided_service_instances/e9358711-0ad9-4f2a-b3dc-289d47c17c87/routes" + } +}` + +const listUserProvidedServiceInstancePayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "54e4c645-7d20-4271-8c27-8cc904e1e7ee", + "url": "/v2/user_provided_service_instances/54e4c645-7d20-4271-8c27-8cc904e1e7ee", + "created_at": "2016-06-08T16:41:33Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-1696", + "credentials": { + "creds-key-57": "creds-val-57" + }, + "space_guid": "87d14ac2-f396-460e-a523-dc1d77aba35a", + "type": "user_provided_service_instance", + "syslog_drain_url": "https://foo.com/url-103", + "route_service_url": null, + "space_url": "/v2/spaces/87d14ac2-f396-460e-a523-dc1d77aba35a", + "service_bindings_url": "/v2/user_provided_service_instances/54e4c645-7d20-4271-8c27-8cc904e1e7ee/service_bindings", + "routes_url": "/v2/user_provided_service_instances/54e4c645-7d20-4271-8c27-8cc904e1e7ee/routes" + } + } + ] +}` + +const listRoutesPayloadPage1 string = `{ + "total_results": 2, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/routes_page_2", + "resources": [ + { + "metadata": { + "guid": "24707add-83b8-4fd8-a8f4-b7297199c805", + "url": "/v2/routes/24707add-83b8-4fd8-a8f4-b7297199c805", + "created_at": "2017-02-06T14:13:57Z", + "updated_at": "2017-02-06T14:13:57Z" + }, + "entity": { + "host": "test-1", + "path": "/foo", + "domain_guid": "0b183484-45cc-4855-94d4-892f80f20c13", + "space_guid": "494d8b64-8181-4183-a6d3-6279db8fec6e", + "service_instance_guid": null, + "port": null, + "domain_url": "/v2/shared_domains/0b183484-45cc-4855-94d4-892f80f20c13", + "space_url": "/v2/spaces/494d8b64-8181-4183-a6d3-6279db8fec6e", + "apps_url": "/v2/routes/24707add-83b8-4fd8-a8f4-b7297199c805/apps", + "route_mappings_url": "/v2/routes/24707add-83b8-4fd8-a8f4-b7297199c805/route_mappings" + } + } + ] +}` + +const listRoutesPayloadPage2 string = `{ + "total_results": 2, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "1aba0d30-eb57-4543-a805-0d1c77171b4d", + "url": "/v2/routes/1aba0d30-eb57-4543-a805-0d1c77171b4d", + "created_at": "2017-02-07T03:57:17Z", + "updated_at": "2017-02-07T03:57:17Z" + }, + "entity": { + "host": "test-2", + "path": "", + "domain_guid": "0b183484-45cc-4855-94d4-892f80f20c13", + "space_guid": "494d8b64-8181-4183-a6d3-6279db8fec6e", + "service_instance_guid": null, + "port": null, + "domain_url": "/v2/shared_domains/0b183484-45cc-4855-94d4-892f80f20c13", + "space_url": "/v2/spaces/494d8b64-8181-4183-a6d3-6279db8fec6e", + "apps_url": "/v2/routes/1aba0d30-eb57-4543-a805-0d1c77171b4d/apps", + "route_mappings_url": "/v2/routes/1aba0d30-eb57-4543-a805-0d1c77171b4d/route_mappings" + } + } + ] +}` + +const bindRoute string = ` +{ + "metadata": { + "guid": "7803de15-a20f-4dea-bf17-37de56629582", + "url": "/v2/routes/7803de15-a20f-4dea-bf17-37de56629582", + "created_at": "2016-06-08T16:41:28Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "host": "foo-host", + "path": "", + "domain_guid": "08167353-32da-4ed9-9ef5-aa7b31bbc009", + "space_guid": "b65a9a76-8c55-460b-9162-18b396da66cf", + "service_instance_guid": null, + "port": null, + "domain_url": "/v2/shared_domains/08167353-32da-4ed9-9ef5-aa7b31bbc009", + "space_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf", + "apps_url": "/v2/routes/7803de15-a20f-4dea-bf17-37de56629582/apps", + "route_mappings_url": "/v2/routes/7803de15-a20f-4dea-bf17-37de56629582/route_mappings" + } +} +` + +const createRoute string = ` +{ + "metadata": { + "guid": "b3fe6f31-e897-4e02-b49e-263ca96b4e3a", + "url": "/v2/routes/b3fe6f31-e897-4e02-b49e-263ca96b4e3a", + "created_at": "2018-05-24T22:16:36Z", + "updated_at": "2018-05-24T22:16:36Z" + }, + "entity": { + "host": "foo-host", + "path": "", + "domain_guid": "08167353-32da-4ed9-9ef5-aa7b31bbc009", + "space_guid": "b65a9a76-8c55-460b-9162-18b396da66cf", + "service_instance_guid": null, + "port": null, + "domain_url": "/v2/shared_domains/08167353-32da-4ed9-9ef5-aa7b31bbc009", + "domain": { + "metadata": { + "guid": "08167353-32da-4ed9-9ef5-aa7b31bbc009", + "url": "/v2/shared_domains/08167353-32da-4ed9-9ef5-aa7b31bbc009", + "created_at": "2018-05-11T00:28:15Z", + "updated_at": "2018-05-11T00:28:15Z" + }, + "entity": { + "name": "apps.pcf.example.com", + "router_group_guid": null, + "router_group_type": null + } + }, + "space_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf", + "space": { + "metadata": { + "guid": "b65a9a76-8c55-460b-9162-18b396da66cf", + "url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf", + "created_at": "2018-05-18T02:52:35Z", + "updated_at": "2018-05-18T02:52:35Z" + }, + "entity": { + "name": "dev", + "organization_guid": "de84b21e-dd45-4a58-b483-83be15cf1b00", + "space_quota_definition_guid": null, + "isolation_segment_guid": null, + "allow_ssh": true, + "organization_url": "/v2/organizations/de84b21e-dd45-4a58-b483-83be15cf1b00", + "developers_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/developers", + "managers_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/managers", + "auditors_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/auditors", + "apps_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/apps", + "routes_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/routes", + "domains_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/domains", + "service_instances_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/service_instances", + "app_events_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/app_events", + "events_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/events", + "security_groups_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/security_groups", + "staging_security_groups_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/staging_security_groups" + } + }, + "apps_url": "/v2/routes/b3fe6f31-e897-4e02-b49e-263ca96b4e3a/apps", + "apps": [ + + ], + "route_mappings_url": "/v2/routes/b3fe6f31-e897-4e02-b49e-263ca96b4e3a/route_mappings" + } +} +` + +const createTcpRoute string = ` +{ + "metadata": { + "guid": "78fe5006-1d1c-41ba-94de-eb7002241b82", + "url": "/v2/routes/78fe5006-1d1c-41ba-94de-eb7002241b82", + "created_at": "2017-05-24T19:04:34Z", + "updated_at": null + }, + "entity": { + "host": "", + "path": "", + "domain_guid": "08167353-32da-4ed9-9ef5-aa7b31bbc009", + "space_guid": "b65a9a76-8c55-460b-9162-18b396da66cf", + "service_instance_guid": null, + "port": 1099, + "domain_url": "/v2/shared_domains/08167353-32da-4ed9-9ef5-aa7b31bbc009", + "domain": { + "metadata": { + "guid": "08167353-32da-4ed9-9ef5-aa7b31bbc009", + "url": "/v2/shared_domains/08167353-32da-4ed9-9ef5-aa7b31bbc009", + "created_at": "2017-01-17T17:54:46Z", + "updated_at": null + }, + "entity": { + "name": "tcp.main.example.com", + "router_group_guid": "b4c90165-5689-4a7e-4cfc-f55dc41f3e22", + "router_group_type": null + } + }, + "space_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf", + "space": { + "metadata": { + "guid": "b65a9a76-8c55-460b-9162-18b396da66cf", + "url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf", + "created_at": "2016-12-09T15:06:17Z", + "updated_at": null + }, + "entity": { + "name": "system", + "organization_guid": "236c6d93-7cfb-4d4a-bc76-9a9cc2bc8e58", + "space_quota_definition_guid": null, + "allow_ssh": true, + "organization_url": "/v2/organizations/236c6d93-7cfb-4d4a-bc76-9a9cc2bc8e58", + "developers_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/developers", + "managers_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/managers", + "auditors_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/auditors", + "apps_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/apps", + "routes_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/routes", + "domains_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/domains", + "service_instances_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/service_instances", + "app_events_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/app_events", + "events_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/events", + "security_groups_url": "/v2/spaces/b65a9a76-8c55-460b-9162-18b396da66cf/security_groups" + } + }, + "apps_url": "/v2/routes/78fe5006-1d1c-41ba-94de-eb7002241b82/apps", + "apps": [ + + ], + "route_mappings_url": "/v2/routes/78fe5006-1d1c-41ba-94de-eb7002241b82/route_mappings" + } +}` + +const listStacksPayloadPage1 string = `{ + "total_results": 2, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/stacks_page_2", + "resources": [ + { + "metadata": { + "guid": "67e019a3-322a-407a-96e0-178e95bd0e55", + "url": "/v2/stacks/67e019a3-322a-407a-96e0-178e95bd0e55", + "created_at": "2017-01-18T16:39:11Z", + "updated_at": "2017-01-18T16:39:11Z" + }, + "entity": { + "name": "cflinuxfs2", + "description": "Cloud Foundry Linux-based filesystem" + } + } + ] +}` + +const listStacksPayloadPage2 string = `{ + "total_results": 2, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "a9be2e10-0164-401d-94e0-88455d614844", + "url": "/v2/stacks/a9be2e10-0164-401d-94e0-88455d614844", + "created_at": "2017-01-18T16:39:11Z", + "updated_at": "2017-01-18T16:39:11Z" + }, + "entity": { + "name": "windows2012R2", + "description": "Experimental Windows runtime" + } + } + ] +}` + +const stackByGuidPayload = `{ + "metadata": { + "guid": "a9be2e10-0164-401d-94e0-88455d614844", + "url": "/v2/stacks/a9be2e10-0164-401d-94e0-88455d614844", + "created_at": "2017-01-18T16:39:11Z", + "updated_at": "2017-01-18T16:39:11Z" + }, + "entity": { + "name": "windows2012R2", + "description": "Experimental Windows runtime" + } +}` + +const listTasksByAppPayloadPage1 string = ` +{ + "pagination": { + "total_results": 4, + "total_pages": 2, + "first": { + "href": "https://api.run.example.com/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5/tasks?page=1&per_page=2" + }, + "last": { + "href": "https://api.run.example.com/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5/tasks?page=2&per_page=2" + }, + "next": { + "href": "https://api.run.example.com/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5/tasks?page=2&per_page=2" + }, + "previous": null + }, + "resources": [ + { + "guid": "d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa", + "sequence_id": 1, + "name": "hello", + "state": "SUCCEEDED", + "memory_in_mb": 512, + "disk_in_mb": 1024, + "result": { + "failure_reason": null + }, + "droplet_guid": "740ebd2b-162b-469a-bd72-3edb96fabd9a", + "metadata": { + "labels": { }, + "annotations": { } + }, + "created_at": "2016-05-04T17:00:41Z", + "updated_at": "2016-05-04T17:00:42Z", + "relationships": { + "app": { + "data": { + "guid": "ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/tasks/d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa" + }, + "app": { + "href": "https://api.example.org/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + }, + "cancel": { + "href": "https://api.example.org/v3/tasks/d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa/actions/cancel", + "method": "POST" + }, + "droplet": { + "href": "https://api.example.org/v3/droplets/740ebd2b-162b-469a-bd72-3edb96fabd9a" + } + } + }, + { + "guid": "63b4cd89-fd8b-4bf1-a311-7174fcc907d6", + "sequence_id": 2, + "name": "migrate", + "state": "FAILED", + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "result": { + "failure_reason": "Exited with status 1" + }, + "droplet_guid": "740ebd2b-162b-469a-bd72-3edb96fabd9a", + "metadata": { + "labels": { }, + "annotations": { } + }, + "created_at": "2016-05-04T17:00:43Z", + "updated_at": "2016-05-04T17:00:44Z", + "relationships": { + "app": { + "data": { + "guid": "ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/tasks/63b4cd89-fd8b-4bf1-a311-7174fcc907d6" + }, + "app": { + "href": "https://api.example.org/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + }, + "cancel": { + "href": "https://api.example.org/v3/tasks/63b4cd89-fd8b-4bf1-a311-7174fcc907d6/actions/cancel", + "method": "POST" + }, + "droplet": { + "href": "https://api.example.org/v3/droplets/740ebd2b-162b-469a-bd72-3edb96fabd9a" + } + } + } + ] +} +` + +const listTasksByAppPayloadPage2 string = ` +{ + "pagination": { + "total_results": 4, + "total_pages": 2, + "first": { + "href": "https://api.run.example.com/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5/tasks?page=1&per_page=2" + }, + "last": { + "href": "https://api.run.example.com/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5/tasks?page=2&per_page=2" + }, + "next": null, + "previous":{ + "href": "https://api.run.example.com/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5/tasks?page=1&per_page=2" + } + }, + "resources": [ + { + "guid": "abcdefc-99a3-4e6a-af91-a44b4ab7b6fa", + "sequence_id": 3, + "name": "hi", + "state": "SUCCEEDED", + "memory_in_mb": 512, + "disk_in_mb": 1024, + "result": { + "failure_reason": null + }, + "droplet_guid": "740ebd2b-162b-469a-bd72-3edb96fabd9a", + "metadata": { + "labels": { }, + "annotations": { } + }, + "created_at": "2016-05-04T17:00:44Z", + "updated_at": "2016-05-04T17:00:45Z", + "relationships": { + "app": { + "data": { + "guid": "ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/tasks/abcdefc-99a3-4e6a-af91-a44b4ab7b6fa" + }, + "app": { + "href": "https://api.example.org/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + }, + "cancel": { + "href": "https://api.example.org/v3/tasks/abcdefc-99a3-4e6a-af91-a44b4ab7b6fa/actions/cancel", + "method": "POST" + }, + "droplet": { + "href": "https://api.example.org/v3/droplets/740ebd2b-162b-469a-bd72-3edb96fabd9a" + } + } + }, + { + "guid": "hijklm9-fd8b-4bf1-a311-7174fcc907d6", + "sequence_id": 4, + "name": "hello2", + "state": "SUCCEEDED", + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "result": { + "failure_reason": "Exited with status 1" + }, + "droplet_guid": "740ebd2b-162b-469a-bd72-3edb96fabd9a", + "metadata": { + "labels": { }, + "annotations": { } + }, + "created_at": "2016-05-04T17:00:46Z", + "updated_at": "2016-05-04T17:00:47Z", + "relationships": { + "app": { + "data": { + "guid": "ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/tasks/hijklm9-fd8b-4bf1-a311-7174fcc907d6" + }, + "app": { + "href": "https://api.example.org/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + }, + "cancel": { + "href": "https://api.example.org/v3/tasks/hijklm9-fd8b-4bf1-a311-7174fcc907d6/actions/cancel", + "method": "POST" + }, + "droplet": { + "href": "https://api.example.org/v3/droplets/740ebd2b-162b-469a-bd72-3edb96fabd9a" + } + } + } + ] +} +` + +const listTasksPayloadPage1 string = ` +{ + "pagination": { + "total_results": 4, + "total_pages": 2, + "first": { + "href ": "https: //api.run.example.com/v3/tasks?page=1&per_page=2" + }, + "last": { + "href": "https://api.run.example.com/v3/tasks?page=2&per_page=2" + }, + "next": { + "href": "https://api.run.example.com/v3/tasks?page=2&per_page=2" + }, + "previous": null + }, + "resources": [{ + "guid": "d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa", + "sequence_id": 1, + "name": "hello", + "state": "SUCCEEDED", + "memory_in_mb": 512, + "disk_in_mb": 1024, + "result": { + "failure_reason": null + }, + "droplet_guid": "740ebd2b-162b-469a-bd72-3edb96fabd9a", + "metadata": { + "labels": {}, + "annotations": {} + }, + "created_at": "2016-05-04T17:00:41Z", + "updated_at": "2016-05-04T17:00:42Z", + "links": { + "self": { + "href": "https://api.example.org/v3/tasks/d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa" + }, + "app": { + "href": "https://api.example.org/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + }, + "cancel": { + "href": "https://api.example.org/v3/tasks/d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa/actions/cancel", + "method": "POST" + }, + "droplet": { + "href": "https://api.example.org/v3/droplets/740ebd2b-162b-469a-bd72-3edb96fabd9a" + } + } + }, + { + "guid": "63b4cd89-fd8b-4bf1-a311-7174fcc907d6", + "sequence_id": 2, + "name": "migrate", + "state": "FAILED", + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "result": { + "failure_reason": "Exited with status 1" + }, + "droplet_guid": "740ebd2b-162b-469a-bd72-3edb96fabd9a", + "metadata": { + "labels": {}, + "annotations": {} + }, + "created_at": "2016-05-04T17:00:43Z", + "updated_at": "2016-05-04T17:00:44Z", + "links": { + "self": { + "href": "https://api.example.org/v3/tasks/63b4cd89-fd8b-4bf1-a311-7174fcc907d6" + }, + "app": { + "href": "https://api.example.org/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + }, + "cancel": { + "href": "https://api.example.org/v3/tasks/63b4cd89-fd8b-4bf1-a311-7174fcc907d6/actions/cancel", + "method": "POST" + }, + "droplet": { + "href": "https://api.example.org/v3/droplets/740ebd2b-162b-469a-bd72-3edb96fabd9a" + } + } + } + ] +}` + +const listTasksPayloadPage2 string = ` +{ + "pagination": { + "total_results": 4, + "total_pages": 2, + "first": { + "href": "https://api.run.example.com/v3/tasks?page=1&per_page=2" + }, + "last": { + "href": "https://api.run.example.com/v3/tasks?page=2&per_page=2" + }, + "next": null, + "previous": { + "href": "https://api.run.example.com/v3/tasks?page=1&per_page=2" + } + }, + "resources": [ + { + "guid": "abcdefc-99a3-4e6a-af91-a44b4ab7b6fa", + "sequence_id": 3, + "name": "hi", + "state": "SUCCEEDED", + "memory_in_mb": 512, + "disk_in_mb": 1024, + "result": { + "failure_reason": null + }, + "droplet_guid": "740ebd2b-162b-469a-bd72-3edb96fabd9a", + "metadata": { + "labels": { }, + "annotations": { } + }, + "created_at": "2016-05-04T17:00:44Z", + "updated_at": "2016-05-04T17:00:45Z", + "links": { + "self": { + "href": "https://api.example.org/v3/tasks/abcdefc-99a3-4e6a-af91-a44b4ab7b6fa" + }, + "app": { + "href": "https://api.example.org/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + }, + "cancel": { + "href": "https://api.example.org/v3/tasks/abcdefc-99a3-4e6a-af91-a44b4ab7b6fa/actions/cancel", + "method": "POST" + }, + "droplet": { + "href": "https://api.example.org/v3/droplets/740ebd2b-162b-469a-bd72-3edb96fabd9a" + } + } + }, + { + "guid": "hijklm9-fd8b-4bf1-a311-7174fcc907d6", + "sequence_id": 4, + "name": "hello2", + "state": "SUCCEEDED", + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "result": { + "failure_reason": "Exited with status 1" + }, + "droplet_guid": "740ebd2b-162b-469a-bd72-3edb96fabd9a", + "metadata": { + "labels": { }, + "annotations": { } + }, + "created_at": "2016-05-04T17:00:46Z", + "updated_at": "2016-05-04T17:00:47Z", + "links": { + "self": { + "href": "https://api.example.org/v3/tasks/hijklm9-fd8b-4bf1-a311-7174fcc907d6" + }, + "app": { + "href": "https://api.example.org/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + }, + "cancel": { + "href": "https://api.example.org/v3/tasks/hijklm9-fd8b-4bf1-a311-7174fcc907d6/actions/cancel", + "method": "POST" + }, + "droplet": { + "href": "https://api.example.org/v3/droplets/740ebd2b-162b-469a-bd72-3edb96fabd9a" + } + } + } + ] +} +` + +const createTaskPayload = ` +{ + "guid": "d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa", + "sequence_id": 1, + "name": "migrate", + "command": "rake db:migrate", + "state": "RUNNING", + "memory_in_mb": 512, + "disk_in_mb": 1024, + "result": { + "failure_reason": null + }, + "droplet_guid": "740ebd2b-162b-469a-bd72-3edb96fabd9a", + "created_at": "2016-05-04T17:00:41Z", + "updated_at": "2016-05-04T17:00:42Z", + "links": { + "self": { + "href": "https://api.example.org/v3/tasks/d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa" + }, + "app": { + "href": "https://api.example.org/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5" + }, + "droplet": { + "href": "https://api.example.org/v3/droplets/740ebd2b-162b-469a-bd72-3edb96fabd9a" + } + } +} +` + +const errorV3Payload = `{ + "errors": [ + { + "code": 10008, + "title": "CF-UnprocessableEntity", + "detail": "something went wrong" + } + ] +} +` + +const listDomainsPayload = `{ + "total_results": 4, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "b2a35f0c-d5ad-4a59-bea7-461711d96b0d", + "url": "/v2/private_domains/b2a35f0c-d5ad-4a59-bea7-461711d96b0d", + "created_at": "2016-06-08T16:41:39Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "vcap.me", + "owning_organization_guid": "4cf3bc47-eccd-4662-9322-7833c3bdcded", + "owning_organization_url": "/v2/organizations/4cf3bc47-eccd-4662-9322-7833c3bdcded", + "shared_organizations_url": "/v2/private_domains/b2a35f0c-d5ad-4a59-bea7-461711d96b0d/shared_organizations" + } + }, + { + "metadata": { + "guid": "28db6393-cc6f-4318-a63c-f4009e8842bc", + "url": "/v2/private_domains/28db6393-cc6f-4318-a63c-f4009e8842bc", + "created_at": "2016-06-08T16:41:39Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "domain-61.example.com", + "owning_organization_guid": "c262280e-0ccc-4e13-918a-6852f2d1e3a0", + "owning_organization_url": "/v2/organizations/c262280e-0ccc-4e13-918a-6852f2d1e3a0", + "shared_organizations_url": "/v2/private_domains/28db6393-cc6f-4318-a63c-f4009e8842bc/shared_organizations" + } + }, + { + "metadata": { + "guid": "a16ffec7-5fab-4447-861e-c38da6548c6d", + "url": "/v2/private_domains/a16ffec7-5fab-4447-861e-c38da6548c6d", + "created_at": "2016-06-08T16:41:39Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "domain-62.example.com", + "owning_organization_guid": "68f69961-f751-4b52-907c-4469009fdf74", + "owning_organization_url": "/v2/organizations/68f69961-f751-4b52-907c-4469009fdf74", + "shared_organizations_url": "/v2/private_domains/a16ffec7-5fab-4447-861e-c38da6548c6d/shared_organizations" + } + }, + { + "metadata": { + "guid": "4168cdaf-1586-41a6-9e5f-d8c715c332f5", + "url": "/v2/private_domains/4168cdaf-1586-41a6-9e5f-d8c715c332f5", + "created_at": "2016-06-08T16:41:39Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "domain-63.example.com", + "owning_organization_guid": "8d8ed1ba-f7f3-48f1-8d9a-2dfaad91335b", + "owning_organization_url": "/v2/organizations/8d8ed1ba-f7f3-48f1-8d9a-2dfaad91335b", + "shared_organizations_url": "/v2/private_domains/4168cdaf-1586-41a6-9e5f-d8c715c332f5/shared_organizations" + } + } + ] +}` + +const listSharedDomainsPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "91977695-8ad9-40db-858f-4df782603ec3", + "url": "/v2/shared_domains/91977695-8ad9-40db-858f-4df782603ec3", + "created_at": "2016-06-08T16:41:37Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "domain-49.example.com", + "router_group_guid": "my-random-guid", + "router_group_type": "tcp" + } + } + ] +}` + +const listSharedDomainByGuidPayload = `{ + "metadata": { + "guid": "91977695-8ad9-40db-858f-4df782603ec3", + "url": "/v2/shared_domains/91977695-8ad9-40db-858f-4df782603ec3", + "created_at": "2016-06-08T16:41:37Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "apps.some.random.cf.installation.example.com", + "internal": false, + "router_group_guid": null, + "router_group_type": null + } +} +` + +const listDomainByGuidPayload = `{ + "metadata": { + "guid": "b2a35f0c-d5ad-4a59-bea7-461711d96b0d", + "url": "/v2/private_domains/b2a35f0c-d5ad-4a59-bea7-461711d96b0d", + "created_at": "2016-06-08T16:41:39Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "vcap.me", + "owning_organization_guid": "4cf3bc47-eccd-4662-9322-7833c3bdcded", + "owning_organization_url": "/v2/organizations/4cf3bc47-eccd-4662-9322-7833c3bdcded", + "shared_organizations_url": "/v2/private_domains/b2a35f0c-d5ad-4a59-bea7-461711d96b0d/shared_organizations" + } +} +` + +const listDomainsEmptyResponse = `{ + "total_results": 0, + "total_pages": 0, + "prev_url": null, + "next_url": null, + "resources": [] +}` + +const postDomainPayload = `{ + "metadata": { + "guid": "b98aeca1-22b9-49f9-8428-3ace9ea2ba11", + "url": "/v2/private_domains/b98aeca1-22b9-49f9-8428-3ace9ea2ba11", + "created_at": "2016-06-08T16:41:39Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "exmaple.com", + "owning_organization_guid": "8483e4f1-d3a3-43e2-ab8c-b05ea40ef8db", + "owning_organization_url": "/v2/organizations/8483e4f1-d3a3-43e2-ab8c-b05ea40ef8db", + "shared_organizations_url": "/v2/private_domains/b98aeca1-22b9-49f9-8428-3ace9ea2ba11/shared_organizations" + } +}` + +const getDomainPayload = `{ + "metadata": { + "guid": "369373be-7864-4bb9-a8ef-8274da1f8c8b", + "url": "/v2/private_domains/369373be-7864-4bb9-a8ef-8274da1f8c8b", + "created_at": "2016-06-08T16:41:39Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "example.com", + "owning_organization_guid": "8483e4f1-d3a3-43e2-ab8c-b05ea40ef8db", + "owning_organization_url": "/v2/organizations/8483e4f1-d3a3-43e2-ab8c-b05ea40ef8db", + "shared_organizations_url": "/v2/private_domains/369373be-7864-4bb9-a8ef-8274da1f8c8b/shared_organizations" + } +}` + +const postExternalSharedDomainPayload = `{ + "metadata": { + "guid": "b98aeca1-22b9-49f9-8428-3ace9ea2ba11", + "url": "/v2/shared_domains/b98aeca1-22b9-49f9-8428-3ace9ea2ba11", + "created_at": "2016-06-08T16:41:39Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "shared-exmaple.com", + "internal": false, + "router_group_guid": "8483e4f1-d3a3-43e2-ab8c-b05ea40ef8db", + "router_group_type": "tcp" + } +}` + +const postInternalSharedDomainPayload = `{ + "metadata": { + "guid": "b98aeca1-22b9-49f9-8428-3ace9ea2ba11", + "url": "/v2/shared_domains/b98aeca1-22b9-49f9-8428-3ace9ea2ba11", + "created_at": "2016-06-08T16:41:39Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "shared-exmaple.com", + "internal": true + } +}` + +const listBuildpacksPayload = `{ + "total_results": 3, + "total_pages": 1, + "prev_url": null, + "next_url": "/v2/buildpacksPage2", + "resources": [ + { + "metadata": { + "guid": "c92b6f5f-d2a4-413a-b515-647d059723aa", + "url": "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name_1", + "position": 1, + "enabled": true, + "locked": false, + "filename": "name-1616", + "stack": "cflinuxfs2" + } + }, + { + "metadata": { + "guid": "4de2ac22-ef36-4d62-9698-5f2b426748a9", + "url": "/v2/buildpacks/4de2ac22-ef36-4d62-9698-5f2b426748a9", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name_2", + "position": 2, + "enabled": true, + "locked": false, + "filename": "name-1617", + "stack": "cflinuxfs2" + } + }, + { + "metadata": { + "guid": "79f16936-56f1-41d5-a4c4-f0e9a8877791", + "url": "/v2/buildpacks/79f16936-56f1-41d5-a4c4-f0e9a8877791", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name_3", + "position": 3, + "enabled": true, + "locked": false, + "filename": "name-1618", + "stack": "cflinuxfs2" + } + } + ] +}` + +const listBuildpacksPayload2 = `{ + "total_results": 3, + "total_pages": 1, + "prev_url": "/v2/buildpacks", + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "c92b6f5f-d2a4-413a-b515-647d059723aa", + "url": "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name_1", + "position": 1, + "enabled": true, + "locked": false, + "filename": "name-1616", + "stack": "cflinuxfs2" + } + }, + { + "metadata": { + "guid": "4de2ac22-ef36-4d62-9698-5f2b426748a9", + "url": "/v2/buildpacks/4de2ac22-ef36-4d62-9698-5f2b426748a9", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name_2", + "position": 2, + "enabled": true, + "locked": false, + "filename": "name-1617", + "stack": "cflinuxfs2" + } + }, + { + "metadata": { + "guid": "79f16936-56f1-41d5-a4c4-f0e9a8877791", + "url": "/v2/buildpacks/79f16936-56f1-41d5-a4c4-f0e9a8877791", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name_3", + "position": 3, + "enabled": true, + "locked": false, + "filename": "name-1618", + "stack": "cflinuxfs2" + } + } + ] +}` + +const buildpackPayloadBackwardsCompat = `{ + "metadata": { + "guid": "c92b6f5f-d2a4-413a-b515-647d059723aa", + "url": "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name_1", + "position": 1, + "enabled": true, + "locked": false, + "filename": "name-1616" + } +}` + +const buildpackPayload = `{ + "metadata": { + "guid": "c92b6f5f-d2a4-413a-b515-647d059723aa", + "url": "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name_1", + "position": 1, + "enabled": true, + "locked": false, + "filename": "name-1616", + "stack": "cflinuxfs2" + } +}` + +const userByGUIDPayload = `{ + "metadata": { + "guid": "72ccf759-43aa-4954-903f-7d892c268e80", + "url": "/v2/users/72ccf759-43aa-4954-903f-7d892c268e80", + "created_at": "2017-11-03T01:33:31Z", + "updated_at": "2017-11-03T01:33:31Z" + }, + "entity": { + "admin": false, + "active": false, + "default_space_guid": null, + "username": "user@example.com", + "spaces_url": "/v2/users/72ccf759-43aa-4954-903f-7d892c268e80/spaces", + "organizations_url": "/v2/users/72ccf759-43aa-4954-903f-7d892c268e80/organizations", + "managed_organizations_url": "/v2/users/72ccf759-43aa-4954-903f-7d892c268e80/managed_organizations", + "billing_managed_organizations_url": "/v2/users/72ccf759-43aa-4954-903f-7d892c268e80/billing_managed_organizations", + "audited_organizations_url": "/v2/users/72ccf759-43aa-4954-903f-7d892c268e80/audited_organizations", + "managed_spaces_url": "/v2/users/72ccf759-43aa-4954-903f-7d892c268e80/managed_spaces", + "audited_spaces_url": "/v2/users/72ccf759-43aa-4954-903f-7d892c268e80/audited_spaces" + } +}` + +const listUsersPayload = `{ + "total_results": 8, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/usersPage2", + "resources": [ + { + "metadata": { + "guid": "ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac", + "url": "/v2/users/ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac", + "created_at": "2017-01-13T10:50:21Z", + "updated_at": "2017-01-27T12:20:08Z" + }, + "entity": { + "admin": false, + "active": false, + "default_space_guid": null, + "username": "testUser1", + "spaces_url": "/v2/users/ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac/spaces", + "organizations_url": "/v2/users/ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac/organizations", + "managed_organizations_url": "/v2/users/ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac/managed_organizations", + "billing_managed_organizations_url": "/v2/users/ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac/billing_managed_organizations", + "audited_organizations_url": "/v2/users/ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac/audited_organizations", + "managed_spaces_url": "/v2/users/ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac/managed_spaces", + "audited_spaces_url": "/v2/users/ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac/audited_spaces" + } + }, + { + "metadata": { + "guid": "f97f5699-c920-4633-aa23-bd70f3db0808", + "url": "/v2/users/f97f5699-c920-4633-aa23-bd70f3db0808", + "created_at": "2017-01-17T15:08:45Z", + "updated_at": "2017-01-27T12:23:17Z" + }, + "entity": { + "admin": false, + "active": true, + "default_space_guid": null, + "username": "testUser2", + "spaces_url": "/v2/users/f97f5699-c920-4633-aa23-bd70f3db0808/spaces", + "organizations_url": "/v2/users/f97f5699-c920-4633-aa23-bd70f3db0808/organizations", + "managed_organizations_url": "/v2/users/f97f5699-c920-4633-aa23-bd70f3db0808/managed_organizations", + "billing_managed_organizations_url": "/v2/users/f97f5699-c920-4633-aa23-bd70f3db0808/billing_managed_organizations", + "audited_organizations_url": "/v2/users/f97f5699-c920-4633-aa23-bd70f3db0808/audited_organizations", + "managed_spaces_url": "/v2/users/f97f5699-c920-4633-aa23-bd70f3db0808/managed_spaces", + "audited_spaces_url": "/v2/users/f97f5699-c920-4633-aa23-bd70f3db0808/audited_spaces" + } + } + ] +}` + +const listUsersPayloadPage2 = `{ + "total_results": 8, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "cadd6389-fcf6-4928-84f0-6153556bf693", + "url": "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693", + "created_at": "2017-01-04T06:27:51Z", + "updated_at": "2017-01-27T12:21:19Z" + }, + "entity": { + "admin": false, + "active": false, + "default_space_guid": null, + "username": "testUser3", + "spaces_url": "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/spaces", + "organizations_url": "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/organizations", + "managed_organizations_url": "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/managed_organizations", + "billing_managed_organizations_url": "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/billing_managed_organizations", + "audited_organizations_url": "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/audited_organizations", + "managed_spaces_url": "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/managed_spaces", + "audited_spaces_url": "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/audited_spaces" + } + }, + { + "metadata": { + "guid": "79c854b0-c12a-41b7-8d3c-fdd6e116e385", + "url": "/v2/users/79c854b0-c12a-41b7-8d3c-fdd6e116e385", + "created_at": "2017-01-05T14:50:42Z", + "updated_at": "2017-01-27T12:23:17Z" + }, + "entity": { + "admin": false, + "active": false, + "default_space_guid": null, + "username": "testUser4", + "spaces_url": "/v2/users/79c854b0-c12a-41b7-8d3c-fdd6e116e385/spaces", + "organizations_url": "/v2/users/79c854b0-c12a-41b7-8d3c-fdd6e116e385/organizations", + "managed_organizations_url": "/v2/users/79c854b0-c12a-41b7-8d3c-fdd6e116e385/managed_organizations", + "billing_managed_organizations_url": "/v2/users/79c854b0-c12a-41b7-8d3c-fdd6e116e385/billing_managed_organizations", + "audited_organizations_url": "/v2/users/79c854b0-c12a-41b7-8d3c-fdd6e116e385/audited_organizations", + "managed_spaces_url": "/v2/users/79c854b0-c12a-41b7-8d3c-fdd6e116e385/managed_spaces", + "audited_spaces_url": "/v2/users/79c854b0-c12a-41b7-8d3c-fdd6e116e385/audited_spaces" + } + } + ] +}` + +const listUserSpacesPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "9881c79e-d269-4a53-9d77-cb21b745356e", + "url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e", + "created_at": "2016-06-08T16:41:37Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "dev", + "organization_guid": "6a2a2d18-7620-43cf-a332-353824b431b2", + "space_quota_definition_guid": null, + "allow_ssh": true, + "organization_url": "/v2/organizations/6a2a2d18-7620-43cf-a332-353824b431b2", + "developers_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/developers", + "managers_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/managers", + "auditors_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/auditors", + "apps_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/apps", + "routes_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/routes", + "domains_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/domains", + "service_instances_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/service_instances", + "app_events_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/app_events", + "events_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/events", + "security_groups_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/security_groups", + "staging_security_groups_url": "/v2/spaces/9881c79e-d269-4a53-9d77-cb21b745356e/staging_security_groups" + } + } + ] +} +` + +const listUserOrgsPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "9881c79e-d269-4a53-9d77-cb21b745356e", + "url": "/v2/organizations/9881c79e-d269-4a53-9d77-cb21b745356e", + "created_at": "2016-06-08T16:41:37Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "dev", + "billing_enabled": false, + "quota_definition_guid": "6a2a2d18-7620-43cf-a332-353824b431b2", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/6a2a2d18-7620-43cf-a332-353824b431b2", + "spaces_url": "/v2/organizations/9881c79e-d269-4a53-9d77-cb21b745356e/spaces", + "domains_url": "/v2/organizations/9881c79e-d269-4a53-9d77-cb21b745356e/domains", + "private_domains_url": "/v2/organizations/9881c79e-d269-4a53-9d77-cb21b745356e/private_domains", + "users_url": "/v2/organizations/9881c79e-d269-4a53-9d77-cb21b745356e/users", + "managers_url": "/v2/organizations/9881c79e-d269-4a53-9d77-cb21b745356e/managers", + "billing_managers_url": "/v2/organizations/9881c79e-d269-4a53-9d77-cb21b745356e/billing_managers", + "auditors_url": "/v2/organizations/9881c79e-d269-4a53-9d77-cb21b745356e/auditors", + "app_events_url": "/v2/organizations/9881c79e-d269-4a53-9d77-cb21b745356e/app_events", + "space_quota_definitions_url": "/v2/organizations/9881c79e-d269-4a53-9d77-cb21b745356e/space_quota_definitions" + } + } + ] +} +` + +const createUserPayload = `{ + "metadata": { + "guid": "guid-cb24b36d-4656-468e-a50d-b53113ac6177", + "url": "/v2/users/guid-cb24b36d-4656-468e-a50d-b53113ac6177", + "created_at": "2016-06-08T16:41:37Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "admin": false, + "active": false, + "default_space_guid": null, + "spaces_url": "/v2/users/guid-cb24b36d-4656-468e-a50d-b53113ac6177/spaces", + "organizations_url": "/v2/users/guid-cb24b36d-4656-468e-a50d-b53113ac6177/organizations", + "managed_organizations_url": "/v2/users/guid-cb24b36d-4656-468e-a50d-b53113ac6177/managed_organizations", + "billing_managed_organizations_url": "/v2/users/guid-cb24b36d-4656-468e-a50d-b53113ac6177/billing_managed_organizations", + "audited_organizations_url": "/v2/users/guid-cb24b36d-4656-468e-a50d-b53113ac6177/audited_organizations", + "managed_spaces_url": "/v2/users/guid-cb24b36d-4656-468e-a50d-b53113ac6177/managed_spaces", + "audited_spaces_url": "/v2/users/guid-cb24b36d-4656-468e-a50d-b53113ac6177/audited_spaces" + } +}` + +const createIsolationSegmentPayload = `{ + "guid": "323f211e-fea3-4161-9bd1-615392327913", + "name": "TheKittenIsTheShark", + "created_at": "2016-10-19T20:25:04Z", + "updated_at": "2016-11-08T16:41:26Z", + "links": { + "self": { + "href": "https://api.example.org/v3/isolation_segments/323f211e-fea3-4161-9bd1-615392327913" + }, + "spaces": { + "href": "https://api.example.org/v3/isolation_segments/323f211e-fea3-4161-9bd1-615392327913/relationships/spaces" + }, + "organizations": { + "href": "https://api.example.org/v3/isolation_segments/323f211e-fea3-4161-9bd1-615392327913/relationships/organizations" + } + } +}` + +const listV3DomainsPayload = ` + { + "pagination": { + "total_results": 1, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/domains?page=1&per_page=2" + }, + "last": { + "href": "https://api.example.org/v3/domains?page=2&per_page=2" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "3a5d3d89-3f89-4f05-8188-8a2b298c79d5", + "created_at": "2019-03-08T01:06:19Z", + "updated_at": "2019-03-08T01:06:19Z", + "name": "test-domain.com", + "internal": false, + "metadata": { + "labels": { }, + "annotations": { } + }, + "relationships": { + "organization": { + "data": { "guid": "3a3f3d89-3f89-4f05-8188-751b298c79d5" } + }, + "shared_organizations": { + "data": [ + {"guid": "404f3d89-3f89-6z72-8188-751b298d88d5"}, + {"guid": "416d3d89-3f89-8h67-2189-123b298d3592"} + ] + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/3a3f3d89-3f89-4f05-8188-751b298c79d5" + }, + "route_reservations": { + "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations" + }, + "shared_organizations": { + "href": "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/relationships/shared_organizations" + } + } + } + ] +}` + +const listV3OrganizationsPayload = `{ + "pagination": { + "total_results": 2, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/organizations?page=1&per_page=1" + }, + "last": { + "href": "https://api.example.org/v3/organizations?page=2&per_page=1" + }, + "next": { + "href": "https://api.example.org/v3/organizations?page=2&per_page=1" + }, + "previous": null + }, + "resources": [ + { + "guid": "org-guid", + "created_at": "2017-02-01T01:33:58Z", + "updated_at": "2017-02-01T01:33:58Z", + "name": "my-org-1", + "relationships": { + "quota": { + "data": { + "guid": "quota-guid" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/organizations/org-guid" + }, + "domains": { + "href": "https://api.example.org/v3/organizations/org-guid/domains" + }, + "default_domain": { + "href": "https://api.example.org/v3/organizations/org-guid/domains/default" + }, + "quota": { + "href": "https://api.example.org/v3/organization_quotas/quota-guid" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } + } + ] +}` + +const listV3OrganizationsPayloadPage2 = `{ + "pagination": { + "total_results": 2, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/organizations?page=1&per_page=1" + }, + "last": { + "href": "https://api.example.org/v3/organizations?page=2&per_page=1" + }, + "next": null, + "previous": { + "href": "https://api.example.org/v3/organizations?page=2&per_page=1" + } + }, + "resources": [ + { + "guid": "org-guid-2", + "created_at": "2017-02-01T01:33:58Z", + "updated_at": "2017-02-01T01:33:58Z", + "name": "my-org-2", + "relationships": { + "quota": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/organizations/org-guid-2" + }, + "domains": { + "href": "https://api.example.org/v3/organizations/org-guid-2/domains" + }, + "default_domain": { + "href": "https://api.example.org/v3/organizations/org-guid-2/domains/default" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } + } + ] +}` + +const updateV3OrganizationPayload = ` +{ + "guid": "org-guid", + "created_at": "2017-02-01T01:33:58Z", + "updated_at": "2017-02-01T01:33:58Z", + "name": "my-org", + "suspended": false, + "relationships": { + "quota": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/organizations/org-guid" + }, + "domains": { + "href": "https://api.example.org/v3/organizations/org-guid/domains" + }, + "default_domain": { + "href": "https://api.example.org/v3/organizations/org-guid/domains/default" + } + }, + "metadata": { + "labels": { + "ORG_KEY": "org_value" + }, + "annotations": {} + } +}` + +const getV3OrganizationPayload = `{ + "guid": "org-guid", + "created_at": "2017-02-01T01:33:58Z", + "updated_at": "2017-02-01T01:33:58Z", + "name": "my-org", + "relationships": { + "quota": { + "data": { + "guid": "quota-guid" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/organizations/org-guid" + }, + "domains": { + "href": "https://api.example.org/v3/organizations/org-guid/domains" + }, + "default_domain": { + "href": "https://api.example.org/v3/organizations/org-guid/domains/default" + } + }, + "metadata": { + "labels": { + "ORG_KEY": "org_value" + }, + "annotations": {} + } +}` + +const createV3OrganizationPayload = `{ + "guid": "org-guid", + "created_at": "2017-02-01T01:33:58Z", + "updated_at": "2017-02-01T01:33:58Z", + "name": "my-org", + "relationships": { + "quota": { + "data": { + "guid": "quota-guid" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/organizations/org-guid" + }, + "domains": { + "href": "https://api.example.org/v3/organizations/org-guid/domains" + }, + "default_domain": { + "href": "https://api.example.org/v3/organizations/org-guid/domains/default" + } + }, + "metadata": { + "labels": { + "ORG_KEY": "org_value" + }, + "annotations": {} + } +}` + +const listV3SpacesPayload = `{ + "pagination": { + "total_results": 2, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/spaces?page=1&per_page=1" + }, + "last": { + "href": "https://api.example.org/v3/spaces?page=2&per_page=1" + }, + "next": { + "href": "https://api.example.org/v3/spaces?page=2&per_page=1" + }, + "previous": null + }, + "resources": [ + { + "guid": "space-guid", + "created_at": "2017-02-01T01:33:58Z", + "updated_at": "2017-02-01T01:33:58Z", + "name": "my-space-1", + "relationships": { + "organization": { + "data": { + "guid": "org-guid" + } + }, + "quota": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/spaces/space-guid" + }, + "features": { + "href": "https://api.example.org/v3/spaces/space-guid/features" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/org-guid" + }, + "apply_manifest": { + "href": "https://api.example.org/v3/spaces/space-guid/actions/apply_manifest", + "method": "POST" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } + } + ] +}` + +const listV3SpacesPayloadPage2 = `{ + "pagination": { + "total_results": 2, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/spaces?page=1&per_page=1" + }, + "last": { + "href": "https://api.example.org/v3/spaces?page=2&per_page=1" + }, + "next": null, + "previous": { + "href": "https://api.example.org/v3/spaces?page=2&per_page=1" + } + }, + "resources": [ + { + "guid": "space-guid-2", + "created_at": "2017-02-01T01:33:58Z", + "updated_at": "2017-02-01T01:33:58Z", + "name": "my-space-2", + "relationships": { + "organization": { + "data": { + "guid": "org-guid" + } + }, + "quota": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/spaces/space-guid-2" + }, + "features": { + "href": "https://api.example.org/v3/spaces/space-guid-2/features" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/org-guid" + }, + "apply_manifest": { + "href": "https://api.example.org/v3/spaces/space-guid-2/actions/apply_manifest", + "method": "POST" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } + } + ] +}` + +const listV3SpaceUsersPayload = `{ + "pagination": { + "total_results": 2, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/spaces/space-guid/users?page=1&per_page=1" + }, + "last": { + "href": "https://api.example.org/v3/spaces/space-guid/users?page=2&per_page=1" + }, + "next": { + "href": "https://api.example.org/v3/spaces/space-guid/users?page=2&per_page=1" + }, + "previous": null + }, + "resources": [ + { + "guid": "10a93b89-3f89-4f05-7238-8a2b123c79l9", + "created_at": "2019-03-08T01:06:18Z", + "updated_at": "2019-03-08T01:06:18Z", + "username": "some-name-1", + "presentation_name": "some-name-1", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations":{} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/10a93b89-3f89-4f05-7238-8a2b123c79l9" + } + } + } + ] +}` + +const listV3SpaceUsersPayloadPage2 = `{ + "pagination": { + "total_results": 2, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/spaces/space-guid/users?page=1&per_page=1" + }, + "last": { + "href": "https://api.example.org/v3/spaces/space-guid/users?page=2&per_page=1" + }, + "next": null, + "previous": { + "href": "https://api.example.org/v3/spaces/space-guid/users?page=1&per_page=1" + } + }, + "resources": [ + { + "guid": "9da93b89-3f89-4f05-7238-8a2b123c79l9", + "created_at": "2019-03-08T01:06:19Z", + "updated_at": "2019-03-08T01:06:19Z", + "username": "some-name-2", + "presentation_name": "some-name-2", + "origin": "ldap", + "metadata": { + "labels": {}, + "annotations":{} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/9da93b89-3f89-4f05-7238-8a2b123c79l9" + } + } + } + ] +}` + +const updateV3SpacePayload = ` +{ + "guid": "space-guid", + "created_at": "2017-02-01T01:33:58Z", + "updated_at": "2017-02-01T01:33:58Z", + "name": "my-space", + "relationships": { + "organization": { + "data": { + "guid": "org-guid" + } + }, + "quota": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/spaces/space-guid" + }, + "features": { + "href": "https://api.example.org/v3/spaces/space-guid/features" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/org-guid" + }, + "apply_manifest": { + "href": "https://api.example.org/v3/spaces/space-guid/actions/apply_manifest", + "method": "POST" + } + }, + "metadata": { + "labels": { + "SPACE_KEY": "space_value" + }, + "annotations": {} + } +}` + +const getV3SpacePayload = `{ + "guid": "space-guid", + "created_at": "2017-02-01T01:33:58Z", + "updated_at": "2017-02-01T01:33:58Z", + "name": "my-space", + "relationships": { + "organization": { + "data": { + "guid": "org-guid" + } + }, + "quota": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/spaces/space-guid" + }, + "features": { + "href": "https://api.example.org/v3/spaces/space-guid/features" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/org-guid" + }, + "apply_manifest": { + "href": "https://api.example.org/v3/spaces/space-guid/actions/apply_manifest", + "method": "POST" + } + }, + "metadata": { + "labels": { + "SPACE_KEY": "space_value" + }, + "annotations": {} + } +}` + +const createV3RoutePayload = `{ + "guid": "cbad697f-cac1-48f4-9017-ac08f39dfb31", + "host": "a-hostname", + "path": "/some_path", + "url": "a-hostname.a-domain.com/some_path", + "created_at": "2019-05-10T17:17:48Z", + "updated_at": "2019-05-10T17:17:48Z", + "metadata": { + "labels": { "key": "value" }, + "annotations": { "note": "detailed information" } + }, + "relationships": { + "space": { + "data": { + "guid": "885a8cb3-c07b-4856-b448-eeb10bf36236" + } + }, + "domain": { + "data": { + "guid": "0b5f3633-194c-42d2-9408-972366617e0e" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/routes/cbad697f-cac1-48f4-9017-ac08f39dfb31" + }, + "space": { + "href": "https://api.example.org/v3/spaces/885a8cb3-c07b-4856-b448-eeb10bf36236" + }, + "domain": { + "href": "https://api.example.org/v3/domains/0b5f3633-194c-42d2-9408-972366617e0e" + }, + "destinations": { + "href": "https://api.example.org/v3/routes/cbad697f-cac1-48f4-9017-ac08f39dfb31/destinations" + } + } +}` + +const createV3SpaceRolePayload = `{ + "guid": "b9f59ab2-2b09-438e-bebb-30e8704ffb89", + "created_at": "2022-05-31T20:14:13Z", + "updated_at": "2022-05-31T20:14:13Z", + "type": "space_supporter", + "relationships": { + "user": { + "data": { + "guid": "c4958204-6b65-43ea-832b-e4c57aea6641" + } + }, + "space": { + "data": { + "guid": "b40a40c8-58b7-49a0-b47d-9d6fe5d72905" + } + }, + "organization": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/b9f59ab2-2b09-438e-bebb-30e8704ffb89" + }, + "user": { + "href": "https://api.example.org/v3/users/c4958204-6b65-43ea-832b-e4c57aea6641" + }, + "space": { + "href": "https://api.example.org/v3/spaces/b40a40c8-58b7-49a0-b47d-9d6fe5d72905" + } + } +}` + +const createV3OrganizationRolePayload = `{ + "guid": "21cbfaeb-bff7-4cfd-a7a9-6c13ec76f246", + "created_at": "2022-05-31T18:19:42Z", + "updated_at": "2022-05-31T18:19:42Z", + "type": "organization_user", + "relationships": { + "user": { + "data": { + "guid": "ac2e02c9-2c5c-4712-a620-a68449d263c3" + } + }, + "organization": { + "data": { + "guid": "fa8a8346-0d92-4729-870c-77ee1934f973" + } + }, + "space": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/roles/21cbfaeb-bff7-4cfd-a7a9-6c13ec76f246" + }, + "user": { + "href": "https://api.example.org/v3/users/ac2e02c9-2c5c-4712-a620-a68449d263c3" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/fa8a8346-0d92-4729-870c-77ee1934f973" + } + } +}` + +const createV3SpacePayload = `{ + "guid": "space-guid", + "created_at": "2017-02-01T01:33:58Z", + "updated_at": "2017-02-01T01:33:58Z", + "name": "my-space", + "relationships": { + "organization": { + "data": { + "guid": "org-guid" + } + }, + "quota": { + "data": null + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/spaces/space-guid" + }, + "features": { + "href": "https://api.example.org/v3/spaces/space-guid/features" + }, + "organization": { + "href": "https://api.example.org/v3/organizations/org-guid" + }, + "apply_manifest": { + "href": "https://api.example.org/v3/spaces/space-guid/actions/apply_manifest", + "method": "POST" + } + }, + "metadata": { + "labels": { + "SPACE_KEY": "space_value" + }, + "annotations": {} + } +}` + +const getV3AppPayload = `{ + "guid": "1cb006ee-fb05-47e1-b541-c34179ddc446", + "name": "my_app", + "state": "STOPPED", + "created_at": "2016-03-17T21:41:30Z", + "updated_at": "2016-06-08T16:41:26Z", + "lifecycle": { + "type": "buildpack", + "data": { + "buildpacks": ["java_buildpack"], + "stack": "cflinuxfs2" + } + }, + "relationships": { + "space": { + "data": { + "guid": "2f35885d-0c9d-4423-83ad-fd05066f8576" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446" + }, + "space": { + "href": "https://api.example.org/v3/spaces/2f35885d-0c9d-4423-83ad-fd05066f8576" + }, + "processes": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/processes" + }, + "route_mappings": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/route_mappings" + }, + "packages": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/packages" + }, + "environment_variables": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/environment_variables" + }, + "current_droplet": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/droplets/current" + }, + "droplets": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/droplets" + }, + "tasks": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/tasks" + }, + "start": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/actions/start", + "method": "POST" + }, + "stop": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/actions/stop", + "method": "POST" + } + }, + "metadata": { + "labels": {}, + "annotations": { + "contacts": "Bill tel(1111111) email(bill@fixme), Bob tel(222222) pager(3333333#555) email(bob@fixme)" + } + } +}` + +const getV3AppEnvPayload = `{ + "staging_env_json": { + "GEM_CACHE": "http://gem-cache.example.org" + }, + "running_env_json": { + "HTTP_PROXY": "http://proxy.example.org" + }, + "environment_variables": { + "RAILS_ENV": "production" + }, + "system_env_json": { + "VCAP_SERVICES": { + "mysql": [ + { + "name": "db-for-my-app", + "label": "mysql", + "tags": ["relational", "sql"], + "plan": "xlarge", + "credentials": { + "username": "user", + "password": "top-secret" + }, + "syslog_drain_url": "https://syslog.example.org/drain", + "provider": null + } + ] + } + }, + "application_env_json": { + "VCAP_APPLICATION": { + "limits": { + "fds": 16384 + }, + "application_name": "my_app", + "application_uris": [ "my_app.example.org" ], + "name": "my_app", + "space_name": "my_space", + "space_id": "2f35885d-0c9d-4423-83ad-fd05066f8576", + "uris": [ "my_app.example.org" ], + "users": null + } + } +}` + +const createV3AppPayload = `{ + "guid": "app-guid", + "name": "my-app", + "state": "STOPPED", + "created_at": "2016-03-17T21:41:30Z", + "updated_at": "2016-06-08T16:41:26Z", + "lifecycle": { + "type": "buildpack", + "data": { + "buildpacks": ["java_buildpack"], + "stack": "cflinuxfs2" + } + }, + "relationships": { + "space": { + "data": { + "guid": "space-guid" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/apps/app-guid" + }, + "space": { + "href": "https://api.example.org/v3/spaces/space-guid" + }, + "processes": { + "href": "https://api.example.org/v3/apps/app-guid/processes" + }, + "route_mappings": { + "href": "https://api.example.org/v3/apps/app-guid/route_mappings" + }, + "packages": { + "href": "https://api.example.org/v3/apps/app-guid/packages" + }, + "environment_variables": { + "href": "https://api.example.org/v3/apps/app-guid/environment_variables" + }, + "current_droplet": { + "href": "https://api.example.org/v3/apps/app-guid/droplets/current" + }, + "droplets": { + "href": "https://api.example.org/v3/apps/app-guid/droplets" + }, + "tasks": { + "href": "https://api.example.org/v3/apps/app-guid/tasks" + }, + "start": { + "href": "https://api.example.org/v3/apps/app-guid/actions/start", + "method": "POST" + }, + "stop": { + "href": "https://api.example.org/v3/apps/app-guid/actions/stop", + "method": "POST" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } +}` + +const createV3BuildPayload = `{ + "guid": "585bc3c1-3743-497d-88b0-403ad6b56d16", + "created_at": "2016-03-28T23:39:34Z", + "updated_at": "2016-06-08T16:41:26Z", + "created_by": { + "guid": "3cb4e243-bed4-49d5-8739-f8b45abdec1c", + "name": "bill", + "email": "bill@example.com" + }, + "state": "STAGING", + "error": null, + "lifecycle": { + "type": "buildpack", + "data": { + "buildpacks": [ "ruby_buildpack" ], + "stack": "cflinuxfs2" + } + }, + "package": { + "guid": "8e4da443-f255-499c-8b47-b3729b5b7432" + }, + "droplet": null, + "metadata": { + "labels": { }, + "annotations": { } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/builds/585bc3c1-3743-497d-88b0-403ad6b56d16" + }, + "app": { + "href": "https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396" + } + } +} +` + +const listIsolationSegmentsPayload = `{ + "pagination": { + "total_results": 2, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/isolation_segments?page=1&per_page=50" + }, + "last": { + "href": "https://api.example.org/v3/isolation_segments?page=1&per_page=50" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "033b4c58-12bb-499a-b05d-4b6fc9e2993b", + "name": "shared", + "created_at": "2017-04-02T11:22:04Z", + "updated_at": "2017-04-02T11:22:04Z", + "links": { + "self": { + "href": "https://api.example.org/v3/isolation_segments/033b4c58-12bb-499a-b05d-4b6fc9e2993b" + }, + "organizations": { + "href": "https://api.example.org/v3/isolation_segments/033b4c58-12bb-499a-b05d-4b6fc9e2993b/organizations" + }, + "spaces": { + "href": "https://api.example.org/v3/isolation_segments/033b4c58-12bb-499a-b05d-4b6fc9e2993b/relationships/spaces" + } + } + }, + { + "guid": "23d0baf4-9d3c-44d8-b2dc-1767bcdad1e0", + "name": "my_segment", + "created_at": "2017-04-07T11:20:16Z", + "updated_at": "2017-04-07T11:20:16Z", + "links": { + "self": { + "href": "https://api.example.org/v3/isolation_segments/23d0baf4-9d3c-44d8-b2dc-1767bcdad1e0" + }, + "organizations": { + "href": "https://api.example.org/v3/isolation_segments/23d0baf4-9d3c-44d8-b2dc-1767bcdad1e0/organizations" + }, + "spaces": { + "href": "https://api.example.org/v3/isolation_segments/23d0baf4-9d3c-44d8-b2dc-1767bcdad1e0/relationships/spaces" + } + } + } + ] +}` + +const listIsolationSegmentsPayloadPage1 = `{ + "pagination": { + "total_results": 4, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/isolation_segments?page=1&per_page=2" + }, + "last": { + "href": "https://api.example.org/v3/isolation_segments?page=2&per_page=2" + }, + "next": { + "href": "https://api.example.org/v3/isolation_segments?page=2&per_page=2" + }, + "previous": null + }, + "resources": [ + { + "guid": "033b4c58-12bb-499a-b05d-4b6fc9e2993b", + "name": "shared", + "created_at": "2017-04-02T11:22:04Z", + "updated_at": "2017-04-02T11:22:04Z", + "links": { + "self": { + "href": "https://api.example.org/v3/isolation_segments/033b4c58-12bb-499a-b05d-4b6fc9e2993b" + }, + "organizations": { + "href": "https://api.example.org/v3/isolation_segments/033b4c58-12bb-499a-b05d-4b6fc9e2993b/organizations" + }, + "spaces": { + "href": "https://api.example.org/v3/isolation_segments/033b4c58-12bb-499a-b05d-4b6fc9e2993b/relationships/spaces" + } + } + }, + { + "guid": "23d0baf4-9d3c-44d8-b2dc-1767bcdad1e0", + "name": "my_segment", + "created_at": "2017-04-07T11:20:16Z", + "updated_at": "2017-04-07T11:20:16Z", + "links": { + "self": { + "href": "https://api.example.org/v3/isolation_segments/23d0baf4-9d3c-44d8-b2dc-1767bcdad1e0" + }, + "organizations": { + "href": "https://api.example.org/v3/isolation_segments/23d0baf4-9d3c-44d8-b2dc-1767bcdad1e0/organizations" + }, + "spaces": { + "href": "https://api.example.org/v3/isolation_segments/23d0baf4-9d3c-44d8-b2dc-1767bcdad1e0/relationships/spaces" + } + } + } + ] +}` + +const listIsolationSegmentsPayloadPage2 = `{ + "pagination": { + "total_results": 4, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/isolation_segments?page=1&per_page=2" + }, + "last": { + "href": "https://api.example.org/v3/isolation_segments?page=2&per_page=2" + }, + "next": null, + "previous": { + "href": "https://api.example.org/v3/isolation_segments?page=1&per_page=2" + } + }, + "resources": [ + { + "guid": "abcdefg12-12bb-499a-b05d-4b6fc9e2993b", + "name": "shared1", + "created_at": "2017-05-02T11:22:04Z", + "updated_at": "2017-05-02T11:22:04Z", + "links": { + "self": { + "href": "https://api.example.org/v3/isolation_segments/abcdefg12-12bb-499a-b05d-4b6fc9e2993b" + }, + "organizations": { + "href": "https://api.example.org/v3/isolation_segments/abcdefg12-12bb-499a-b05d-4b6fc9e2993b/organizations" + }, + "spaces": { + "href": "https://api.example.org/v3/isolation_segments/abcdefg12-12bb-499a-b05d-4b6fc9e2993b/relationships/spaces" + } + } + }, + { + "guid": "abcdef123-9d3c-44d8-b2dc-1767bcdad1e0", + "name": "my_segment1", + "created_at": "2017-05-07T11:20:16Z", + "updated_at": "2017-05-07T11:20:16Z", + "links": { + "self": { + "href": "https://api.example.org/v3/isolation_segments/abcdef123-9d3c-44d8-b2dc-1767bcdad1e0" + }, + "organizations": { + "href": "https://api.example.org/v3/isolation_segments/abcdef123-9d3c-44d8-b2dc-1767bcdad1e0/organizations" + }, + "spaces": { + "href": "https://api.example.org/v3/isolation_segments/abcdef123-9d3c-44d8-b2dc-1767bcdad1e0/relationships/spaces" + } + } + } + ] +}` + +const startV3AppPayload = `{ + "guid": "1cb006ee-fb05-47e1-b541-c34179ddc446", + "name": "my_app", + "state": "STARTED", + "created_at": "2016-03-17T21:41:30Z", + "updated_at": "2016-03-18T11:32:30Z", + "lifecycle": { + "type": "buildpack", + "data": { + "buildpacks": ["java_buildpack"], + "stack": "cflinuxfs2" + } + }, + "relationships": { + "space": { + "data": { + "guid": "2f35885d-0c9d-4423-83ad-fd05066f8576" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446" + }, + "space": { + "href": "https://api.example.org/v3/spaces/2f35885d-0c9d-4423-83ad-fd05066f8576" + }, + "processes": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/processes" + }, + "route_mappings": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/route_mappings" + }, + "packages": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/packages" + }, + "environment_variables": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/environment_variables" + }, + "current_droplet": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/droplets/current" + }, + "droplets": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/droplets" + }, + "tasks": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/tasks" + }, + "start": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/actions/start", + "method": "POST" + }, + "stop": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/actions/stop", + "method": "POST" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } +}` + +const updateV3AppPayload = `{ + "guid": "1cb006ee-fb05-47e1-b541-c34179ddc446", + "name": "my_app", + "state": "STARTED", + "created_at": "2016-03-17T21:41:30Z", + "updated_at": "2016-03-18T11:32:30Z", + "lifecycle": { + "type": "buildpack", + "data": { + "buildpacks": ["java_buildpack"], + "stack": "cflinuxfs2" + } + }, + "relationships": { + "space": { + "data": { + "guid": "2f35885d-0c9d-4423-83ad-fd05066f8576" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446" + }, + "space": { + "href": "https://api.example.org/v3/spaces/2f35885d-0c9d-4423-83ad-fd05066f8576" + }, + "processes": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/processes" + }, + "route_mappings": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/route_mappings" + }, + "packages": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/packages" + }, + "environment_variables": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/environment_variables" + }, + "current_droplet": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/droplets/current" + }, + "droplets": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/droplets" + }, + "tasks": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/tasks" + }, + "start": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/actions/start", + "method": "POST" + }, + "stop": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/actions/stop", + "method": "POST" + } + }, + "metadata": { + "labels": { + "environment": "production", + "internet-facing": "false" + }, + "annotations": {} + } +}` + +const currentDropletV3AppPayload = `{ + "data": { + "guid": "9d8e007c-ce52-4ea7-8a57-f2825d2c6b39" + }, + "links": { + "self": { + "href": "https://api.example.org/v3/apps/d4c91047-7b29-4fda-b7f9-04033e5c9c9f/relationships/current_droplet" + }, + "related": { + "href": "https://api.example.org/v3/apps/d4c91047-7b29-4fda-b7f9-04033e5c9c9f/droplets/current" + } + } +}` + +const getV3CurrentAppDropletPayload = `{ + "guid": "585bc3c1-3743-497d-88b0-403ad6b56d16", + "state": "STAGED", + "error": null, + "lifecycle": { + "type": "buildpack", + "data": {} + }, + "execution_metadata": "", + "process_types": { + "rake": "bundle exec rake", + "web": "bundle exec rackup config.ru -p $PORT" + }, + "checksum": { + "type": "sha256", + "value": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "buildpacks": [ + { + "name": "ruby_buildpack", + "detect_output": "ruby 1.6.14", + "version": "1.1.1.", + "buildpack_name": "ruby" + } + ], + "stack": "cflinuxfs3", + "image": null, + "created_at": "2016-03-28T23:39:34Z", + "updated_at": "2016-03-28T23:39:47Z", + "relationships": { + "app": { + "data": { + "guid": "7b34f1cf-7e73-428a-bb5a-8a17a8058396" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/droplets/585bc3c1-3743-497d-88b0-403ad6b56d16" + }, + "package": { + "href": "https://api.example.org/v3/packages/8222f76a-9e09-4360-b3aa-1ed329945e92" + }, + "app": { + "href": "https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396" + }, + "assign_current_droplet": { + "href": "https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396/relationships/current_droplet", + "method": "PATCH" + }, + "download": { + "href": "https://api.example.org/v3/droplets/585bc3c1-3743-497d-88b0-403ad6b56d16/download" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } +}` + +const listV3AppsPayload = `{ + "pagination": { + "total_results": 2, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/apps?page=1&per_page=2" + }, + "last": { + "href": "https://api.example.org/v3/apps?page=2&per_page=2" + }, + "next": { + "href": "https://api.example.org/v3/apps?page=2&per_page=2" + }, + "previous": null + }, + "resources": [ + { + "guid": "1cb006ee-fb05-47e1-b541-c34179ddc446", + "name": "my_app", + "state": "STARTED", + "created_at": "2016-03-17T21:41:30Z", + "updated_at": "2016-03-18T11:32:30Z", + "lifecycle": { + "type": "buildpack", + "data": { + "buildpacks": ["java_buildpack"], + "stack": "cflinuxfs2" + } + }, + "relationships": { + "space": { + "data": { + "guid": "2f35885d-0c9d-4423-83ad-fd05066f8576" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446" + }, + "space": { + "href": "https://api.example.org/v3/spaces/2f35885d-0c9d-4423-83ad-fd05066f8576" + }, + "processes": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/processes" + }, + "route_mappings": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/route_mappings" + }, + "packages": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/packages" + }, + "environment_variables": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/environment_variables" + }, + "current_droplet": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/droplets/current" + }, + "droplets": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/droplets" + }, + "tasks": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/tasks" + }, + "start": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/actions/start", + "method": "POST" + }, + "stop": { + "href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/actions/stop", + "method": "POST" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } + } + ] +}` + +const listV3AppsPayloadPage2 = `{ + "pagination": { + "total_results": 2, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/apps?page=1&per_page=2" + }, + "last": { + "href": "https://api.example.org/v3/apps?page=2&per_page=2" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "02b4ec9b-94c7-4468-9c23-4e906191a0f8", + "name": "my_app2", + "state": "STOPPED", + "created_at": "1970-01-01T00:00:02Z", + "updated_at": "2016-06-08T16:41:26Z", + "lifecycle": { + "type": "buildpack", + "data": { + "buildpacks": ["ruby_buildpack", "staticfile_buildpack"], + "stack": "cflinuxfs2" + } + }, + "relationships": { + "space": { + "data": { + "guid": "2f35885d-0c9d-4423-83ad-fd05066f8576" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/apps/02b4ec9b-94c7-4468-9c23-4e906191a0f8" + }, + "space": { + "href": "https://api.example.org/v3/spaces/2f35885d-0c9d-4423-83ad-fd05066f8576" + }, + "processes": { + "href": "https://api.example.org/v3/apps/02b4ec9b-94c7-4468-9c23-4e906191a0f8/processes" + }, + "route_mappings": { + "href": "https://api.example.org/v3/apps/02b4ec9b-94c7-4468-9c23-4e906191a0f8/route_mappings" + }, + "packages": { + "href": "https://api.example.org/v3/apps/02b4ec9b-94c7-4468-9c23-4e906191a0f8/packages" + }, + "environment_variables": { + "href": "https://api.example.org/v3/apps/02b4ec9b-94c7-4468-9c23-4e906191a0f8/environment_variables" + }, + "current_droplet": { + "href": "https://api.example.org/v3/apps/02b4ec9b-94c7-4468-9c23-4e906191a0f8/droplets/current" + }, + "droplets": { + "href": "https://api.example.org/v3/apps/02b4ec9b-94c7-4468-9c23-4e906191a0f8/droplets" + }, + "tasks": { + "href": "https://api.example.org/v3/apps/02b4ec9b-94c7-4468-9c23-4e906191a0f8/tasks" + }, + "start": { + "href": "https://api.example.org/v3/apps/02b4ec9b-94c7-4468-9c23-4e906191a0f8/actions/start", + "method": "POST" + }, + "stop": { + "href": "https://api.example.org/v3/apps/02b4ec9b-94c7-4468-9c23-4e906191a0f8/actions/stop", + "method": "POST" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } + } + ] +}` + +const listV3ServiceInstancesPayload = `{ + "pagination": { + "total_results": 1, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/service_instances?page=1&per_page=50" + }, + "last": { + "href": "https://api.example.org/v3/service_instances?page=1&per_page=50" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "85ccdcad-d725-4109-bca4-fd6ba062b5c8", + "created_at": "2017-11-17T13:54:21Z", + "updated_at": "2017-11-17T13:54:21Z", + "name": "my_service_instance", + "relationships": { + "space": { + "data": { + "guid": "ae0031f9-dd49-461c-a945-df40e77c39cb" + } + } + }, + "metadata": { + "labels": { }, + "annotations": { } + }, + "links": { + "space": { + "href": "https://api.example.org/v3/spaces/ae0031f9-dd49-461c-a945-df40e77c39cb" + } + } + } + ] +}` + +const listV3RoutesPayload = `{ + "pagination": { + "total_results": 1, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/routes?page=1&per_page=1" + }, + "last": { + "href": "https://api.example.org/v3/routes?page=1&per_page=1" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "cbad697f-cac1-48f4-9017-ac08f39dfb31", + "host": "a-hostname", + "path": "/some_path", + "url": "a-hostname.a-domain.com/some_path", + "created_at": "2019-05-10T17:17:48Z", + "updated_at": "2019-05-10T17:17:48Z", + "metadata": { + "labels": {}, + "annotations": {} + }, + "relationships": { + "space": { + "data": { + "guid": "885a8cb3-c07b-4856-b448-eeb10bf36236" + } + }, + "domain": { + "data": { + "guid": "0b5f3633-194c-42d2-9408-972366617e0e" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/routes/cbad697f-cac1-48f4-9017-ac08f39dfb31" + }, + "space": { + "href": "https://api.example.org/v3/spaces/885a8cb3-c07b-4856-b448-eeb10bf36236" + }, + "domain": { + "href": "https://api.example.org/v3/domains/0b5f3633-194c-42d2-9408-972366617e0e" + }, + "destinations": { + "href": "https://api.example.org/v3/routes/cbad697f-cac1-48f4-9017-ac08f39dfb31/destinations" + } + } + } + ] +}` + +const listPackagesForV3AppPayloadPage1 = `{ + "pagination": { + "total_results": 2, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/apps/f2efe391-2b5b-4836-8518-ad93fa9ebf69/packages?page=1&per_page=1" + }, + "last": { + "href": "https://api.example.org/v3/apps/f2efe391-2b5b-4836-8518-ad93fa9ebf69/packages?page=2&per_page=1" + }, + "next": { + "href": "https://api.example.org/v3/apps/f2efe391-2b5b-4836-8518-ad93fa9ebf69/packages?page=2&per_page=1" + }, + "previous": null + }, + "resources": [ + { + "guid": "752edab0-2147-4f58-9c25-cd72ad8c3561", + "type": "bits", + "data": { + "error": null, + "checksum": { + "type": "sha256", + "value": null + } + }, + "state": "READY", + "created_at": "2016-03-17T21:41:09Z", + "updated_at": "2016-06-08T16:41:26Z", + "links": { + "self": { + "href": "https://api.example.org/v3/packages/752edab0-2147-4f58-9c25-cd72ad8c3561" + }, + "upload": { + "href": "https://api.example.org/v3/packages/752edab0-2147-4f58-9c25-cd72ad8c3561/upload", + "method": "POST" + }, + "download": { + "href": "https://api.example.org/v3/packages/752edab0-2147-4f58-9c25-cd72ad8c3561/download", + "method": "GET" + }, + "app": { + "href": "https://api.example.org/v3/apps/f2efe391-2b5b-4836-8518-ad93fa9ebf69" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } + } + ] +}` + +const listPackagesForV3AppPayloadPage2 = `{ + "pagination": { + "total_results": 2, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/apps/f2efe391-2b5b-4836-8518-ad93fa9ebf69/packages?page=1&per_page=1" + }, + "last": { + "href": "https://api.example.org/v3/apps/f2efe391-2b5b-4836-8518-ad93fa9ebf69/packages?page=2&per_page=1" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "2345ab-2147-4f58-9c25-cd72ad8c3561", + "type": "bits", + "data": { + "error": null, + "checksum": { + "type": "sha256", + "value": null + } + }, + "state": "READY", + "created_at": "2016-03-17T21:41:09Z", + "updated_at": "2016-06-08T16:41:26Z", + "links": { + "self": { + "href": "https://api.example.org/v3/packages/2345ab-2147-4f58-9c25-cd72ad8c3561" + }, + "upload": { + "href": "https://api.example.org/v3/packages/2345ab-2147-4f58-9c25-cd72ad8c3561/upload", + "method": "POST" + }, + "download": { + "href": "https://api.example.org/v3/packages/2345ab-2147-4f58-9c25-cd72ad8c3561/download", + "method": "GET" + }, + "app": { + "href": "https://api.example.org/v3/apps/f2efe391-2b5b-4836-8518-ad93fa9ebf69" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } + } + ] +}` + +const copyPackageV3Payload = `{ + "guid": "fec72fc1-e453-4463-a86d-5df426f337a3", + "type": "docker", + "data": { + "image": "http://awesome-sauce.example.org" + }, + "state": "COPYING", + "created_at": "2016-03-17T21:41:09Z", + "updated_at": "2016-06-08T16:41:26Z", + "links": { + "self": { + "href": "https://api.example.org/v3/packages/fec72fc1-e453-4463-a86d-5df426f337a3" + }, + "app": { + "href": "https://api.example.org/v3/apps/36208a68-562d-4f51-94ea-28bd8553a271" + } + }, + "metadata": { + "labels": {}, + "annotations": {} + } +}` + +const getServiceKeyByGuidPayload = `{ + "metadata": { + "guid": "6ad2cc9b-1996-49a3-9538-dfc0da3b1f32", + "url": "/v2/service_keys/6ad2cc9b-1996-49a3-9538-dfc0da3b1f32", + "created_at": "2016-06-08T16:41:23Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-140", + "service_instance_guid": "ca567b3d-e142-4139-94e3-1e0c010ba728", + "credentials": { + "creds-key-7": "creds-val-7" + }, + "service_instance_url": "/v2/service_instances/ca567b3d-e142-4139-94e3-1e0c010ba728", + "service_key_parameters_url": "/v2/service_keys/6ad2cc9b-1996-49a3-9538-dfc0da3b1f32/parameters" + } +} +` + +const listServiceKeysPayloadPage1 = `{ + "total_results": 4, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/service_keys2", + "resources": [ + { + "metadata": { + "guid": "3b933598-64ed-4613-a0f5-b7e8c0379368", + "url": "/v2/service_keys/3b933598-64ed-4613-a0f5-b7e8c0379368", + "created_at": "2016-08-01T15:17:35Z", + "updated_at": "2016-08-01T15:17:35Z" + }, + "entity": { + "name": "RedisMonitoringKey", + "service_instance_guid": "ad98f310-a3a0-47aa-9116-f8295d41a9b2", + "credentials": { + "host": "10.10.10.10", + "password": "some-password", + "port": 12345 + }, + "service_instance_url": "/v2/service_instances/ad98f310-a3a0-47aa-9116-f8295d41a9b2" + } + }, + { + "metadata": { + "guid": "8be3911b-c621-4467-8866-f8b924aaee57", + "url": "/v2/service_keys/8be3911b-c621-4467-8866-f8b924aaee57", + "created_at": "2017-05-16T12:14:46Z", + "updated_at": "2017-05-16T12:14:46Z" + }, + "entity": { + "name": "test01_key", + "service_instance_guid": "ecf26687-e176-4784-b181-b3c942fecb62", + "credentials": { + "jms": "nhp://100.100.100.100:9008", + "js_uri": "http://100.100.100.100:9008", + "amqp": "amqp://100.100.100.100:9008", + "nhp": "nhp://100.100.100.100:9009", + "mqtt": "tcp://100.100.100.100:9008", + "name": "fcf26687-e176-4784-b181-b3c942fecb62", + "nsp": "nsp://100.100.100.100:9008", + "userid": "cfu-9be3911b-c621-4467-8866-f8b924aaee57", + "uri": "nhp://100.100.100.100:9008", + "uriInfos": [ + { + "host": "100.100.100.100", + "port": 9008 + } + ] + }, + "service_instance_url": "/v2/service_instances/fcf26687-e176-4784-b181-b3c942fecb62" + } + } + ] +}` + +const listServiceKeysPayloadPage2 = `{ + "total_results": 4, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "3b933598-64ed-4613-a0f5-b7e8c0379368", + "url": "/v2/service_keys/3b933598-64ed-4613-a0f5-b7e8c0379368", + "created_at": "2016-08-01T15:17:35Z", + "updated_at": "2016-08-01T15:17:35Z" + }, + "entity": { + "name": "RedisMonitoringKey", + "service_instance_guid": "ad98f310-a3a0-47aa-9116-f8295d41a9b2", + "credentials": { + "host": "10.10.10.10", + "password": "some-password", + "port": 12345 + }, + "service_instance_url": "/v2/service_instances/ad98f310-a3a0-47aa-9116-f8295d41a9b2" + } + }, + { + "metadata": { + "guid": "8be3911b-c621-4467-8866-f8b924aaee57", + "url": "/v2/service_keys/8be3911b-c621-4467-8866-f8b924aaee57", + "created_at": "2017-05-16T12:14:46Z", + "updated_at": "2017-05-16T12:14:46Z" + }, + "entity": { + "name": "test01_key", + "service_instance_guid": "ecf26687-e176-4784-b181-b3c942fecb62", + "credentials": { + "jms": "nhp://100.100.100.100:9008", + "js_uri": "http://100.100.100.100:9008", + "amqp": "amqp://100.100.100.100:9008", + "nhp": "nhp://100.100.100.100:9009", + "mqtt": "tcp://100.100.100.100:9008", + "name": "fcf26687-e176-4784-b181-b3c942fecb62", + "nsp": "nsp://100.100.100.100:9008", + "userid": "cfu-9be3911b-c621-4467-8866-f8b924aaee57", + "uri": "nhp://100.100.100.100:9008", + "uriInfos": [ + { + "host": "100.100.100.100", + "port": 9008 + } + ] + }, + "service_instance_url": "/v2/service_instances/fcf26687-e176-4784-b181-b3c942fecb62" + } + } + ] +}` + +const getServiceKeyPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "8be3911b-c621-4467-8866-f8b924aaee57", + "url": "/v2/service_keys/8be3911b-c621-4467-8866-f8b924aaee57", + "created_at": "2017-05-16T12:14:46Z", + "updated_at": "2017-05-16T12:14:46Z" + }, + "entity": { + "name": "test01_key", + "service_instance_guid": "ecf26687-e176-4784-b181-b3c942fecb62", + "credentials": { + "jms": "nhp://100.100.100.100:9008", + "js_uri": "http://100.100.100.100:9008", + "amqp": "amqp://100.100.100.100:9008", + "nhp": "nhp://100.100.100.100:9009", + "mqtt": "tcp://100.100.100.100:9008", + "name": "ecf26687-e176-4784-b181-b3c942fecb62", + "nsp": "nsp://100.100.100.100:9008", + "userid": "cfu-9be3911b-c621-4467-8866-f8b924aaee57", + "uri": "nhp://100.100.100.100:9008", + "uriInfos": [ + { + "host": "100.100.100.100", + "port": 9008 + } + ] + }, + "service_instance_url": "/v2/service_instances/ecf26687-e176-4784-b181-b3c942fecb62" + } + } + ] +}` + +const getServiceKeysPayload = `{ + "total_results": 2, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "8be3911b-c621-4467-8866-f8b924aaee57", + "url": "/v2/service_keys/8be3911b-c621-4467-8866-f8b924aaee57", + "created_at": "2017-05-16T12:14:46Z", + "updated_at": "2017-05-16T12:14:46Z" + }, + "entity": { + "name": "test01_key", + "service_instance_guid": "ecf26687-e176-4784-b181-b3c942fecb62", + "credentials": { + "jms": "nhp://100.100.100.100:9008", + "js_uri": "http://100.100.100.100:9008", + "amqp": "amqp://100.100.100.100:9008", + "nhp": "nhp://100.100.100.100:9009", + "mqtt": "tcp://100.100.100.100:9008", + "name": "ecf26687-e176-4784-b181-b3c942fecb62", + "nsp": "nsp://100.100.100.100:9008", + "userid": "cfu-9be3911b-c621-4467-8866-f8b924aaee57", + "uri": "nhp://100.100.100.100:9008", + "uriInfos": [ + { + "host": "100.100.100.100", + "port": 9008 + } + ] + }, + "service_instance_url": "/v2/service_instances/ecf26687-e176-4784-b181-b3c942fecb62" + } + }, + { + "metadata": { + "guid": "9361b5dc-9262-4a83-8969-9b3469211884", + "url": "/v2/service_keys/9361b5dc-9262-4a83-8969-9b3469211884", + "created_at": "2017-10-24T17:00:46Z", + "updated_at": "2017-10-24T17:00:46Z" + }, + "entity": { + "name": "test02_key", + "service_instance_guid": "ecf26687-e176-4784-b181-b3c942fecb62", + "credentials": { + "jms": "nhp://100.100.47.11:9008", + "js_uri": "http://100.100.47.11:9008", + "amqp": "amqp://100.100.47.11:9008", + "nhp": "nhp://100.100.47.11:9009", + "mqtt": "tcp://100.100.47.11.100:9008", + "name": "ecf26687-e176-4784-b181-b3c942fecb62", + "nsp": "nsp://100.100.47.11:9008", + "userid": "cfu-7fb486c4-4d9e-49cb-b121-3241ece5dc10", + "uri": "nhp://100.100.47.11:9008", + "uriInfos": [ + { + "host": "100.100.47.11", + "port": 9008 + } + ] + }, + "service_instance_url": "/v2/service_instances/ecf26687-e176-4784-b181-b3c942fecb62" + } + } + + ] +}` + +const postServiceKeysPayload = `{ + "metadata": { + "guid": "9361b5dc-9262-4a83-8969-9b3469211884", + "url": "/v2/service_keys/9361b5dc-9262-4a83-8969-9b3469211884", + "created_at": "2017-10-25T17:31:23Z", + "updated_at": "2017-10-25T17:31:23Z" + }, + "entity": { + "name": "key1", + "service_instance_guid": "ecf26687-e176-4784-b181-b3c942fecb62", + "credentials": { + "jms": "nhp://100.100.47.11:9008", + "js_uri": "http://100.100.47.11:9008", + "amqp": "amqp://100.100.47.11:9008", + "nhp": "nhp://100.100.47.11:9009", + "mqtt": "tcp://100.100.47.11.100:9008", + "name": "ecf26687-e176-4784-b181-b3c942fecb62", + "nsp": "nsp://100.100.47.11:9008", + "userid": "cfu-7fb486c4-4d9e-49cb-b121-3241ece5dc10", + "uri": "nhp://100.100.47.11:9008", + "uriInfos": [ + { + "host": "100.100.47.11", + "port": 9008 + } + ] + }, + "service_instance_url": "/v2/service_instances/ecf26687-e176-4784-b181-b3c942fecb62" + } +}` + +const postServiceKeysDuplicatePayload = `{ + "description": "The service key name is taken: key1", + "error_code": "CF-ServiceKeyNameTaken", + "code": 360001 +}` + +const postServiceKeysBadPayload = `{ + "description": "The service key name is taken: key1", + "error_code": "CF-ServiceKeyNameTaken", + "code": 360001 +` + +const listServiceBrokersPayload = ` +{ + "total_results": 3, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "90a413fd-a636-4133-8bfb-a94b07839e96", + "url": "/v2/service_brokers/90a413fd-a636-4133-8bfb-a94b07839e96", + "created_at": "2016-06-08T16:41:22Z", + "updated_at": "2016-06-08T16:41:22Z" + }, + "entity": { + "name": "name-85", + "broker_url": "https://foo.com/url-2", + "auth_username": "auth_username-2", + "space_guid": "1d43e64d-ed64-43dd-9046-11f422bd407b" + } + } + ] +} +` + +const getServiceByGuidPayload = ` +{ + "metadata": { + "guid": "53f52780-e93c-4af7-a96c-6958311c40e5", + "url": "/v2/services/53f52780-e93c-4af7-a96c-6958311c40e5", + "created_at": "2016-06-08T16:41:32Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "label": "label-58", + "provider": null, + "url": null, + "description": "desc-135", + "long_description": null, + "version": null, + "info_url": null, + "active": true, + "bindable": true, + "unique_id": "c181996b-f233-43d1-8901-3a43eafcaacf", + "extra": null, + "tags": [ + + ], + "requires": [ + + ], + "documentation_url": null, + "service_broker_guid": "0e7250aa-364f-42c2-8fd2-808b0224376f", + "plan_updateable": false, + "service_plans_url": "/v2/services/53f52780-e93c-4af7-a96c-6958311c40e5/service_plans" + } +} +` + +const buildpackUploadPayload = `{ "metadata":{ "guid": "my-job-guid" } }` + +const buildpackUpdatePayload = ` +{ + "metadata": { + "guid": "c92b6f5f-d2a4-413a-b515-647d059723aa", + "url": "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:31Z" + }, + "entity": { + "name": "renamed-buildpack", + "position": 2, + "enabled": true, + "locked": true, + "filename": "my-file", + "stack": "cflinuxfs2" + } +}` +const buildpackCreatePayload = ` +{ + "metadata": { + "guid": "c92b6f5f-d2a4-413a-b515-647d059723aa", + "url": "/v2/buildpacks/c92b6f5f-d2a4-413a-b515-647d059723aa", + "created_at": "2016-06-08T16:41:31Z", + "updated_at": "2016-06-08T16:41:31Z" + }, + "entity": { + "name": "test-buildpack", + "position": 10, + "enabled": true, + "locked": false, + "filename": null, + "stack": "cflinuxfs2" + } +}` + +const listAppUsageEventsPayload = ` +{ + "total_results": 4, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/app_usage_events?results-per-page=2&page=2", + "resources": [ + { + "metadata": { + "guid": "b32241a5-5508-4d42-893c-360e42a300b6", + "url": "/v2/app_usage_events/b32241a5-5508-4d42-893c-360e42a300b6", + "created_at": "2016-06-08T16:41:33Z" + }, + "entity": { + "state": "STARTED", + "previous_state": null, + "memory_in_mb_per_instance": 564, + "previous_memory_in_mb_per_instance": null, + "instance_count": 1, + "previous_instance_count": null, + "app_guid": "guid-d9fbb7f8-cba5-44a2-b720-c24f1fe5e1c4", + "app_name": "name-1663", + "space_guid": "guid-5e28f12f-9d80-473e-b826-537b148eb338", + "space_name": "name-1664", + "org_guid": "guid-036444f4-f2f5-4ea8-a353-e73330ca0f0a", + "buildpack_guid": "guid-df37754c-819b-4697-a523-4b457d3c83dd", + "buildpack_name": "name-1665", + "package_state": "STAGED", + "previous_package_state": null, + "parent_app_guid": null, + "parent_app_name": null, + "process_type": "web", + "task_name": null, + "task_guid": null + } + }, + { + "metadata": { + "guid": "b32241a5-5508-4d42-893c-360e42a300a8", + "url": "/v2/app_usage_events/b32241a5-5508-4d42-893c-360e42a300a8", + "created_at": "2016-06-08T16:41:33Z" + }, + "entity": { + "state": "STARTED", + "previous_state": null, + "memory_in_mb_per_instance": 564, + "previous_memory_in_mb_per_instance": null, + "instance_count": 1, + "previous_instance_count": null, + "app_guid": "guid-d9fbb7f8-cba5-44a2-b720-c24f1fe5e1c4", + "app_name": "name-1663", + "space_guid": "guid-5e28f12f-9d80-473e-b826-537b148eb338", + "space_name": "name-1664", + "org_guid": "guid-036444f4-f2f5-4ea8-a353-e73330ca0f0a", + "buildpack_guid": "guid-df37754c-819b-4697-a523-4b457d3c83dd", + "buildpack_name": "name-1665", + "package_state": "STARTED", + "previous_package_state": null, + "parent_app_guid": null, + "parent_app_name": null, + "process_type": "web", + "task_name": null, + "task_guid": null + } + } + ] +}` + +const listAppUsageEventsPayloadPage2 = ` +{ + "total_results": 4, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "b32241a5-5508-4d42-893c-360e42a300b6", + "url": "/v2/app_usage_events/b32241a5-5508-4d42-893c-360e42a300b6", + "created_at": "2016-06-08T16:41:33Z" + }, + "entity": { + "state": "STOPPED", + "previous_state": null, + "memory_in_mb_per_instance": 564, + "previous_memory_in_mb_per_instance": null, + "instance_count": 1, + "previous_instance_count": null, + "app_guid": "guid-d9fbb7f8-cba5-44a2-b720-c24f1fe5e1c4", + "app_name": "name-1663", + "space_guid": "guid-5e28f12f-9d80-473e-b826-537b148eb338", + "space_name": "name-1664", + "org_guid": "guid-036444f4-f2f5-4ea8-a353-e73330ca0f0a", + "buildpack_guid": "guid-df37754c-819b-4697-a523-4b457d3c83dd", + "buildpack_name": "name-1665", + "package_state": "STAGED", + "previous_package_state": null, + "parent_app_guid": null, + "parent_app_name": null, + "process_type": "web", + "task_name": null, + "task_guid": null + } + }, + { + "metadata": { + "guid": "b32241a5-5508-4d42-893c-360e42a300a8", + "url": "/v2/app_usage_events/b32241a5-5508-4d42-893c-360e42a300a8", + "created_at": "2016-06-08T16:41:33Z" + }, + "entity": { + "state": "CRASHED", + "previous_state": null, + "memory_in_mb_per_instance": 564, + "previous_memory_in_mb_per_instance": null, + "instance_count": 1, + "previous_instance_count": null, + "app_guid": "guid-d9fbb7f8-cba5-44a2-b720-c24f1fe5e1c4", + "app_name": "name-1663", + "space_guid": "guid-5e28f12f-9d80-473e-b826-537b148eb338", + "space_name": "name-1664", + "org_guid": "guid-036444f4-f2f5-4ea8-a353-e73330ca0f0a", + "buildpack_guid": "guid-df37754c-819b-4697-a523-4b457d3c83dd", + "buildpack_name": "name-1665", + "package_state": "STARTED", + "previous_package_state": null, + "parent_app_guid": null, + "parent_app_name": null, + "process_type": "web", + "task_name": null, + "task_guid": null + } + } + ] +}` + +const listServiceUsageEventsPayload = ` +{ + "total_results": 4, + "total_pages": 2, + "prev_url": null, + "next_url": "/v2/service_usage_events?results-per-page=2&page=2", + "resources": [ + { + "metadata": { + "guid": "985c09c5-bf5a-44eb-a260-41c532dc0f1d", + "url": "/v2/service_usage_events/985c09c5-bf5a-44eb-a260-41c532dc0f1d", + "created_at": "2016-06-08T16:41:39Z" + }, + "entity": { + "state": "CREATED", + "org_guid": "guid-396a8cb9-5524-4a2b-8e9e-2bfc70edb58d", + "space_guid": "guid-be1f6fe3-e63a-41a3-b196-3fc084022823", + "space_name": "name-1981", + "service_instance_guid": "guid-f93250f7-7ef5-4b02-8d33-353919ce8358", + "service_instance_name": "name-1982", + "service_instance_type": "type-5", + "service_plan_guid": "guid-e9d2d5a0-69a6-46ef-bac5-43f3ed177614", + "service_plan_name": "name-1983", + "service_guid": "guid-34916716-31d7-40c1-9afd-f312996c9654", + "service_label": "label-64" + } + }, + { + "metadata": { + "guid": "985c09c5-bf5a-44eb-a260-41c532dc0f2a", + "url": "/v2/service_usage_events/985c09c5-bf5a-44eb-a260-41c532dc0f1d", + "created_at": "2016-06-08T16:41:39Z" + }, + "entity": { + "state": "DELETED", + "org_guid": "guid-396a8cb9-5524-4a2b-8e9e-2bfc70edb58d", + "space_guid": "guid-be1f6fe3-e63a-41a3-b196-3fc084022823", + "space_name": "name-1981", + "service_instance_guid": "guid-f93250f7-7ef5-4b02-8d33-353919ce8358", + "service_instance_name": "name-1983", + "service_instance_type": "type-5", + "service_plan_guid": "guid-e9d2d5a0-69a6-46ef-bac5-43f3ed177614", + "service_plan_name": "name-1984", + "service_guid": "guid-34916716-31d7-40c1-9afd-f312996c9655", + "service_label": "label-65" + } + } + ] +}` + +const listServiceUsageEventsPayloadPage2 = ` +{ + "total_results": 4, + "total_pages": 2, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "985c09c5-bf5a-44eb-a260-41c532dc0f3f", + "url": "/v2/service_usage_events/985c09c5-bf5a-44eb-a260-41c532dc0f1d", + "created_at": "2016-06-08T16:41:39Z" + }, + "entity": { + "state": "CREATED", + "org_guid": "guid-396a8cb9-5524-4a2b-8e9e-2bfc70edb58d", + "space_guid": "guid-be1f6fe3-e63a-41a3-b196-3fc084022823", + "space_name": "name-1988", + "service_instance_guid": "guid-f93250f7-7ef5-4b02-8d33-353919ce8358", + "service_instance_name": "name-1988", + "service_instance_type": "type-5", + "service_plan_guid": "guid-e9d2d5a0-69a6-46ef-bac5-43f3ed177614", + "service_plan_name": "name-1988", + "service_guid": "guid-34916716-31d7-40c1-9afd-f312996c9654", + "service_label": "label-64" + } + }, + { + "metadata": { + "guid": "985c09c5-bf5a-44eb-a260-41c532dc0f6d", + "url": "/v2/service_usage_events/985c09c5-bf5a-44eb-a260-41c532dc0f1d", + "created_at": "2016-06-08T16:41:39Z" + }, + "entity": { + "state": "UPDATED", + "org_guid": "guid-396a8cb9-5524-4a2b-8e9e-2bfc70edb58d", + "space_guid": "guid-be1f6fe3-e63a-41a3-b196-3fc084022823", + "space_name": "name-1985", + "service_instance_guid": "guid-f93250f7-7ef5-4b02-8d33-353919ce8358", + "service_instance_name": "name-1985", + "service_instance_type": "type-5", + "service_plan_guid": "guid-e9d2d5a0-69a6-46ef-bac5-43f3ed177614", + "service_plan_name": "name-1985", + "service_guid": "guid-34916716-31d7-40c1-9afd-f312996c9655", + "service_label": "label-65" + } + } + ] +}` + +const sharePrivateDomainPayload = `{ + "metadata": { + "guid": "3b6f763f-aae1-4177-9b93-f2de6f2a48f2", + "url": "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2", + "created_at": "2016-06-08T16:41:35Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "name": "name-1777", + "billing_enabled": false, + "quota_definition_guid": "8737180b-8587-4244-a37d-a12bffcc24b5", + "status": "active", + "quota_definition_url": "/v2/quota_definitions/8737180b-8587-4244-a37d-a12bffcc24b5", + "spaces_url": "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/spaces", + "domains_url": "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/domains", + "private_domains_url": "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/private_domains", + "users_url": "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/users", + "managers_url": "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/managers", + "billing_managers_url": "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/billing_managers", + "auditors_url": "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/auditors", + "app_events_url": "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/app_events", + "space_quota_definitions_url": "/v2/organizations/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/space_quota_definitions" + } +} +` +const AppUpdatePayload = ` +{ + "metadata": { + "guid": "97f7e56b-addf-4d26-be82-998a06600011", + "url": "/v2/apps/97f7e56b-addf-4d26-be82-998a06600011", + "created_at": "2018-03-04T16:05:36Z", + "updated_at": "2018-03-06T20:46:26Z" + }, + "entity": { + "name": "NewName", + "production": false, + "space_guid": "d17d98b9-5f88-44c6-8dbc-6036c9607ce0", + "stack_guid": "46ff2259-d51b-48a3-ac7e-72a86c51d85c", + "buildpack": "go_buildpack", + "detected_buildpack": "", + "detected_buildpack_guid": "d42d6cd9-7c1f-4a01-9251-178b51d1ed47", + "environment_json": { + "GOPACKAGENAME": "MichaelIsMetal" + }, + "memory": 65, + "instances": 1, + "disk_quota": 1024, + "state": "STOPPED", + "version": "ac75afb9-bfa6-426e-b0f6-96866e295f2c", + "command": "MichaelIsMetal", + "console": false, + "debug": "", + "staging_task_id": "6379fc80-a71b-4848-812f-520faec910a5", + "package_state": "STAGED", + "health_check_http_endpoint": "", + "health_check_type": "port", + "health_check_timeout": 0, + "staging_failed_reason": "", + "staging_failed_description": "", + "diego": true, + "docker_image": "", + "docker_credentials": { + "username": "", + "password": "" + }, + "package_updated_at": "2018-03-04T21:31:10Z", + "detected_start_command": "./bin/MichaelIsMetal", + "enable_ssh": true, + "ports": [ + 8080 + ], + "space_url": "/v2/spaces/d17d98b9-5f88-44c6-8dbc-6036c9607ce0", + "stack_url": "/v2/stacks/46ff2259-d51b-48a3-ac7e-72a86c51d85c", + "routes_url": "/v2/apps/97f7e56b-addf-4d26-be82-998a06600011/routes", + "events_url": "/v2/apps/97f7e56b-addf-4d26-be82-998a06600011/events", + "service_bindings_url": "/v2/apps/97f7e56b-addf-4d26-be82-998a06600011/service_bindings", + "route_mappings_url": "/v2/apps/97f7e56b-addf-4d26-be82-998a06600011/route_mappings" + } +}` + +const appRestagePayload = `{ + "metadata": { + "guid": "97f7e56b-addf-4d26-be82-998a06600011", + "url": "/v2/apps/97f7e56b-addf-4d26-be82-998a06600011", + "created_at": "2016-06-08T16:41:40Z", + "updated_at": "2016-06-08T16:41:40Z" + }, + "entity": { + "name": "name-2047", + "production": false, + "space_guid": "b1787767-ca42-4fcf-989e-2530fe2987a5", + "stack_guid": "00caa65b-55f4-4c72-8e61-011c20189462", + "buildpack": null, + "detected_buildpack": null, + "detected_buildpack_guid": null, + "environment_json": null, + "memory": 1024, + "instances": 1, + "disk_quota": 1024, + "state": "STARTED", + "version": "4de62557-7599-422e-93ab-49e6b6ede56b", + "command": null, + "console": false, + "debug": null, + "staging_task_id": null, + "package_state": "PENDING", + "health_check_http_endpoint": "", + "health_check_type": "port", + "health_check_timeout": null, + "staging_failed_reason": null, + "staging_failed_description": null, + "diego": false, + "docker_image": null, + "docker_credentials": { + "username": null, + "password": null + }, + "package_updated_at": "2016-06-08T16:41:40Z", + "detected_start_command": "", + "enable_ssh": true, + "ports": null + } +}` + +const postServiceBindingPayload = `{ + "metadata": { + "guid": "4e690cd4-66ef-4052-a23d-0d748316f18c", + "url": "/v2/service_bindings/4e690cd4-66ef-4052-a23d-0d748316f18c", + "created_at": "2016-06-08T16:41:42Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "app_guid": "081d55a0-1bfa-4e51-8d08-273f764988db", + "service_instance_guid": "a0029c76-7017-4a74-94b0-54a04ad94b80", + "credentials": { + "creds-key-63": "creds-val-63" + }, + "name": "prod-db", + "binding_options": { + }, + "gateway_data": null, + "gateway_name": "", + "syslog_drain_url": null, + "volume_mounts": [ + ], + "app_url": "/v2/apps/081d55a0-1bfa-4e51-8d08-273f764988db", + "service_instance_url": "/v2/user_provided_service_instances/a0029c76-7017-4a74-94b0-54a04ad94b80" + } +}` + +const postRouteMappingsPayload = `{ + "metadata": { + "guid": "f869fa46-22b1-40ee-b491-58e321345528", + "url": "/v2/route_mappings/f869fa46-22b1-40ee-b491-58e321345528", + "created_at": "2016-06-08T16:41:42Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "app_port": 8888, + "app_guid": "fa23ddfc-b635-4205-8283-844c53122888", + "route_guid": "e00fb1e1-f7d4-4e36-9912-f76a587e9858", + "app_url": "/v2/apps/fa23ddfc-b635-4205-8283-844c53122888", + "route_url": "/v2/routes/e00fb1e1-f7d4-4e36-9912-f76a587e9858" + } +}` + +const listRouteMappingsPayload = `{ + "total_results": 1, + "total_pages": 1, + "prev_url": null, + "next_url": null, + "resources": [ + { + "metadata": { + "guid": "63603ed7-bd4a-4475-a371-5b34381e0cf7", + "url": "/v2/route_mappings/63603ed7-bd4a-4475-a371-5b34381e0cf7", + "created_at": "2016-06-08T16:41:42Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "app_port": 8888, + "app_guid": "ee8b175a-2228-4931-be8a-1f6445bd63bc", + "route_guid": "eb1c4fcd-7d6d-41d2-bd2f-5811f53b6677", + "app_url": "/v2/apps/ee8b175a-2228-4931-be8a-1f6445bd63bc", + "route_url": "/v2/routes/eb1c4fcd-7d6d-41d2-bd2f-5811f53b6677" + } + }, + { + "metadata": { + "guid": "63603ed7-bd4a-4475-a371-5b34381e0cf8", + "url": "/v2/route_mappings/63603ed7-bd4a-4475-a371-5b34381e0cf8", + "created_at": "2016-06-08T16:41:42Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "app_port": 8888, + "app_guid": "ee8b175a-2228-4931-be8a-1f6445bd63bd", + "route_guid": "eb1c4fcd-7d6d-41d2-bd2f-5811f53b6678", + "app_url": "/v2/apps/ee8b175a-2228-4931-be8a-1f6445bd63bd", + "route_url": "/v2/routes/eb1c4fcd-7d6d-41d2-bd2f-5811f53b6678" + } + } + ] +}` + +const getRouteByGuidPayload = `{ + "metadata": { + "guid": "49df626e-8e87-4366-9fbc-f82186824e21", + "url": "/v2/route_mappings/49df626e-8e87-4366-9fbc-f82186824e21", + "created_at": "2016-06-08T16:41:42Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "space_guid": "e374dd83-1cea-40d4-84dc-6ac4fb9b2145", + "host": "host" + } +}` + +const getRouteMappingByGuidPayload = `{ + "metadata": { + "guid": "93eb2527-81b9-4e15-8ba0-2fd8dd8c0c1c", + "url": "/v2/route_mappings/93eb2527-81b9-4e15-8ba0-2fd8dd8c0c1c", + "created_at": "2016-06-08T16:41:42Z", + "updated_at": "2016-06-08T16:41:26Z" + }, + "entity": { + "app_port": 8888, + "app_guid": "caf3e3a9-1f64-46d3-a0d5-a3d4ae3f4be4", + "route_guid": "34931bf5-79d0-4303-b082-df023b3305ce", + "app_url": "/v2/apps/caf3e3a9-1f64-46d3-a0d5-a3d4ae3f4be4", + "route_url": "/v2/routes/34931bf5-79d0-4303-b082-df023b3305ce" + } +}` + +const getEVGPayload = `{ + "foo": "bar", + "val": 3 +}` + +const listProcessesPayload1 = `{ + "pagination": { + "total_results": 26, + "total_pages": 2, + "first": { + "href": "https://api.run.example.com/v3/processes?page=1&per_page=20" + }, + "last": { + "href": "https://api.run.example.com/v3/processes?page=2&per_page=20" + }, + "next": { + "href": "https://api.run.example.com/v3/processes?page=2&per_page=20" + }, + "previous": null + }, + "resources": [ + { + "guid": "30200dd1-64c0-451a-8c37-3c91e05c6741", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 2, + "memory_in_mb": 256, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-05-22T21:06:42Z", + "updated_at": "2018-06-05T21:07:08Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/30200dd1-64c0-451a-8c37-3c91e05c6741" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/30200dd1-64c0-451a-8c37-3c91e05c6741/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/30200dd1-64c0-451a-8c37-3c91e05c6741" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/30200dd1-64c0-451a-8c37-3c91e05c6741/stats" + } + } + }, + { + "guid": "0a8eb31c-0450-465d-90a1-837d92895504", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 6, + "memory_in_mb": 128, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-05-22T21:06:43Z", + "updated_at": "2018-06-05T21:07:07Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/0a8eb31c-0450-465d-90a1-837d92895504" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/0a8eb31c-0450-465d-90a1-837d92895504/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/0a8eb31c-0450-465d-90a1-837d92895504" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/0a8eb31c-0450-465d-90a1-837d92895504/stats" + } + } + }, + { + "guid": "c55dca62-ff2e-4641-a4ec-9bea56f987b2", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-05-22T21:17:50Z", + "updated_at": "2018-06-05T21:19:26Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/c55dca62-ff2e-4641-a4ec-9bea56f987b2" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/c55dca62-ff2e-4641-a4ec-9bea56f987b2/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/c55dca62-ff2e-4641-a4ec-9bea56f987b2" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/d5ecae4a-3bfc-4302-af74-bee452108316" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/c55dca62-ff2e-4641-a4ec-9bea56f987b2/stats" + } + } + }, + { + "guid": "72fab46a-8bcd-4941-b556-99694627c402", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-05-29T20:03:48Z", + "updated_at": "2018-05-29T20:07:40Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/72fab46a-8bcd-4941-b556-99694627c402" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/72fab46a-8bcd-4941-b556-99694627c402/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/72fab46a-8bcd-4941-b556-99694627c402" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/6d6eaa00-1fba-4c31-9121-db9a72299240" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/72fab46a-8bcd-4941-b556-99694627c402/stats" + } + } + }, + { + "guid": "46b49bad-e469-418d-9f22-2fa8eb8a9144", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 2, + "memory_in_mb": 256, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-05-30T01:19:06Z", + "updated_at": "2018-06-05T21:07:07Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/46b49bad-e469-418d-9f22-2fa8eb8a9144" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/46b49bad-e469-418d-9f22-2fa8eb8a9144/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/46b49bad-e469-418d-9f22-2fa8eb8a9144" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/46b49bad-e469-418d-9f22-2fa8eb8a9144/stats" + } + } + }, + { + "guid": "74600cfb-9cc9-4026-8473-f638f44ade12", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 6, + "memory_in_mb": 128, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-05-30T01:19:06Z", + "updated_at": "2018-06-05T21:07:07Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/74600cfb-9cc9-4026-8473-f638f44ade12" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/74600cfb-9cc9-4026-8473-f638f44ade12/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/74600cfb-9cc9-4026-8473-f638f44ade12" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/74600cfb-9cc9-4026-8473-f638f44ade12/stats" + } + } + }, + { + "guid": "d782ee5f-8cff-451a-ad30-a0101c7fb430", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 256, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-05-30T17:57:29Z", + "updated_at": "2018-05-30T18:20:20Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/d782ee5f-8cff-451a-ad30-a0101c7fb430" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/d782ee5f-8cff-451a-ad30-a0101c7fb430/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/d782ee5f-8cff-451a-ad30-a0101c7fb430" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/6d6eaa00-1fba-4c31-9121-db9a72299240" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/d782ee5f-8cff-451a-ad30-a0101c7fb430/stats" + } + } + }, + { + "guid": "1b4d1907-3a54-46e6-ac73-d4732af2a28b", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 2, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": 360 + } + }, + "created_at": "2018-06-05T19:41:09Z", + "updated_at": "2018-06-05T21:06:35Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/1b4d1907-3a54-46e6-ac73-d4732af2a28b" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/1b4d1907-3a54-46e6-ac73-d4732af2a28b/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/1b4d1907-3a54-46e6-ac73-d4732af2a28b" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/1b4d1907-3a54-46e6-ac73-d4732af2a28b/stats" + } + } + }, + { + "guid": "bec57af6-4b84-4698-a366-1c4de1f4cc1e", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "none", + "data": { + "timeout": null + } + }, + "created_at": "2018-06-05T19:41:09Z", + "updated_at": "2018-06-05T21:06:14Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/bec57af6-4b84-4698-a366-1c4de1f4cc1e" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/bec57af6-4b84-4698-a366-1c4de1f4cc1e/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/bec57af6-4b84-4698-a366-1c4de1f4cc1e" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/bec57af6-4b84-4698-a366-1c4de1f4cc1e/stats" + } + } + }, + { + "guid": "5d449f8d-999a-4720-9296-5b6afce15a69", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 2048, + "disk_in_mb": 1024, + "health_check": { + "type": "none", + "data": { + "timeout": null + } + }, + "created_at": "2018-06-05T19:41:09Z", + "updated_at": "2018-06-05T21:06:20Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/5d449f8d-999a-4720-9296-5b6afce15a69" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/5d449f8d-999a-4720-9296-5b6afce15a69/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/5d449f8d-999a-4720-9296-5b6afce15a69" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/5d449f8d-999a-4720-9296-5b6afce15a69/stats" + } + } + }, + { + "guid": "57a598af-c4a6-4ade-8db6-05679ae092f5", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 2, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": 180 + } + }, + "created_at": "2018-06-05T19:45:25Z", + "updated_at": "2018-06-05T21:10:23Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/57a598af-c4a6-4ade-8db6-05679ae092f5" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/57a598af-c4a6-4ade-8db6-05679ae092f5/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/57a598af-c4a6-4ade-8db6-05679ae092f5" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/1c17814c-e195-4ea5-9be2-6d01d9bf6007" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/57a598af-c4a6-4ade-8db6-05679ae092f5/stats" + } + } + }, + { + "guid": "79616d63-1075-4c02-a058-574a01314206", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "none", + "data": { + "timeout": null + } + }, + "created_at": "2018-06-05T21:04:37Z", + "updated_at": "2018-06-05T21:04:48Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/79616d63-1075-4c02-a058-574a01314206" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/79616d63-1075-4c02-a058-574a01314206/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/79616d63-1075-4c02-a058-574a01314206" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/79616d63-1075-4c02-a058-574a01314206/stats" + } + } + }, + { + "guid": "a2298d27-57fe-41e9-ad1e-f540427a0949", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 2, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": 360 + } + }, + "created_at": "2018-06-05T21:04:37Z", + "updated_at": "2018-06-05T21:06:34Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/a2298d27-57fe-41e9-ad1e-f540427a0949" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/a2298d27-57fe-41e9-ad1e-f540427a0949/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/a2298d27-57fe-41e9-ad1e-f540427a0949" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/a2298d27-57fe-41e9-ad1e-f540427a0949/stats" + } + } + }, + { + "guid": "a98f0649-4e31-435a-bb61-a96364c366a4", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 2048, + "disk_in_mb": 1024, + "health_check": { + "type": "none", + "data": { + "timeout": null + } + }, + "created_at": "2018-06-05T21:04:38Z", + "updated_at": "2018-06-05T21:04:49Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/a98f0649-4e31-435a-bb61-a96364c366a4" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/a98f0649-4e31-435a-bb61-a96364c366a4/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/a98f0649-4e31-435a-bb61-a96364c366a4" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/a98f0649-4e31-435a-bb61-a96364c366a4/stats" + } + } + }, + { + "guid": "6aa28ed8-d377-4225-b853-80001e64113b", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 3, + "memory_in_mb": 64, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-06-05T21:07:29Z", + "updated_at": "2018-06-05T21:08:02Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/6aa28ed8-d377-4225-b853-80001e64113b" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/6aa28ed8-d377-4225-b853-80001e64113b/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/6aa28ed8-d377-4225-b853-80001e64113b" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/2bd2080e-b9d7-4911-a607-a4e5adb00b59" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/6aa28ed8-d377-4225-b853-80001e64113b/stats" + } + } + }, + { + "guid": "dfc0f648-a3c8-4f46-b0a4-425136f238c6", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 2, + "memory_in_mb": 64, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-06-05T21:08:19Z", + "updated_at": "2018-06-05T21:08:41Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/dfc0f648-a3c8-4f46-b0a4-425136f238c6" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/dfc0f648-a3c8-4f46-b0a4-425136f238c6/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/dfc0f648-a3c8-4f46-b0a4-425136f238c6" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/2bd2080e-b9d7-4911-a607-a4e5adb00b59" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/dfc0f648-a3c8-4f46-b0a4-425136f238c6/stats" + } + } + }, + { + "guid": "ba159a14-a3b5-4711-95c7-4bf89ff89a6c", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 2, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": 180 + } + }, + "created_at": "2018-06-05T21:08:57Z", + "updated_at": "2018-06-05T21:10:23Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/ba159a14-a3b5-4711-95c7-4bf89ff89a6c" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/ba159a14-a3b5-4711-95c7-4bf89ff89a6c/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/ba159a14-a3b5-4711-95c7-4bf89ff89a6c" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/1c17814c-e195-4ea5-9be2-6d01d9bf6007" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/ba159a14-a3b5-4711-95c7-4bf89ff89a6c/stats" + } + } + }, + { + "guid": "c7d20ea3-028b-4559-9f0c-a61966abc163", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 3, + "memory_in_mb": 256, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-06-05T21:11:44Z", + "updated_at": "2018-06-05T21:12:00Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/c7d20ea3-028b-4559-9f0c-a61966abc163" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/c7d20ea3-028b-4559-9f0c-a61966abc163/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/c7d20ea3-028b-4559-9f0c-a61966abc163" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/7443e429-eee3-48ea-89cb-c9d3234c7fbf" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/c7d20ea3-028b-4559-9f0c-a61966abc163/stats" + } + } + }, + { + "guid": "956ca6e5-6560-49c6-ae01-843144b24ec5", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": 120 + } + }, + "created_at": "2018-06-05T21:12:01Z", + "updated_at": "2018-06-05T21:12:54Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/956ca6e5-6560-49c6-ae01-843144b24ec5" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/956ca6e5-6560-49c6-ae01-843144b24ec5/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/956ca6e5-6560-49c6-ae01-843144b24ec5" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/7443e429-eee3-48ea-89cb-c9d3234c7fbf" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/956ca6e5-6560-49c6-ae01-843144b24ec5/stats" + } + } + }, + { + "guid": "787fd0c1-d827-4c9e-975b-acd73267a583", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-06-29T18:31:10Z", + "updated_at": "2018-06-29T18:31:10Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/787fd0c1-d827-4c9e-975b-acd73267a583" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/787fd0c1-d827-4c9e-975b-acd73267a583/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/787fd0c1-d827-4c9e-975b-acd73267a583" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/787fd0c1-d827-4c9e-975b-acd73267a583/stats" + } + } + } + ] +}` + +const listProcessesPayload2 = `{ + "pagination": { + "total_results": 26, + "total_pages": 2, + "first": { + "href": "https://api.run.example.com/v3/processes?page=1&per_page=20" + }, + "last": { + "href": "https://api.run.example.com/v3/processes?page=2&per_page=20" + }, + "next": null, + "previous": { + "href": "https://api.run.example.com/v3/processes?page=1&per_page=20" + } + }, + "resources": [ + { + "guid": "09eb0d25-75b0-48e1-b45f-1636ea5bbe0c", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-06-29T18:32:35Z", + "updated_at": "2018-06-29T18:32:35Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/09eb0d25-75b0-48e1-b45f-1636ea5bbe0c" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/09eb0d25-75b0-48e1-b45f-1636ea5bbe0c/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/09eb0d25-75b0-48e1-b45f-1636ea5bbe0c" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/60fa9e9b-c6eb-47a7-92ad-f438e775d234" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/09eb0d25-75b0-48e1-b45f-1636ea5bbe0c/stats" + } + } + }, + { + "guid": "00944be5-fe20-43ba-abe2-8fcc41ee2edc", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-07-13T20:17:23Z", + "updated_at": "2018-07-18T17:20:59Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/00944be5-fe20-43ba-abe2-8fcc41ee2edc" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/00944be5-fe20-43ba-abe2-8fcc41ee2edc/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/00944be5-fe20-43ba-abe2-8fcc41ee2edc" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/a40da3ef-f0a3-4374-a7af-9c867382b30c" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/00944be5-fe20-43ba-abe2-8fcc41ee2edc/stats" + } + } + }, + { + "guid": "750ce4f3-3c28-4acc-9b50-357dc7dde27a", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-07-17T14:46:37Z", + "updated_at": "2018-07-17T14:46:37Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/750ce4f3-3c28-4acc-9b50-357dc7dde27a" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/750ce4f3-3c28-4acc-9b50-357dc7dde27a/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/750ce4f3-3c28-4acc-9b50-357dc7dde27a" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/a40da3ef-f0a3-4374-a7af-9c867382b30c" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/750ce4f3-3c28-4acc-9b50-357dc7dde27a/stats" + } + } + }, + { + "guid": "2274c4c4-7e6e-413f-b976-e8210ddcc748", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 256, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-08-06T21:45:14Z", + "updated_at": "2018-08-07T18:11:33Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/2274c4c4-7e6e-413f-b976-e8210ddcc748" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/2274c4c4-7e6e-413f-b976-e8210ddcc748/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/2274c4c4-7e6e-413f-b976-e8210ddcc748" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/939eb497-671b-46cb-abd2-26e89129cc5b" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/2274c4c4-7e6e-413f-b976-e8210ddcc748/stats" + } + } + }, + { + "guid": "bc69b3fe-0d80-4508-a1d2-9bc53269287f", + "type": "web", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 128, + "disk_in_mb": 1024, + "health_check": { + "type": "port", + "data": { + "timeout": null + } + }, + "created_at": "2018-08-07T22:27:14Z", + "updated_at": "2018-08-08T16:09:41Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/bc69b3fe-0d80-4508-a1d2-9bc53269287f" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/bc69b3fe-0d80-4508-a1d2-9bc53269287f/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/bc69b3fe-0d80-4508-a1d2-9bc53269287f" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/a40da3ef-f0a3-4374-a7af-9c867382b30c" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/bc69b3fe-0d80-4508-a1d2-9bc53269287f/stats" + } + } + }, + { + "guid": "4b32fba5-ec34-40e1-9511-0a25c8f93d8f", + "type": "worker", + "command": "[PRIVATE DATA HIDDEN IN LISTS]", + "instances": 1, + "memory_in_mb": 1024, + "disk_in_mb": 1024, + "health_check": { + "type": "process", + "data": { + "timeout": null + } + }, + "created_at": "2018-08-07T22:28:44Z", + "updated_at": "2018-08-08T16:09:41Z", + "links": { + "self": { + "href": "https://api.run.example.com/v3/processes/4b32fba5-ec34-40e1-9511-0a25c8f93d8f" + }, + "scale": { + "href": "https://api.run.example.com/v3/processes/4b32fba5-ec34-40e1-9511-0a25c8f93d8f/actions/scale", + "method": "POST" + }, + "app": { + "href": "https://api.run.example.com/v3/apps/bc69b3fe-0d80-4508-a1d2-9bc53269287f" + }, + "space": { + "href": "https://api.run.example.com/v3/spaces/a40da3ef-f0a3-4374-a7af-9c867382b30c" + }, + "stats": { + "href": "https://api.run.example.com/v3/processes/4b32fba5-ec34-40e1-9511-0a25c8f93d8f/stats" + } + } + } + ] +}` + +const getV3DeploymentPayload = `{ + "guid": "59c3d133-2b83-46f3-960e-7765a129aea4", + "state": "DEPLOYING", + "status": { + "value": "ACTIVE", + "reason": "DEPLOYING", + "details": { + "last_successful_healthcheck": "2018-04-25T22:42:10Z" + } + }, + "strategy": "rolling", + "droplet": { + "guid": "44ccfa61-dbcf-4a0d-82fe-f668e9d2a962" + }, + "previous_droplet": { + "guid": "cc6bc315-bd06-49ce-92c2-bc3ad45268c2" + }, + "new_processes": [ + { + "guid": "fd5d3e60-f88c-4c37-b1ae-667cfc65a856", + "type": "web" + } + ], + "revision": { + "guid": "56126cba-656a-4eba-a81e-7e9951b2df57", + "version": 1 + }, + "created_at": "2018-04-25T22:42:10Z", + "updated_at": "2018-04-25T22:42:10Z", + "metadata": { + "labels": { }, + "annotations": { } + }, + "relationships": { + "app": { + "data": { + "guid": "305cea31-5a44-45ca-b51b-e89c7a8ef8b2" + } + } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/deployments/59c3d133-2b83-46f3-960e-7765a129aea4" + }, + "app": { + "href": "https://api.example.org/v3/apps/305cea31-5a44-45ca-b51b-e89c7a8ef8b2" + } + } +}` + +const getProcessStatsPayload1 = `{ + "resources": [ + { + "type": "web", + "index": 0, + "state": "RUNNING", + "usage": { + "time": "2016-03-23T23:17:30.476314154Z", + "cpu": 0.00038711029163348665, + "mem": 19177472, + "disk": 69705728 + }, + "host": "10.244.16.10", + "instance_ports": [ + { + "external": 64546, + "internal": 8080, + "external_tls_proxy_port": 61002, + "internal_tls_proxy_port": 61003 + } + ], + "uptime": 9042, + "mem_quota": 268435456, + "disk_quota": 1073741824, + "fds_quota": 16384, + "isolation_segment": "example_iso_segment", + "details": null + } + ] +}` +const listValidResources = `[ + { + "sha1": "002d760bea1be268e27077412e11a320d0f164d3", + "size": 36 + }, + { + "sha1": "a9993e364706816aba3e25717850c26c9cd0d89d", + "size": 1 + } +]` + +const listV3StacksPayload = `{ + "pagination": { + "total_results": 2, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/stacks?page=1&per_page=2" + }, + "last": { + "href": "https://api.example.org/v3/stacks?page=1&per_page=2" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "guid-1", + "created_at": "2018-11-09T22:43:28Z", + "updated_at": "2018-11-09T22:43:28Z", + "name": "my-stack-1", + "description": "This is my first stack!", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/stacks/guid-1" + } + } + }, + { + "guid": "guid-2", + "created_at": "2018-11-09T22:43:29Z", + "updated_at": "2018-11-09T22:43:29Z", + "name": "my-stack-2", + "description": "This is my second stack!", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/stacks/guid-2" + } + } + } + ] +}` + +const listV3ServiceCredentialBindingsPayload = `{ + "pagination": { + "total_results": 1, + "total_pages": 1, + "first": { + "href": "https://api.example.org/v3/service_instances?page=1&per_page=50" + }, + "last": { + "href": "https://api.example.org/v3/service_instances?page=1&per_page=50" + }, + "next": null, + "previous": null + }, + "resources": [ + { + "guid": "d9634934-8e1f-4c2d-bb33-fa5df019cf9d", + "created_at": "2022-02-17T17:17:44Z", + "updated_at": "2022-02-17T17:17:44Z", + "name": "my_service_key", + "type": "key", + "relationships": { + "service_instance": { + "data": { + "guid": "85ccdcad-d725-4109-bca4-fd6ba062b5c8" + } + } + }, + "metadata": { + "labels": { }, + "annotations": { } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/service_credential_bindings/d9634934-8e1f-4c2d-bb33-fa5df019cf9d" + }, + "details": { + "href": "https://api.example.org/v3/service_credential_bindings/d9634934-8e1f-4c2d-bb33-fa5df019cf9d/details" + }, + "service_instance": { + "href": "https://api.example.org/v3/service_instances/85ccdcad-d725-4109-bca4-fd6ba062b5c8" + }, + "parameters": { + "href": "https://api.example.org/v3/service_credential_bindings/d9634934-8e1f-4c2d-bb33-fa5df019cf9d/parameters" + } + } + } + ] +}` + +const GetV3ServiceCredentialBindingsByGUIDPayload = `{ + "guid": "d9634934-8e1f-4c2d-bb33-fa5df019cf9d", + "created_at": "2022-02-17T17:17:44Z", + "updated_at": "2022-02-17T17:17:44Z", + "name": "my_service_key", + "type": "key", + "last_operation": { + "type": "create", + "state": "succeeded", + "description": "", + "created_at": "2022-02-17T17:17:44Z", + "updated_at": "2022-02-17T17:17:44Z" + }, + "relationships": { + "service_instance": { + "data": { + "guid": "85ccdcad-d725-4109-bca4-fd6ba062b5c8" + } + } + }, + "metadata": { + "labels": { }, + "annotations": { } + }, + "links": { + "self": { + "href": "https://api.example.org/v3/service_credential_bindings/d9634934-8e1f-4c2d-bb33-fa5df019cf9d" + }, + "details": { + "href": "https://api.example.org/v3/service_credential_bindings/d9634934-8e1f-4c2d-bb33-fa5df019cf9d/details" + }, + "service_instance": { + "href": "https://api.example.org/v3/service_instances/85ccdcad-d725-4109-bca4-fd6ba062b5c8" + }, + "parameters": { + "href": "https://api.example.org/v3/service_credential_bindings/d9634934-8e1f-4c2d-bb33-fa5df019cf9d/parameters" + } + } +}` + +const listV3UsersPayload = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/users?page=1&per_page=2" + }, + "last": { + "href": "https://api.example.org/v3/users?page=2&per_page=2" + }, + "next": { + "href": "https://api.example.org/v3/userspage2?page=2&per_page=2" + }, + "previous": null + }, + "resources": [ + { + "guid": "16f43d50-43a2-4981-bae8-633e8248a637", + "created_at": "2022-08-02T21:37:52Z", + "updated_at": "2022-08-02T21:37:52Z", + "username": "smoke_tests", + "presentation_name": "smoke_tests", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/16f43d50-43a2-4981-bae8-633e8248a637" + } + } + }, + { + "guid": "test1", + "created_at": "2022-08-02T21:40:34Z", + "updated_at": "2022-08-02T21:40:34Z", + "username": "test1", + "presentation_name": "test1", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/test1" + } + } + } + ] +}` + +const listV3UsersPayloadPage2 = `{ + "pagination": { + "total_results": 3, + "total_pages": 2, + "first": { + "href": "https://api.example.org/v3/users?page=1&per_page=2" + }, + "last": { + "href": "https://api.example.org/v3/users?page=2&per_page=2" + }, + "next": { + "href": "" + }, + "previous": { + "href": "https://api.example.org/v3/users?page=1&per_page=2" + } + }, + "resources": [ + { + "guid": "test2", + "created_at": "2022-08-02T21:41:59Z", + "updated_at": "2022-08-02T21:41:59Z", + "username": "test2", + "presentation_name": "test2", + "origin": "uaa", + "metadata": { + "labels": {}, + "annotations": {} + }, + "links": { + "self": { + "href": "https://api.example.org/v3/users/test2" + } + } + } + ] +}` diff --git a/third_party/go-cfclient/processes.go b/third_party/go-cfclient/processes.go new file mode 100644 index 000000000000..f3b729d34d30 --- /dev/null +++ b/third_party/go-cfclient/processes.go @@ -0,0 +1,102 @@ +package cfclient + +import ( + "encoding/json" + "net/url" +) + +// ProcessListResponse is the json body returned from the API +type ProcessListResponse struct { + Pagination Pagination `json:"pagination"` + Processes []Process `json:"resources"` +} + +// Process represents a running process in a container. +type Process struct { + GUID string `json:"guid"` + Type string `json:"type"` + Instances int `json:"instances"` + MemoryInMB int `json:"memory_in_mb"` + DiskInMB int `json:"disk_in_mb"` + Ports []int `json:"ports,omitempty"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + HealthCheck struct { + Type string `json:"type"` + Data struct { + Timeout int `json:"timeout"` + InvocationTimeout int `json:"invocation_timeout"` + Endpoint string `json:"endpoint"` + } `json:"data"` + } `json:"health_check"` + Links struct { + Self Link `json:"self"` + Scale Link `json:"scale"` + App Link `json:"app"` + Space Link `json:"space"` + Stats Link `json:"stats"` + } `json:"links"` +} + +// ListAllProcesses will call the v3 processes api +func (c *Client) ListAllProcesses() ([]Process, error) { + return c.ListAllProcessesByQuery(url.Values{}) +} + +// ListAllProcessesByQuery will call the v3 processes api +func (c *Client) ListAllProcessesByQuery(query url.Values) ([]Process, error) { + var allProcesses []Process + + requestURL := "/v3/processes" + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + for { + resp, err := c.getProcessPage(requestURL) + if err != nil { + return nil, err + } + + if resp.Pagination.TotalResults == 0 { + return nil, nil + } + + if allProcesses == nil { + allProcesses = make([]Process, 0, resp.Pagination.TotalResults) + } + + allProcesses = append(allProcesses, resp.Processes...) + if resp.Pagination.Next.Href == "" { + break + } + + requestURL = resp.Pagination.Next.Href + if requestURL == "" { + return allProcesses, nil + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, err + } + } + + return allProcesses, nil +} + +func (c *Client) getProcessPage(requestURL string) (*ProcessListResponse, error) { + req := c.NewRequest("GET", requestURL) + + resp, err := c.DoRequest(req) + if err != nil { + return nil, err + } + + procResp := new(ProcessListResponse) + defer resp.Body.Close() + err = json.NewDecoder(resp.Body).Decode(procResp) + if err != nil { + return nil, err + } + + return procResp, nil +} diff --git a/third_party/go-cfclient/processes_test.go b/third_party/go-cfclient/processes_test.go new file mode 100644 index 000000000000..7984a42ded56 --- /dev/null +++ b/third_party/go-cfclient/processes_test.go @@ -0,0 +1,28 @@ +package cfclient + +import ( + "net/url" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListProcesses(t *testing.T) { + Convey("List Processes", t, func() { + setup(MockRoute{"GET", "/v3/processes", []string{listProcessesPayload1, listProcessesPayload2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + q := url.Values{} + q.Add("per_page", "20") + procs, err := client.ListAllProcessesByQuery(q) + So(err, ShouldBeNil) + + So(procs, ShouldHaveLength, 26) + }) +} diff --git a/third_party/go-cfclient/resource_match.go b/third_party/go-cfclient/resource_match.go new file mode 100644 index 000000000000..70b541328ad5 --- /dev/null +++ b/third_party/go-cfclient/resource_match.go @@ -0,0 +1,45 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "io/ioutil" + + "github.com/pkg/errors" +) + +// The Resource match Api retruns the response in the following data structure +type Resource struct { + Sha1 string `json:"sha1"` + Size int `json:"size"` +} + +// ResourceMatch matches given resource list of SHA / file size pairs against +// the Cloud Controller cache, and reports the subset which describes already +// existing files +func (c *Client) ResourceMatch(resources []Resource) ([]Resource, error) { + + var resourcesList []Resource + emptyResource := make([]Resource, 0) + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(resources) + if err != nil { + return emptyResource, errors.Wrapf(err, "Error reading Resource List") + } + r := c.NewRequestWithBody("PUT", "/v2/resource_match", buf) + resp, err := c.DoRequest(r) + if err != nil { + return emptyResource, errors.Wrapf(err, "Error uploading Resource List") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return emptyResource, errors.Wrapf(err, "Error reading Resources http response body") + } + err = json.Unmarshal(resBody, &resourcesList) + if err != nil { + return emptyResource, errors.Wrapf(err, "Error reading Resources http response body") + } + return resourcesList, nil + +} diff --git a/third_party/go-cfclient/resource_match_test.go b/third_party/go-cfclient/resource_match_test.go new file mode 100644 index 000000000000..06cd82379e0c --- /dev/null +++ b/third_party/go-cfclient/resource_match_test.go @@ -0,0 +1,40 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestResourceMatch(t *testing.T) { + Convey("Resource Match", t, func() { + mocks := []MockRoute{ + {"PUT", "/v2/resource_match", []string{listValidResources}, "Test-golang", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + UserAgent: "Test-golang", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + ResourceList := []Resource{} + ResourceList = append(ResourceList, Resource{Sha1: "002d760bea1be268e27077412e11a320d0f164d3", Size: 36}) + ResourceList = append(ResourceList, Resource{Sha1: "a9993e364706816aba3e25717850c26c9cd0d89d", Size: 1}) + + ResApps, err := client.ResourceMatch(ResourceList) + assertResourceList(ResApps, err) + }) +} + +func assertResourceList(resList []Resource, err error) { + So(err, ShouldBeNil) + So(len(resList), ShouldEqual, 2) + So(resList[0].Sha1, ShouldEqual, "002d760bea1be268e27077412e11a320d0f164d3") + So(resList[0].Size, ShouldEqual, 36) + So(resList[1].Sha1, ShouldEqual, "a9993e364706816aba3e25717850c26c9cd0d89d") + So(resList[1].Size, ShouldEqual, 1) + +} diff --git a/third_party/go-cfclient/route_mappings.go b/third_party/go-cfclient/route_mappings.go new file mode 100644 index 000000000000..c4e327f29330 --- /dev/null +++ b/third_party/go-cfclient/route_mappings.go @@ -0,0 +1,162 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type RouteMappingRequest struct { + AppGUID string `json:"app_guid"` + RouteGUID string `json:"route_guid"` + AppPort int `json:"app_port"` +} + +type RouteMappingResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []RouteMappingResource `json:"resources"` +} + +type RouteMapping struct { + Guid string `json:"guid"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + AppPort int `json:"app_port"` + AppGUID string `json:"app_guid"` + RouteGUID string `json:"route_guid"` + AppUrl string `json:"app_url"` + RouteUrl string `json:"route_url"` + c *Client +} + +type RouteMappingResource struct { + Meta Meta `json:"metadata"` + Entity RouteMapping `json:"entity"` +} + +func (c *Client) MappingAppAndRoute(req RouteMappingRequest) (*RouteMapping, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(req) + if err != nil { + return nil, err + } + r := c.NewRequestWithBody("POST", "/v2/route_mappings", buf) + resp, err := c.DoRequest(r) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return c.handleMappingResp(resp) +} + +func (c *Client) ListRouteMappings() ([]*RouteMapping, error) { + return c.ListRouteMappingsByQuery(nil) +} + +func (c *Client) ListRouteMappingsByQuery(query url.Values) ([]*RouteMapping, error) { + var routeMappings []*RouteMapping + var routeMappingsResp RouteMappingResponse + pages := 0 + + requestUrl := "/v2/route_mappings?" + query.Encode() + for { + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting route mappings") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading route mappings request:") + } + + err = json.Unmarshal(resBody, &routeMappingsResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshalling route mappings") + } + + for _, routeMapping := range routeMappingsResp.Resources { + routeMappings = append(routeMappings, c.mergeRouteMappingResource(routeMapping)) + } + requestUrl = routeMappingsResp.NextUrl + if requestUrl == "" { + break + } + pages++ + totalPages := routeMappingsResp.Pages + if totalPages > 0 && pages >= totalPages { + break + } + } + return routeMappings, nil +} + +func (c *Client) GetRouteMappingByGuid(guid string) (*RouteMapping, error) { + var routeMapping RouteMappingResource + requestUrl := fmt.Sprintf("/v2/route_mappings/%s", guid) + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting route mapping") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading route mapping response body") + } + err = json.Unmarshal(resBody, &routeMapping) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshalling route mapping") + } + routeMapping.Entity.Guid = routeMapping.Meta.Guid + routeMapping.Entity.CreatedAt = routeMapping.Meta.CreatedAt + routeMapping.Entity.UpdatedAt = routeMapping.Meta.UpdatedAt + routeMapping.Entity.c = c + return &routeMapping.Entity, nil +} + +func (c *Client) DeleteRouteMapping(guid string) error { + requestUrl := fmt.Sprintf("/v2/route_mappings/%s?", guid) + resp, err := c.DoRequest(c.NewRequest("DELETE", requestUrl)) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting route mapping %s, response code %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) handleMappingResp(resp *http.Response) (*RouteMapping, error) { + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return nil, err + } + var mappingResource RouteMappingResource + err = json.Unmarshal(body, &mappingResource) + if err != nil { + return nil, err + } + return c.mergeRouteMappingResource(mappingResource), nil +} + +func (c *Client) mergeRouteMappingResource(mapping RouteMappingResource) *RouteMapping { + mapping.Entity.Guid = mapping.Meta.Guid + mapping.Entity.CreatedAt = mapping.Meta.CreatedAt + mapping.Entity.UpdatedAt = mapping.Meta.UpdatedAt + mapping.Entity.c = c + return &mapping.Entity +} diff --git a/third_party/go-cfclient/route_mappings_test.go b/third_party/go-cfclient/route_mappings_test.go new file mode 100644 index 000000000000..aba4cf066dca --- /dev/null +++ b/third_party/go-cfclient/route_mappings_test.go @@ -0,0 +1,90 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestMappingAppAndRoute(t *testing.T) { + Convey("Mapping app and route", t, func() { + setup(MockRoute{"POST", "/v2/route_mappings", []string{postRouteMappingsPayload}, "", http.StatusCreated, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + mappingRequest := RouteMappingRequest{AppGUID: "fa23ddfc-b635-4205-8283-844c53122888", RouteGUID: "e00fb1e1-f7d4-4e36-9912-f76a587e9858", AppPort: 8888} + + mapping, err := client.MappingAppAndRoute(mappingRequest) + So(err, ShouldBeNil) + So(mapping.Guid, ShouldEqual, "f869fa46-22b1-40ee-b491-58e321345528") + So(mapping.AppGUID, ShouldEqual, "fa23ddfc-b635-4205-8283-844c53122888") + So(mapping.RouteGUID, ShouldEqual, "e00fb1e1-f7d4-4e36-9912-f76a587e9858") + }) +} + +func TestListRouteMappings(t *testing.T) { + Convey("List route mappings", t, func() { + setup(MockRoute{"GET", "/v2/route_mappings", []string{listRouteMappingsPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + routeMappings, err := client.ListRouteMappings() + So(err, ShouldBeNil) + + So(len(routeMappings), ShouldEqual, 2) + So(routeMappings[0].Guid, ShouldEqual, "63603ed7-bd4a-4475-a371-5b34381e0cf7") + So(routeMappings[1].Guid, ShouldEqual, "63603ed7-bd4a-4475-a371-5b34381e0cf8") + So(routeMappings[0].AppGUID, ShouldEqual, "ee8b175a-2228-4931-be8a-1f6445bd63bc") + So(routeMappings[1].AppGUID, ShouldEqual, "ee8b175a-2228-4931-be8a-1f6445bd63bd") + So(routeMappings[0].RouteGUID, ShouldEqual, "eb1c4fcd-7d6d-41d2-bd2f-5811f53b6677") + So(routeMappings[1].RouteGUID, ShouldEqual, "eb1c4fcd-7d6d-41d2-bd2f-5811f53b6678") + }) +} + +func TestGetRouteMappingByGuid(t *testing.T) { + Convey("Get route mapping by guid", t, func() { + setup(MockRoute{"GET", "/v2/route_mappings/93eb2527-81b9-4e15-8ba0-2fd8dd8c0c1c", []string{getRouteMappingByGuidPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + routeMapping, err := client.GetRouteMappingByGuid("93eb2527-81b9-4e15-8ba0-2fd8dd8c0c1c") + So(err, ShouldBeNil) + So(routeMapping.Guid, ShouldEqual, "93eb2527-81b9-4e15-8ba0-2fd8dd8c0c1c") + So(routeMapping.AppGUID, ShouldEqual, "caf3e3a9-1f64-46d3-a0d5-a3d4ae3f4be4") + So(routeMapping.RouteGUID, ShouldEqual, "34931bf5-79d0-4303-b082-df023b3305ce") + }) +} + +func TestDeleteRouteMapping(t *testing.T) { + Convey("Delete route mapping", t, func() { + setup(MockRoute{"DELETE", "/v2/route_mappings/93eb2527-81b9-4e15-8ba0-2fd8dd8c0c1c", []string{""}, "", http.StatusNoContent, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteRouteMapping("93eb2527-81b9-4e15-8ba0-2fd8dd8c0c1c") + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/routes.go b/third_party/go-cfclient/routes.go new file mode 100644 index 000000000000..6b222d7c7e73 --- /dev/null +++ b/third_party/go-cfclient/routes.go @@ -0,0 +1,209 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type RoutesResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []RoutesResource `json:"resources"` +} + +type RoutesResource struct { + Meta Meta `json:"metadata"` + Entity Route `json:"entity"` +} + +type RouteRequest struct { + DomainGuid string `json:"domain_guid"` + SpaceGuid string `json:"space_guid"` + Host string `json:"host"` // required for http routes + Path string `json:"path"` + Port int `json:"port"` +} + +type Route struct { + Guid string `json:"guid"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Host string `json:"host"` + Path string `json:"path"` + DomainGuid string `json:"domain_guid"` + DomainURL string `json:"domain_url"` + SpaceGuid string `json:"space_guid"` + ServiceInstanceGuid string `json:"service_instance_guid"` + Port int `json:"port"` + c *Client +} + +// CreateRoute creates a regular http route +func (c *Client) CreateRoute(routeRequest RouteRequest) (Route, error) { + routesResource, err := c.createRoute("/v2/routes", routeRequest) + if nil != err { + return Route{}, err + } + return c.mergeRouteResource(routesResource), nil +} + +// CreateTcpRoute creates a TCP route +func (c *Client) CreateTcpRoute(routeRequest RouteRequest) (Route, error) { + routesResource, err := c.createRoute("/v2/routes?generate_port=true", routeRequest) + if nil != err { + return Route{}, err + } + return c.mergeRouteResource(routesResource), nil +} + +// BindRoute associates the specified route with the application +func (c *Client) BindRoute(routeGUID, appGUID string) error { + resp, err := c.DoRequest(c.NewRequest("PUT", fmt.Sprintf("/v2/routes/%s/apps/%s", routeGUID, appGUID))) + if err != nil { + return errors.Wrapf(err, "Error binding route %s to app %s", routeGUID, appGUID) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return fmt.Errorf("Error binding route %s to app %s, response code: %d", routeGUID, appGUID, resp.StatusCode) + } + return nil +} + +func (c *Client) GetRouteByGuid(guid string) (Route, error) { + var route RoutesResource + + r := c.NewRequest("GET", fmt.Sprintf("/v2/routes/%s", guid)) + resp, err := c.DoRequest(r) + if err != nil { + return route.Entity, errors.Wrap(err, "Error requesting route") + } + defer resp.Body.Close() + + err = json.NewDecoder(resp.Body).Decode(&route) + if err != nil { + return route.Entity, errors.Wrap(err, "Error unmarshalling route response body") + } + + route.Entity.Guid = route.Meta.Guid + route.Entity.CreatedAt = route.Meta.CreatedAt + route.Entity.UpdatedAt = route.Meta.UpdatedAt + route.Entity.c = c + return route.Entity, nil +} + +func (c *Client) ListRoutesByQuery(query url.Values) ([]Route, error) { + return c.fetchRoutes("/v2/routes?" + query.Encode()) +} + +func (c *Client) fetchRoutes(requestUrl string) ([]Route, error) { + var routes []Route + for { + routesResp, err := c.getRoutesResponse(requestUrl) + if err != nil { + return []Route{}, err + } + for _, route := range routesResp.Resources { + route.Entity.Guid = route.Meta.Guid + route.Entity.CreatedAt = route.Meta.CreatedAt + route.Entity.UpdatedAt = route.Meta.UpdatedAt + route.Entity.c = c + routes = append(routes, route.Entity) + } + requestUrl = routesResp.NextUrl + if requestUrl == "" { + break + } + } + return routes, nil +} + +func (c *Client) ListRoutes() ([]Route, error) { + return c.ListRoutesByQuery(nil) +} + +func (r *Route) Domain() (*Domain, error) { + req := r.c.NewRequest("GET", r.DomainURL) + resp, err := r.c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "requesting domain for route "+r.DomainURL) + } + + defer resp.Body.Close() + var domain DomainResource + if err = json.NewDecoder(resp.Body).Decode(&domain); err != nil { + return nil, errors.Wrap(err, "unmarshalling domain") + } + + return r.c.mergeDomainResource(domain), nil +} + +func (c *Client) getRoutesResponse(requestUrl string) (RoutesResponse, error) { + var routesResp RoutesResponse + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return RoutesResponse{}, errors.Wrap(err, "Error requesting routes") + } + resBody, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return RoutesResponse{}, errors.Wrap(err, "Error reading routes body") + } + err = json.Unmarshal(resBody, &routesResp) + if err != nil { + return RoutesResponse{}, errors.Wrap(err, "Error unmarshalling routes") + } + return routesResp, nil +} + +func (c *Client) createRoute(requestUrl string, routeRequest RouteRequest) (RoutesResource, error) { + var routeResp RoutesResource + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(routeRequest) + if err != nil { + return RoutesResource{}, errors.Wrap(err, "Error creating route - failed to serialize request body") + } + r := c.NewRequestWithBody("POST", requestUrl, buf) + resp, err := c.DoRequest(r) + if err != nil { + return RoutesResource{}, errors.Wrap(err, "Error creating route") + } + resBody, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return RoutesResource{}, errors.Wrap(err, "Error creating route") + } + err = json.Unmarshal(resBody, &routeResp) + if err != nil { + return RoutesResource{}, errors.Wrap(err, "Error unmarshalling routes") + } + routeResp.Entity.c = c + return routeResp, nil +} + +func (c *Client) DeleteRoute(guid string) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/routes/%s", guid))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting route %s, response code: %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) mergeRouteResource(rr RoutesResource) Route { + rr.Entity.Guid = rr.Meta.Guid + rr.Entity.CreatedAt = rr.Meta.CreatedAt + rr.Entity.UpdatedAt = rr.Meta.UpdatedAt + rr.Entity.c = c + return rr.Entity +} diff --git a/third_party/go-cfclient/routes_test.go b/third_party/go-cfclient/routes_test.go new file mode 100644 index 000000000000..84aafb279e82 --- /dev/null +++ b/third_party/go-cfclient/routes_test.go @@ -0,0 +1,200 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListRoutes(t *testing.T) { + Convey("List Routes", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/routes", []string{listRoutesPayloadPage1}, "", 200, "", nil}, + {"GET", "/v2/routes_page_2", []string{listRoutesPayloadPage2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + routes, err := client.ListRoutes() + So(err, ShouldBeNil) + + So(len(routes), ShouldEqual, 2) + So(routes[0].Guid, ShouldEqual, "24707add-83b8-4fd8-a8f4-b7297199c805") + So(routes[0].Host, ShouldEqual, "test-1") + So(routes[0].Path, ShouldEqual, "/foo") + So(routes[0].DomainGuid, ShouldEqual, "0b183484-45cc-4855-94d4-892f80f20c13") + So(routes[0].SpaceGuid, ShouldEqual, "494d8b64-8181-4183-a6d3-6279db8fec6e") + So(routes[0].ServiceInstanceGuid, ShouldEqual, "") + So(routes[0].Port, ShouldEqual, 0) + }) +} + +func TestGetRouteByGuid(t *testing.T) { + Convey("Get Route", t, func() { + setup(MockRoute{"GET", "/v2/routes/49df626e-8e87-4366-9fbc-f82186824e21", []string{getRouteByGuidPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + route, err := client.GetRouteByGuid("49df626e-8e87-4366-9fbc-f82186824e21") + So(err, ShouldBeNil) + So(route.Guid, ShouldEqual, "49df626e-8e87-4366-9fbc-f82186824e21") + So(route.Host, ShouldEqual, "host") + So(route.SpaceGuid, ShouldEqual, "e374dd83-1cea-40d4-84dc-6ac4fb9b2145") + }) +} + +func TestCreateRoute(t *testing.T) { + Convey("Create HTTP Route", t, func() { + setup(MockRoute{"POST", "/v2/routes", []string{createRoute}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + routeRequest := RouteRequest{ + DomainGuid: "08167353-32da-4ed9-9ef5-aa7b31bbc009", + SpaceGuid: "b65a9a76-8c55-460b-9162-18b396da66cf", + Host: "foo-host", + } + + route, err := client.CreateRoute(routeRequest) + So(err, ShouldBeNil) + + So(route.Guid, ShouldEqual, "b3fe6f31-e897-4e02-b49e-263ca96b4e3a") + So(route.SpaceGuid, ShouldEqual, "b65a9a76-8c55-460b-9162-18b396da66cf") + So(route.DomainGuid, ShouldEqual, "08167353-32da-4ed9-9ef5-aa7b31bbc009") + So(route.Host, ShouldEqual, "foo-host") + So(route.Port, ShouldEqual, 0) + So(route.Path, ShouldEqual, "") + So(route.ServiceInstanceGuid, ShouldEqual, "") + }) +} + +func TestCreateTcpRoute(t *testing.T) { + Convey("Create TCP Route", t, func() { + setup(MockRoute{"POST", "/v2/routes", []string{createTcpRoute}, "", 201, "generate_port=true", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + routeRequest := RouteRequest{ + DomainGuid: "08167353-32da-4ed9-9ef5-aa7b31bbc009", + SpaceGuid: "b65a9a76-8c55-460b-9162-18b396da66cf", + } + + route, err := client.CreateTcpRoute(routeRequest) + So(err, ShouldBeNil) + + So(route.Guid, ShouldEqual, "78fe5006-1d1c-41ba-94de-eb7002241b82") + So(route.SpaceGuid, ShouldEqual, "b65a9a76-8c55-460b-9162-18b396da66cf") + So(route.DomainGuid, ShouldEqual, "08167353-32da-4ed9-9ef5-aa7b31bbc009") + So(route.Port, ShouldEqual, 1099) + }) +} + +func TestBindRoute(t *testing.T) { + Convey("Bind route", t, func() { + Convey("When a successful status code is returned", func() { + setup(MockRoute{"PUT", "/v2/routes/7803de15-a20f-4dea-bf17-37de56629582/apps/ce5d0e27-3048-4024-80cb-fafbae9c3161", []string{bindRoute}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.BindRoute("7803de15-a20f-4dea-bf17-37de56629582", "ce5d0e27-3048-4024-80cb-fafbae9c3161") + So(err, ShouldBeNil) + + }) + Convey("When an error status code is returned", func() { + setup(MockRoute{"PUT", "/v2/routes/7803de15-a20f-4dea-bf17-37de56629582/apps/ce5d0e27-3048-4024-80cb-fafbae9c3161", []string{""}, "", 400, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.BindRoute("7803de15-a20f-4dea-bf17-37de56629582", "ce5d0e27-3048-4024-80cb-fafbae9c3161") + So(err, ShouldNotBeNil) + So(err.Error(), ShouldStartWith, "Error binding route 7803de15-a20f-4dea-bf17-37de56629582 to app ce5d0e27-3048-4024-80cb-fafbae9c3161") + }) + }) +} + +func TestDeleteRoute(t *testing.T) { + Convey("Delete route", t, func() { + Convey("When a successful status code is returned", func() { + setup(MockRoute{"DELETE", "/v2/routes/a537761f-9d93-4b30-af17-3d73dbca181b", []string{""}, "", 204, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteRoute("a537761f-9d93-4b30-af17-3d73dbca181b") + So(err, ShouldBeNil) + }) + + Convey("When an error status code is returned", func() { + setup(MockRoute{"DELETE", "/v2/routes/a537761f-9d93-4b30-af17-3d73dbca181b", []string{""}, "", 404, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteRoute("a537761f-9d93-4b30-af17-3d73dbca181b") + So(err, ShouldNotBeNil) + }) + }) +} + +func TestRouteDomain(t *testing.T) { + Convey("Find route domain", t, func() { + setup(MockRoute{"GET", "/v2/private_domains/foobar", []string{getDomainPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + route := Route{ + Guid: "route-guid", + DomainURL: "/v2/private_domains/foobar", + c: client, + } + + domain, err := route.Domain() + So(err, ShouldBeNil) + So(domain.Guid, ShouldEqual, "369373be-7864-4bb9-a8ef-8274da1f8c8b") + So(domain.Name, ShouldEqual, "example.com") + }) +} diff --git a/third_party/go-cfclient/secgroups.go b/third_party/go-cfclient/secgroups.go new file mode 100644 index 000000000000..5d6db1e67fcf --- /dev/null +++ b/third_party/go-cfclient/secgroups.go @@ -0,0 +1,576 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "reflect" + "strings" + + "github.com/Masterminds/semver" + "github.com/pkg/errors" +) + +type SecGroupResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []SecGroupResource `json:"resources"` +} + +type SecGroupCreateResponse struct { + Code int `json:"code"` + ErrorCode string `json:"error_code"` + Description string `json:"description"` +} + +type SecGroupResource struct { + Meta Meta `json:"metadata"` + Entity SecGroup `json:"entity"` +} + +type SecGroup struct { + Guid string `json:"guid"` + Name string `json:"name"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Rules []SecGroupRule `json:"rules"` + Running bool `json:"running_default"` + Staging bool `json:"staging_default"` + SpacesURL string `json:"spaces_url"` + StagingSpacesURL string `json:"staging_spaces_url"` + SpacesData []SpaceResource `json:"spaces"` + StagingSpacesData []SpaceResource `json:"staging_spaces"` + c *Client +} + +type SecGroupRule struct { + Protocol string `json:"protocol"` + Ports string `json:"ports,omitempty"` // e.g. "4000-5000,9142" + Destination string `json:"destination"` // CIDR Format + Description string `json:"description,omitempty"` // Optional description + Code int `json:"code"` // ICMP code + Type int `json:"type"` // ICMP type. Only valid if Protocol=="icmp" + Log bool `json:"log,omitempty"` // If true, log this rule +} + +var MinStagingSpacesVersion *semver.Version = getMinStagingSpacesVersion() + +func (c *Client) ListSecGroups() (secGroups []SecGroup, err error) { + requestURL := "/v2/security_groups?inline-relations-depth=1" + for requestURL != "" { + var secGroupResp SecGroupResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting sec groups") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading sec group response body") + } + + err = json.Unmarshal(resBody, &secGroupResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling sec group") + } + + for _, secGroup := range secGroupResp.Resources { + secGroup.Entity.Guid = secGroup.Meta.Guid + secGroup.Entity.CreatedAt = secGroup.Meta.CreatedAt + secGroup.Entity.UpdatedAt = secGroup.Meta.UpdatedAt + secGroup.Entity.c = c + for i, space := range secGroup.Entity.SpacesData { + space.Entity.Guid = space.Meta.Guid + secGroup.Entity.SpacesData[i] = space + } + if len(secGroup.Entity.SpacesData) == 0 { + spaces, err := secGroup.Entity.ListSpaceResources() + if err != nil { + return nil, err + } + secGroup.Entity.SpacesData = append(secGroup.Entity.SpacesData, spaces...) + } + if len(secGroup.Entity.StagingSpacesData) == 0 { + spaces, err := secGroup.Entity.ListStagingSpaceResources() + if err != nil { + return nil, err + } + secGroup.Entity.StagingSpacesData = append(secGroup.Entity.SpacesData, spaces...) + } + secGroups = append(secGroups, secGroup.Entity) + } + + requestURL = secGroupResp.NextUrl + resp.Body.Close() + } + return secGroups, nil +} + +func (c *Client) ListRunningSecGroups() ([]SecGroup, error) { + secGroups := make([]SecGroup, 0) + requestURL := "/v2/config/running_security_groups" + for requestURL != "" { + var secGroupResp SecGroupResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + + if err != nil { + return nil, errors.Wrap(err, "Error requesting sec groups") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading sec group response body") + } + + err = json.Unmarshal(resBody, &secGroupResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling sec group") + } + + for _, secGroup := range secGroupResp.Resources { + secGroup.Entity.Guid = secGroup.Meta.Guid + secGroup.Entity.CreatedAt = secGroup.Meta.CreatedAt + secGroup.Entity.UpdatedAt = secGroup.Meta.UpdatedAt + secGroup.Entity.c = c + + secGroups = append(secGroups, secGroup.Entity) + } + + requestURL = secGroupResp.NextUrl + resp.Body.Close() + } + return secGroups, nil +} + +func (c *Client) ListStagingSecGroups() ([]SecGroup, error) { + secGroups := make([]SecGroup, 0) + requestURL := "/v2/config/staging_security_groups" + for requestURL != "" { + var secGroupResp SecGroupResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + + if err != nil { + return nil, errors.Wrap(err, "Error requesting sec groups") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading sec group response body") + } + + err = json.Unmarshal(resBody, &secGroupResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling sec group") + } + + for _, secGroup := range secGroupResp.Resources { + secGroup.Entity.Guid = secGroup.Meta.Guid + secGroup.Entity.CreatedAt = secGroup.Meta.CreatedAt + secGroup.Entity.UpdatedAt = secGroup.Meta.UpdatedAt + secGroup.Entity.c = c + + secGroups = append(secGroups, secGroup.Entity) + } + + requestURL = secGroupResp.NextUrl + resp.Body.Close() + } + return secGroups, nil +} + +func (c *Client) GetSecGroupByName(name string) (secGroup SecGroup, err error) { + requestURL := "/v2/security_groups?q=name:" + name + var secGroupResp SecGroupResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + + if err != nil { + return secGroup, errors.Wrap(err, "Error requesting sec groups") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return secGroup, errors.Wrap(err, "Error reading sec group response body") + } + + err = json.Unmarshal(resBody, &secGroupResp) + if err != nil { + return secGroup, errors.Wrap(err, "Error unmarshaling sec group") + } + if len(secGroupResp.Resources) == 0 { + cfErr := NewSecurityGroupNotFoundError() + cfErr.Description = fmt.Sprintf(cfErr.Description, name) + return secGroup, cfErr + } + secGroup = secGroupResp.Resources[0].Entity + secGroup.Guid = secGroupResp.Resources[0].Meta.Guid + secGroup.CreatedAt = secGroupResp.Resources[0].Meta.CreatedAt + secGroup.UpdatedAt = secGroupResp.Resources[0].Meta.UpdatedAt + secGroup.c = c + + resp.Body.Close() + return secGroup, nil +} + +func (secGroup *SecGroup) ListSpaceResources() ([]SpaceResource, error) { + var spaceResources []SpaceResource + requestURL := secGroup.SpacesURL + for requestURL != "" { + spaceResp, err := secGroup.c.getSpaceResponse(requestURL) + if err != nil { + return []SpaceResource{}, err + } + for i, spaceRes := range spaceResp.Resources { + spaceRes.Entity.Guid = spaceRes.Meta.Guid + spaceRes.Entity.CreatedAt = spaceRes.Meta.CreatedAt + spaceRes.Entity.UpdatedAt = spaceRes.Meta.UpdatedAt + spaceResp.Resources[i] = spaceRes + } + spaceResources = append(spaceResources, spaceResp.Resources...) + requestURL = spaceResp.NextUrl + } + return spaceResources, nil +} + +func (secGroup *SecGroup) ListStagingSpaceResources() ([]SpaceResource, error) { + var spaceResources []SpaceResource + requestURL := secGroup.StagingSpacesURL + for requestURL != "" { + spaceResp, err := secGroup.c.getSpaceResponse(requestURL) + if err != nil { + // if this is a 404, let's make sure that it's not because we're on a legacy system + if cause := errors.Cause(err); cause != nil { + if httpErr, ok := cause.(CloudFoundryHTTPError); ok { + if httpErr.StatusCode == http.StatusNotFound { + info, infoErr := secGroup.c.GetInfo() + if infoErr != nil { + return nil, infoErr + } + + apiVersion, versionErr := semver.NewVersion(info.APIVersion) + if versionErr != nil { + return nil, versionErr + } + + if MinStagingSpacesVersion.GreaterThan(apiVersion) { + // this is probably not really an error, we're just trying to use a non-existent api + return nil, nil + } + } + } + } + + return []SpaceResource{}, err + } + for i, spaceRes := range spaceResp.Resources { + spaceRes.Entity.Guid = spaceRes.Meta.Guid + spaceRes.Entity.CreatedAt = spaceRes.Meta.CreatedAt + spaceRes.Entity.UpdatedAt = spaceRes.Meta.UpdatedAt + spaceResp.Resources[i] = spaceRes + } + spaceResources = append(spaceResources, spaceResp.Resources...) + requestURL = spaceResp.NextUrl + } + return spaceResources, nil +} + +/* +CreateSecGroup contacts the CF endpoint for creating a new security group. +name: the name to give to the created security group +rules: A slice of rule objects that describe the rules that this security group enforces. + This can technically be nil or an empty slice - we won't judge you +spaceGuids: The security group will be associated with the spaces specified by the contents of this slice. + If nil, the security group will not be associated with any spaces initially. +*/ +func (c *Client) CreateSecGroup(name string, rules []SecGroupRule, spaceGuids []string) (*SecGroup, error) { + return c.secGroupCreateHelper("/v2/security_groups", "POST", name, rules, spaceGuids) +} + +/* +UpdateSecGroup contacts the CF endpoint to update an existing security group. +guid: identifies the security group that you would like to update. +name: the new name to give to the security group +rules: A slice of rule objects that describe the rules that this security group enforces. + If this is left nil, the rules will not be changed. +spaceGuids: The security group will be associated with the spaces specified by the contents of this slice. + If nil, the space associations will not be changed. +*/ +func (c *Client) UpdateSecGroup(guid, name string, rules []SecGroupRule, spaceGuids []string) (*SecGroup, error) { + return c.secGroupCreateHelper("/v2/security_groups/"+guid, "PUT", name, rules, spaceGuids) +} + +/* +DeleteSecGroup contacts the CF endpoint to delete an existing security group. +guid: Indentifies the security group to be deleted. +*/ +func (c *Client) DeleteSecGroup(guid string) error { + // Perform the DELETE and check for errors + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/security_groups/%s", guid))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return nil +} + +/* +GetSecGroup contacts the CF endpoint for fetching the info for a particular security group. +guid: Identifies the security group to fetch information from +*/ +func (c *Client) GetSecGroup(guid string) (*SecGroup, error) { + // Perform the GET and check for errors + resp, err := c.DoRequest(c.NewRequest("GET", "/v2/security_groups/"+guid)) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + // get the json out of the response body + return respBodyToSecGroup(resp.Body, c) +} + +/* +BindSecGroup contacts the CF endpoint to associate a space with a security group +secGUID: identifies the security group to add a space to +spaceGUID: identifies the space to associate +*/ +func (c *Client) BindSecGroup(secGUID, spaceGUID string) error { + // Perform the PUT and check for errors + resp, err := c.DoRequest(c.NewRequest("PUT", fmt.Sprintf("/v2/security_groups/%s/spaces/%s", secGUID, spaceGUID))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return nil +} + +/* +BindSpaceStagingSecGroup contacts the CF endpoint to associate a space with a security group for staging functions only +secGUID: identifies the security group to add a space to +spaceGUID: identifies the space to associate +*/ +func (c *Client) BindStagingSecGroupToSpace(secGUID, spaceGUID string) error { + // Perform the PUT and check for errors + resp, err := c.DoRequest(c.NewRequest("PUT", fmt.Sprintf("/v2/security_groups/%s/staging_spaces/%s", secGUID, spaceGUID))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return nil +} + +/* +BindRunningSecGroup contacts the CF endpoint to associate a security group +secGUID: identifies the security group to add a space to +*/ +func (c *Client) BindRunningSecGroup(secGUID string) error { + // Perform the PUT and check for errors + resp, err := c.DoRequest(c.NewRequest("PUT", fmt.Sprintf("/v2/config/running_security_groups/%s", secGUID))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return nil +} + +/* +UnbindRunningSecGroup contacts the CF endpoint to dis-associate a security group +secGUID: identifies the security group to add a space to +*/ +func (c *Client) UnbindRunningSecGroup(secGUID string) error { + // Perform the DELETE and check for errors + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/config/running_security_groups/%s", secGUID))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return nil +} + +/* +BindStagingSecGroup contacts the CF endpoint to associate a space with a security group +secGUID: identifies the security group to add a space to +*/ +func (c *Client) BindStagingSecGroup(secGUID string) error { + // Perform the PUT and check for errors + resp, err := c.DoRequest(c.NewRequest("PUT", fmt.Sprintf("/v2/config/staging_security_groups/%s", secGUID))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return nil +} + +/* +UnbindStagingSecGroup contacts the CF endpoint to dis-associate a space with a security group +secGUID: identifies the security group to add a space to +*/ +func (c *Client) UnbindStagingSecGroup(secGUID string) error { + // Perform the DELETE and check for errors + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/config/staging_security_groups/%s", secGUID))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return nil +} + +/* +UnbindSecGroup contacts the CF endpoint to dissociate a space from a security group +secGUID: identifies the security group to remove a space from +spaceGUID: identifies the space to dissociate from the security group +*/ +func (c *Client) UnbindSecGroup(secGUID, spaceGUID string) error { + // Perform the DELETE and check for errors + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/security_groups/%s/spaces/%s", secGUID, spaceGUID))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return nil +} + +// Reads most security group response bodies into a SecGroup object +func respBodyToSecGroup(body io.ReadCloser, c *Client) (*SecGroup, error) { + // get the json from the response body + bodyRaw, err := ioutil.ReadAll(body) + if err != nil { + return nil, errors.Wrap(err, "Could not read response body") + } + jStruct := SecGroupResource{} + // make it a SecGroup + err = json.Unmarshal(bodyRaw, &jStruct) + if err != nil { + return nil, errors.Wrap(err, "Could not unmarshal response body as json") + } + // pull a few extra fields from other places + ret := jStruct.Entity + ret.Guid = jStruct.Meta.Guid + ret.CreatedAt = jStruct.Meta.CreatedAt + ret.UpdatedAt = jStruct.Meta.UpdatedAt + ret.c = c + return &ret, nil +} + +func convertStructToMap(st interface{}) map[string]interface{} { + reqRules := make(map[string]interface{}) + + v := reflect.ValueOf(st) + t := reflect.TypeOf(st) + + for i := 0; i < v.NumField(); i++ { + key := strings.ToLower(t.Field(i).Name) + typ := v.FieldByName(t.Field(i).Name).Kind().String() + structTag := t.Field(i).Tag.Get("json") + jsonName := strings.TrimSpace(strings.Split(structTag, ",")[0]) + value := v.FieldByName(t.Field(i).Name) + + // if jsonName is not empty use it for the key + if jsonName != "" { + key = jsonName + } + + switch typ { + case "string": + if !(value.String() == "" && strings.Contains(structTag, "omitempty")) { + reqRules[key] = value.String() + } + case "int": + reqRules[key] = value.Int() + default: + reqRules[key] = value.Interface() + } + } + + return reqRules +} + +// Create and Update secGroup pretty much do the same thing, so this function abstracts those out. +func (c *Client) secGroupCreateHelper(url, method, name string, rules []SecGroupRule, spaceGuids []string) (*SecGroup, error) { + reqRules := make([]map[string]interface{}, len(rules)) + + for i, rule := range rules { + reqRules[i] = convertStructToMap(rule) + protocol := strings.ToLower(reqRules[i]["protocol"].(string)) + + // if not icmp protocol need to remove the Code/Type fields + if protocol != "icmp" { + delete(reqRules[i], "code") + delete(reqRules[i], "type") + } + } + + req := c.NewRequest(method, url) + // set up request body + inputs := map[string]interface{}{ + "name": name, + "rules": reqRules, + } + + if spaceGuids != nil { + inputs["space_guids"] = spaceGuids + } + req.obj = inputs + // fire off the request and check for problems + resp, err := c.DoRequest(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { // Both create and update should give 201 CREATED + var response SecGroupCreateResponse + + bodyRaw, _ := ioutil.ReadAll(resp.Body) + + err = json.Unmarshal(bodyRaw, &response) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling response") + } + + return nil, fmt.Errorf(`Request failed CF API returned with status code %d +------------------------------- +Error Code %s +Code %d +Description %s`, + resp.StatusCode, response.ErrorCode, response.Code, response.Description) + } + // get the json from the response body + return respBodyToSecGroup(resp.Body, c) +} + +func getMinStagingSpacesVersion() *semver.Version { + v, _ := semver.NewVersion("2.68.0") + return v +} diff --git a/third_party/go-cfclient/secgroups_test.go b/third_party/go-cfclient/secgroups_test.go new file mode 100644 index 000000000000..051fd47266b8 --- /dev/null +++ b/third_party/go-cfclient/secgroups_test.go @@ -0,0 +1,256 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListSecGroups(t *testing.T) { + Convey("List SecGroups", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/security_groups", []string{listSecGroupsPayload}, "", 200, "inline-relations-depth=1", nil}, + {"GET", "/v2/security_groupsPage2", []string{listSecGroupsPayloadPage2}, "", 200, "", nil}, + {"GET", "/v2/security_groups/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/spaces", []string{emptyResources}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + secGroups, err := client.ListSecGroups() + So(err, ShouldBeNil) + + So(len(secGroups), ShouldEqual, 2) + So(secGroups[0].Guid, ShouldEqual, "af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c") + So(secGroups[0].Name, ShouldEqual, "secgroup-test") + So(secGroups[0].Running, ShouldEqual, true) + So(secGroups[0].Staging, ShouldEqual, true) + So(secGroups[0].Rules[0].Protocol, ShouldEqual, "tcp") + So(secGroups[0].Rules[0].Ports, ShouldEqual, "443,4443") + So(secGroups[0].Rules[0].Destination, ShouldEqual, "1.1.1.1") + So(secGroups[0].Rules[1].Protocol, ShouldEqual, "udp") + So(secGroups[0].Rules[1].Ports, ShouldEqual, "1111") + So(secGroups[0].Rules[1].Destination, ShouldEqual, "1.2.3.4") + So(secGroups[0].SpacesURL, ShouldEqual, "/v2/security_groups/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/spaces") + So(secGroups[0].SpacesData, ShouldBeEmpty) + So(secGroups[1].Guid, ShouldEqual, "f9ad202b-76dd-44ec-b7c2-fd2417a561e8") + So(secGroups[1].Name, ShouldEqual, "secgroup-test2") + So(secGroups[1].Running, ShouldEqual, false) + So(secGroups[1].Staging, ShouldEqual, false) + So(secGroups[1].Rules[0].Protocol, ShouldEqual, "udp") + So(secGroups[1].Rules[0].Ports, ShouldEqual, "2222") + So(secGroups[1].Rules[0].Destination, ShouldEqual, "2.2.2.2") + So(secGroups[1].Rules[1].Protocol, ShouldEqual, "tcp") + So(secGroups[1].Rules[1].Ports, ShouldEqual, "443,4443") + So(secGroups[1].Rules[1].Destination, ShouldEqual, "4.3.2.1") + So(secGroups[1].SpacesData[0].Entity.Guid, ShouldEqual, "e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4") + So(secGroups[1].SpacesData[0].Entity.Name, ShouldEqual, "space-test") + So(secGroups[1].SpacesData[1].Entity.Guid, ShouldEqual, "a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333") + So(secGroups[1].SpacesData[1].Entity.Name, ShouldEqual, "space-test2") + So(secGroups[1].SpacesData[2].Entity.Guid, ShouldEqual, "c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1") + So(secGroups[1].SpacesData[2].Entity.Name, ShouldEqual, "space-test3") + }) +} + +func TestSecGroupListSpaceResources(t *testing.T) { + Convey("List Space Resources", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/security_groups/123/spaces", []string{listSpacesPayload}, "", 200, "", nil}, + {"GET", "/v2/spacesPage2", []string{listSpacesPayloadPage2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + secGroup := &SecGroup{ + Guid: "123", + Name: "test-sec-group", + SpacesURL: "/v2/security_groups/123/spaces", + c: client, + } + spaces, err := secGroup.ListSpaceResources() + So(err, ShouldBeNil) + + So(len(spaces), ShouldEqual, 4) + So(spaces[0].Entity.Guid, ShouldEqual, "8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(spaces[0].Entity.Name, ShouldEqual, "dev") + So(spaces[1].Entity.Guid, ShouldEqual, "657b5923-7de0-486a-9928-b4d78ee24931") + So(spaces[1].Entity.Name, ShouldEqual, "demo") + So(spaces[2].Entity.Guid, ShouldEqual, "9ffd7c5c-d83c-4786-b399-b7bd54883977") + So(spaces[2].Entity.Name, ShouldEqual, "test") + So(spaces[3].Entity.Guid, ShouldEqual, "329b5923-7de0-486a-9928-b4d78ee24982") + So(spaces[3].Entity.Name, ShouldEqual, "prod") + }) +} + +func TestBindStagingSecGroupToSpaces(t *testing.T) { + Convey("Associate a security group to a space for staging", t, func() { + mocks := []MockRoute{ + {"PUT", "/v2/security_groups/8efd7c5c-d83c-4786-b399-b7bd548839e1/staging_spaces/329b5923-7de0-486a-9928-b4d78ee24982", []string{""}, "", 201, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.BindStagingSecGroupToSpace("8efd7c5c-d83c-4786-b399-b7bd548839e1", "329b5923-7de0-486a-9928-b4d78ee24982") + So(err, ShouldBeNil) + }) +} + +func TestNegativeBindStagingSecGroupToSpaces(t *testing.T) { + Convey("Try to associate a security group to a space for staging on a pre-2.68.0 API", t, func() { + mocks := []MockRoute{ + {"PUT", "/v2/security_groups/8efd7c5c-d83c-4786-b399-b7bd548839e1/staging_spaces/329b5923-7de0-486a-9928-b4d78ee24982", []string{""}, "", 404, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.BindStagingSecGroupToSpace("8efd7c5c-d83c-4786-b399-b7bd548839e1", "329b5923-7de0-486a-9928-b4d78ee24982") + So(err, ShouldNotBeNil) + }) +} + +func TestListRunningSecGroups(t *testing.T) { + Convey("List Running SecGroups", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/config/running_security_groups", []string{listRunningSecGroupsPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + secGroups, err := client.ListRunningSecGroups() + So(err, ShouldBeNil) + + So(len(secGroups), ShouldEqual, 1) + for i := range secGroups { + So(secGroups[i].Running, ShouldBeTrue) + } + }) +} + +func TestListStagingSecGroups(t *testing.T) { + Convey("List Staging SecGroups", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/config/staging_security_groups", []string{listStagingSecGroupsPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + secGroups, err := client.ListStagingSecGroups() + So(err, ShouldBeNil) + + So(len(secGroups), ShouldEqual, 1) + for i := range secGroups { + So(secGroups[i].Staging, ShouldBeTrue) + } + }) +} + +func TestBindRunningSecGroups(t *testing.T) { + Convey("Unbind Running Sec Groups", t, func() { + mocks := []MockRoute{ + {"PUT", "/v2/config/running_security_groups/8efd7c5c-d83c-4786-b399-b7bd548839e1", []string{""}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.BindRunningSecGroup("8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(err, ShouldBeNil) + }) +} + +func TestUnbindRunningSecGroups(t *testing.T) { + Convey("Unbind Running Sec Groups", t, func() { + mocks := []MockRoute{ + {"DELETE", "/v2/config/running_security_groups/8efd7c5c-d83c-4786-b399-b7bd548839e1", []string{""}, "", 204, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.UnbindRunningSecGroup("8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(err, ShouldBeNil) + }) +} + +func TestBindStagingSecGroups(t *testing.T) { + Convey("Unbind Staging Sec Groups", t, func() { + mocks := []MockRoute{ + {"PUT", "/v2/config/staging_security_groups/8efd7c5c-d83c-4786-b399-b7bd548839e1", []string{""}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.BindStagingSecGroup("8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(err, ShouldBeNil) + }) +} + +func TestUnbindStagingSecGroups(t *testing.T) { + Convey("Unbind Staging Sec Groups", t, func() { + mocks := []MockRoute{ + {"DELETE", "/v2/config/staging_security_groups/8efd7c5c-d83c-4786-b399-b7bd548839e1", []string{""}, "", 204, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.UnbindStagingSecGroup("8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/service_bindings.go b/third_party/go-cfclient/service_bindings.go new file mode 100644 index 000000000000..b495897e8471 --- /dev/null +++ b/third_party/go-cfclient/service_bindings.go @@ -0,0 +1,181 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type ServiceBindingsResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + Resources []ServiceBindingResource `json:"resources"` + NextUrl string `json:"next_url"` +} + +type ServiceBindingResource struct { + Meta Meta `json:"metadata"` + Entity ServiceBinding `json:"entity"` +} + +type ServiceBinding struct { + Guid string `json:"guid"` + Name string `json:"name"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + AppGuid string `json:"app_guid"` + ServiceInstanceGuid string `json:"service_instance_guid"` + Credentials interface{} `json:"credentials"` + BindingOptions interface{} `json:"binding_options"` + GatewayData interface{} `json:"gateway_data"` + GatewayName string `json:"gateway_name"` + SyslogDrainUrl string `json:"syslog_drain_url"` + VolumeMounts interface{} `json:"volume_mounts"` + AppUrl string `json:"app_url"` + ServiceInstanceUrl string `json:"service_instance_url"` + c *Client +} + +func (c *Client) ListServiceBindingsByQuery(query url.Values) ([]ServiceBinding, error) { + var serviceBindings []ServiceBinding + requestUrl := "/v2/service_bindings?" + query.Encode() + + for { + var serviceBindingsResp ServiceBindingsResponse + + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting service bindings") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading service bindings request:") + } + + err = json.Unmarshal(resBody, &serviceBindingsResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling service bindings") + } + for _, serviceBinding := range serviceBindingsResp.Resources { + serviceBinding.Entity.Guid = serviceBinding.Meta.Guid + serviceBinding.Entity.CreatedAt = serviceBinding.Meta.CreatedAt + serviceBinding.Entity.UpdatedAt = serviceBinding.Meta.UpdatedAt + serviceBinding.Entity.c = c + serviceBindings = append(serviceBindings, serviceBinding.Entity) + } + requestUrl = serviceBindingsResp.NextUrl + if requestUrl == "" { + break + } + } + + return serviceBindings, nil +} + +func (c *Client) ListServiceBindings() ([]ServiceBinding, error) { + return c.ListServiceBindingsByQuery(nil) +} + +func (c *Client) GetServiceBindingByGuid(guid string) (ServiceBinding, error) { + var serviceBinding ServiceBindingResource + r := c.NewRequest("GET", "/v2/service_bindings/"+url.QueryEscape(guid)) + resp, err := c.DoRequest(r) + if err != nil { + return ServiceBinding{}, errors.Wrap(err, "Error requesting serving binding") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return ServiceBinding{}, errors.Wrap(err, "Error reading service binding response body") + } + err = json.Unmarshal(resBody, &serviceBinding) + if err != nil { + return ServiceBinding{}, errors.Wrap(err, "Error unmarshalling service binding") + } + serviceBinding.Entity.Guid = serviceBinding.Meta.Guid + serviceBinding.Entity.CreatedAt = serviceBinding.Meta.CreatedAt + serviceBinding.Entity.UpdatedAt = serviceBinding.Meta.UpdatedAt + serviceBinding.Entity.c = c + return serviceBinding.Entity, nil +} + +func (c *Client) ServiceBindingByGuid(guid string) (ServiceBinding, error) { + return c.GetServiceBindingByGuid(guid) +} + +func (c *Client) DeleteServiceBinding(guid string) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/service_bindings/%s", guid))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting service binding %s, response code %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) CreateServiceBinding(appGUID, serviceInstanceGUID string) (*ServiceBinding, error) { + req := c.NewRequest("POST", "/v2/service_bindings") + req.obj = map[string]interface{}{ + "app_guid": appGUID, + "service_instance_guid": serviceInstanceGUID, + } + resp, err := c.DoRequest(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, errors.Wrapf(err, "Error binding app %s to service instance %s, response code %d", appGUID, serviceInstanceGUID, resp.StatusCode) + } + return c.handleServiceBindingResp(resp) +} + +func (c *Client) CreateRouteServiceBinding(routeGUID, serviceInstanceGUID string) error { + req := c.NewRequest("PUT", fmt.Sprintf("/v2/user_provided_service_instances/%s/routes/%s", serviceInstanceGUID, routeGUID)) + resp, err := c.DoRequest(req) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return errors.Wrapf(err, "Error binding route %s to service instance %s, response code %d", routeGUID, serviceInstanceGUID, resp.StatusCode) + } + return nil +} + +func (c *Client) DeleteRouteServiceBinding(routeGUID, serviceInstanceGUID string) error { + req := c.NewRequest("DELETE", fmt.Sprintf("/v2/service_instances/%s/routes/%s", serviceInstanceGUID, routeGUID)) + resp, err := c.DoRequest(req) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return errors.Wrapf(err, "Error deleting bound route %s from service instance %s, response code %d", routeGUID, serviceInstanceGUID, resp.StatusCode) + } + return nil +} + +func (c *Client) handleServiceBindingResp(resp *http.Response) (*ServiceBinding, error) { + defer resp.Body.Close() + var sb ServiceBindingResource + err := json.NewDecoder(resp.Body).Decode(&sb) + if err != nil { + return nil, err + } + return c.mergeServiceBindingResource(sb), nil +} + +func (c *Client) mergeServiceBindingResource(serviceBinding ServiceBindingResource) *ServiceBinding { + serviceBinding.Entity.Guid = serviceBinding.Meta.Guid + serviceBinding.Entity.c = c + return &serviceBinding.Entity +} diff --git a/third_party/go-cfclient/service_bindings_test.go b/third_party/go-cfclient/service_bindings_test.go new file mode 100644 index 000000000000..7b028356e9ba --- /dev/null +++ b/third_party/go-cfclient/service_bindings_test.go @@ -0,0 +1,158 @@ +package cfclient + +import ( + "net/http" + "reflect" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListServiceBindings(t *testing.T) { + Convey("List Service Bindings", t, func() { + mocks := []MockRoute{ + { + Method: "GET", + Endpoint: "/v2/service_bindings", + Output: []string{listServiceBindingsPayloadPage1}, + Status: 200, + }, + { + Method: "GET", + Endpoint: "/v2/service_bindings2", + Output: []string{listServiceBindingsPayloadPage2}, + Status: 200, + }, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceBindings, err := client.ListServiceBindings() + So(err, ShouldBeNil) + + So(len(serviceBindings), ShouldEqual, 2) + So(serviceBindings[0].Guid, ShouldEqual, "aa599bb3-4811-405a-bbe3-a68c7c55afc8") + So(serviceBindings[0].AppGuid, ShouldEqual, "b26e7e98-f002-41a8-a663-1b60f808a92a") + So(serviceBindings[0].ServiceInstanceGuid, ShouldEqual, "bde206e0-1ee8-48ad-b794-44c857633d50") + So(reflect.DeepEqual( + serviceBindings[0].Credentials, + map[string]interface{}{"creds-key-66": "creds-val-66"}), ShouldBeTrue) + So(serviceBindings[0].BindingOptions, ShouldBeEmpty) + So(serviceBindings[0].GatewayData, ShouldBeNil) + So(serviceBindings[0].GatewayName, ShouldEqual, "") + So(serviceBindings[0].SyslogDrainUrl, ShouldEqual, "") + So(serviceBindings[0].VolumeMounts, ShouldBeEmpty) + So(serviceBindings[0].AppUrl, ShouldEqual, "/v2/apps/b26e7e98-f002-41a8-a663-1b60f808a92a") + So(serviceBindings[0].ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/bde206e0-1ee8-48ad-b794-44c857633d50") + So(serviceBindings[1].Guid, ShouldEqual, "8201b87d-b273-4fdf-8dd4-4b42ce970cc7") + So(serviceBindings[1].AppGuid, ShouldEqual, "636bbf83-5b54-488d-9528-066f680a99dc") + So(serviceBindings[1].ServiceInstanceGuid, ShouldEqual, "c3023201-44f5-4dc8-a903-c69c9eba9809") + So(reflect.DeepEqual( + serviceBindings[1].Credentials, + map[string]interface{}{"creds-key-66": "creds-val-66"}), ShouldBeTrue) + So(serviceBindings[1].BindingOptions, ShouldBeEmpty) + So(serviceBindings[1].GatewayData, ShouldBeNil) + So(serviceBindings[1].GatewayName, ShouldEqual, "") + So(serviceBindings[1].SyslogDrainUrl, ShouldEqual, "") + So(serviceBindings[1].VolumeMounts, ShouldBeEmpty) + So(serviceBindings[1].AppUrl, ShouldEqual, "/v2/apps/636bbf83-5b54-488d-9528-066f680a99dc") + So(serviceBindings[1].ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/c3023201-44f5-4dc8-a903-c69c9eba9809") + + }) +} +func TestServiceBindingByGuid(t *testing.T) { + Convey("Service Binding By Guid", t, func() { + setup(MockRoute{"GET", "/v2/service_bindings/foo-bar-baz", []string{serviceBindingByGuidPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceBinding, err := client.GetServiceBindingByGuid("foo-bar-baz") + So(err, ShouldBeNil) + + So(serviceBinding.Guid, ShouldEqual, "foo-bar-baz") + So(serviceBinding.AppGuid, ShouldEqual, "app-bar-baz") + }) +} + +func TestDeleteServiceBinding(t *testing.T) { + Convey("Delete service binding", t, func() { + setup(MockRoute{"DELETE", "/v2/service_bindings/guid", []string{""}, "", http.StatusNoContent, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteServiceBinding("guid") + So(err, ShouldBeNil) + }) +} + +func TestCreateServiceBinding(t *testing.T) { + Convey("Create service binding", t, func() { + body := `{"app_guid":"app-guid","service_instance_guid":"service-instance-guid"}` + setup(MockRoute{"POST", "/v2/service_bindings", []string{postServiceBindingPayload}, "", http.StatusCreated, "", &body}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + binding, err := client.CreateServiceBinding("app-guid", "service-instance-guid") + So(err, ShouldBeNil) + So(binding.Guid, ShouldEqual, "4e690cd4-66ef-4052-a23d-0d748316f18c") + So(binding.AppGuid, ShouldEqual, "081d55a0-1bfa-4e51-8d08-273f764988db") + So(binding.ServiceInstanceGuid, ShouldEqual, "a0029c76-7017-4a74-94b0-54a04ad94b80") + }) +} + +func TestCreateRouteServiceBinding(t *testing.T) { + Convey("Create route service binding", t, func() { + setup(MockRoute{"PUT", "/v2/user_provided_service_instances/5badd282-6e07-4fc6-a8c4-78be99040774/routes/237d9236-7997-4b1a-be8d-2aaf2d85421a", []string{""}, "", http.StatusCreated, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.CreateRouteServiceBinding("237d9236-7997-4b1a-be8d-2aaf2d85421a", "5badd282-6e07-4fc6-a8c4-78be99040774") + So(err, ShouldBeNil) + }) +} + +func TestDeleteRouteServiceBinding(t *testing.T) { + Convey("Delete route service binding", t, func() { + setup(MockRoute{"DELETE", "/v2/service_instances/5badd282-6e07-4fc6-a8c4-78be99040774/routes/237d9236-7997-4b1a-be8d-2aaf2d85421a", []string{""}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteRouteServiceBinding("237d9236-7997-4b1a-be8d-2aaf2d85421a", "5badd282-6e07-4fc6-a8c4-78be99040774") + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/service_brokers.go b/third_party/go-cfclient/service_brokers.go new file mode 100644 index 000000000000..a3392b2fae30 --- /dev/null +++ b/third_party/go-cfclient/service_brokers.go @@ -0,0 +1,208 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type ServiceBrokerResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []ServiceBrokerResource `json:"resources"` +} + +type ServiceBrokerResource struct { + Meta Meta `json:"metadata"` + Entity ServiceBroker `json:"entity"` +} + +type UpdateServiceBrokerRequest struct { + Name string `json:"name"` + BrokerURL string `json:"broker_url"` + Username string `json:"auth_username"` + Password string `json:"auth_password"` +} + +type CreateServiceBrokerRequest struct { + Name string `json:"name"` + BrokerURL string `json:"broker_url"` + Username string `json:"auth_username"` + Password string `json:"auth_password"` + SpaceGUID string `json:"space_guid,omitempty"` +} + +type ServiceBroker struct { + Guid string `json:"guid"` + Name string `json:"name"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + BrokerURL string `json:"broker_url"` + Username string `json:"auth_username"` + Password string `json:"auth_password"` + SpaceGUID string `json:"space_guid,omitempty"` +} + +func (c *Client) DeleteServiceBroker(guid string) error { + requestURL := fmt.Sprintf("/v2/service_brokers/%s", guid) + r := c.NewRequest("DELETE", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting service broker %s, response code: %d", guid, resp.StatusCode) + } + return nil + +} + +func (c *Client) UpdateServiceBroker(guid string, usb UpdateServiceBrokerRequest) (ServiceBroker, error) { + var serviceBrokerResource ServiceBrokerResource + + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(usb) + if err != nil { + return ServiceBroker{}, err + } + req := c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/service_brokers/%s", guid), buf) + resp, err := c.DoRequest(req) + if err != nil { + return ServiceBroker{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return ServiceBroker{}, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return ServiceBroker{}, err + } + err = json.Unmarshal(body, &serviceBrokerResource) + if err != nil { + return ServiceBroker{}, err + } + serviceBrokerResource.Entity.Guid = serviceBrokerResource.Meta.Guid + return serviceBrokerResource.Entity, nil +} + +func (c *Client) CreateServiceBroker(csb CreateServiceBrokerRequest) (ServiceBroker, error) { + var serviceBrokerResource ServiceBrokerResource + + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(csb) + if err != nil { + return ServiceBroker{}, err + } + req := c.NewRequestWithBody("POST", "/v2/service_brokers", buf) + resp, err := c.DoRequest(req) + if err != nil { + return ServiceBroker{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return ServiceBroker{}, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return ServiceBroker{}, err + } + err = json.Unmarshal(body, &serviceBrokerResource) + if err != nil { + return ServiceBroker{}, err + } + + serviceBrokerResource.Entity.Guid = serviceBrokerResource.Meta.Guid + return serviceBrokerResource.Entity, nil +} + +func (c *Client) ListServiceBrokersByQuery(query url.Values) ([]ServiceBroker, error) { + var sbs []ServiceBroker + requestURL := "/v2/service_brokers?" + query.Encode() + for { + serviceBrokerResp, err := c.getServiceBrokerResponse(requestURL) + if err != nil { + return []ServiceBroker{}, err + } + for _, sb := range serviceBrokerResp.Resources { + sb.Entity.Guid = sb.Meta.Guid + sb.Entity.CreatedAt = sb.Meta.CreatedAt + sb.Entity.UpdatedAt = sb.Meta.UpdatedAt + sbs = append(sbs, sb.Entity) + } + requestURL = serviceBrokerResp.NextUrl + if requestURL == "" { + break + } + } + return sbs, nil +} + +func (c *Client) ListServiceBrokers() ([]ServiceBroker, error) { + return c.ListServiceBrokersByQuery(nil) +} + +func (c *Client) GetServiceBrokerByGuid(guid string) (ServiceBroker, error) { + var serviceBrokerRes ServiceBrokerResource + r := c.NewRequest("GET", "/v2/service_brokers/"+guid) + resp, err := c.DoRequest(r) + if err != nil { + return ServiceBroker{}, err + } + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return ServiceBroker{}, err + } + err = json.Unmarshal(body, &serviceBrokerRes) + if err != nil { + return ServiceBroker{}, err + } + serviceBrokerRes.Entity.Guid = serviceBrokerRes.Meta.Guid + serviceBrokerRes.Entity.CreatedAt = serviceBrokerRes.Meta.CreatedAt + serviceBrokerRes.Entity.UpdatedAt = serviceBrokerRes.Meta.UpdatedAt + return serviceBrokerRes.Entity, nil +} + +func (c *Client) GetServiceBrokerByName(name string) (ServiceBroker, error) { + q := url.Values{} + q.Set("q", "name:"+name) + sbs, err := c.ListServiceBrokersByQuery(q) + if err != nil { + return ServiceBroker{}, err + } + if len(sbs) == 0 { + cfErr := NewServiceBrokerNotFoundError() + cfErr.Description = fmt.Sprintf(cfErr.Description, name) + return ServiceBroker{}, cfErr + } + return sbs[0], nil +} + +func (c *Client) getServiceBrokerResponse(requestURL string) (ServiceBrokerResponse, error) { + var serviceBrokerResp ServiceBrokerResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return ServiceBrokerResponse{}, errors.Wrap(err, "Error requesting Service Brokers") + } + resBody, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return ServiceBrokerResponse{}, errors.Wrap(err, "Error reading Service Broker request") + } + err = json.Unmarshal(resBody, &serviceBrokerResp) + if err != nil { + return ServiceBrokerResponse{}, errors.Wrap(err, "Error unmarshalling Service Broker") + } + return serviceBrokerResp, nil +} diff --git a/third_party/go-cfclient/service_brokers_test.go b/third_party/go-cfclient/service_brokers_test.go new file mode 100644 index 000000000000..4e6b8f9f9e8c --- /dev/null +++ b/third_party/go-cfclient/service_brokers_test.go @@ -0,0 +1,31 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListServiceBrokers(t *testing.T) { + Convey("List Service Brokers", t, func() { + setup(MockRoute{"GET", "/v2/service_brokers", []string{listServiceBrokersPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + servicePlans, err := client.ListServiceBrokers() + So(err, ShouldBeNil) + + So(len(servicePlans), ShouldEqual, 1) + So(servicePlans[0].Guid, ShouldEqual, "90a413fd-a636-4133-8bfb-a94b07839e96") + So(servicePlans[0].Name, ShouldEqual, "name-85") + So(servicePlans[0].BrokerURL, ShouldEqual, "https://foo.com/url-2") + So(servicePlans[0].Username, ShouldEqual, "auth_username-2") + So(servicePlans[0].SpaceGUID, ShouldEqual, "1d43e64d-ed64-43dd-9046-11f422bd407b") + So(servicePlans[0].Password, ShouldBeEmpty) + }) +} diff --git a/third_party/go-cfclient/service_instances.go b/third_party/go-cfclient/service_instances.go new file mode 100644 index 000000000000..070c262e4226 --- /dev/null +++ b/third_party/go-cfclient/service_instances.go @@ -0,0 +1,234 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type ServiceInstancesResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []ServiceInstanceResource `json:"resources"` +} + +type ServiceInstanceRequest struct { + Name string `json:"name"` + SpaceGuid string `json:"space_guid"` + ServicePlanGuid string `json:"service_plan_guid"` + Parameters map[string]interface{} `json:"parameters,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +type ServiceInstanceUpdateRequest struct { + Name string `json:"name,omitempty"` + ServicePlanGuid string `json:"service_plan_guid,omitempty"` + Parameters map[string]interface{} `json:"parameters,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +type ServiceInstanceResource struct { + Meta Meta `json:"metadata"` + Entity ServiceInstance `json:"entity"` +} + +type ServiceInstance struct { + Name string `json:"name"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Credentials map[string]interface{} `json:"credentials"` + ServicePlanGuid string `json:"service_plan_guid"` + SpaceGuid string `json:"space_guid"` + DashboardUrl string `json:"dashboard_url"` + Type string `json:"type"` + LastOperation LastOperation `json:"last_operation"` + Tags []string `json:"tags"` + ServiceGuid string `json:"service_guid"` + SpaceUrl string `json:"space_url"` + ServicePlanUrl string `json:"service_plan_url"` + ServiceBindingsUrl string `json:"service_bindings_url"` + ServiceKeysUrl string `json:"service_keys_url"` + ServiceInstanceParametersUrl string `json:"service_instance_parameters_url"` + SharedFromUrl string `json:"shared_from_url"` + SharedToUrl string `json:"shared_to_url"` + RoutesUrl string `json:"routes_url"` + ServiceUrl string `json:"service_url"` + Guid string `json:"guid"` + c *Client +} + +type LastOperation struct { + Type string `json:"type"` + State string `json:"state"` + Description string `json:"description"` + UpdatedAt string `json:"updated_at"` + CreatedAt string `json:"created_at"` +} + +func (c *Client) ListServiceInstancesByQuery(query url.Values) ([]ServiceInstance, error) { + var instances []ServiceInstance + + requestUrl := "/v2/service_instances?" + query.Encode() + for { + sir, err := c.getServiceInstancesResponse(requestUrl) + if err != nil { + return instances, err + } + for _, instance := range sir.Resources { + instances = append(instances, c.mergeServiceInstance(instance)) + } + requestUrl = sir.NextUrl + if requestUrl == "" || query.Get("page") != "" { + break + } + } + return instances, nil +} + +func (c *Client) ListServiceInstances() ([]ServiceInstance, error) { + return c.ListServiceInstancesByQuery(nil) +} + +func (c *Client) GetServiceInstanceParams(guid string) (map[string]interface{}, error) { + req := c.NewRequest("GET", "/v2/service_instances/"+guid+"/parameters") + res, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error requesting service instance parameters") + } + + defer res.Body.Close() + + var result map[string]interface{} + err = json.NewDecoder(res.Body).Decode(&result) + if err != nil { + return nil, errors.Wrap(err, "Error JSON parsing service instance parameters") + } + + return result, nil +} + +func (c *Client) GetServiceInstanceByGuid(guid string) (ServiceInstance, error) { + var sir ServiceInstanceResource + req := c.NewRequest("GET", "/v2/service_instances/"+guid) + res, err := c.DoRequest(req) + if err != nil { + return ServiceInstance{}, errors.Wrap(err, "Error requesting service instance") + } + defer res.Body.Close() + data, err := ioutil.ReadAll(res.Body) + if err != nil { + return ServiceInstance{}, errors.Wrap(err, "Error reading service instance response") + } + err = json.Unmarshal(data, &sir) + if err != nil { + return ServiceInstance{}, errors.Wrap(err, "Error JSON parsing service instance response") + } + return c.mergeServiceInstance(sir), nil +} + +func (c *Client) ServiceInstanceByGuid(guid string) (ServiceInstance, error) { + return c.GetServiceInstanceByGuid(guid) +} + +func (c *Client) getServiceInstancesResponse(requestUrl string) (ServiceInstancesResponse, error) { + var serviceInstancesResponse ServiceInstancesResponse + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return ServiceInstancesResponse{}, errors.Wrap(err, "Error requesting service instances") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + + if err != nil { + return ServiceInstancesResponse{}, errors.Wrap(err, "Error reading service instance request") + } + err = json.Unmarshal(resBody, &serviceInstancesResponse) + if err != nil { + return ServiceInstancesResponse{}, errors.Wrap(err, "Error unmarshalling service instance") + } + return serviceInstancesResponse, nil +} + +func (c *Client) mergeServiceInstance(instance ServiceInstanceResource) ServiceInstance { + instance.Entity.Guid = instance.Meta.Guid + instance.Entity.CreatedAt = instance.Meta.CreatedAt + instance.Entity.UpdatedAt = instance.Meta.UpdatedAt + instance.Entity.c = c + return instance.Entity +} + +func (c *Client) CreateServiceInstance(req ServiceInstanceRequest) (ServiceInstance, error) { + var sir ServiceInstanceResource + + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(req) + if err != nil { + return ServiceInstance{}, err + } + + r := c.NewRequestWithBody("POST", "/v2/service_instances?accepts_incomplete=true", buf) + + res, err := c.DoRequest(r) + if err != nil { + return ServiceInstance{}, err + } + + defer res.Body.Close() + if res.StatusCode != http.StatusAccepted && res.StatusCode != http.StatusCreated { + return ServiceInstance{}, errors.Wrapf(err, "Error creating service, response code: %d", res.StatusCode) + } + + data, err := ioutil.ReadAll(res.Body) + if err != nil { + return ServiceInstance{}, errors.Wrap(err, "Error reading service instance response") + } + + err = json.Unmarshal(data, &sir) + if err != nil { + return ServiceInstance{}, errors.Wrap(err, "Error JSON parsing service instance response") + } + + return c.mergeServiceInstance(sir), nil +} + +func (c *Client) UpdateSI(serviceInstanceGuid string, req ServiceInstanceUpdateRequest, async bool) error { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(req) + if err != nil { + return err + } + return c.UpdateServiceInstance(serviceInstanceGuid, buf, async) +} + +func (c *Client) UpdateServiceInstance(serviceInstanceGuid string, updatedConfiguration io.Reader, async bool) error { + u := fmt.Sprintf("/v2/service_instances/%s?accepts_incomplete=%t", serviceInstanceGuid, async) + resp, err := c.DoRequest(c.NewRequestWithBody("PUT", u, updatedConfiguration)) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusAccepted { + return errors.Wrapf(err, "Error updating service instance %s, response code %d", serviceInstanceGuid, resp.StatusCode) + } + return nil +} + +func (c *Client) DeleteServiceInstance(guid string, recursive, async bool) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/service_instances/%s?recursive=%t&accepts_incomplete=%t&async=%t", guid, recursive, async, async))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusAccepted { + return errors.Wrapf(err, "Error deleting service instance %s, response code %d", guid, resp.StatusCode) + } + return nil +} diff --git a/third_party/go-cfclient/service_instances_test.go b/third_party/go-cfclient/service_instances_test.go new file mode 100644 index 000000000000..34a829e2eebc --- /dev/null +++ b/third_party/go-cfclient/service_instances_test.go @@ -0,0 +1,214 @@ +package cfclient + +import ( + "net/http" + "strings" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListServicesInstances(t *testing.T) { + Convey("List Service Instances", t, func() { + setup(MockRoute{"GET", "/v2/service_instances", []string{listServiceInstancePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + instances, err := client.ListServiceInstances() + So(err, ShouldBeNil) + + So(len(instances), ShouldEqual, 2) + So(instances[0].Guid, ShouldEqual, "8423ca96-90ad-411f-b77a-0907844949fc") + So(instances[0].Name, ShouldEqual, "fortunes-db") + }) +} + +func TestGetServiceInstanceParams(t *testing.T) { + Convey("Service instance parameters", t, func() { + setup(MockRoute{"GET", "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/parameters", []string{serviceInstanceParamsPayload}, "", 200, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + params, err := client.GetServiceInstanceParams("8423ca96-90ad-411f-b77a-0907844949fc") + So(err, ShouldBeNil) + + So(params, ShouldContainKey, "foo") + So(params, ShouldContainKey, "baz") + So(params["foo"], ShouldEqual, "bar") + So(params["baz"], ShouldEqual, 42) + }) +} + +func TestServiceInstanceByGuid(t *testing.T) { + Convey("Service instance by Guid", t, func() { + setup(MockRoute{"GET", "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc", []string{serviceInstancePayload}, "", 200, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + service, err := client.GetServiceInstanceByGuid("8423ca96-90ad-411f-b77a-0907844949fc") + So(err, ShouldBeNil) + + expected := ServiceInstance{ + Guid: "8423ca96-90ad-411f-b77a-0907844949fc", + CreatedAt: "2016-10-21T18:22:56Z", + UpdatedAt: "2016-10-21T18:22:56Z", + Credentials: map[string]interface{}{}, + Name: "fortunes-db", + LastOperation: LastOperation{ + Type: "create", + State: "succeeded", + Description: "", + UpdatedAt: "", + CreatedAt: "2016-10-21T18:22:56Z", + }, + Tags: []string{}, + ServiceGuid: "440ce9d9-b108-4bbe-80b4-08338f3cc25b", + ServicePlanGuid: "f48419f7-4717-4706-86e4-a24973848a77", + SpaceGuid: "21e5fdc7-5131-4743-8447-6373cf336a77", + DashboardUrl: "https://p-mysql.system.example.com/manage/instances/8423ca96-90ad-411f-b77a-0907844949fc", + Type: "managed_service_instance", + SpaceUrl: "/v2/spaces/21e5fdc7-5131-4743-8447-6373cf336a77", + ServicePlanUrl: "/v2/service_plans/f48419f7-4717-4706-86e4-a24973848a77", + ServiceBindingsUrl: "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/service_bindings", + ServiceKeysUrl: "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/service_keys", + RoutesUrl: "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/routes", + ServiceUrl: "/v2/services/440ce9d9-b108-4bbe-80b4-08338f3cc25b", + c: client, + } + So(service, ShouldResemble, expected) + }) +} + +func TestCreateServiceInstance(t *testing.T) { + Convey("Create service instance", t, func() { + setup(MockRoute{"POST", "/v2/service_instances", []string{serviceInstancePayload}, "", 202, "accepts_incomplete=true", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + req := ServiceInstanceRequest{ + Name: "test-service", + ServicePlanGuid: "f48419f7-4717-4706-86e4-a24973848a77", + SpaceGuid: "21e5fdc7-5131-4743-8447-6373cf336a77", + } + + service, err := client.CreateServiceInstance(req) + So(err, ShouldBeNil) + + expected := ServiceInstance{ + Guid: "8423ca96-90ad-411f-b77a-0907844949fc", + CreatedAt: "2016-10-21T18:22:56Z", + UpdatedAt: "2016-10-21T18:22:56Z", + Credentials: map[string]interface{}{}, + Name: "fortunes-db", + LastOperation: LastOperation{ + Type: "create", + State: "succeeded", + Description: "", + UpdatedAt: "", + CreatedAt: "2016-10-21T18:22:56Z", + }, + Tags: []string{}, + ServiceGuid: "440ce9d9-b108-4bbe-80b4-08338f3cc25b", + ServicePlanGuid: "f48419f7-4717-4706-86e4-a24973848a77", + SpaceGuid: "21e5fdc7-5131-4743-8447-6373cf336a77", + DashboardUrl: "https://p-mysql.system.example.com/manage/instances/8423ca96-90ad-411f-b77a-0907844949fc", + Type: "managed_service_instance", + SpaceUrl: "/v2/spaces/21e5fdc7-5131-4743-8447-6373cf336a77", + ServicePlanUrl: "/v2/service_plans/f48419f7-4717-4706-86e4-a24973848a77", + ServiceBindingsUrl: "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/service_bindings", + ServiceKeysUrl: "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/service_keys", + RoutesUrl: "/v2/service_instances/8423ca96-90ad-411f-b77a-0907844949fc/routes", + ServiceUrl: "/v2/services/440ce9d9-b108-4bbe-80b4-08338f3cc25b", + c: client, + } + So(service, ShouldResemble, expected) + }) +} + +func TestUpdateSIt(t *testing.T) { + Convey("Update SI", t, func() { + expectedPayload := "{\"name\":\"test-cs\",\"parameters\":{\"git\":{\"label\":\"master\",\"uri\":\"https://github.com/cloudfoundry-community/go-cfclient.git\"}},\"tags\":[\"tag1\",\"tag2\",\"tag3\"]}" + req := ServiceInstanceUpdateRequest{ + Name: "test-cs", + Tags: []string{"tag1", "tag2", "tag3"}, + Parameters: map[string]interface{}{ + "git": map[string]interface{}{ + "uri": "https://github.com/cloudfoundry-community/go-cfclient.git", + "label": "master", + }, + }, + } + + setup(MockRoute{"PUT", "/v2/service_instances/guid", []string{""}, "", http.StatusAccepted, "accepts_incomplete=false", &expectedPayload}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.UpdateSI("guid", req, false) + So(err, ShouldBeNil) + }) +} + +func TestUpdateServiceInstance(t *testing.T) { + Convey("Update service instance", t, func() { + updateBody := "myUpdate" + + setup(MockRoute{"PUT", "/v2/service_instances/guid", []string{""}, "", http.StatusAccepted, "accepts_incomplete=false", &updateBody}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.UpdateServiceInstance("guid", strings.NewReader(updateBody), false) + So(err, ShouldBeNil) + }) +} + +func TestDeleteServiceInstance(t *testing.T) { + Convey("Delete service instance", t, func() { + setup(MockRoute{"DELETE", "/v2/service_instances/guid", []string{""}, "", http.StatusAccepted, "recursive=true&accepts_incomplete=false&async=false", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteServiceInstance("guid", true, false) + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/service_keys.go b/third_party/go-cfclient/service_keys.go new file mode 100644 index 000000000000..5c0806dc61b9 --- /dev/null +++ b/third_party/go-cfclient/service_keys.go @@ -0,0 +1,204 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type ServiceKeysResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + Resources []ServiceKeyResource `json:"resources"` + NextUrl string `json:"next_url"` +} + +type ServiceKeyResource struct { + Meta Meta `json:"metadata"` + Entity ServiceKey `json:"entity"` +} + +type CreateServiceKeyRequest struct { + Name string `json:"name"` + ServiceInstanceGuid string `json:"service_instance_guid"` + Parameters interface{} `json:"parameters,omitempty"` +} + +type ServiceKey struct { + Name string `json:"name"` + Guid string `json:"guid"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + ServiceInstanceGuid string `json:"service_instance_guid"` + Credentials interface{} `json:"credentials"` + ServiceInstanceUrl string `json:"service_instance_url"` + c *Client +} + +func (c *Client) ListServiceKeysByQuery(query url.Values) ([]ServiceKey, error) { + var serviceKeys []ServiceKey + requestUrl := "/v2/service_keys?" + query.Encode() + + for { + var serviceKeysResp ServiceKeysResponse + + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting service keys") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading service keys request:") + } + + err = json.Unmarshal(resBody, &serviceKeysResp) + if err != nil { + return nil, errors.Wrapf(err, "Error unmarshaling service keys: %q", string(resBody)) + } + for _, serviceKey := range serviceKeysResp.Resources { + serviceKey.Entity.Guid = serviceKey.Meta.Guid + serviceKey.Entity.CreatedAt = serviceKey.Meta.CreatedAt + serviceKey.Entity.UpdatedAt = serviceKey.Meta.UpdatedAt + serviceKey.Entity.c = c + serviceKeys = append(serviceKeys, serviceKey.Entity) + } + + requestUrl = serviceKeysResp.NextUrl + if requestUrl == "" { + break + } + } + + return serviceKeys, nil +} + +func (c *Client) GetServiceKeyByGuid(guid string) (ServiceKey, error) { + var serviceKey ServiceKeyResource + r := c.NewRequest("GET", "/v2/service_keys/"+url.QueryEscape(guid)) + resp, err := c.DoRequest(r) + if err != nil { + return ServiceKey{}, errors.Wrap(err, "Error requesting serving Key") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return ServiceKey{}, errors.Wrap(err, "Error reading service Key response body") + } + err = json.Unmarshal(resBody, &serviceKey) + if err != nil { + return ServiceKey{}, errors.Wrap(err, "Error unmarshalling service Key") + } + serviceKey.Entity.Guid = serviceKey.Meta.Guid + serviceKey.Entity.c = c + return serviceKey.Entity, nil +} + +func (c *Client) ListServiceKeys() ([]ServiceKey, error) { + return c.ListServiceKeysByQuery(nil) +} + +func (c *Client) GetServiceKeyByName(name string) (ServiceKey, error) { + var serviceKey ServiceKey + q := url.Values{} + q.Set("q", "name:"+name) + serviceKeys, err := c.ListServiceKeysByQuery(q) + if err != nil { + return serviceKey, err + } + if len(serviceKeys) == 0 { + cfErr := NewServiceKeyNotFoundError() + cfErr.Description = fmt.Sprintf(cfErr.Description, name) + return ServiceKey{}, cfErr + } + return serviceKeys[0], nil +} + +// GetServiceKeyByInstanceGuid is deprecated in favor of GetServiceKeysByInstanceGuid +func (c *Client) GetServiceKeyByInstanceGuid(guid string) (ServiceKey, error) { + q := url.Values{} + q.Set("q", "service_instance_guid:"+guid) + serviceKeys, err := c.ListServiceKeysByQuery(q) + if err != nil { + return ServiceKey{}, err + } + if len(serviceKeys) == 0 { + cfErr := NewServiceKeyNotFoundError() + return ServiceKey{}, cfErr + } + return serviceKeys[0], nil +} + +// GetServiceKeysByInstanceGuid returns the service keys for a service instance. +// If none are found, it returns an error. +func (c *Client) GetServiceKeysByInstanceGuid(guid string) ([]ServiceKey, error) { + q := url.Values{} + q.Set("q", "service_instance_guid:"+guid) + serviceKeys, err := c.ListServiceKeysByQuery(q) + if err != nil { + return serviceKeys, err + } + if len(serviceKeys) == 0 { + cfErr := NewServiceKeyNotFoundError() + return serviceKeys, cfErr + } + return serviceKeys, nil +} + +// CreateServiceKey creates a service key from the request. If a service key +// exists already, it returns an error containing `CF-ServiceKeyNameTaken` +func (c *Client) CreateServiceKey(csr CreateServiceKeyRequest) (ServiceKey, error) { + var serviceKeyResource ServiceKeyResource + + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(csr) + if err != nil { + return ServiceKey{}, err + } + req := c.NewRequestWithBody("POST", "/v2/service_keys", buf) + resp, err := c.DoRequest(req) + if err != nil { + return ServiceKey{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return ServiceKey{}, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return ServiceKey{}, err + } + err = json.Unmarshal(body, &serviceKeyResource) + if err != nil { + return ServiceKey{}, err + } + + return c.mergeServiceKey(serviceKeyResource), nil +} + +// DeleteServiceKey removes a service key instance +func (c *Client) DeleteServiceKey(guid string) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/service_keys/%s", guid))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting service instance key %s, response code %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) mergeServiceKey(key ServiceKeyResource) ServiceKey { + key.Entity.Guid = key.Meta.Guid + key.Entity.CreatedAt = key.Meta.CreatedAt + key.Entity.UpdatedAt = key.Meta.UpdatedAt + key.Entity.c = c + return key.Entity +} diff --git a/third_party/go-cfclient/service_keys_test.go b/third_party/go-cfclient/service_keys_test.go new file mode 100644 index 000000000000..ff2d72dc76ef --- /dev/null +++ b/third_party/go-cfclient/service_keys_test.go @@ -0,0 +1,287 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListServiceKeys(t *testing.T) { + Convey("List Service Keys", t, func() { + mocks := []MockRoute{ + { + Method: "GET", + Endpoint: "/v2/service_keys", + Output: []string{listServiceKeysPayloadPage1}, + Status: 200, + }, + { + Method: "GET", + Endpoint: "/v2/service_keys2", + Output: []string{listServiceKeysPayloadPage2}, + Status: 200, + }, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceKeys, err := client.ListServiceKeys() + So(err, ShouldBeNil) + + So(len(serviceKeys), ShouldEqual, 4) + So(serviceKeys[0].Guid, ShouldEqual, "3b933598-64ed-4613-a0f5-b7e8c0379368") + So(serviceKeys[0].Name, ShouldEqual, "RedisMonitoringKey") + So(serviceKeys[0].ServiceInstanceGuid, ShouldEqual, "ad98f310-a3a0-47aa-9116-f8295d41a9b2") + So(serviceKeys[0].Credentials, ShouldNotEqual, nil) + So(serviceKeys[0].ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/ad98f310-a3a0-47aa-9116-f8295d41a9b2") + So(serviceKeys[1].Guid, ShouldEqual, "8be3911b-c621-4467-8866-f8b924aaee57") + So(serviceKeys[1].Name, ShouldEqual, "test01_key") + So(serviceKeys[1].ServiceInstanceGuid, ShouldEqual, "ecf26687-e176-4784-b181-b3c942fecb62") + So(serviceKeys[1].Credentials, ShouldNotEqual, nil) + m := serviceKeys[1].Credentials.(map[string]interface{}) + So(m["uri"], ShouldEqual, "nhp://100.100.100.100:9008") + So(serviceKeys[1].ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/fcf26687-e176-4784-b181-b3c942fecb62") + So(serviceKeys[2].Guid, ShouldEqual, "3b933598-64ed-4613-a0f5-b7e8c0379368") + So(serviceKeys[2].Name, ShouldEqual, "RedisMonitoringKey") + So(serviceKeys[2].ServiceInstanceGuid, ShouldEqual, "ad98f310-a3a0-47aa-9116-f8295d41a9b2") + So(serviceKeys[2].Credentials, ShouldNotEqual, nil) + So(serviceKeys[2].ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/ad98f310-a3a0-47aa-9116-f8295d41a9b2") + So(serviceKeys[3].Guid, ShouldEqual, "8be3911b-c621-4467-8866-f8b924aaee57") + So(serviceKeys[3].Name, ShouldEqual, "test01_key") + So(serviceKeys[3].ServiceInstanceGuid, ShouldEqual, "ecf26687-e176-4784-b181-b3c942fecb62") + So(serviceKeys[3].Credentials, ShouldNotEqual, nil) + m = serviceKeys[3].Credentials.(map[string]interface{}) + So(m["uri"], ShouldEqual, "nhp://100.100.100.100:9008") + So(serviceKeys[3].ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/fcf26687-e176-4784-b181-b3c942fecb62") + }) +} + +func TestGetServiceKeyByName(t *testing.T) { + Convey("Get service key by name", t, func() { + setup(MockRoute{"GET", "/v2/service_keys", []string{getServiceKeyPayload}, "", 200, "q=name:test01_key", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceKey, err := client.GetServiceKeyByName("test01_key") + So(err, ShouldBeNil) + + So(serviceKey, ShouldNotBeNil) + So(serviceKey.Name, ShouldEqual, "test01_key") + So(serviceKey.ServiceInstanceGuid, ShouldEqual, "ecf26687-e176-4784-b181-b3c942fecb62") + So(serviceKey.Credentials, ShouldNotEqual, nil) + So(serviceKey.ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/ecf26687-e176-4784-b181-b3c942fecb62") + }) +} + +func TestGetServiceKeyByGuid(t *testing.T) { + Convey("Get service key by guid", t, func() { + setup(MockRoute{"GET", "/v2/service_keys/6ad2cc9b-1996-49a3-9538-dfc0da3b1f32", []string{getServiceKeyByGuidPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceKey, err := client.GetServiceKeyByGuid("6ad2cc9b-1996-49a3-9538-dfc0da3b1f32") + So(err, ShouldBeNil) + + So(serviceKey, ShouldNotBeNil) + So(serviceKey.Name, ShouldEqual, "name-140") + So(serviceKey.ServiceInstanceGuid, ShouldEqual, "ca567b3d-e142-4139-94e3-1e0c010ba728") + So(serviceKey.Credentials, ShouldNotEqual, nil) + So(serviceKey.ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/ca567b3d-e142-4139-94e3-1e0c010ba728") + }) +} + +func TestGetServiceKeyByInstanceGuid(t *testing.T) { + Convey("Get service key by instance guid", t, func() { + setup(MockRoute{"GET", "/v2/service_keys", []string{getServiceKeyPayload}, "", 200, "q=service_instance_guid:ecf26687-e176-4784-b181-b3c942fecb62", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceKey, err := client.GetServiceKeyByInstanceGuid("ecf26687-e176-4784-b181-b3c942fecb62") + So(err, ShouldBeNil) + + So(serviceKey, ShouldNotBeNil) + So(serviceKey.Name, ShouldEqual, "test01_key") + So(serviceKey.ServiceInstanceGuid, ShouldEqual, "ecf26687-e176-4784-b181-b3c942fecb62") + So(serviceKey.Credentials, ShouldNotEqual, nil) + So(serviceKey.ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/ecf26687-e176-4784-b181-b3c942fecb62") + }) +} + +func TestGetServiceKeysByInstanceGuid(t *testing.T) { + Convey("Get service keys by instance guid", t, func() { + setup(MockRoute{"GET", "/v2/service_keys", []string{getServiceKeysPayload}, "", 200, "q=service_instance_guid:ecf26687-e176-4784-b181-b3c942fecb62", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceKeys, err := client.GetServiceKeysByInstanceGuid("ecf26687-e176-4784-b181-b3c942fecb62") + So(err, ShouldBeNil) + So(len(serviceKeys), ShouldEqual, 2) + + So(serviceKeys[0].Name, ShouldEqual, "test01_key") + So(serviceKeys[0].ServiceInstanceGuid, ShouldEqual, "ecf26687-e176-4784-b181-b3c942fecb62") + So(serviceKeys[0].Credentials, ShouldNotEqual, nil) + So(serviceKeys[0].ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/ecf26687-e176-4784-b181-b3c942fecb62") + + So(serviceKeys[1].Name, ShouldEqual, "test02_key") + So(serviceKeys[1].ServiceInstanceGuid, ShouldEqual, "ecf26687-e176-4784-b181-b3c942fecb62") + So(serviceKeys[1].Credentials, ShouldNotEqual, nil) + So(serviceKeys[1].ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/ecf26687-e176-4784-b181-b3c942fecb62") + }) +} + +func TestCreateServiceKey(t *testing.T) { + Convey("Create a service key succeeds", t, func() { + setup(MockRoute{"POST", "/v2/service_keys", []string{postServiceKeysPayload}, "", 201, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + csr := CreateServiceKeyRequest{ + Name: "key1", + ServiceInstanceGuid: "ecf26687-e176-4784-b181-b3c942fecb62", + } + + key, err := client.CreateServiceKey(csr) + So(err, ShouldBeNil) + + So(key.Name, ShouldEqual, "key1") + So(key.ServiceInstanceUrl, ShouldEqual, "/v2/service_instances/ecf26687-e176-4784-b181-b3c942fecb62") + }) + + Convey("Create a service key with parameters succeeds", t, func() { + setup(MockRoute{"POST", "/v2/service_keys", []string{postServiceKeysPayload}, "", 201, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + csr := CreateServiceKeyRequest{ + Name: "key1", + ServiceInstanceGuid: "ecf26687-e176-4784-b181-b3c942fecb62", + Parameters: map[string]interface{}{ + "read-only": true, + "username": "user1", + "connections": 6, + }, + } + + _, err = client.CreateServiceKey(csr) + So(err, ShouldBeNil) + }) + + Convey("Delete a service key succeeds", t, func() { + setup(MockRoute{"DELETE", "/v2/service_keys/ecf26687-e176-4784-b181-b3c942fecb62", []string{""}, "", 200, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteServiceKey("ecf26687-e176-4784-b181-b3c942fecb62") + So(err, ShouldBeNil) + }) + + Convey("Create a duplicate service key", t, func() { + setup(MockRoute{"POST", "/v2/service_keys", []string{postServiceKeysDuplicatePayload}, "", 400, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + csr := CreateServiceKeyRequest{ + Name: "key1", + ServiceInstanceGuid: "ecf26687-e176-4784-b181-b3c942fecb62", + } + + key, err := client.CreateServiceKey(csr) + So(err.Error(), ShouldEqual, "cfclient error (CF-ServiceKeyNameTaken|360001): The service key name is taken: key1") + + So(key.Name, ShouldEqual, "") + }) + + Convey("Gets a bad JSON response", t, func() { + setup(MockRoute{"POST", "/v2/service_keys", []string{postServiceKeysBadPayload}, "", 201, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + csr := CreateServiceKeyRequest{ + Name: "key1", + ServiceInstanceGuid: "ecf26687-e176-4784-b181-b3c942fecb62", + } + + key, err := client.CreateServiceKey(csr) + So(err.Error(), ShouldEqual, "unexpected end of JSON input") + + So(key.Name, ShouldEqual, "") + }) + + Convey("Gets an unexpected HTTP status code", t, func() { + setup(MockRoute{"POST", "/v2/service_keys", []string{""}, "", 202, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + csr := CreateServiceKeyRequest{ + Name: "key1", + ServiceInstanceGuid: "ecf26687-e176-4784-b181-b3c942fecb62", + } + + key, err := client.CreateServiceKey(csr) + So(err.Error(), ShouldEqual, "CF API returned with status code 202") + + So(key.Name, ShouldEqual, "") + }) +} diff --git a/third_party/go-cfclient/service_plan_visibilities.go b/third_party/go-cfclient/service_plan_visibilities.go new file mode 100644 index 000000000000..b875b37ae756 --- /dev/null +++ b/third_party/go-cfclient/service_plan_visibilities.go @@ -0,0 +1,174 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type ServicePlanVisibilitiesResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []ServicePlanVisibilityResource `json:"resources"` +} + +type ServicePlanVisibilityResource struct { + Meta Meta `json:"metadata"` + Entity ServicePlanVisibility `json:"entity"` +} + +type ServicePlanVisibility struct { + Guid string `json:"guid"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + ServicePlanGuid string `json:"service_plan_guid"` + OrganizationGuid string `json:"organization_guid"` + ServicePlanUrl string `json:"service_plan_url"` + OrganizationUrl string `json:"organization_url"` + c *Client +} + +func (c *Client) ListServicePlanVisibilitiesByQuery(query url.Values) ([]ServicePlanVisibility, error) { + var servicePlanVisibilities []ServicePlanVisibility + requestUrl := "/v2/service_plan_visibilities?" + query.Encode() + for { + var servicePlanVisibilitiesResp ServicePlanVisibilitiesResponse + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting service plan visibilities") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading service plan visibilities request:") + } + + err = json.Unmarshal(resBody, &servicePlanVisibilitiesResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling service plan visibilities") + } + for _, servicePlanVisibility := range servicePlanVisibilitiesResp.Resources { + servicePlanVisibility.Entity.Guid = servicePlanVisibility.Meta.Guid + servicePlanVisibility.Entity.CreatedAt = servicePlanVisibility.Meta.CreatedAt + servicePlanVisibility.Entity.UpdatedAt = servicePlanVisibility.Meta.UpdatedAt + servicePlanVisibility.Entity.c = c + servicePlanVisibilities = append(servicePlanVisibilities, servicePlanVisibility.Entity) + } + requestUrl = servicePlanVisibilitiesResp.NextUrl + if requestUrl == "" { + break + } + } + return servicePlanVisibilities, nil +} + +func (c *Client) ListServicePlanVisibilities() ([]ServicePlanVisibility, error) { + return c.ListServicePlanVisibilitiesByQuery(nil) +} + +func (c *Client) GetServicePlanVisibilityByGuid(guid string) (ServicePlanVisibility, error) { + r := c.NewRequest("GET", "/v2/service_plan_visibilities/"+guid) + resp, err := c.DoRequest(r) + if err != nil { + return ServicePlanVisibility{}, err + } + defer resp.Body.Close() + return respBodyToServicePlanVisibility(resp.Body, c) +} + +// a uniqueID is the id of the service in the catalog and not in cf internal db +func (c *Client) CreateServicePlanVisibilityByUniqueId(uniqueId string, organizationGuid string) (ServicePlanVisibility, error) { + q := url.Values{} + q.Set("q", fmt.Sprintf("unique_id:%s", uniqueId)) + plans, err := c.ListServicePlansByQuery(q) + if err != nil { + return ServicePlanVisibility{}, errors.Wrap(err, fmt.Sprintf("Couldn't find a service plan with unique_id: %s", uniqueId)) + } + return c.CreateServicePlanVisibility(plans[0].Guid, organizationGuid) +} + +func (c *Client) CreateServicePlanVisibility(servicePlanGuid string, organizationGuid string) (ServicePlanVisibility, error) { + req := c.NewRequest("POST", "/v2/service_plan_visibilities") + req.obj = map[string]interface{}{ + "service_plan_guid": servicePlanGuid, + "organization_guid": organizationGuid, + } + resp, err := c.DoRequest(req) + if err != nil { + return ServicePlanVisibility{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return ServicePlanVisibility{}, errors.Wrapf(err, "Error creating service plan visibility, response code: %d", resp.StatusCode) + } + return respBodyToServicePlanVisibility(resp.Body, c) +} + +func (c *Client) DeleteServicePlanVisibilityByPlanAndOrg(servicePlanGuid string, organizationGuid string, async bool) error { + q := url.Values{} + q.Set("q", fmt.Sprintf("organization_guid:%s;service_plan_guid:%s", organizationGuid, servicePlanGuid)) + plans, err := c.ListServicePlanVisibilitiesByQuery(q) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("Couldn't find a service plan visibility for service plan %s and org %s", servicePlanGuid, organizationGuid)) + } + if len(plans) != 1 { + return fmt.Errorf("Query for a service plan visibility did not return exactly one result when searching for a service plan visibility for service plan %s and org %s", + servicePlanGuid, organizationGuid) + } + return c.DeleteServicePlanVisibility(plans[0].Guid, async) +} + +func (c *Client) DeleteServicePlanVisibility(guid string, async bool) error { + req := c.NewRequest("DELETE", fmt.Sprintf("/v2/service_plan_visibilities/%s?async=%v", guid, async)) + resp, err := c.DoRequest(req) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting service plan visibility, response code: %d", resp.StatusCode) + } + return nil +} + +func (c *Client) UpdateServicePlanVisibility(guid string, servicePlanGuid string, organizationGuid string) (ServicePlanVisibility, error) { + req := c.NewRequest("PUT", "/v2/service_plan_visibilities/"+guid) + req.obj = map[string]interface{}{ + "service_plan_guid": servicePlanGuid, + "organization_guid": organizationGuid, + } + resp, err := c.DoRequest(req) + if err != nil { + return ServicePlanVisibility{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return ServicePlanVisibility{}, errors.Wrapf(err, "Error updating service plan visibility, response code: %d", resp.StatusCode) + } + return respBodyToServicePlanVisibility(resp.Body, c) +} + +func respBodyToServicePlanVisibility(body io.ReadCloser, c *Client) (ServicePlanVisibility, error) { + bodyRaw, err := ioutil.ReadAll(body) + if err != nil { + return ServicePlanVisibility{}, err + } + servicePlanVisibilityRes := ServicePlanVisibilityResource{} + err = json.Unmarshal(bodyRaw, &servicePlanVisibilityRes) + if err != nil { + return ServicePlanVisibility{}, err + } + servicePlanVisibility := servicePlanVisibilityRes.Entity + servicePlanVisibility.Guid = servicePlanVisibilityRes.Meta.Guid + servicePlanVisibility.CreatedAt = servicePlanVisibilityRes.Meta.CreatedAt + servicePlanVisibility.UpdatedAt = servicePlanVisibilityRes.Meta.UpdatedAt + servicePlanVisibility.c = c + return servicePlanVisibility, nil +} diff --git a/third_party/go-cfclient/service_plan_visibilities_test.go b/third_party/go-cfclient/service_plan_visibilities_test.go new file mode 100644 index 000000000000..4ba87fe517cf --- /dev/null +++ b/third_party/go-cfclient/service_plan_visibilities_test.go @@ -0,0 +1,52 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListServicePlanVisibilities(t *testing.T) { + Convey("List service plan visibilities", t, func() { + setup(MockRoute{"GET", "/v2/service_plan_visibilities", []string{listServicePlanVisibilitiesPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + servicePlanVisibilities, err := client.ListServicePlanVisibilities() + So(err, ShouldBeNil) + + So(len(servicePlanVisibilities), ShouldEqual, 2) + So(servicePlanVisibilities[0].Guid, ShouldEqual, "d1b5ea55-f354-4f43-b52e-53045747adb9") + So(servicePlanVisibilities[0].ServicePlanGuid, ShouldEqual, "62cb572c-e9ca-4c9f-b822-8292db1d9a96") + So(servicePlanVisibilities[0].OrganizationGuid, ShouldEqual, "81df84f3-8ce0-4c92-990a-3760b6ff66bd") + So(servicePlanVisibilities[0].ServicePlanUrl, ShouldEqual, "/v2/service_plans/62cb572c-e9ca-4c9f-b822-8292db1d9a96") + So(servicePlanVisibilities[0].OrganizationUrl, ShouldEqual, "/v2/organizations/81df84f3-8ce0-4c92-990a-3760b6ff66bd") + }) +} + +func TestCreateServicePlanVisibility(t *testing.T) { + Convey("Create service plan visibility", t, func() { + setup(MockRoute{"POST", "/v2/service_plan_visibilities", []string{postServicePlanVisibilityPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + servicePlanVisibility, err := client.CreateServicePlanVisibility("ab5780a9-ac8e-4412-9496-4512e865011a", "55d0ff39-dac9-431f-ba6d-83f37381f1c3") + So(err, ShouldBeNil) + + So(servicePlanVisibility.Guid, ShouldEqual, "f740b01a-4afe-4435-aedd-0a8308a7e7d6") + So(servicePlanVisibility.ServicePlanGuid, ShouldEqual, "ab5780a9-ac8e-4412-9496-4512e865011a") + So(servicePlanVisibility.OrganizationGuid, ShouldEqual, "55d0ff39-dac9-431f-ba6d-83f37381f1c3") + So(servicePlanVisibility.ServicePlanUrl, ShouldEqual, "/v2/service_plans/ab5780a9-ac8e-4412-9496-4512e865011a") + So(servicePlanVisibility.OrganizationUrl, ShouldEqual, "/v2/organizations/55d0ff39-dac9-431f-ba6d-83f37381f1c3") + }) +} diff --git a/third_party/go-cfclient/service_plans.go b/third_party/go-cfclient/service_plans.go new file mode 100644 index 000000000000..2fa0961809c4 --- /dev/null +++ b/third_party/go-cfclient/service_plans.go @@ -0,0 +1,131 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/url" + + "github.com/pkg/errors" +) + +type ServicePlansResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []ServicePlanResource `json:"resources"` +} + +type ServicePlanResource struct { + Meta Meta `json:"metadata"` + Entity ServicePlan `json:"entity"` +} + +type ServicePlan struct { + Name string `json:"name"` + Guid string `json:"guid"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Free bool `json:"free"` + Description string `json:"description"` + ServiceGuid string `json:"service_guid"` + Extra interface{} `json:"extra"` + UniqueId string `json:"unique_id"` + Public bool `json:"public"` + Active bool `json:"active"` + Bindable bool `json:"bindable"` + PlanUpdateable bool `json:"plan_updateable"` + ServiceUrl string `json:"service_url"` + ServiceInstancesUrl string `json:"service_instances_url"` + c *Client +} + +func (c *Client) ListServicePlansByQuery(query url.Values) ([]ServicePlan, error) { + var servicePlans []ServicePlan + requestURL := "/v2/service_plans?" + query.Encode() + for { + var servicePlansResp ServicePlansResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting service plans") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading service plans request:") + } + err = json.Unmarshal(resBody, &servicePlansResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling service plans") + } + for _, servicePlan := range servicePlansResp.Resources { + servicePlan.Entity.Guid = servicePlan.Meta.Guid + servicePlan.Entity.CreatedAt = servicePlan.Meta.CreatedAt + servicePlan.Entity.UpdatedAt = servicePlan.Meta.UpdatedAt + servicePlan.Entity.c = c + servicePlans = append(servicePlans, servicePlan.Entity) + } + requestURL = servicePlansResp.NextUrl + if requestURL == "" { + break + } + } + return servicePlans, nil +} + +func (c *Client) ListServicePlans() ([]ServicePlan, error) { + return c.ListServicePlansByQuery(nil) +} + +func (c *Client) GetServicePlanByGUID(guid string) (*ServicePlan, error) { + var ( + plan *ServicePlan + planResponse ServicePlanResource + ) + + r := c.NewRequest("GET", "/v2/service_plans/"+guid) + resp, err := c.DoRequest(r) + if err != nil { + return nil, err + } + + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return nil, err + } + + err = json.Unmarshal(body, &planResponse) + if err != nil { + return nil, err + } + + planResponse.Entity.Guid = planResponse.Meta.Guid + planResponse.Entity.CreatedAt = planResponse.Meta.CreatedAt + planResponse.Entity.UpdatedAt = planResponse.Meta.UpdatedAt + plan = &planResponse.Entity + + return plan, nil +} + +func (c *Client) MakeServicePlanPublic(servicePlanGUID string) error { + return c.setPlanGlobalVisibility(servicePlanGUID, true) +} + +func (c *Client) MakeServicePlanPrivate(servicePlanGUID string) error { + return c.setPlanGlobalVisibility(servicePlanGUID, false) +} + +func (c *Client) setPlanGlobalVisibility(servicePlanGUID string, public bool) error { + bodyString := fmt.Sprintf(`{"public": %t}`, public) + req := c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/service_plans/%s", servicePlanGUID), bytes.NewBufferString(bodyString)) + + resp, err := c.DoRequest(req) + if err != nil { + return err + } + defer resp.Body.Close() + return nil +} diff --git a/third_party/go-cfclient/service_plans_test.go b/third_party/go-cfclient/service_plans_test.go new file mode 100644 index 000000000000..9637cc69aa69 --- /dev/null +++ b/third_party/go-cfclient/service_plans_test.go @@ -0,0 +1,111 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListServicePlans(t *testing.T) { + Convey("List Service Plans", t, func() { + setup(MockRoute{"GET", "/v2/service_plans", []string{listServicePlansPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + servicePlans, err := client.ListServicePlans() + So(err, ShouldBeNil) + + So(len(servicePlans), ShouldEqual, 1) + So(servicePlans[0].Guid, ShouldEqual, "6fecf53b-7553-4cb3-b97e-930f9c4e3385") + So(servicePlans[0].Name, ShouldEqual, "name-1575") + So(servicePlans[0].Description, ShouldEqual, "desc-109") + So(servicePlans[0].ServiceGuid, ShouldEqual, "1ccab853-87c9-45a6-bf99-603032d17fe5") + So(servicePlans[0].Extra, ShouldBeNil) + So(servicePlans[0].UniqueId, ShouldEqual, "1bc2884c-ee3d-4f82-a78b-1a657f79aeac") + So(servicePlans[0].Public, ShouldEqual, true) + So(servicePlans[0].Active, ShouldEqual, true) + So(servicePlans[0].Bindable, ShouldEqual, true) + So(servicePlans[0].PlanUpdateable, ShouldEqual, true) + So(servicePlans[0].ServiceUrl, ShouldEqual, "/v2/services/1ccab853-87c9-45a6-bf99-603032d17fe5") + So(servicePlans[0].ServiceInstancesUrl, ShouldEqual, "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385/service_instances") + }) +} + +func TestGetServicePlanByGuid(t *testing.T) { + Convey("List Service Plans", t, func() { + setup(MockRoute{"GET", "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385", []string{getServicePlanByGuidPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + servicePlan, err := client.GetServicePlanByGUID("6fecf53b-7553-4cb3-b97e-930f9c4e3385") + So(err, ShouldBeNil) + So(servicePlan.Guid, ShouldEqual, "6fecf53b-7553-4cb3-b97e-930f9c4e3385") + So(servicePlan.Name, ShouldEqual, "name-1575") + So(servicePlan.Description, ShouldEqual, "desc-109") + So(servicePlan.ServiceGuid, ShouldEqual, "1ccab853-87c9-45a6-bf99-603032d17fe5") + So(servicePlan.Extra, ShouldBeNil) + So(servicePlan.UniqueId, ShouldEqual, "1bc2884c-ee3d-4f82-a78b-1a657f79aeac") + So(servicePlan.Public, ShouldEqual, true) + So(servicePlan.Active, ShouldEqual, true) + So(servicePlan.Bindable, ShouldEqual, true) + So(servicePlan.PlanUpdateable, ShouldEqual, true) + So(servicePlan.ServiceUrl, ShouldEqual, "/v2/services/1ccab853-87c9-45a6-bf99-603032d17fe5") + So(servicePlan.ServiceInstancesUrl, ShouldEqual, "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385/service_instances") + }) +} + +func TestMakeServicePlanPublic(t *testing.T) { + Convey("Make Service Plan public", t, func() { + setupMultiple([]MockRoute{ + {"GET", "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385", []string{privateServicePlanPayload}, "", 200, "", nil}, + {"PUT", "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385", []string{getServicePlanByGuidPayload}, "", 201, "", nil}, + }, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + servicePlan, err := client.GetServicePlanByGUID("6fecf53b-7553-4cb3-b97e-930f9c4e3385") + So(err, ShouldBeNil) + So(servicePlan.Public, ShouldBeFalse) + + err = client.MakeServicePlanPublic("6fecf53b-7553-4cb3-b97e-930f9c4e3385") + So(err, ShouldBeNil) + }) +} + +func TestMakeServicePlanPrivate(t *testing.T) { + Convey("Make Service Plan private", t, func() { + setupMultiple([]MockRoute{ + {"GET", "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385", []string{getServicePlanByGuidPayload}, "", 200, "", nil}, + {"PUT", "/v2/service_plans/6fecf53b-7553-4cb3-b97e-930f9c4e3385", []string{privateServicePlanPayload}, "", 201, "", nil}, + }, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + servicePlan, err := client.GetServicePlanByGUID("6fecf53b-7553-4cb3-b97e-930f9c4e3385") + So(err, ShouldBeNil) + So(servicePlan.Public, ShouldBeTrue) + + err = client.MakeServicePlanPrivate("6fecf53b-7553-4cb3-b97e-930f9c4e3385") + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/service_usage_events.go b/third_party/go-cfclient/service_usage_events.go new file mode 100644 index 000000000000..17fb8a2b1e1f --- /dev/null +++ b/third_party/go-cfclient/service_usage_events.go @@ -0,0 +1,72 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/url" + + "github.com/pkg/errors" +) + +type ServiceUsageEvent struct { + GUID string `json:"guid"` + CreatedAt string `json:"created_at"` + State string `json:"state"` + OrgGUID string `json:"org_guid"` + SpaceGUID string `json:"space_guid"` + SpaceName string `json:"space_name"` + ServiceInstanceGUID string `json:"service_instance_guid"` + ServiceInstanceName string `json:"service_instance_name"` + ServiceInstanceType string `json:"service_instance_type"` + ServicePlanGUID string `json:"service_plan_guid"` + ServicePlanName string `json:"service_plan_name"` + ServiceGUID string `json:"service_guid"` + ServiceLabel string `json:"service_label"` + c *Client +} + +type ServiceUsageEventsResponse struct { + TotalResults int `json:"total_results"` + Pages int `json:"total_pages"` + NextURL string `json:"next_url"` + Resources []ServiceUsageEventResource `json:"resources"` +} + +type ServiceUsageEventResource struct { + Meta Meta `json:"metadata"` + Entity ServiceUsageEvent `json:"entity"` +} + +// ListServiceUsageEventsByQuery lists all events matching the provided query. +func (c *Client) ListServiceUsageEventsByQuery(query url.Values) ([]ServiceUsageEvent, error) { + var serviceUsageEvents []ServiceUsageEvent + requestURL := fmt.Sprintf("/v2/service_usage_events?%s", query.Encode()) + for { + var serviceUsageEventsResponse ServiceUsageEventsResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "error requesting events") + } + defer resp.Body.Close() + if err := json.NewDecoder(resp.Body).Decode(&serviceUsageEventsResponse); err != nil { + return nil, errors.Wrap(err, "error unmarshaling events") + } + for _, e := range serviceUsageEventsResponse.Resources { + e.Entity.GUID = e.Meta.Guid + e.Entity.CreatedAt = e.Meta.CreatedAt + e.Entity.c = c + serviceUsageEvents = append(serviceUsageEvents, e.Entity) + } + requestURL = serviceUsageEventsResponse.NextURL + if requestURL == "" { + break + } + } + return serviceUsageEvents, nil +} + +// ListServiceUsageEvents lists all unfiltered events. +func (c *Client) ListServiceUsageEvents() ([]ServiceUsageEvent, error) { + return c.ListServiceUsageEventsByQuery(nil) +} diff --git a/third_party/go-cfclient/service_usage_events_test.go b/third_party/go-cfclient/service_usage_events_test.go new file mode 100644 index 000000000000..9d54a97ab51d --- /dev/null +++ b/third_party/go-cfclient/service_usage_events_test.go @@ -0,0 +1,54 @@ +package cfclient + +import ( + "net/url" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListServiceUsageEvents(t *testing.T) { + Convey("List Service Usage Events", t, func() { + + setup(MockRoute{"GET", "/v2/service_usage_events", []string{listServiceUsageEventsPayload, listServiceUsageEventsPayloadPage2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceUsageEvents, err := client.ListServiceUsageEvents() + So(err, ShouldBeNil) + + So(len(serviceUsageEvents), ShouldEqual, 4) + So(serviceUsageEvents[0].GUID, ShouldEqual, "985c09c5-bf5a-44eb-a260-41c532dc0f1d") + So(serviceUsageEvents[0].CreatedAt, ShouldEqual, "2016-06-08T16:41:39Z") + }) +} + +func TestListServiceUsageEventsByQuery(t *testing.T) { + Convey("List Service Usage Events", t, func() { + setup(MockRoute{"GET", "/v2/service_usage_events", []string{listServiceUsageEventsPayload, listServiceUsageEventsPayloadPage2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + var query = url.Values{ + "results-per-page": []string{ + "2", + }, + } + serviceUsageEvents, err := client.ListServiceUsageEventsByQuery(query) + So(err, ShouldBeNil) + + So(len(serviceUsageEvents), ShouldEqual, 4) + So(serviceUsageEvents[0].GUID, ShouldEqual, "985c09c5-bf5a-44eb-a260-41c532dc0f1d") + So(serviceUsageEvents[0].CreatedAt, ShouldEqual, "2016-06-08T16:41:39Z") + }) +} diff --git a/third_party/go-cfclient/services.go b/third_party/go-cfclient/services.go new file mode 100644 index 000000000000..b93e4c874d7a --- /dev/null +++ b/third_party/go-cfclient/services.go @@ -0,0 +1,128 @@ +package cfclient + +import ( + "encoding/json" + "io/ioutil" + "net/url" + + "github.com/pkg/errors" +) + +type ServicesResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []ServicesResource `json:"resources"` +} + +type ServicesResource struct { + Meta Meta `json:"metadata"` + Entity Service `json:"entity"` +} + +type Service struct { + Guid string `json:"guid"` + Label string `json:"label"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Description string `json:"description"` + Active bool `json:"active"` + Bindable bool `json:"bindable"` + ServiceBrokerGuid string `json:"service_broker_guid"` + ServiceBrokerName string `json:"service_broker_name"` + PlanUpdateable bool `json:"plan_updateable"` + Tags []string `json:"tags"` + UniqueID string `json:"unique_id"` + Extra string `json:"extra"` + Requires []string `json:"requires"` + InstancesRetrievable bool `json:"instances_retrievable"` + BindingsRetrievable bool `json:"bindings_retrievable"` + c *Client +} + +type ServiceSummary struct { + Guid string `json:"guid"` + Name string `json:"name"` + BoundAppCount int `json:"bound_app_count"` + DashboardURL string `json:"dashboard_url"` + ServiceBrokerName string `json:"service_broker_name"` + MaintenanceInfo MaintenanceInfo `json:"maintenance_info"` + ServicePlan struct { + Guid string `json:"guid"` + Name string `json:"name"` + MaintenanceInfo MaintenanceInfo `json:"maintenance_info"` + Service struct { + Guid string `json:"guid"` + Label string `json:"label"` + Provider string `json:"provider"` + Version string `json:"version"` + } `json:"service"` + } `json:"service_plan"` +} + +type MaintenanceInfo struct { + Version string `json:"version"` + Description string `json:"description"` +} + +func (c *Client) GetServiceByGuid(guid string) (Service, error) { + var serviceRes ServicesResource + r := c.NewRequest("GET", "/v2/services/"+guid) + resp, err := c.DoRequest(r) + if err != nil { + return Service{}, err + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return Service{}, err + } + err = json.Unmarshal(body, &serviceRes) + if err != nil { + return Service{}, err + } + serviceRes.Entity.Guid = serviceRes.Meta.Guid + serviceRes.Entity.CreatedAt = serviceRes.Meta.CreatedAt + serviceRes.Entity.UpdatedAt = serviceRes.Meta.UpdatedAt + return serviceRes.Entity, nil + +} + +func (c *Client) ListServicesByQuery(query url.Values) ([]Service, error) { + var services []Service + requestURL := "/v2/services?" + query.Encode() + for { + var serviceResp ServicesResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting services") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading services request:") + } + + err = json.Unmarshal(resBody, &serviceResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling services") + } + for _, service := range serviceResp.Resources { + service.Entity.Guid = service.Meta.Guid + service.Entity.CreatedAt = service.Meta.CreatedAt + service.Entity.UpdatedAt = service.Meta.UpdatedAt + service.Entity.c = c + services = append(services, service.Entity) + } + requestURL = serviceResp.NextUrl + if requestURL == "" { + break + } + } + return services, nil +} + +func (c *Client) ListServices() ([]Service, error) { + return c.ListServicesByQuery(nil) +} diff --git a/third_party/go-cfclient/services_test.go b/third_party/go-cfclient/services_test.go new file mode 100644 index 000000000000..bb1b90b1f66f --- /dev/null +++ b/third_party/go-cfclient/services_test.go @@ -0,0 +1,66 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListServices(t *testing.T) { + Convey("List Services", t, func() { + setup(MockRoute{"GET", "/v2/services", []string{listServicePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + services, err := client.ListServices() + So(err, ShouldBeNil) + + So(len(services), ShouldEqual, 2) + So(services[0].Guid, ShouldEqual, "a3d76c01-c08a-4505-b06d-8603265682a3") + So(services[0].Label, ShouldEqual, "nats") + So(services[0].Description, ShouldEqual, "NATS is a lightweight cloud messaging system") + So(services[0].Active, ShouldEqual, true) + So(services[0].Bindable, ShouldEqual, true) + So(services[0].PlanUpdateable, ShouldEqual, false) + So(services[1].ServiceBrokerGuid, ShouldEqual, "a4bdf03a-f0c4-43f9-9c77-f434da91404f") + So(services[1].Guid, ShouldEqual, "ab9ad9c8-1f51-463a-ae3a-5082e9f04ae6") + So(services[1].Label, ShouldEqual, "etcd") + So(services[1].Description, ShouldEqual, "Etcd key-value storage") + So(services[1].Active, ShouldEqual, true) + So(services[1].Bindable, ShouldEqual, true) + So(services[1].PlanUpdateable, ShouldEqual, false) + So(services[1].ServiceBrokerGuid, ShouldEqual, "a4bdf03a-f0c4-43f9-9c77-f434da91404f") + So(len(services[1].Tags), ShouldEqual, 3) + So(services[1].Tags[0], ShouldEqual, "etcd") + So(services[1].Tags[1], ShouldEqual, "keyvalue") + So(services[1].Tags[2], ShouldEqual, "etcd-0.4.6") + }) +} + +func TestGetServiceByGuid(t *testing.T) { + Convey("Get Service By Guid", t, func() { + setup(MockRoute{"GET", "/v2/services/53f52780-e93c-4af7-a96c-6958311c40e5", []string{getServiceByGuidPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + service, err := client.GetServiceByGuid("53f52780-e93c-4af7-a96c-6958311c40e5") + So(err, ShouldBeNil) + + So(service.Guid, ShouldEqual, "53f52780-e93c-4af7-a96c-6958311c40e5") + So(service.Label, ShouldEqual, "label-58") + So(service.Description, ShouldEqual, "desc-135") + So(service.Active, ShouldEqual, true) + So(service.Bindable, ShouldEqual, true) + So(service.PlanUpdateable, ShouldEqual, false) + }) +} diff --git a/third_party/go-cfclient/space_quotas.go b/third_party/go-cfclient/space_quotas.go new file mode 100644 index 000000000000..216ba5097978 --- /dev/null +++ b/third_party/go-cfclient/space_quotas.go @@ -0,0 +1,187 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type SpaceQuotasResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []SpaceQuotasResource `json:"resources"` +} + +type SpaceQuotasResource struct { + Meta Meta `json:"metadata"` + Entity SpaceQuota `json:"entity"` +} + +type SpaceQuotaRequest struct { + Name string `json:"name"` + OrganizationGuid string `json:"organization_guid"` + NonBasicServicesAllowed bool `json:"non_basic_services_allowed"` + TotalServices int `json:"total_services"` + TotalRoutes int `json:"total_routes"` + MemoryLimit int `json:"memory_limit"` + InstanceMemoryLimit int `json:"instance_memory_limit"` + AppInstanceLimit int `json:"app_instance_limit"` + AppTaskLimit int `json:"app_task_limit"` + TotalServiceKeys int `json:"total_service_keys"` + TotalReservedRoutePorts int `json:"total_reserved_route_ports"` +} + +type SpaceQuota struct { + Guid string `json:"guid"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Name string `json:"name"` + OrganizationGuid string `json:"organization_guid"` + NonBasicServicesAllowed bool `json:"non_basic_services_allowed"` + TotalServices int `json:"total_services"` + TotalRoutes int `json:"total_routes"` + MemoryLimit int `json:"memory_limit"` + InstanceMemoryLimit int `json:"instance_memory_limit"` + AppInstanceLimit int `json:"app_instance_limit"` + AppTaskLimit int `json:"app_task_limit"` + TotalServiceKeys int `json:"total_service_keys"` + TotalReservedRoutePorts int `json:"total_reserved_route_ports"` + c *Client +} + +func (c *Client) ListSpaceQuotasByQuery(query url.Values) ([]SpaceQuota, error) { + var spaceQuotas []SpaceQuota + requestUrl := "/v2/space_quota_definitions?" + query.Encode() + for { + spaceQuotasResp, err := c.getSpaceQuotasResponse(requestUrl) + if err != nil { + return []SpaceQuota{}, err + } + for _, space := range spaceQuotasResp.Resources { + space.Entity.Guid = space.Meta.Guid + space.Entity.CreatedAt = space.Meta.CreatedAt + space.Entity.UpdatedAt = space.Meta.UpdatedAt + space.Entity.c = c + spaceQuotas = append(spaceQuotas, space.Entity) + } + requestUrl = spaceQuotasResp.NextUrl + if requestUrl == "" { + break + } + } + return spaceQuotas, nil +} + +func (c *Client) ListSpaceQuotas() ([]SpaceQuota, error) { + return c.ListSpaceQuotasByQuery(nil) +} + +func (c *Client) GetSpaceQuotaByName(name string) (SpaceQuota, error) { + q := url.Values{} + q.Set("q", "name:"+name) + spaceQuotas, err := c.ListSpaceQuotasByQuery(q) + if err != nil { + return SpaceQuota{}, err + } + if len(spaceQuotas) != 1 { + return SpaceQuota{}, fmt.Errorf("Unable to find space quota " + name) + } + return spaceQuotas[0], nil +} + +func (c *Client) getSpaceQuotasResponse(requestUrl string) (SpaceQuotasResponse, error) { + var spaceQuotasResp SpaceQuotasResponse + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return SpaceQuotasResponse{}, errors.Wrap(err, "Error requesting space quotas") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + + if err != nil { + return SpaceQuotasResponse{}, errors.Wrap(err, "Error reading space quotas body") + } + err = json.Unmarshal(resBody, &spaceQuotasResp) + if err != nil { + return SpaceQuotasResponse{}, errors.Wrap(err, "Error unmarshalling space quotas") + } + return spaceQuotasResp, nil +} + +func (c *Client) AssignSpaceQuota(quotaGUID, spaceGUID string) error { + // Perform the PUT and check for errors + resp, err := c.DoRequest(c.NewRequest("PUT", fmt.Sprintf("/v2/space_quota_definitions/%s/spaces/%s", quotaGUID, spaceGUID))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { // 201 + return fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return nil +} + +func (c *Client) CreateSpaceQuota(spaceQuote SpaceQuotaRequest) (*SpaceQuota, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(spaceQuote) + if err != nil { + return nil, err + } + r := c.NewRequestWithBody("POST", "/v2/space_quota_definitions", buf) + resp, err := c.DoRequest(r) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return c.handleSpaceQuotaResp(resp) +} + +func (c *Client) UpdateSpaceQuota(spaceQuotaGUID string, spaceQuote SpaceQuotaRequest) (*SpaceQuota, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(spaceQuote) + if err != nil { + return nil, err + } + r := c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/space_quota_definitions/%s", spaceQuotaGUID), buf) + resp, err := c.DoRequest(r) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return c.handleSpaceQuotaResp(resp) +} + +func (c *Client) handleSpaceQuotaResp(resp *http.Response) (*SpaceQuota, error) { + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return nil, err + } + var spaceQuotasResource SpaceQuotasResource + err = json.Unmarshal(body, &spaceQuotasResource) + if err != nil { + return nil, err + } + return c.mergeSpaceQuotaResource(spaceQuotasResource), nil +} + +func (c *Client) mergeSpaceQuotaResource(spaceQuote SpaceQuotasResource) *SpaceQuota { + spaceQuote.Entity.Guid = spaceQuote.Meta.Guid + spaceQuote.Entity.CreatedAt = spaceQuote.Meta.CreatedAt + spaceQuote.Entity.UpdatedAt = spaceQuote.Meta.UpdatedAt + spaceQuote.Entity.c = c + return &spaceQuote.Entity +} diff --git a/third_party/go-cfclient/space_quotas_test.go b/third_party/go-cfclient/space_quotas_test.go new file mode 100644 index 000000000000..535d66eea45f --- /dev/null +++ b/third_party/go-cfclient/space_quotas_test.go @@ -0,0 +1,134 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListSpaceQuotas(t *testing.T) { + Convey("List Space Quotas", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/space_quota_definitions", []string{listSpaceQuotasPayloadPage1}, "", 200, "", nil}, + {"GET", "/v2/space_quota_definitions_page_2", []string{listSpaceQuotasPayloadPage2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaceQuotas, err := client.ListSpaceQuotas() + So(err, ShouldBeNil) + + So(len(spaceQuotas), ShouldEqual, 2) + So(spaceQuotas[0].Guid, ShouldEqual, "889aa2ed-a883-4cc0-abe5-804b2503f15d") + So(spaceQuotas[0].Name, ShouldEqual, "test-1") + So(spaceQuotas[0].NonBasicServicesAllowed, ShouldEqual, true) + So(spaceQuotas[0].TotalServices, ShouldEqual, -1) + So(spaceQuotas[0].TotalRoutes, ShouldEqual, 100) + So(spaceQuotas[0].MemoryLimit, ShouldEqual, 102400) + So(spaceQuotas[0].InstanceMemoryLimit, ShouldEqual, -1) + So(spaceQuotas[0].AppInstanceLimit, ShouldEqual, -1) + So(spaceQuotas[0].AppTaskLimit, ShouldEqual, -1) + So(spaceQuotas[0].TotalServiceKeys, ShouldEqual, -1) + So(spaceQuotas[0].TotalReservedRoutePorts, ShouldEqual, -1) + }) +} + +func TestGetSpaceQuotaByName(t *testing.T) { + Convey("Get Space Quota By Name", t, func() { + setup(MockRoute{"GET", "/v2/space_quota_definitions", []string{listSpaceQuotasPayloadPage2}, "", 200, "q=name:test-2", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaceQuota, err := client.GetSpaceQuotaByName("test-2") + So(err, ShouldBeNil) + + So(spaceQuota.Guid, ShouldEqual, "9ffd7c5c-d83c-4786-b399-b7bd54883977") + So(spaceQuota.Name, ShouldEqual, "test-2") + So(spaceQuota.NonBasicServicesAllowed, ShouldEqual, false) + So(spaceQuota.TotalServices, ShouldEqual, 10) + So(spaceQuota.TotalRoutes, ShouldEqual, 20) + So(spaceQuota.MemoryLimit, ShouldEqual, 30) + So(spaceQuota.InstanceMemoryLimit, ShouldEqual, 40) + So(spaceQuota.AppInstanceLimit, ShouldEqual, 50) + So(spaceQuota.AppTaskLimit, ShouldEqual, 60) + So(spaceQuota.TotalServiceKeys, ShouldEqual, 70) + So(spaceQuota.TotalReservedRoutePorts, ShouldEqual, 80) + }) +} + +func TestCreateSpaceQuota(t *testing.T) { + Convey("Create Space Quota", t, func() { + setup(MockRoute{"POST", "/v2/space_quota_definitions", []string{spaceQuotaPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaceQuotaRequest := SpaceQuotaRequest{ + Name: "test-2", + OrganizationGuid: "06dcedd4-1f24-49a6-adc1-cce9131a1b2c", + } + + spaceQuota, err := client.CreateSpaceQuota(spaceQuotaRequest) + So(err, ShouldBeNil) + + So(spaceQuota.Name, ShouldEqual, "test-2") + So(spaceQuota.OrganizationGuid, ShouldEqual, "06dcedd4-1f24-49a6-adc1-cce9131a1b2c") + + }) +} + +func TestUpdateSpaceQuota(t *testing.T) { + Convey("Create Update Quota", t, func() { + setup(MockRoute{"PUT", "/v2/space_quota_definitions/9ffd7c5c-d83c-4786-b399-b7bd54883977", []string{spaceQuotaPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaceQuotaRequest := SpaceQuotaRequest{ + Name: "test-2", + OrganizationGuid: "06dcedd4-1f24-49a6-adc1-cce9131a1b2c", + } + + spaceQuota, err := client.UpdateSpaceQuota("9ffd7c5c-d83c-4786-b399-b7bd54883977", spaceQuotaRequest) + So(err, ShouldBeNil) + + So(spaceQuota.Name, ShouldEqual, "test-2") + So(spaceQuota.OrganizationGuid, ShouldEqual, "06dcedd4-1f24-49a6-adc1-cce9131a1b2c") + + }) +} + +func TestAssignSpaceQuota(t *testing.T) { + Convey("Assign Space Quota", t, func() { + setup(MockRoute{"PUT", "/v2/space_quota_definitions/9ffd7c5c-d83c-4786-b399-b7bd54883977/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1", []string{""}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.AssignSpaceQuota("9ffd7c5c-d83c-4786-b399-b7bd54883977", "8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/spaces.go b/third_party/go-cfclient/spaces.go new file mode 100644 index 000000000000..c85e5b0051ae --- /dev/null +++ b/third_party/go-cfclient/spaces.go @@ -0,0 +1,829 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strconv" + + "github.com/pkg/errors" +) + +type SpaceRequest struct { + Name string `json:"name"` + OrganizationGuid string `json:"organization_guid"` + DeveloperGuid []string `json:"developer_guids,omitempty"` + ManagerGuid []string `json:"manager_guids,omitempty"` + AuditorGuid []string `json:"auditor_guids,omitempty"` + DomainGuid []string `json:"domain_guids,omitempty"` + SecurityGroupGuids []string `json:"security_group_guids,omitempty"` + SpaceQuotaDefGuid string `json:"space_quota_definition_guid,omitempty"` + IsolationSegmentGuid string `json:"isolation_segment_guid,omitempty"` + AllowSSH bool `json:"allow_ssh"` +} + +type SpaceResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []SpaceResource `json:"resources"` +} + +type SpaceResource struct { + Meta Meta `json:"metadata"` + Entity Space `json:"entity"` +} + +type ServicePlanEntity struct { + Name string `json:"name"` + Free bool `json:"free"` + Public bool `json:"public"` + Active bool `json:"active"` + Description string `json:"description"` + ServiceOfferingGUID string `json:"service_guid"` + ServiceOffering ServiceOfferingResource `json:"service"` +} + +type ServiceOfferingExtra struct { + DisplayName string `json:"displayName"` + DocumentationURL string `json:"documentationURL"` + LongDescription string `json:"longDescription"` +} + +type ServiceOfferingEntity struct { + Label string + Description string + Provider string `json:"provider"` + BrokerGUID string `json:"service_broker_guid"` + Requires []string `json:"requires"` + ServicePlans []interface{} `json:"service_plans"` + Extra ServiceOfferingExtra +} + +type ServiceOfferingResource struct { + Metadata Meta + Entity ServiceOfferingEntity +} + +type ServiceOfferingResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + PrevUrl string `json:"prev_url"` + Resources []ServiceOfferingResource `json:"resources"` +} + +type SpaceUserResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextURL string `json:"next_url"` + Resources []UserResource `json:"resources"` +} + +type Space struct { + Guid string `json:"guid"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Name string `json:"name"` + OrganizationGuid string `json:"organization_guid"` + OrgURL string `json:"organization_url"` + OrgData OrgResource `json:"organization"` + QuotaDefinitionGuid string `json:"space_quota_definition_guid"` + IsolationSegmentGuid string `json:"isolation_segment_guid"` + AllowSSH bool `json:"allow_ssh"` + c *Client +} + +type SpaceSummary struct { + Guid string `json:"guid"` + Name string `json:"name"` + Apps []AppSummary `json:"apps"` + Services []ServiceSummary `json:"services"` +} + +type SpaceRoleResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []SpaceRoleResource `json:"resources"` +} + +type SpaceRoleResource struct { + Meta Meta `json:"metadata"` + Entity SpaceRole `json:"entity"` +} + +type SpaceRole struct { + Guid string `json:"guid"` + Admin bool `json:"admin"` + Active bool `json:"active"` + DefaultSpaceGuid string `json:"default_space_guid"` + Username string `json:"username"` + SpaceRoles []string `json:"space_roles"` + SpacesUrl string `json:"spaces_url"` + OrganizationsUrl string `json:"organizations_url"` + ManagedOrganizationsUrl string `json:"managed_organizations_url"` + BillingManagedOrganizationsUrl string `json:"billing_managed_organizations_url"` + AuditedOrganizationsUrl string `json:"audited_organizations_url"` + ManagedSpacesUrl string `json:"managed_spaces_url"` + AuditedSpacesUrl string `json:"audited_spaces_url"` + c *Client +} + +func (s *Space) Org() (Org, error) { + var orgResource OrgResource + r := s.c.NewRequest("GET", s.OrgURL) + resp, err := s.c.DoRequest(r) + if err != nil { + return Org{}, errors.Wrap(err, "Error requesting org") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return Org{}, errors.Wrap(err, "Error reading org request") + } + + err = json.Unmarshal(resBody, &orgResource) + if err != nil { + return Org{}, errors.Wrap(err, "Error unmarshaling org") + } + return s.c.mergeOrgResource(orgResource), nil +} + +func (s *Space) Quota() (*SpaceQuota, error) { + var spaceQuota *SpaceQuota + var spaceQuotaResource SpaceQuotasResource + if s.QuotaDefinitionGuid == "" { + return nil, nil + } + requestUrl := fmt.Sprintf("/v2/space_quota_definitions/%s", s.QuotaDefinitionGuid) + r := s.c.NewRequest("GET", requestUrl) + resp, err := s.c.DoRequest(r) + if err != nil { + return &SpaceQuota{}, errors.Wrap(err, "Error requesting space quota") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return &SpaceQuota{}, errors.Wrap(err, "Error reading space quota body") + } + err = json.Unmarshal(resBody, &spaceQuotaResource) + if err != nil { + return &SpaceQuota{}, errors.Wrap(err, "Error unmarshalling space quota") + } + spaceQuota = &spaceQuotaResource.Entity + spaceQuota.Guid = spaceQuotaResource.Meta.Guid + spaceQuota.c = s.c + return spaceQuota, nil +} + +func (s *Space) Summary() (SpaceSummary, error) { + var spaceSummary SpaceSummary + requestUrl := fmt.Sprintf("/v2/spaces/%s/summary", s.Guid) + r := s.c.NewRequest("GET", requestUrl) + resp, err := s.c.DoRequest(r) + if err != nil { + return SpaceSummary{}, errors.Wrap(err, "Error requesting space summary") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return SpaceSummary{}, errors.Wrap(err, "Error reading space summary body") + } + err = json.Unmarshal(resBody, &spaceSummary) + if err != nil { + return SpaceSummary{}, errors.Wrap(err, "Error unmarshalling space summary") + } + return spaceSummary, nil +} + +func (s *Space) Roles() ([]SpaceRole, error) { + var roles []SpaceRole + requestUrl := fmt.Sprintf("/v2/spaces/%s/user_roles", s.Guid) + for { + rolesResp, err := s.c.getSpaceRolesResponse(requestUrl) + if err != nil { + return roles, err + } + for _, role := range rolesResp.Resources { + role.Entity.Guid = role.Meta.Guid + role.Entity.c = s.c + roles = append(roles, role.Entity) + } + requestUrl = rolesResp.NextUrl + if requestUrl == "" { + break + } + } + return roles, nil +} + +func (c *Client) CreateSpace(req SpaceRequest) (Space, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(req) + if err != nil { + return Space{}, err + } + r := c.NewRequestWithBody("POST", "/v2/spaces", buf) + resp, err := c.DoRequest(r) + if err != nil { + return Space{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return Space{}, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return c.handleSpaceResp(resp) +} + +func (c *Client) UpdateSpace(spaceGUID string, req SpaceRequest) (Space, error) { + space := Space{Guid: spaceGUID, c: c} + return space.Update(req) +} + +func (c *Client) DeleteSpace(guid string, recursive, async bool) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/spaces/%s?recursive=%t&async=%t", guid, recursive, async))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting space %s, response code: %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) ListSpaceManagersByQuery(spaceGUID string, query url.Values) ([]User, error) { + return c.listSpaceUsersByRoleAndQuery(spaceGUID, "managers", query) +} + +func (c *Client) ListSpaceManagers(spaceGUID string) ([]User, error) { + return c.ListSpaceManagersByQuery(spaceGUID, nil) +} + +func (c *Client) ListSpaceAuditorsByQuery(spaceGUID string, query url.Values) ([]User, error) { + return c.listSpaceUsersByRoleAndQuery(spaceGUID, "auditors", query) +} + +func (c *Client) ListSpaceAuditors(spaceGUID string) ([]User, error) { + return c.ListSpaceAuditorsByQuery(spaceGUID, nil) +} + +func (c *Client) ListSpaceDevelopersByQuery(spaceGUID string, query url.Values) ([]User, error) { + return c.listSpaceUsersByRoleAndQuery(spaceGUID, "developers", query) +} + +func (c *Client) listSpaceUsersByRoleAndQuery(spaceGUID, role string, query url.Values) ([]User, error) { + var users []User + requestURL := fmt.Sprintf("/v2/spaces/%s/%s?%s", spaceGUID, role, query.Encode()) + for { + userResp, err := c.getUserResponse(requestURL) + if err != nil { + return []User{}, err + } + for _, u := range userResp.Resources { + users = append(users, c.mergeUserResource(u)) + } + requestURL = userResp.NextUrl + if requestURL == "" { + break + } + } + return users, nil +} + +func (c *Client) ListSpaceDevelopers(spaceGUID string) ([]User, error) { + return c.ListSpaceDevelopersByQuery(spaceGUID, nil) +} + +func (c *Client) ListSpaceServiceInstances(spaceGUID string) ([]ServiceInstance, error) { + return c.ListSpaceServiceInstancesByQuery(spaceGUID, nil) +} + +func (c *Client) ListSpaceServiceInstancesByQuery(spaceGUID string, query url.Values) ([]ServiceInstance, error) { + var instances []ServiceInstance + requestURL := fmt.Sprintf("/v2/spaces/%s/service_instances?%s", spaceGUID, query.Encode()) + for { + res, err := c.getServiceInstancesResponse(requestURL) + if err != nil { + return instances, err + } + for _, instance := range res.Resources { + instances = append(instances, c.mergeServiceInstance(instance)) + } + requestURL = res.NextUrl + if requestURL == "" || query.Get("page") != "" { + break + } + } + return instances, nil +} + +func (c *Client) AssociateSpaceDeveloper(spaceGUID, userGUID string) (Space, error) { + space := Space{Guid: spaceGUID, c: c} + return space.AssociateDeveloper(userGUID) +} + +func (c *Client) AssociateSpaceDeveloperByUsername(spaceGUID, name string) (Space, error) { + space := Space{Guid: spaceGUID, c: c} + return space.AssociateDeveloperByUsername(name) +} + +func (c *Client) AssociateSpaceDeveloperByUsernameAndOrigin(spaceGUID, name, origin string) (Space, error) { + space := Space{Guid: spaceGUID, c: c} + return space.AssociateDeveloperByUsernameAndOrigin(name, origin) +} + +func (c *Client) RemoveSpaceDeveloper(spaceGUID, userGUID string) error { + space := Space{Guid: spaceGUID, c: c} + return space.RemoveDeveloper(userGUID) +} + +func (c *Client) RemoveSpaceDeveloperByUsername(spaceGUID, name string) error { + space := Space{Guid: spaceGUID, c: c} + return space.RemoveDeveloperByUsername(name) +} + +func (c *Client) RemoveSpaceDeveloperByUsernameAndOrigin(spaceGUID, name, origin string) error { + space := Space{Guid: spaceGUID, c: c} + return space.RemoveDeveloperByUsernameAndOrigin(name, origin) +} + +func (c *Client) AssociateSpaceAuditor(spaceGUID, userGUID string) (Space, error) { + space := Space{Guid: spaceGUID, c: c} + return space.AssociateAuditor(userGUID) +} + +func (c *Client) AssociateSpaceAuditorByUsername(spaceGUID, name string) (Space, error) { + space := Space{Guid: spaceGUID, c: c} + return space.AssociateAuditorByUsername(name) +} + +func (c *Client) AssociateSpaceAuditorByUsernameAndOrigin(spaceGUID, name, origin string) (Space, error) { + space := Space{Guid: spaceGUID, c: c} + return space.AssociateAuditorByUsernameAndOrigin(name, origin) +} + +func (c *Client) RemoveSpaceAuditor(spaceGUID, userGUID string) error { + space := Space{Guid: spaceGUID, c: c} + return space.RemoveAuditor(userGUID) +} + +func (c *Client) RemoveSpaceAuditorByUsername(spaceGUID, name string) error { + space := Space{Guid: spaceGUID, c: c} + return space.RemoveAuditorByUsername(name) +} + +func (c *Client) RemoveSpaceAuditorByUsernameAndOrigin(spaceGUID, name, origin string) error { + space := Space{Guid: spaceGUID, c: c} + return space.RemoveAuditorByUsernameAndOrigin(name, origin) +} + +func (c *Client) AssociateSpaceManager(spaceGUID, userGUID string) (Space, error) { + space := Space{Guid: spaceGUID, c: c} + return space.AssociateManager(userGUID) +} + +func (c *Client) AssociateSpaceManagerByUsername(spaceGUID, name string) (Space, error) { + space := Space{Guid: spaceGUID, c: c} + return space.AssociateManagerByUsername(name) +} + +func (c *Client) AssociateSpaceManagerByUsernameAndOrigin(spaceGUID, name, origin string) (Space, error) { + space := Space{Guid: spaceGUID, c: c} + return space.AssociateManagerByUsernameAndOrigin(name, origin) +} + +func (c *Client) RemoveSpaceManager(spaceGUID, userGUID string) error { + space := Space{Guid: spaceGUID, c: c} + return space.RemoveManager(userGUID) +} + +func (c *Client) RemoveSpaceManagerByUsername(spaceGUID, name string) error { + space := Space{Guid: spaceGUID, c: c} + return space.RemoveManagerByUsername(name) +} + +func (c *Client) RemoveSpaceManagerByUsernameAndOrigin(spaceGUID, name, origin string) error { + space := Space{Guid: spaceGUID, c: c} + return space.RemoveManagerByUsernameAndOrigin(name, origin) +} + +func (s *Space) AssociateDeveloper(userGUID string) (Space, error) { + return s.associateRole(userGUID, "developers") +} + +func (s *Space) AssociateDeveloperByUsername(name string) (Space, error) { + return s.associateUserByRole(name, "developers", "") +} + +func (s *Space) AssociateDeveloperByUsernameAndOrigin(name, origin string) (Space, error) { + return s.associateUserByRole(name, "developers", origin) +} + +func (s *Space) RemoveDeveloper(userGUID string) error { + return s.removeRole(userGUID, "developers") +} + +func (s *Space) RemoveDeveloperByUsername(name string) error { + return s.removeUserByRole(name, "developers", "") +} + +func (s *Space) RemoveDeveloperByUsernameAndOrigin(name, origin string) error { + return s.removeUserByRole(name, "developers", origin) +} + +func (s *Space) AssociateAuditor(userGUID string) (Space, error) { + return s.associateRole(userGUID, "auditors") +} + +func (s *Space) AssociateAuditorByUsername(name string) (Space, error) { + return s.associateUserByRole(name, "auditors", "") +} + +func (s *Space) AssociateAuditorByUsernameAndOrigin(name, origin string) (Space, error) { + return s.associateUserByRole(name, "auditors", origin) +} + +func (s *Space) RemoveAuditor(userGUID string) error { + return s.removeRole(userGUID, "auditors") +} + +func (s *Space) RemoveAuditorByUsername(name string) error { + return s.removeUserByRole(name, "auditors", "") +} + +func (s *Space) RemoveAuditorByUsernameAndOrigin(name, origin string) error { + return s.removeUserByRole(name, "auditors", origin) +} + +func (s *Space) AssociateManager(userGUID string) (Space, error) { + return s.associateRole(userGUID, "managers") +} + +func (s *Space) AssociateManagerByUsername(name string) (Space, error) { + return s.associateUserByRole(name, "managers", "") +} + +func (s *Space) AssociateManagerByUsernameAndOrigin(name, origin string) (Space, error) { + return s.associateUserByRole(name, "managers", origin) +} + +func (s *Space) RemoveManager(userGUID string) error { + return s.removeRole(userGUID, "managers") +} + +func (s *Space) RemoveManagerByUsername(name string) error { + return s.removeUserByRole(name, "managers", "") +} +func (s *Space) RemoveManagerByUsernameAndOrigin(name, origin string) error { + return s.removeUserByRole(name, "managers", origin) +} + +func (s *Space) associateRole(userGUID, role string) (Space, error) { + requestUrl := fmt.Sprintf("/v2/spaces/%s/%s/%s", s.Guid, role, userGUID) + r := s.c.NewRequest("PUT", requestUrl) + resp, err := s.c.DoRequest(r) + if err != nil { + return Space{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return Space{}, errors.Wrapf(err, "Error associating %s %s, response code: %d", role, userGUID, resp.StatusCode) + } + return s.c.handleSpaceResp(resp) +} + +func (s *Space) associateUserByRole(name, role, origin string) (Space, error) { + requestUrl := fmt.Sprintf("/v2/spaces/%s/%s", s.Guid, role) + buf := bytes.NewBuffer(nil) + payload := make(map[string]string) + payload["username"] = name + if origin != "" { + payload["origin"] = origin + } + err := json.NewEncoder(buf).Encode(payload) + if err != nil { + return Space{}, err + } + r := s.c.NewRequestWithBody("PUT", requestUrl, buf) + resp, err := s.c.DoRequest(r) + if err != nil { + return Space{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return Space{}, errors.Wrapf(err, "Error associating %s %s, response code: %d", role, name, resp.StatusCode) + } + return s.c.handleSpaceResp(resp) +} + +func (s *Space) removeRole(userGUID, role string) error { + requestUrl := fmt.Sprintf("/v2/spaces/%s/%s/%s", s.Guid, role, userGUID) + r := s.c.NewRequest("DELETE", requestUrl) + resp, err := s.c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error removing %s %s, response code: %d", role, userGUID, resp.StatusCode) + } + return nil +} + +func (s *Space) removeUserByRole(name, role, origin string) error { + var requestURL string + var method string + + buf := bytes.NewBuffer(nil) + payload := make(map[string]string) + payload["username"] = name + if origin != "" { + payload["origin"] = origin + requestURL = fmt.Sprintf("/v2/spaces/%s/%s/remove", s.Guid, role) + method = "POST" + } else { + requestURL = fmt.Sprintf("/v2/spaces/%s/%s", s.Guid, role) + method = "DELETE" + } + err := json.NewEncoder(buf).Encode(payload) + if err != nil { + return err + } + r := s.c.NewRequestWithBody(method, requestURL, buf) + resp, err := s.c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return errors.Wrapf(err, "Error removing %s %s, response code: %d", role, name, resp.StatusCode) + } + return nil +} + +func (c *Client) ListSpaceSecGroups(spaceGUID string) (secGroups []SecGroup, err error) { + space := Space{Guid: spaceGUID, c: c} + return space.ListSecGroups() +} + +func (s *Space) ListSecGroups() (secGroups []SecGroup, err error) { + requestURL := fmt.Sprintf("/v2/spaces/%s/security_groups?inline-relations-depth=1", s.Guid) + for requestURL != "" { + var secGroupResp SecGroupResponse + r := s.c.NewRequest("GET", requestURL) + resp, err := s.c.DoRequest(r) + + if err != nil { + return nil, errors.Wrap(err, "Error requesting sec groups") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading sec group response body") + } + + err = json.Unmarshal(resBody, &secGroupResp) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling sec group") + } + + for _, secGroup := range secGroupResp.Resources { + secGroup.Entity.Guid = secGroup.Meta.Guid + secGroup.Entity.c = s.c + for i, space := range secGroup.Entity.SpacesData { + space.Entity.Guid = space.Meta.Guid + secGroup.Entity.SpacesData[i] = space + } + if len(secGroup.Entity.SpacesData) == 0 { + spaces, err := secGroup.Entity.ListSpaceResources() + if err != nil { + return nil, err + } + secGroup.Entity.SpacesData = append(secGroup.Entity.SpacesData, spaces...) + } + secGroups = append(secGroups, secGroup.Entity) + } + + requestURL = secGroupResp.NextUrl + resp.Body.Close() + } + return secGroups, nil +} + +func (s *Space) GetServiceOfferings() (ServiceOfferingResponse, error) { + var response ServiceOfferingResponse + requestURL := fmt.Sprintf("/v2/spaces/%s/services", s.Guid) + req := s.c.NewRequest("GET", requestURL) + + resp, err := s.c.DoRequest(req) + if err != nil { + return ServiceOfferingResponse{}, errors.Wrap(err, "Error requesting service offerings") + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return ServiceOfferingResponse{}, errors.Wrap(err, "Error reading service offering response") + } + + err = json.Unmarshal(body, &response) + if err != nil { + return ServiceOfferingResponse{}, errors.Wrap(err, "Error unmarshalling service offering response") + } + + return response, nil +} + +func (s *Space) Update(req SpaceRequest) (Space, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(req) + if err != nil { + return Space{}, err + } + r := s.c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/spaces/%s", s.Guid), buf) + resp, err := s.c.DoRequest(r) + if err != nil { + return Space{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return Space{}, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return s.c.handleSpaceResp(resp) +} + +func (c *Client) ListSpacesByQuery(query url.Values) ([]Space, error) { + return c.fetchSpaces("/v2/spaces", query) +} + +func (c *Client) ListSpacesByOrgGuid(orgGuid string) ([]Space, error) { + return c.fetchSpaces(fmt.Sprintf("/v2/organizations/%s/spaces", orgGuid), url.Values{}) +} + +func (c *Client) ListSpaces() ([]Space, error) { + return c.ListSpacesByQuery(nil) +} + +func (c *Client) fetchSpaces(path string, query url.Values) ([]Space, error) { + requestUrl := path + "?" + query.Encode() + var spaces []Space + for { + spaceResp, err := c.getSpaceResponse(requestUrl) + if err != nil { + return []Space{}, err + } + for _, space := range spaceResp.Resources { + spaces = append(spaces, c.mergeSpaceResource(space)) + } + requestUrl = spaceResp.NextUrl + if requestUrl == "" || query.Get("page") != "" { + break + } + } + return spaces, nil +} + +func (c *Client) GetSpaceByName(spaceName string, orgGuid string) (Space, error) { + query := url.Values{} + query.Add("q", fmt.Sprintf("organization_guid:%s", orgGuid)) + query.Add("q", fmt.Sprintf("name:%s", spaceName)) + spaces, err := c.ListSpacesByQuery(query) + if err != nil { + return Space{}, err + } + + if len(spaces) == 0 { + cfErr := NewSpaceNotFoundError() + cfErr.Description = fmt.Sprintf(cfErr.Description, spaceName) + return Space{}, cfErr + } + + return spaces[0], nil + +} + +func (c *Client) GetSpaceByGuid(spaceGUID string) (Space, error) { + requestUrl := fmt.Sprintf("/v2/spaces/%s", spaceGUID) + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return Space{}, errors.Wrap(err, "Error requesting space info") + } + defer resp.Body.Close() + return c.handleSpaceResp(resp) +} + +func (c *Client) getSpaceResponse(requestUrl string) (SpaceResponse, error) { + var spaceResp SpaceResponse + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return SpaceResponse{}, errors.Wrap(err, "Error requesting spaces") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return SpaceResponse{}, errors.Wrap(err, "Error reading space request") + } + err = json.Unmarshal(resBody, &spaceResp) + if err != nil { + return SpaceResponse{}, errors.Wrap(err, "Error unmarshalling space") + } + return spaceResp, nil +} + +func (c *Client) getSpaceRolesResponse(requestUrl string) (SpaceRoleResponse, error) { + var roleResp SpaceRoleResponse + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return roleResp, errors.Wrap(err, "Error requesting space roles") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return roleResp, errors.Wrap(err, "Error reading space roles request") + } + err = json.Unmarshal(resBody, &roleResp) + if err != nil { + return roleResp, errors.Wrap(err, "Error unmarshalling space roles") + } + return roleResp, nil +} + +func (c *Client) handleSpaceResp(resp *http.Response) (Space, error) { + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return Space{}, err + } + var spaceResource SpaceResource + err = json.Unmarshal(body, &spaceResource) + if err != nil { + return Space{}, err + } + return c.mergeSpaceResource(spaceResource), nil +} + +func (c *Client) mergeSpaceResource(space SpaceResource) Space { + space.Entity.Guid = space.Meta.Guid + space.Entity.CreatedAt = space.Meta.CreatedAt + space.Entity.UpdatedAt = space.Meta.UpdatedAt + space.Entity.c = c + return space.Entity +} + +type serviceOfferingExtra ServiceOfferingExtra + +func (resource *ServiceOfferingExtra) UnmarshalJSON(rawData []byte) error { + if string(rawData) == "null" { + return nil + } + + extra := serviceOfferingExtra{} + + unquoted, err := strconv.Unquote(string(rawData)) + if err != nil { + return err + } + + err = json.Unmarshal([]byte(unquoted), &extra) + if err != nil { + return err + } + + *resource = ServiceOfferingExtra(extra) + + return nil +} + +func (c *Client) IsolationSegmentForSpace(spaceGUID, isolationSegmentGUID string) error { + return c.updateSpaceIsolationSegment(spaceGUID, map[string]interface{}{"guid": isolationSegmentGUID}) +} + +func (c *Client) ResetIsolationSegmentForSpace(spaceGUID string) error { + return c.updateSpaceIsolationSegment(spaceGUID, nil) +} + +func (c *Client) updateSpaceIsolationSegment(spaceGUID string, data interface{}) error { + requestURL := fmt.Sprintf("/v3/spaces/%s/relationships/isolation_segment", spaceGUID) + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(map[string]interface{}{"data": data}) + if err != nil { + return err + } + r := c.NewRequestWithBody("PATCH", requestURL, buf) + resp, err := c.DoRequest(r) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return errors.Wrapf(err, "Error setting isolation segment for space %s, response code: %d", spaceGUID, resp.StatusCode) + } + return nil +} diff --git a/third_party/go-cfclient/spaces_test.go b/third_party/go-cfclient/spaces_test.go new file mode 100644 index 000000000000..11b4a198a07e --- /dev/null +++ b/third_party/go-cfclient/spaces_test.go @@ -0,0 +1,786 @@ +package cfclient + +import ( + "fmt" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListSpaces(t *testing.T) { + Convey("List Space", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/spaces", []string{listSpacesPayload}, "", 200, "", nil}, + {"GET", "/v2/spacesPage2", []string{listSpacesPayloadPage2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaces, err := client.ListSpaces() + So(err, ShouldBeNil) + + So(len(spaces), ShouldEqual, 4) + So(spaces[0].Guid, ShouldEqual, "8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(spaces[0].CreatedAt, ShouldEqual, "2014-09-24T13:54:54+00:00") + So(spaces[0].UpdatedAt, ShouldEqual, "2014-09-24T13:54:54+00:00") + So(spaces[0].Name, ShouldEqual, "dev") + So(spaces[0].OrganizationGuid, ShouldEqual, "a537761f-9d93-4b30-af17-3d73dbca181b") + So(spaces[1].Guid, ShouldEqual, "657b5923-7de0-486a-9928-b4d78ee24931") + So(spaces[1].CreatedAt, ShouldEqual, "2014-09-26T13:37:31+00:00") + So(spaces[1].UpdatedAt, ShouldEqual, "2014-09-26T13:37:31+00:00") + So(spaces[1].Name, ShouldEqual, "demo") + So(spaces[1].OrganizationGuid, ShouldEqual, "da0dba14-6064-4f7a-b15a-ff9e677e49b2") + So(spaces[2].Guid, ShouldEqual, "9ffd7c5c-d83c-4786-b399-b7bd54883977") + So(spaces[2].CreatedAt, ShouldEqual, "2014-09-24T13:54:54+00:00") + So(spaces[2].UpdatedAt, ShouldEqual, "2014-09-24T13:54:54+00:00") + So(spaces[2].Name, ShouldEqual, "test") + So(spaces[2].OrganizationGuid, ShouldEqual, "a537761f-9d93-4b30-af17-3d73dbca181b") + So(spaces[3].Guid, ShouldEqual, "329b5923-7de0-486a-9928-b4d78ee24982") + So(spaces[3].CreatedAt, ShouldEqual, "2014-09-26T13:37:31+00:00") + So(spaces[3].UpdatedAt, ShouldEqual, "2014-09-26T13:37:31+00:00") + So(spaces[3].Name, ShouldEqual, "prod") + So(spaces[3].OrganizationGuid, ShouldEqual, "da0dba14-6064-4f7a-b15a-ff9e677e49b2") + }) +} + +func TestListSpaceSecGroups(t *testing.T) { + Convey("List Space SecGroups", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1/security_groups", []string{listSecGroupsPayload}, "", 200, "inline-relations-depth=1", nil}, + {"GET", "/v2/security_groupsPage2", []string{listSecGroupsPayloadPage2}, "", 200, "", nil}, + {"GET", "/v2/security_groups/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/spaces", []string{emptyResources}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + secGroups, err := client.ListSpaceSecGroups("8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(err, ShouldBeNil) + + So(len(secGroups), ShouldEqual, 2) + So(secGroups[0].Guid, ShouldEqual, "af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c") + So(secGroups[0].Name, ShouldEqual, "secgroup-test") + So(secGroups[0].Running, ShouldEqual, true) + So(secGroups[0].Staging, ShouldEqual, true) + So(secGroups[0].Rules[0].Protocol, ShouldEqual, "tcp") + So(secGroups[0].Rules[0].Ports, ShouldEqual, "443,4443") + So(secGroups[0].Rules[0].Destination, ShouldEqual, "1.1.1.1") + So(secGroups[0].Rules[1].Protocol, ShouldEqual, "udp") + So(secGroups[0].Rules[1].Ports, ShouldEqual, "1111") + So(secGroups[0].Rules[1].Destination, ShouldEqual, "1.2.3.4") + So(secGroups[0].SpacesURL, ShouldEqual, "/v2/security_groups/af15c29a-6bde-4a9b-8cdf-43aa0d4b7e3c/spaces") + So(secGroups[0].SpacesData, ShouldBeEmpty) + So(secGroups[1].Guid, ShouldEqual, "f9ad202b-76dd-44ec-b7c2-fd2417a561e8") + So(secGroups[1].Name, ShouldEqual, "secgroup-test2") + So(secGroups[1].Running, ShouldEqual, false) + So(secGroups[1].Staging, ShouldEqual, false) + So(secGroups[1].Rules[0].Protocol, ShouldEqual, "udp") + So(secGroups[1].Rules[0].Ports, ShouldEqual, "2222") + So(secGroups[1].Rules[0].Destination, ShouldEqual, "2.2.2.2") + So(secGroups[1].Rules[1].Protocol, ShouldEqual, "tcp") + So(secGroups[1].Rules[1].Ports, ShouldEqual, "443,4443") + So(secGroups[1].Rules[1].Destination, ShouldEqual, "4.3.2.1") + So(secGroups[1].SpacesData[0].Entity.Guid, ShouldEqual, "e0a0d1bf-ad74-4b3c-8f4a-0c33859a54e4") + So(secGroups[1].SpacesData[0].Entity.Name, ShouldEqual, "space-test") + So(secGroups[1].SpacesData[1].Entity.Guid, ShouldEqual, "a2a0d1bf-ad74-4b3c-8f4a-0c33859a5333") + So(secGroups[1].SpacesData[1].Entity.Name, ShouldEqual, "space-test2") + So(secGroups[1].SpacesData[2].Entity.Guid, ShouldEqual, "c7a0d1bf-ad74-4b3c-8f4a-0c33859adsa1") + So(secGroups[1].SpacesData[2].Entity.Name, ShouldEqual, "space-test3") + }) +} + +func TestListSpaceManagers(t *testing.T) { + Convey("ListSpaceManagers()", t, func() { + setup(MockRoute{"GET", "/v2/spaces/foo/managers", []string{listSpacePeoplePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + users, err := client.ListSpaceManagers("foo") + So(err, ShouldBeNil) + So(len(users), ShouldEqual, 2) + So(users[0].Username, ShouldEqual, "user1") + So(users[1].Username, ShouldEqual, "user2") + }) +} + +func TestListSpaceAuditors(t *testing.T) { + Convey("ListSpaceAuditors()", t, func() { + setup(MockRoute{"GET", "/v2/spaces/foo/auditors", []string{listSpacePeoplePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + users, err := client.ListSpaceAuditors("foo") + So(err, ShouldBeNil) + So(len(users), ShouldEqual, 2) + So(users[0].Username, ShouldEqual, "user1") + So(users[1].Username, ShouldEqual, "user2") + }) +} + +func TestListSpaceDevelopers(t *testing.T) { + Convey("ListSpaceDevelopers()", t, func() { + setup(MockRoute{"GET", "/v2/spaces/foo/developers", []string{listSpacePeoplePayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + users, err := client.ListSpaceDevelopers("foo") + So(err, ShouldBeNil) + So(len(users), ShouldEqual, 2) + So(users[0].Username, ShouldEqual, "user1") + So(users[1].Username, ShouldEqual, "user2") + }) +} + +func TestListSpaceServiceInstances(t *testing.T) { + Convey("ListSpaceServiceInstances()", t, func() { + setup(MockRoute{"GET", "/v2/spaces/494d8b64-8181-4183-a6d3-6279db8fec6e/service_instances", []string{listSpaceServiceInstancesPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceInstances, err := client.ListSpaceServiceInstances("494d8b64-8181-4183-a6d3-6279db8fec6e") + So(err, ShouldBeNil) + + So(len(serviceInstances), ShouldEqual, 2) + So(serviceInstances[0].Guid, ShouldEqual, "9547e9ed-e460-4abe-bda3-7070b9835917") + So(serviceInstances[0].Name, ShouldEqual, "name-2104") + So(serviceInstances[0].Credentials, ShouldHaveLength, 1) + So(serviceInstances[0].ServicePlanGuid, ShouldEqual, "fcf57f7f-3c51-49b2-b252-dc24e0f7dcab") + So(serviceInstances[0].SpaceGuid, ShouldEqual, "f858c6b3-f6b1-4ae8-81dd-8e8747657fbe") + So(serviceInstances[0].DashboardUrl, ShouldBeEmpty) + So(serviceInstances[0].Type, ShouldEqual, "managed_service_instance") + So(serviceInstances[0].Tags, ShouldBeEmpty) + So(serviceInstances[0].ServiceGuid, ShouldBeEmpty) + So(serviceInstances[0].ServiceInstanceParametersUrl, ShouldEqual, "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/parameters") + So(serviceInstances[0].SharedFromUrl, ShouldEqual, "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/shared_from") + So(serviceInstances[0].SharedToUrl, ShouldEqual, "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/shared_to") + So(serviceInstances[0].SpaceUrl, ShouldEqual, "/v2/spaces/f858c6b3-f6b1-4ae8-81dd-8e8747657fbe") + So(serviceInstances[0].ServicePlanUrl, ShouldEqual, "/v2/service_plans/fcf57f7f-3c51-49b2-b252-dc24e0f7dcab") + So(serviceInstances[0].ServiceBindingsUrl, ShouldEqual, "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/service_bindings") + So(serviceInstances[0].ServiceKeysUrl, ShouldEqual, "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/service_keys") + So(serviceInstances[0].RoutesUrl, ShouldEqual, "/v2/service_instances/9547e9ed-e460-4abe-bda3-7070b9835917/routes") + So(serviceInstances[0].ServiceUrl, ShouldEqual, "") + So(serviceInstances[1].Guid, ShouldEqual, "07d2f44a-9031-11ec-b909-0242ac120002") + So(serviceInstances[1].Name, ShouldEqual, "name-2105") + So(serviceInstances[1].Credentials, ShouldHaveLength, 1) + So(serviceInstances[1].ServicePlanGuid, ShouldEqual, "22b3ae01-280d-41aa-9e97-68d47680003d") + So(serviceInstances[1].SpaceGuid, ShouldEqual, "f858c6b3-f6b1-4ae8-81dd-8e8747657fbe") + So(serviceInstances[1].DashboardUrl, ShouldBeEmpty) + So(serviceInstances[1].Type, ShouldEqual, "managed_service_instance") + So(serviceInstances[1].Tags, ShouldBeEmpty) + So(serviceInstances[1].ServiceGuid, ShouldBeEmpty) + So(serviceInstances[1].ServiceInstanceParametersUrl, ShouldEqual, "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/parameters") + So(serviceInstances[1].SharedFromUrl, ShouldEqual, "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/shared_from") + So(serviceInstances[1].SharedToUrl, ShouldEqual, "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/shared_to") + So(serviceInstances[1].SpaceUrl, ShouldEqual, "/v2/spaces/f858c6b3-f6b1-4ae8-81dd-8e8747657fbe") + So(serviceInstances[1].ServicePlanUrl, ShouldEqual, "/v2/service_plans/22b3ae01-280d-41aa-9e97-68d47680003d") + So(serviceInstances[1].ServiceBindingsUrl, ShouldEqual, "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/service_bindings") + So(serviceInstances[1].ServiceKeysUrl, ShouldEqual, "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/service_keys") + So(serviceInstances[1].RoutesUrl, ShouldEqual, "/v2/service_instances/07d2f44a-9031-11ec-b909-0242ac120002/routes") + So(serviceInstances[1].ServiceUrl, ShouldEqual, "") + }) +} + +func TestCreateSpace(t *testing.T) { + Convey("Create Space", t, func() { + setup(MockRoute{"POST", "/v2/spaces", []string{spacePayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaceRequest := SpaceRequest{Name: "test-space", OrganizationGuid: "da0dba14-6064-4f7a-b15a-ff9e677e49b2", AllowSSH: false} + + space, err := client.CreateSpace(spaceRequest) + So(err, ShouldBeNil) + + So(space.Name, ShouldEqual, "test-space") + So(space.OrganizationGuid, ShouldEqual, "da0dba14-6064-4f7a-b15a-ff9e677e49b2") + So(space.AllowSSH, ShouldEqual, false) + }) +} + +func TestUpdateSpace(t *testing.T) { + Convey("Update Space", t, func() { + setup(MockRoute{"PUT", "/v2/spaces/a72fa1e8-c694-47b3-85f2-55f61fd00d73", []string{spacePayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + updateSpaceRequest := SpaceRequest{ + Name: "test-space", + AllowSSH: false, + } + + space, err := client.UpdateSpace("a72fa1e8-c694-47b3-85f2-55f61fd00d73", updateSpaceRequest) + So(err, ShouldBeNil) + + So(space.Guid, ShouldEqual, "a72fa1e8-c694-47b3-85f2-55f61fd00d73") + So(space.Name, ShouldEqual, "test-space") + So(space.OrganizationGuid, ShouldEqual, "da0dba14-6064-4f7a-b15a-ff9e677e49b2") + So(space.AllowSSH, ShouldEqual, false) + }) +} + +func TestDeleteSpace(t *testing.T) { + Convey("Delete space", t, func() { + setup(MockRoute{"DELETE", "/v2/spaces/a537761f-9d93-4b30-af17-3d73dbca181b", []string{""}, "", 204, "recursive=false&async=false", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteSpace("a537761f-9d93-4b30-af17-3d73dbca181b", false, false) + So(err, ShouldBeNil) + }) +} +func TestSpaceOrg(t *testing.T) { + Convey("Find space org", t, func() { + setup(MockRoute{"GET", "/v2/org/foobar", []string{orgPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "123", + Name: "test space", + OrgURL: "/v2/org/foobar", + c: client, + } + org, err := space.Org() + So(err, ShouldBeNil) + + So(org.Name, ShouldEqual, "test-org") + So(org.Guid, ShouldEqual, "da0dba14-6064-4f7a-b15a-ff9e677e49b2") + }) +} + +func TestSpaceQuota(t *testing.T) { + Convey("Get space quota", t, func() { + setup(MockRoute{"GET", "/v2/space_quota_definitions/9ffd7c5c-d83c-4786-b399-b7bd54883977", []string{spaceQuotaPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + QuotaDefinitionGuid: "9ffd7c5c-d83c-4786-b399-b7bd54883977", + c: client, + } + + spaceQuota, err := space.Quota() + So(err, ShouldBeNil) + + So(spaceQuota.Guid, ShouldEqual, "9ffd7c5c-d83c-4786-b399-b7bd54883977") + So(spaceQuota.Name, ShouldEqual, "test-2") + So(spaceQuota.NonBasicServicesAllowed, ShouldEqual, false) + So(spaceQuota.TotalServices, ShouldEqual, 10) + So(spaceQuota.TotalRoutes, ShouldEqual, 20) + So(spaceQuota.MemoryLimit, ShouldEqual, 30) + So(spaceQuota.InstanceMemoryLimit, ShouldEqual, 40) + So(spaceQuota.AppInstanceLimit, ShouldEqual, 50) + So(spaceQuota.AppTaskLimit, ShouldEqual, 60) + So(spaceQuota.TotalServiceKeys, ShouldEqual, 70) + So(spaceQuota.TotalReservedRoutePorts, ShouldEqual, 80) + }) +} + +func TestSpaceSummary(t *testing.T) { + Convey("Get space summary", t, func() { + setup(MockRoute{"GET", "/v2/spaces/494d8b64-8181-4183-a6d3-6279db8fec6e/summary", []string{spaceSummaryPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "494d8b64-8181-4183-a6d3-6279db8fec6e", + c: client, + } + + summary, err := space.Summary() + So(err, ShouldBeNil) + + So(summary.Guid, ShouldEqual, "494d8b64-8181-4183-a6d3-6279db8fec6e") + So(summary.Name, ShouldEqual, "test") + + So(len(summary.Apps), ShouldEqual, 1) + So(summary.Apps[0].Guid, ShouldEqual, "b5f0d1bd-a3a9-40a4-af1a-312ad26e5379") + So(summary.Apps[0].Name, ShouldEqual, "test-app") + So(summary.Apps[0].ServiceCount, ShouldEqual, 1) + So(summary.Apps[0].RunningInstances, ShouldEqual, 1) + So(summary.Apps[0].SpaceGuid, ShouldEqual, "494d8b64-8181-4183-a6d3-6279db8fec6e") + So(summary.Apps[0].StackGuid, ShouldEqual, "67e019a3-322a-407a-96e0-178e95bd0e55") + So(summary.Apps[0].Buildpack, ShouldEqual, "ruby_buildpack") + So(summary.Apps[0].DetectedBuildpack, ShouldEqual, "") + So(summary.Apps[0].Memory, ShouldEqual, 256) + So(summary.Apps[0].Instances, ShouldEqual, 1) + So(summary.Apps[0].DiskQuota, ShouldEqual, 512) + So(summary.Apps[0].State, ShouldEqual, "STARTED") + So(summary.Apps[0].Command, ShouldEqual, "") + So(summary.Apps[0].PackageState, ShouldEqual, "STAGED") + So(summary.Apps[0].HealthCheckType, ShouldEqual, "port") + So(summary.Apps[0].HealthCheckTimeout, ShouldEqual, 0) + So(summary.Apps[0].StagingFailedReason, ShouldEqual, "") + So(summary.Apps[0].StagingFailedDescription, ShouldEqual, "") + So(summary.Apps[0].Diego, ShouldEqual, true) + So(summary.Apps[0].DockerImage, ShouldEqual, "") + So(summary.Apps[0].DetectedStartCommand, ShouldEqual, "rackup -p $PORT") + So(summary.Apps[0].EnableSSH, ShouldEqual, true) + So(summary.Apps[0].DockerCredentials["redacted_message"], ShouldEqual, "[PRIVATE DATA HIDDEN]") + + So(len(summary.Services), ShouldEqual, 1) + So(summary.Services[0].Guid, ShouldEqual, "3c5c758c-6b76-46f6-89d5-677909bfc975") + So(summary.Services[0].Name, ShouldEqual, "test-service") + So(summary.Services[0].BoundAppCount, ShouldEqual, 1) + So(summary.Services[0].ServiceBrokerName, ShouldEqual, "broker-name") + So(summary.Services[0].ServicePlan.Service.Label, ShouldEqual, "test-service") + }) +} + +func TestSpaceRoles(t *testing.T) { + Convey("Get space roles", t, func() { + setup(MockRoute{"GET", "/v2/spaces/494d8b64-8181-4183-a6d3-6279db8fec6e/user_roles", []string{spaceRolesPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "494d8b64-8181-4183-a6d3-6279db8fec6e", + c: client, + } + + roles, err := space.Roles() + So(err, ShouldBeNil) + + So(len(roles), ShouldEqual, 1) + So(roles[0].Guid, ShouldEqual, "uaa-id-363") + So(roles[0].Admin, ShouldEqual, false) + So(roles[0].Active, ShouldEqual, false) + So(roles[0].DefaultSpaceGuid, ShouldEqual, "") + So(roles[0].Username, ShouldEqual, "everything@example.com") + So(roles[0].SpaceRoles, ShouldResemble, []string{"space_developer", "space_manager", "space_auditor"}) + So(roles[0].SpacesUrl, ShouldEqual, "/v2/users/uaa-id-363/spaces") + So(roles[0].OrganizationsUrl, ShouldEqual, "/v2/users/uaa-id-363/organizations") + So(roles[0].ManagedOrganizationsUrl, ShouldEqual, "/v2/users/uaa-id-363/managed_organizations") + So(roles[0].BillingManagedOrganizationsUrl, ShouldEqual, "/v2/users/uaa-id-363/billing_managed_organizations") + So(roles[0].AuditedOrganizationsUrl, ShouldEqual, "/v2/users/uaa-id-363/audited_organizations") + So(roles[0].ManagedSpacesUrl, ShouldEqual, "/v2/users/uaa-id-363/managed_spaces") + So(roles[0].AuditedSpacesUrl, ShouldEqual, "/v2/users/uaa-id-363/audited_spaces") + }) +} + +func TestAssociateSpaceAuditorByUsername(t *testing.T) { + Convey("Associate auditor by username", t, func() { + requestBody := `{"username":"user-name"}` + setup(MockRoute{"PUT", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors", []string{associateSpaceUserPayload}, "", 201, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newSpace, err := space.AssociateAuditorByUsername("user-name") + So(err, ShouldBeNil) + So(newSpace.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateSpaceAuditorByUsernameAndOrigin(t *testing.T) { + Convey("Associate auditor by username and origin", t, func() { + requestBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"PUT", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors", []string{associateSpaceUserPayload}, "", 201, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newSpace, err := space.AssociateAuditorByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + So(newSpace.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateSpaceDeveloperByUsername(t *testing.T) { + Convey("Associate developer by username", t, func() { + requestBody := `{"username":"user-name"}` + setup(MockRoute{"PUT", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/developers", []string{associateSpaceUserPayload}, "", 201, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newSpace, err := space.AssociateDeveloperByUsername("user-name") + So(err, ShouldBeNil) + So(newSpace.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateSpaceDeveloperByUsernameAndOrigin(t *testing.T) { + Convey("Associate developer by username and origin", t, func() { + requestBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"PUT", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/developers", []string{associateSpaceUserPayload}, "", 201, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newSpace, err := space.AssociateDeveloperByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + So(newSpace.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateSpaceManagerByUsername(t *testing.T) { + Convey("Associate manager by username", t, func() { + requestBody := `{"username":"user-name"}` + setup(MockRoute{"PUT", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers", []string{associateSpaceUserPayload}, "", 201, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newSpace, err := space.AssociateManagerByUsername("user-name") + So(err, ShouldBeNil) + So(newSpace.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestAssociateSpaceManagerByUsernameAndOrigin(t *testing.T) { + Convey("Associate manager by username and origin", t, func() { + requestBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"PUT", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers", []string{associateSpaceUserPayload}, "", 201, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + newSpace, err := space.AssociateManagerByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + So(newSpace.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") + }) +} + +func TestRemoveSpaceDeveloperByUsername(t *testing.T) { + Convey("Remove developer by username", t, func() { + requestBody := `{"username":"user-name"}` + setup(MockRoute{"DELETE", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/developers", []string{""}, "", 200, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = space.RemoveDeveloperByUsername("user-name") + So(err, ShouldBeNil) + }) +} +func TestRemoveSpaceDeveloperByUsernameAndOrigin(t *testing.T) { + Convey("Remove developer by username and origin", t, func() { + requestBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"POST", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/developers/remove", []string{""}, "", 200, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = space.RemoveDeveloperByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + }) +} +func TestRemoveSpaceAuditorByUsername(t *testing.T) { + Convey("Remove auditor by username", t, func() { + requestBody := `{"username":"user-name"}` + setup(MockRoute{"DELETE", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors", []string{""}, "", 200, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = space.RemoveAuditorByUsername("user-name") + So(err, ShouldBeNil) + }) +} + +func TestRemoveSpaceAuditorByUsernameAndOrigin(t *testing.T) { + Convey("Remove auditor by username and origin", t, func() { + requestBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"POST", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors/remove", []string{""}, "", 200, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = space.RemoveAuditorByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + }) +} + +func TestRemoveSpaceManagerByUsername(t *testing.T) { + Convey("Remove manager by username", t, func() { + requestBody := `{"username":"user-name"}` + setup(MockRoute{"DELETE", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers", []string{""}, "", 200, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = space.RemoveManagerByUsername("user-name") + So(err, ShouldBeNil) + }) +} + +func TestRemoveSpaceManagerByUsernameAndOrigin(t *testing.T) { + Convey("Remove manager by username and origin", t, func() { + requestBody := `{"origin":"ldap","username":"user-name"}` + setup(MockRoute{"POST", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers/remove", []string{""}, "", 200, "", &requestBody}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", + c: client, + } + + err = space.RemoveManagerByUsernameAndOrigin("user-name", "ldap") + So(err, ShouldBeNil) + }) +} + +func TestGetSpaceByGuid(t *testing.T) { + Convey("List Space", t, func() { + setup(MockRoute{"GET", "/v2/spaces/8efd7c5c-d83c-4786-b399-b7bd548839e1", []string{spaceByGuidPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space, err := client.GetSpaceByGuid("8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(err, ShouldBeNil) + + So(space.Guid, ShouldEqual, "8efd7c5c-d83c-4786-b399-b7bd548839e1") + So(space.Name, ShouldEqual, "dev") + }) +} + +func TestGetSpaceServiceOfferings(t *testing.T) { + guid := `8efd7c5c-d83c-4786-b399-b7bd548839e1` + Convey("Get service offerings for space", t, func() { + setup(MockRoute{ + Method: "GET", + Endpoint: fmt.Sprintf("/v2/spaces/%s/services", guid), + Output: []string{spaceServiceOfferingsPayload}, + UserAgent: "", + Status: 200, + QueryString: "", + PostForm: nil, + }, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + space := &Space{ + Guid: guid, + c: client, + } + + offerings, err := space.GetServiceOfferings() + So(offerings, ShouldNotBeEmpty) + So(err, ShouldBeNil) + }) +} + +func TestIsolationSegmentForSpace(t *testing.T) { + Convey("set Default IsolationSegment", t, func() { + defaultIsolationSegmentPayload := `{"data":{"guid":"3b6f763f-aae1-4177-9b93-f2de6f2a48f2"}}` + mocks := []MockRoute{ + {"PATCH", "/v3/spaces/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/relationships/isolation_segment", []string{""}, "", 200, "", &defaultIsolationSegmentPayload}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.IsolationSegmentForSpace("3b6f763f-aae1-4177-9b93-f2de6f2a48f2", "3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + So(err, ShouldBeNil) + + }) +} + +func TestResetIsolationSegmentForSpace(t *testing.T) { + Convey("Reset IsolationSegment", t, func() { + resetIsolationSegmentPayload := `{"data":null}` + mocks := []MockRoute{ + {"PATCH", "/v3/spaces/3b6f763f-aae1-4177-9b93-f2de6f2a48f2/relationships/isolation_segment", []string{""}, "", 200, "", &resetIsolationSegmentPayload}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.ResetIsolationSegmentForSpace("3b6f763f-aae1-4177-9b93-f2de6f2a48f2") + So(err, ShouldBeNil) + + }) +} diff --git a/third_party/go-cfclient/stacks.go b/third_party/go-cfclient/stacks.go new file mode 100644 index 000000000000..fe3fc9c2a270 --- /dev/null +++ b/third_party/go-cfclient/stacks.go @@ -0,0 +1,103 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/url" + + "github.com/pkg/errors" +) + +type StacksResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []StacksResource `json:"resources"` +} + +type StacksResource struct { + Meta Meta `json:"metadata"` + Entity Stack `json:"entity"` +} + +type Stack struct { + Guid string `json:"guid"` + Name string `json:"name"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Description string `json:"description"` + c *Client +} + +func (c *Client) ListStacksByQuery(query url.Values) ([]Stack, error) { + var stacks []Stack + requestURL := "/v2/stacks?" + query.Encode() + for { + stacksResp, err := c.getStacksResponse(requestURL) + if err != nil { + return []Stack{}, err + } + for _, stack := range stacksResp.Resources { + stack.Entity.Guid = stack.Meta.Guid + stack.Entity.CreatedAt = stack.Meta.CreatedAt + stack.Entity.UpdatedAt = stack.Meta.UpdatedAt + stack.Entity.c = c + stacks = append(stacks, stack.Entity) + } + requestURL = stacksResp.NextUrl + if requestURL == "" { + break + } + } + return stacks, nil +} + +func (c *Client) ListStacks() ([]Stack, error) { + return c.ListStacksByQuery(nil) +} + +func (c *Client) GetStackByGuid(stackGUID string) (Stack, error) { + var stacksRes StacksResource + requestURL := fmt.Sprintf("/v2/stacks/%s", stackGUID) + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return Stack{}, errors.Wrap(err, "Error requesting stack info") + } + resBody, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return Stack{}, errors.Wrap(err, "Error reading stack body") + } + err = json.Unmarshal(resBody, &stacksRes) + if err != nil { + return Stack{}, errors.Wrap(err, "Error unmarshalling stack") + } + + stacksRes.Entity.Guid = stacksRes.Meta.Guid + stacksRes.Entity.CreatedAt = stacksRes.Meta.CreatedAt + stacksRes.Entity.UpdatedAt = stacksRes.Meta.UpdatedAt + stacksRes.Entity.c = c + + return stacksRes.Entity, nil +} + +func (c *Client) getStacksResponse(requestURL string) (StacksResponse, error) { + var stacksResp StacksResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return StacksResponse{}, errors.Wrap(err, "Error requesting stacks") + } + resBody, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return StacksResponse{}, errors.Wrap(err, "Error reading stacks body") + } + err = json.Unmarshal(resBody, &stacksResp) + if err != nil { + return StacksResponse{}, errors.Wrap(err, "Error unmarshalling stacks") + } + return stacksResp, nil +} diff --git a/third_party/go-cfclient/stacks_test.go b/third_party/go-cfclient/stacks_test.go new file mode 100644 index 000000000000..c0b9d1e8663e --- /dev/null +++ b/third_party/go-cfclient/stacks_test.go @@ -0,0 +1,52 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListStacks(t *testing.T) { + Convey("List Stacks", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/stacks", []string{listStacksPayloadPage1}, "", 200, "", nil}, + {"GET", "/v2/stacks_page_2", []string{listStacksPayloadPage2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + stacks, err := client.ListStacks() + So(err, ShouldBeNil) + + So(len(stacks), ShouldEqual, 2) + So(stacks[0].Guid, ShouldEqual, "67e019a3-322a-407a-96e0-178e95bd0e55") + So(stacks[0].Name, ShouldEqual, "cflinuxfs2") + So(stacks[0].Description, ShouldEqual, "Cloud Foundry Linux-based filesystem") + }) +} + +func TestGetStackByGuid(t *testing.T) { + Convey("Get Stack By Guid", t, func() { + setup(MockRoute{"GET", "/v2/stacks/a9be2e10-0164-401d-94e0-88455d614844", []string{stackByGuidPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + stack, err := client.GetStackByGuid("a9be2e10-0164-401d-94e0-88455d614844") + So(err, ShouldBeNil) + + So(stack.Guid, ShouldEqual, "a9be2e10-0164-401d-94e0-88455d614844") + So(stack.Name, ShouldEqual, "windows2012R2") + So(stack.Description, ShouldEqual, "Experimental Windows runtime") + }) +} diff --git a/third_party/go-cfclient/stats.go b/third_party/go-cfclient/stats.go new file mode 100644 index 000000000000..2bd86e7c705e --- /dev/null +++ b/third_party/go-cfclient/stats.go @@ -0,0 +1,59 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "github.com/pkg/errors" + "net/http" +) + +// StatsGetResponse is the json body returned from the API +type StatsGetResponse struct { + Stats []Stats `json:"resources"` +} + +// Stats represents the stats of a process +type Stats struct { + Type string `json:"type"` + Index int `json:"index"` + State string `json:"state"` + Usage struct { + Time string `json:"time"` + CPU float64 `json:"cpu"` + Mem int `json:"mem"` + Disk int `json:"disk"` + } `json:"usage"` + Host string `json:"host"` + InstancePorts []struct { + External int `json:"external"` + Internal int `json:"internal"` + ExternalTLSProxyPort int `json:"external_tls_proxy_port"` + InternalTLSProxyPort int `json:"internal_tls_proxy_port"` + } `json:"instance_ports"` + Uptime int `json:"uptime"` + MemQuota int `json:"mem_quota"` + DiskQuota int `json:"disk_quota"` + FdsQuota int `json:"fds_quota"` + IsolationSegment string `json:"isolation_segment"` + Details string `json:"details"` +} + +func (c *Client) GetProcessStats(processGUID string) ([]Stats, error) { + req := c.NewRequest("GET", "/v3/processes/"+processGUID+"/stats") + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "error getting stats for v3 process") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error getting stats with GUID [%s], response code: %d", processGUID, resp.StatusCode) + } + + statsResp := new(StatsGetResponse) + err = json.NewDecoder(resp.Body).Decode(statsResp) + if err != nil { + return nil, fmt.Errorf("error decoding stats with GUID [%s], response code: %d", processGUID, resp.StatusCode) + } + return statsResp.Stats, nil +} diff --git a/third_party/go-cfclient/stats_test.go b/third_party/go-cfclient/stats_test.go new file mode 100644 index 000000000000..065a898a0afb --- /dev/null +++ b/third_party/go-cfclient/stats_test.go @@ -0,0 +1,27 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestGetProcessStats(t *testing.T) { + Convey("Get Process Stats", t, func() { + setup(MockRoute{"GET", "/v3/processes/9902530c-c634-4864-a189-71d763cb12e2/stats", []string{getProcessStatsPayload1}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + stats, err := client.GetProcessStats("9902530c-c634-4864-a189-71d763cb12e2") + So(err, ShouldBeNil) + + So(stats[0].State, ShouldEqual, "RUNNING") + So(stats[0].Type, ShouldEqual, "web") + + }) +} diff --git a/third_party/go-cfclient/tasks.go b/third_party/go-cfclient/tasks.go new file mode 100644 index 000000000000..538b5e04a4a1 --- /dev/null +++ b/third_party/go-cfclient/tasks.go @@ -0,0 +1,211 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "time" + + "github.com/pkg/errors" +) + +// TaskListResponse is the JSON response from the API. +type TaskListResponse struct { + Pagination Pagination `json:"pagination"` + Tasks []Task `json:"resources"` +} + +// Task is a description of a task element. +type Task struct { + GUID string `json:"guid"` + SequenceID int `json:"sequence_id"` + Name string `json:"name"` + Command string `json:"command"` + State string `json:"state"` + MemoryInMb int `json:"memory_in_mb"` + DiskInMb int `json:"disk_in_mb"` + Result struct { + FailureReason string `json:"failure_reason"` + } `json:"result"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + DropletGUID string `json:"droplet_guid"` + Relationships struct { + App V3ToOneRelationship `json:"app"` + } `json:"relationships"` + Links struct { + Self Link `json:"self"` + App Link `json:"app"` + Droplet Link `json:"droplet"` + } `json:"links"` +} + +// TaskRequest is a v3 JSON object as described in: +// http://v3-apidocs.cloudfoundry.org/version/3.0.0/index.html#create-a-task +type TaskRequest struct { + Command string `json:"command"` + Name string `json:"name"` + MemoryInMegabyte int `json:"memory_in_mb"` + DiskInMegabyte int `json:"disk_in_mb"` + DropletGUID string `json:"droplet_guid"` +} + +// ListTasks returns all tasks the user has access to. +// See http://v3-apidocs.cloudfoundry.org/version/3.12.0/index.html#list-tasks +func (c *Client) ListTasks() ([]Task, error) { + return c.ListTasksByQuery(nil) +} + +// ListTasksByQuery returns all tasks the user has access to, with query parameters. +// See http://v3-apidocs.cloudfoundry.org/version/3.12.0/index.html#list-tasks +func (c *Client) ListTasksByQuery(query url.Values) ([]Task, error) { + return c.taskListHelper("/v3/tasks", query) +} + +// TasksByApp returns task structures which aligned to an app identified by the given guid. +// See: http://v3-apidocs.cloudfoundry.org/version/3.12.0/index.html#list-tasks-for-an-app +func (c *Client) TasksByApp(guid string) ([]Task, error) { + return c.TasksByAppByQuery(guid, url.Values{}) +} + +// TasksByAppByQuery returns task structures which aligned to an app identified by the given guid +// and filtered by the given query parameters. +// See: http://v3-apidocs.cloudfoundry.org/version/3.12.0/index.html#list-tasks-for-an-app +func (c *Client) TasksByAppByQuery(guid string, query url.Values) ([]Task, error) { + uri := fmt.Sprintf("/v3/apps/%s/tasks", guid) + return c.taskListHelper(uri, query) +} + +func (c *Client) taskListHelper(requestURL string, query url.Values) ([]Task, error) { + var tasks []Task + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + + for { + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 tasks") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 tasks, response code: %d", resp.StatusCode) + } + + var data TaskListResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 tasks") + } + + tasks = append(tasks, data.Tasks...) + + requestURL = data.Pagination.Next.Href + if requestURL == "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, errors.Wrap(err, "Error parsing the next page request url for v3 tasks") + } + } + + return tasks, nil +} + +func createReader(tr TaskRequest) (io.Reader, error) { + rmap := make(map[string]string) + rmap["command"] = tr.Command + if tr.Name != "" { + rmap["name"] = tr.Name + } + // setting droplet GUID causing issues + if tr.MemoryInMegabyte != 0 { + rmap["memory_in_mb"] = fmt.Sprintf("%d", tr.MemoryInMegabyte) + } + if tr.DiskInMegabyte != 0 { + rmap["disk_in_mb"] = fmt.Sprintf("%d", tr.DiskInMegabyte) + } + + bodyReader := bytes.NewBuffer(nil) + enc := json.NewEncoder(bodyReader) + if err := enc.Encode(rmap); err != nil { + return nil, errors.Wrap(err, "Error during encoding task request") + } + return bodyReader, nil +} + +// CreateTask creates a new task in CF system and returns its structure. +func (c *Client) CreateTask(tr TaskRequest) (task Task, err error) { + bodyReader, err := createReader(tr) + if err != nil { + return task, err + } + + request := fmt.Sprintf("/v3/apps/%s/tasks", tr.DropletGUID) + req := c.NewRequestWithBody("POST", request, bodyReader) + + resp, err := c.DoRequest(req) + if err != nil { + return task, errors.Wrap(err, "Error creating task") + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return task, errors.Wrap(err, "Error reading task after creation") + } + + err = json.Unmarshal(body, &task) + if err != nil { + return task, errors.Wrap(err, "Error unmarshaling task") + } + return task, err +} + +// GetTaskByGuid returns a task structure by requesting it with the tasks GUID. +func (c *Client) GetTaskByGuid(guid string) (task Task, err error) { + request := fmt.Sprintf("/v3/tasks/%s", guid) + req := c.NewRequest("GET", request) + + resp, err := c.DoRequest(req) + if err != nil { + return task, errors.Wrap(err, "Error requesting task") + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return task, errors.Wrap(err, "Error reading task") + } + + err = json.Unmarshal(body, &task) + if err != nil { + return task, errors.Wrap(err, "Error unmarshaling task") + } + return task, err +} + +func (c *Client) TaskByGuid(guid string) (task Task, err error) { + return c.GetTaskByGuid(guid) +} + +// TerminateTask cancels a task identified by its GUID. +func (c *Client) TerminateTask(guid string) error { + req := c.NewRequest("PUT", fmt.Sprintf("/v3/tasks/%s/cancel", guid)) + resp, err := c.DoRequest(req) + if err != nil { + return errors.Wrap(err, "Error terminating task") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusAccepted { + return errors.Wrapf(err, "Failed terminating task, response status code %d", resp.StatusCode) + } + return nil +} diff --git a/third_party/go-cfclient/tasks_test.go b/third_party/go-cfclient/tasks_test.go new file mode 100644 index 000000000000..7abb2070a5a9 --- /dev/null +++ b/third_party/go-cfclient/tasks_test.go @@ -0,0 +1,292 @@ +package cfclient + +import ( + "testing" + "time" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListTasks(t *testing.T) { + Convey("List Tasks", t, func() { + setup(MockRoute{"GET", "/v3/tasks", []string{listTasksPayloadPage1, listTasksPayloadPage2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + task, err := client.ListTasks() + So(err, ShouldBeNil) + + So(len(task), ShouldEqual, 4) + + So(task[0].GUID, ShouldEqual, "d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa") + So(task[0].State, ShouldEqual, "SUCCEEDED") + So(task[0].SequenceID, ShouldEqual, 1) + So(task[0].MemoryInMb, ShouldEqual, 512) + So(task[0].DiskInMb, ShouldEqual, 1024) + So(task[0].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 41, 0, time.FixedZone("UTC", 0)).String()) + + So(task[1].GUID, ShouldEqual, "63b4cd89-fd8b-4bf1-a311-7174fcc907d6") + So(task[1].State, ShouldEqual, "FAILED") + So(task[1].SequenceID, ShouldEqual, 2) + So(task[1].MemoryInMb, ShouldEqual, 1024) + So(task[1].DiskInMb, ShouldEqual, 1024) + So(task[1].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 43, 0, time.FixedZone("UTC", 0)).String()) + + So(task[2].GUID, ShouldEqual, "abcdefc-99a3-4e6a-af91-a44b4ab7b6fa") + So(task[2].State, ShouldEqual, "SUCCEEDED") + So(task[2].SequenceID, ShouldEqual, 3) + So(task[2].MemoryInMb, ShouldEqual, 512) + So(task[2].DiskInMb, ShouldEqual, 1024) + So(task[2].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 44, 0, time.FixedZone("UTC", 0)).String()) + + So(task[3].GUID, ShouldEqual, "hijklm9-fd8b-4bf1-a311-7174fcc907d6") + So(task[3].State, ShouldEqual, "SUCCEEDED") + So(task[3].SequenceID, ShouldEqual, 4) + So(task[3].MemoryInMb, ShouldEqual, 1024) + So(task[3].DiskInMb, ShouldEqual, 1024) + So(task[3].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 46, 0, time.FixedZone("UTC", 0)).String()) + }) +} +func TestListTasksByQuery(t *testing.T) { + Convey("List Tasks", t, func() { + setup(MockRoute{"GET", "/v3/tasks", []string{listTasksPayloadPage1, listTasksPayloadPage2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + task, err := client.ListTasksByQuery(nil) + So(err, ShouldBeNil) + + So(len(task), ShouldEqual, 4) + + So(task[0].GUID, ShouldEqual, "d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa") + So(task[0].State, ShouldEqual, "SUCCEEDED") + So(task[0].SequenceID, ShouldEqual, 1) + So(task[0].MemoryInMb, ShouldEqual, 512) + So(task[0].DiskInMb, ShouldEqual, 1024) + So(task[0].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 41, 0, time.FixedZone("UTC", 0)).String()) + + So(task[1].GUID, ShouldEqual, "63b4cd89-fd8b-4bf1-a311-7174fcc907d6") + So(task[1].State, ShouldEqual, "FAILED") + So(task[1].SequenceID, ShouldEqual, 2) + So(task[1].MemoryInMb, ShouldEqual, 1024) + So(task[1].DiskInMb, ShouldEqual, 1024) + So(task[1].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 43, 0, time.FixedZone("UTC", 0)).String()) + + So(task[3].GUID, ShouldEqual, "hijklm9-fd8b-4bf1-a311-7174fcc907d6") + So(task[3].State, ShouldEqual, "SUCCEEDED") + So(task[3].SequenceID, ShouldEqual, 4) + So(task[3].MemoryInMb, ShouldEqual, 1024) + So(task[3].DiskInMb, ShouldEqual, 1024) + So(task[3].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 46, 0, time.FixedZone("UTC", 0)).String()) + }) +} + +func TestCreateTask(t *testing.T) { + Convey("Create Task", t, func() { + mocks := []MockRoute{ + {"POST", "/v3/apps/740ebd2b-162b-469a-bd72-3edb96fabd9a/tasks", []string{createTaskPayload}, "", 201, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + tr := TaskRequest{ + Command: "rake db:migrate", + Name: "migrate", + MemoryInMegabyte: 512, + DiskInMegabyte: 1024, + DropletGUID: "740ebd2b-162b-469a-bd72-3edb96fabd9a", + } + task, err := client.CreateTask(tr) + So(err, ShouldBeNil) + + So(task.Command, ShouldEqual, "rake db:migrate") + So(task.Name, ShouldEqual, "migrate") + So(task.DiskInMb, ShouldEqual, 1024) + So(task.MemoryInMb, ShouldEqual, 512) + So(task.DropletGUID, ShouldEqual, "740ebd2b-162b-469a-bd72-3edb96fabd9a") + }) +} + +func TestCreateTaskFails(t *testing.T) { + Convey("Create Task fails", t, func() { + mocks := []MockRoute{ + {"POST", "/v3/apps/740ebd2b-162b-469a-bd72-3edb96fabd9a/tasks", []string{errorV3Payload}, "", 400, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + tr := TaskRequest{ + Command: "rake db:migrate", + Name: "migrate", + MemoryInMegabyte: 512, + DiskInMegabyte: 1024, + DropletGUID: "740ebd2b-162b-469a-bd72-3edb96fabd9a", + } + + task, err := client.CreateTask(tr) + So(err.Error(), ShouldEqual, "Error creating task: cfclient error (CF-UnprocessableEntity|10008): something went wrong") + So(task.Name, ShouldBeEmpty) + }) +} + +func TestTerminateTask(t *testing.T) { + Convey("Terminate Task", t, func() { + mocks := []MockRoute{ + {"PUT", "/v3/tasks/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/cancel", []string{""}, "", 202, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + errTerm := client.TerminateTask("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") + So(errTerm, ShouldBeNil) + }) +} + +func TestGetTask(t *testing.T) { + Convey("Create Task", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/tasks/740ebd2b-162b-469a-bd72-3edb96fabd9a", []string{createTaskPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + task, err := client.GetTaskByGuid("740ebd2b-162b-469a-bd72-3edb96fabd9a") + So(err, ShouldBeNil) + + So(task.Command, ShouldEqual, "rake db:migrate") + So(task.Name, ShouldEqual, "migrate") + So(task.DiskInMb, ShouldEqual, 1024) + So(task.MemoryInMb, ShouldEqual, 512) + So(task.DropletGUID, ShouldEqual, "740ebd2b-162b-469a-bd72-3edb96fabd9a") + }) +} + +func TestTasksByApp(t *testing.T) { + Convey("List Tasks by App", t, func() { + setup(MockRoute{"GET", "/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5/tasks", []string{listTasksByAppPayloadPage1, listTasksByAppPayloadPage2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + task, err := client.TasksByApp("ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5") + So(err, ShouldBeNil) + + So(len(task), ShouldEqual, 4) + + So(task[0].GUID, ShouldEqual, "d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa") + So(task[0].State, ShouldEqual, "SUCCEEDED") + So(task[0].SequenceID, ShouldEqual, 1) + So(task[0].MemoryInMb, ShouldEqual, 512) + So(task[0].DiskInMb, ShouldEqual, 1024) + So(task[0].Relationships.App.Data.GUID, ShouldEqual, "ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5") + So(task[0].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 41, 0, time.FixedZone("UTC", 0)).String()) + + So(task[1].GUID, ShouldEqual, "63b4cd89-fd8b-4bf1-a311-7174fcc907d6") + So(task[1].State, ShouldEqual, "FAILED") + So(task[1].SequenceID, ShouldEqual, 2) + So(task[1].MemoryInMb, ShouldEqual, 1024) + So(task[1].DiskInMb, ShouldEqual, 1024) + So(task[1].Relationships.App.Data.GUID, ShouldEqual, "ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5") + So(task[1].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 43, 0, time.FixedZone("UTC", 0)).String()) + + So(task[2].GUID, ShouldEqual, "abcdefc-99a3-4e6a-af91-a44b4ab7b6fa") + So(task[2].State, ShouldEqual, "SUCCEEDED") + So(task[2].SequenceID, ShouldEqual, 3) + So(task[2].MemoryInMb, ShouldEqual, 512) + So(task[2].DiskInMb, ShouldEqual, 1024) + So(task[2].Relationships.App.Data.GUID, ShouldEqual, "ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5") + So(task[2].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 44, 0, time.FixedZone("UTC", 0)).String()) + + So(task[3].GUID, ShouldEqual, "hijklm9-fd8b-4bf1-a311-7174fcc907d6") + So(task[3].State, ShouldEqual, "SUCCEEDED") + So(task[3].SequenceID, ShouldEqual, 4) + So(task[3].MemoryInMb, ShouldEqual, 1024) + So(task[3].DiskInMb, ShouldEqual, 1024) + So(task[3].Relationships.App.Data.GUID, ShouldEqual, "ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5") + So(task[3].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 46, 0, time.FixedZone("UTC", 0)).String()) + }) +} + +func TestTasksByAppByQuery(t *testing.T) { + Convey("List Tasks by App", t, func() { + setup(MockRoute{"GET", "/v3/apps/ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5/tasks", []string{listTasksByAppPayloadPage1, listTasksByAppPayloadPage2}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + task, err := client.TasksByAppByQuery("ccc25a0f-c8f4-4b39-9f1b-de9f328d0ee5", nil) + So(err, ShouldBeNil) + + So(len(task), ShouldEqual, 4) + + So(task[0].GUID, ShouldEqual, "d5cc22ec-99a3-4e6a-af91-a44b4ab7b6fa") + So(task[0].State, ShouldEqual, "SUCCEEDED") + So(task[0].SequenceID, ShouldEqual, 1) + So(task[0].MemoryInMb, ShouldEqual, 512) + So(task[0].DiskInMb, ShouldEqual, 1024) + So(task[0].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 41, 0, time.FixedZone("UTC", 0)).String()) + + So(task[1].GUID, ShouldEqual, "63b4cd89-fd8b-4bf1-a311-7174fcc907d6") + So(task[1].State, ShouldEqual, "FAILED") + So(task[1].SequenceID, ShouldEqual, 2) + So(task[1].MemoryInMb, ShouldEqual, 1024) + So(task[1].DiskInMb, ShouldEqual, 1024) + So(task[1].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 43, 0, time.FixedZone("UTC", 0)).String()) + + So(task[2].GUID, ShouldEqual, "abcdefc-99a3-4e6a-af91-a44b4ab7b6fa") + So(task[2].State, ShouldEqual, "SUCCEEDED") + So(task[2].SequenceID, ShouldEqual, 3) + So(task[2].MemoryInMb, ShouldEqual, 512) + So(task[2].DiskInMb, ShouldEqual, 1024) + So(task[2].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 44, 0, time.FixedZone("UTC", 0)).String()) + + So(task[3].GUID, ShouldEqual, "hijklm9-fd8b-4bf1-a311-7174fcc907d6") + So(task[3].State, ShouldEqual, "SUCCEEDED") + So(task[3].SequenceID, ShouldEqual, 4) + So(task[3].MemoryInMb, ShouldEqual, 1024) + So(task[3].DiskInMb, ShouldEqual, 1024) + So(task[3].CreatedAt.String(), ShouldEqual, time.Date(2016, 05, 04, 17, 00, 46, 0, time.FixedZone("UTC", 0)).String()) + }) +} diff --git a/third_party/go-cfclient/tools.go b/third_party/go-cfclient/tools.go new file mode 100644 index 000000000000..dd6139498611 --- /dev/null +++ b/third_party/go-cfclient/tools.go @@ -0,0 +1,5 @@ +package cfclient + +import ( + _ "go.yaml.in/yaml/v2" +) diff --git a/third_party/go-cfclient/types.go b/third_party/go-cfclient/types.go new file mode 100644 index 000000000000..279106bfa40b --- /dev/null +++ b/third_party/go-cfclient/types.go @@ -0,0 +1,8 @@ +package cfclient + +type Meta struct { + Guid string `json:"guid"` + Url string `json:"url"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` +} diff --git a/third_party/go-cfclient/user_provided_service_instances.go b/third_party/go-cfclient/user_provided_service_instances.go new file mode 100644 index 000000000000..7b398a5f143e --- /dev/null +++ b/third_party/go-cfclient/user_provided_service_instances.go @@ -0,0 +1,189 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type UserProvidedServiceInstancesResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []UserProvidedServiceInstanceResource `json:"resources"` +} + +type UserProvidedServiceInstanceResource struct { + Meta Meta `json:"metadata"` + Entity UserProvidedServiceInstance `json:"entity"` +} + +type UserProvidedServiceInstance struct { + Guid string `json:"guid"` + Name string `json:"name"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Credentials map[string]interface{} `json:"credentials"` + SpaceGuid string `json:"space_guid"` + Type string `json:"type"` + Tags []string `json:"tags"` + SpaceUrl string `json:"space_url"` + ServiceBindingsUrl string `json:"service_bindings_url"` + RoutesUrl string `json:"routes_url"` + RouteServiceUrl string `json:"route_service_url"` + SyslogDrainUrl string `json:"syslog_drain_url"` + c *Client +} + +type UserProvidedServiceInstanceRequest struct { + Name string `json:"name"` + Credentials map[string]interface{} `json:"credentials"` + SpaceGuid string `json:"space_guid"` + Tags []string `json:"tags"` + RouteServiceUrl string `json:"route_service_url"` + SyslogDrainUrl string `json:"syslog_drain_url"` +} + +func (c *Client) ListUserProvidedServiceInstancesByQuery(query url.Values) ([]UserProvidedServiceInstance, error) { + var instances []UserProvidedServiceInstance + + requestURL := "/v2/user_provided_service_instances?" + query.Encode() + for { + var sir UserProvidedServiceInstancesResponse + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting user provided service instances") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, errors.Wrap(err, "Error reading user provided service instances request:") + } + + err = json.Unmarshal(resBody, &sir) + if err != nil { + return nil, errors.Wrap(err, "Error unmarshaling user provided service instances") + } + for _, instance := range sir.Resources { + instance.Entity.Guid = instance.Meta.Guid + instance.Entity.CreatedAt = instance.Meta.CreatedAt + instance.Entity.UpdatedAt = instance.Meta.UpdatedAt + instance.Entity.c = c + instances = append(instances, instance.Entity) + } + + requestURL = sir.NextUrl + if requestURL == "" { + break + } + } + return instances, nil +} + +func (c *Client) ListUserProvidedServiceInstances() ([]UserProvidedServiceInstance, error) { + return c.ListUserProvidedServiceInstancesByQuery(nil) +} + +func (c *Client) GetUserProvidedServiceInstanceByGuid(guid string) (UserProvidedServiceInstance, error) { + var sir UserProvidedServiceInstanceResource + req := c.NewRequest("GET", "/v2/user_provided_service_instances/"+guid) + res, err := c.DoRequest(req) + if err != nil { + return UserProvidedServiceInstance{}, errors.Wrap(err, "Error requesting user provided service instance") + } + defer res.Body.Close() + data, err := ioutil.ReadAll(res.Body) + if err != nil { + return UserProvidedServiceInstance{}, errors.Wrap(err, "Error reading user provided service instance response") + } + err = json.Unmarshal(data, &sir) + if err != nil { + return UserProvidedServiceInstance{}, errors.Wrap(err, "Error JSON parsing user provided service instance response") + } + sir.Entity.Guid = sir.Meta.Guid + sir.Entity.CreatedAt = sir.Meta.CreatedAt + sir.Entity.UpdatedAt = sir.Meta.UpdatedAt + sir.Entity.c = c + return sir.Entity, nil +} + +func (c *Client) UserProvidedServiceInstanceByGuid(guid string) (UserProvidedServiceInstance, error) { + return c.GetUserProvidedServiceInstanceByGuid(guid) +} + +func (c *Client) CreateUserProvidedServiceInstance(req UserProvidedServiceInstanceRequest) (*UserProvidedServiceInstance, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(req) + if err != nil { + return nil, err + } + r := c.NewRequestWithBody("POST", "/v2/user_provided_service_instances", buf) + resp, err := c.DoRequest(r) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + + return c.handleUserProvidedServiceInstanceResp(resp) +} + +func (c *Client) DeleteUserProvidedServiceInstance(guid string) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/user_provided_service_instances/%s", guid))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting user provided service instance %s, response code %d", guid, resp.StatusCode) + } + return nil +} + +func (c *Client) UpdateUserProvidedServiceInstance(guid string, req UserProvidedServiceInstanceRequest) (*UserProvidedServiceInstance, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(req) + if err != nil { + return nil, err + } + r := c.NewRequestWithBody("PUT", fmt.Sprintf("/v2/user_provided_service_instances/%s", guid), buf) + resp, err := c.DoRequest(r) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("CF API returned with status code %d", resp.StatusCode) + } + return c.handleUserProvidedServiceInstanceResp(resp) +} + +func (c *Client) handleUserProvidedServiceInstanceResp(resp *http.Response) (*UserProvidedServiceInstance, error) { + body, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return nil, err + } + var upsResource UserProvidedServiceInstanceResource + err = json.Unmarshal(body, &upsResource) + if err != nil { + return nil, err + } + return c.mergeUserProvidedServiceInstanceResource(upsResource), nil +} + +func (c *Client) mergeUserProvidedServiceInstanceResource(ups UserProvidedServiceInstanceResource) *UserProvidedServiceInstance { + ups.Entity.Guid = ups.Meta.Guid + ups.Entity.CreatedAt = ups.Meta.CreatedAt + ups.Entity.UpdatedAt = ups.Meta.UpdatedAt + ups.Entity.c = c + return &ups.Entity +} diff --git a/third_party/go-cfclient/user_provided_service_instances_test.go b/third_party/go-cfclient/user_provided_service_instances_test.go new file mode 100644 index 000000000000..2a944015930c --- /dev/null +++ b/third_party/go-cfclient/user_provided_service_instances_test.go @@ -0,0 +1,135 @@ +package cfclient + +import ( + "reflect" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestUserProvidedServiceInstanceByGuid(t *testing.T) { + Convey("Service instance by Guid", t, func() { + setup(MockRoute{"GET", "/v2/user_provided_service_instances/e9358711-0ad9-4f2a-b3dc-289d47c17c87", []string{userProvidedServiceInstancePayload}, "", 200, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + instance, err := client.GetUserProvidedServiceInstanceByGuid("e9358711-0ad9-4f2a-b3dc-289d47c17c87") + So(err, ShouldBeNil) + + So(instance.Guid, ShouldEqual, "e9358711-0ad9-4f2a-b3dc-289d47c17c87") + So(reflect.DeepEqual( + instance.Credentials, + map[string]interface{}{"creds-key-58": "creds-val-58"}), ShouldBeTrue) + So(instance.Name, ShouldEqual, "name-1700") + So(instance.SpaceGuid, ShouldEqual, "22236d1a-d9c7-44b7-bdad-2bb079a6c4a1") + So(instance.RouteServiceUrl, ShouldEqual, "") + So(instance.Type, ShouldEqual, "user_provided_service_instance") + So(instance.SpaceUrl, ShouldEqual, "/v2/spaces/22236d1a-d9c7-44b7-bdad-2bb079a6c4a1") + So(instance.SyslogDrainUrl, ShouldEqual, "https://foo.com/url-104") + So(instance.ServiceBindingsUrl, ShouldEqual, "/v2/user_provided_service_instances/e9358711-0ad9-4f2a-b3dc-289d47c17c87/service_bindings") + So(instance.RoutesUrl, ShouldEqual, "/v2/user_provided_service_instances/e9358711-0ad9-4f2a-b3dc-289d47c17c87/routes") + }) +} + +func TestListUserProvidedServiceInstances(t *testing.T) { + Convey("List Service Instances", t, func() { + setup(MockRoute{"GET", "/v2/user_provided_service_instances", []string{listUserProvidedServiceInstancePayload}, "", 200, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + instances, err := client.ListUserProvidedServiceInstances() + So(err, ShouldBeNil) + + instance := instances[0] + So(instance.Guid, ShouldEqual, "54e4c645-7d20-4271-8c27-8cc904e1e7ee") + So(reflect.DeepEqual( + instance.Credentials, + map[string]interface{}{"creds-key-57": "creds-val-57"}), ShouldBeTrue) + So(instance.Name, ShouldEqual, "name-1696") + So(instance.SpaceGuid, ShouldEqual, "87d14ac2-f396-460e-a523-dc1d77aba35a") + So(instance.RouteServiceUrl, ShouldEqual, "") + So(instance.Type, ShouldEqual, "user_provided_service_instance") + So(instance.SpaceUrl, ShouldEqual, "/v2/spaces/87d14ac2-f396-460e-a523-dc1d77aba35a") + So(instance.SyslogDrainUrl, ShouldEqual, "https://foo.com/url-103") + So(instance.ServiceBindingsUrl, ShouldEqual, "/v2/user_provided_service_instances/54e4c645-7d20-4271-8c27-8cc904e1e7ee/service_bindings") + So(instance.RoutesUrl, ShouldEqual, "/v2/user_provided_service_instances/54e4c645-7d20-4271-8c27-8cc904e1e7ee/routes") + }) +} + +func TestCreateUserProvidedServiceInstance(t *testing.T) { + Convey("Create User Provided Service Instance", t, func() { + setup(MockRoute{"POST", "/v2/user_provided_service_instances", []string{userProvidedServiceInstancePayload}, "", 201, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + + client, err := NewClient(c) + So(err, ShouldBeNil) + + upsRequest := UserProvidedServiceInstanceRequest{Credentials: map[string]interface{}{"creds-key-58": "creds-val-58"}, SyslogDrainUrl: "https://foo.com/url-104"} + upsInstance, err := client.CreateUserProvidedServiceInstance(upsRequest) + + So(err, ShouldBeNil) + So(upsInstance.Guid, ShouldEqual, "e9358711-0ad9-4f2a-b3dc-289d47c17c87") + So(upsInstance.Name, ShouldEqual, "name-1700") + So(upsInstance.Credentials["creds-key-58"], ShouldEqual, "creds-val-58") + So(upsInstance.SyslogDrainUrl, ShouldEqual, "https://foo.com/url-104") + }) +} + +func TestDeleteUserProvidedServiceInstance(t *testing.T) { + Convey("Delete User Provided Service Instance", t, func() { + setup(MockRoute{"DELETE", "/v2/user_provided_service_instances/e9358711-0ad9-4f2a-b3dc-289d47c17c87", []string{""}, "", 204, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteUserProvidedServiceInstance("e9358711-0ad9-4f2a-b3dc-289d47c17c87") + So(err, ShouldBeNil) + }) +} + +func TestUpdateUserProvidedServiceInstance(t *testing.T) { + Convey("Update User Provided Service Instance", t, func() { + setup(MockRoute{"PUT", "/v2/user_provided_service_instances/e9358711-0ad9-4f2a-b3dc-289d47c17c87", []string{userProvidedServiceInstancePayload}, "", 201, "", nil}, t) + defer teardown() + + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + + client, err := NewClient(c) + So(err, ShouldBeNil) + + upsRequest := UserProvidedServiceInstanceRequest{Credentials: map[string]interface{}{"creds-key-58": "creds-val-58"}, SyslogDrainUrl: "https://foo.com/url-104"} + upsInstance, err := client.UpdateUserProvidedServiceInstance("e9358711-0ad9-4f2a-b3dc-289d47c17c87", upsRequest) + + So(err, ShouldBeNil) + So(upsInstance.Guid, ShouldEqual, "e9358711-0ad9-4f2a-b3dc-289d47c17c87") + So(upsInstance.Name, ShouldEqual, "name-1700") + So(upsInstance.Credentials["creds-key-58"], ShouldEqual, "creds-val-58") + So(upsInstance.SyslogDrainUrl, ShouldEqual, "https://foo.com/url-104") + }) +} diff --git a/third_party/go-cfclient/users.go b/third_party/go-cfclient/users.go new file mode 100644 index 000000000000..9af6d9da763e --- /dev/null +++ b/third_party/go-cfclient/users.go @@ -0,0 +1,205 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type UserRequest struct { + Guid string `json:"guid"` + DefaultSpaceGuid string `json:"default_space_guid,omitempty"` +} + +type Users []User + +type User struct { + Guid string `json:"guid"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + Admin bool `json:"admin"` + Active bool `json:"active"` + DefaultSpaceGUID string `json:"default_space_guid"` + Username string `json:"username"` + SpacesURL string `json:"spaces_url"` + OrgsURL string `json:"organizations_url"` + ManagedOrgsURL string `json:"managed_organizations_url"` + BillingManagedOrgsURL string `json:"billing_managed_organizations_url"` + AuditedOrgsURL string `json:"audited_organizations_url"` + ManagedSpacesURL string `json:"managed_spaces_url"` + AuditedSpacesURL string `json:"audited_spaces_url"` + c *Client +} + +type UserResource struct { + Meta Meta `json:"metadata"` + Entity User `json:"entity"` +} + +type UserResponse struct { + Count int `json:"total_results"` + Pages int `json:"total_pages"` + NextUrl string `json:"next_url"` + Resources []UserResource `json:"resources"` +} + +// GetUserByGUID retrieves the user with the provided guid. +func (c *Client) GetUserByGUID(guid string) (User, error) { + var userRes UserResource + r := c.NewRequest("GET", "/v2/users/"+guid) + resp, err := c.DoRequest(r) + if err != nil { + return User{}, err + } + defer resp.Body.Close() + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return User{}, err + } + err = json.Unmarshal(body, &userRes) + if err != nil { + return User{}, err + } + return c.mergeUserResource(userRes), nil +} + +func (c *Client) ListUsersByQuery(query url.Values) (Users, error) { + var users []User + requestUrl := "/v2/users?" + query.Encode() + for { + userResp, err := c.getUserResponse(requestUrl) + if err != nil { + return []User{}, err + } + for _, user := range userResp.Resources { + user.Entity.Guid = user.Meta.Guid + user.Entity.CreatedAt = user.Meta.CreatedAt + user.Entity.UpdatedAt = user.Meta.UpdatedAt + user.Entity.c = c + users = append(users, user.Entity) + } + requestUrl = userResp.NextUrl + if requestUrl == "" || query.Get("page") != "" { + break + } + } + return users, nil +} + +func (c *Client) ListUsers() (Users, error) { + return c.ListUsersByQuery(nil) +} + +func (c *Client) ListUserSpaces(userGuid string) ([]Space, error) { + return c.fetchSpaces(fmt.Sprintf("/v2/users/%s/spaces", userGuid), url.Values{}) +} + +func (c *Client) ListUserAuditedSpaces(userGuid string) ([]Space, error) { + return c.fetchSpaces(fmt.Sprintf("/v2/users/%s/audited_spaces", userGuid), url.Values{}) +} + +func (c *Client) ListUserManagedSpaces(userGuid string) ([]Space, error) { + return c.fetchSpaces(fmt.Sprintf("/v2/users/%s/managed_spaces", userGuid), url.Values{}) +} + +func (c *Client) ListUserOrgs(userGuid string) ([]Org, error) { + return c.fetchOrgs(fmt.Sprintf("/v2/users/%s/organizations", userGuid)) +} + +func (c *Client) ListUserManagedOrgs(userGuid string) ([]Org, error) { + return c.fetchOrgs(fmt.Sprintf("/v2/users/%s/managed_organizations", userGuid)) +} + +func (c *Client) ListUserAuditedOrgs(userGuid string) ([]Org, error) { + return c.fetchOrgs(fmt.Sprintf("/v2/users/%s/audited_organizations", userGuid)) +} + +func (c *Client) ListUserBillingManagedOrgs(userGuid string) ([]Org, error) { + return c.fetchOrgs(fmt.Sprintf("/v2/users/%s/billing_managed_organizations", userGuid)) +} + +func (c *Client) CreateUser(req UserRequest) (User, error) { + buf := bytes.NewBuffer(nil) + err := json.NewEncoder(buf).Encode(req) + if err != nil { + return User{}, err + } + r := c.NewRequestWithBody("POST", "/v2/users", buf) + resp, err := c.DoRequest(r) + if err != nil { + return User{}, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusCreated { + return User{}, errors.Wrapf(err, "Error creating user, response code: %d", resp.StatusCode) + } + body, err := ioutil.ReadAll(resp.Body) + + if err != nil { + return User{}, err + } + var userResource UserResource + err = json.Unmarshal(body, &userResource) + if err != nil { + return User{}, err + } + user := userResource.Entity + user.Guid = userResource.Meta.Guid + user.c = c + return user, nil +} + +func (c *Client) DeleteUser(userGuid string) error { + resp, err := c.DoRequest(c.NewRequest("DELETE", fmt.Sprintf("/v2/users/%s", userGuid))) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusNoContent { + return errors.Wrapf(err, "Error deleting user %s, response code: %d", userGuid, resp.StatusCode) + } + return nil +} + +func (u Users) GetUserByUsername(username string) User { + for _, user := range u { + if user.Username == username { + return user + } + } + return User{} +} + +func (c *Client) getUserResponse(requestUrl string) (UserResponse, error) { + var userResp UserResponse + r := c.NewRequest("GET", requestUrl) + resp, err := c.DoRequest(r) + if err != nil { + return UserResponse{}, errors.Wrap(err, "Error requesting users") + } + defer resp.Body.Close() + resBody, err := ioutil.ReadAll(resp.Body) + + if err != nil { + return UserResponse{}, errors.Wrap(err, "Error reading user request") + } + err = json.Unmarshal(resBody, &userResp) + if err != nil { + return UserResponse{}, errors.Wrap(err, "Error unmarshalling user") + } + return userResp, nil +} + +func (c *Client) mergeUserResource(u UserResource) User { + u.Entity.Guid = u.Meta.Guid + u.Entity.CreatedAt = u.Meta.CreatedAt + u.Entity.UpdatedAt = u.Meta.UpdatedAt + u.Entity.c = c + return u.Entity +} diff --git a/third_party/go-cfclient/users_test.go b/third_party/go-cfclient/users_test.go new file mode 100644 index 000000000000..bf5418926676 --- /dev/null +++ b/third_party/go-cfclient/users_test.go @@ -0,0 +1,272 @@ +package cfclient + +import ( + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestGetUserByGUID(t *testing.T) { + Convey("Get user by GUID", t, func() { + setup(MockRoute{"GET", "/v2/users/72ccf759-43aa-4954-903f-7d892c268e80", []string{userByGUIDPayload}, "", 200, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + user, err := client.GetUserByGUID("72ccf759-43aa-4954-903f-7d892c268e80") + So(err, ShouldBeNil) + + So(user.Guid, ShouldEqual, "72ccf759-43aa-4954-903f-7d892c268e80") + So(user.Username, ShouldEqual, "user@example.com") + }) +} + +func TestListUsers(t *testing.T) { + Convey("List Users", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/users", []string{listUsersPayload}, "", 200, "", nil}, + {"GET", "/v2/usersPage2", []string{listUsersPayloadPage2}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + users, err := client.ListUsers() + So(err, ShouldBeNil) + + So(len(users), ShouldEqual, 4) + So(users[0].Guid, ShouldEqual, "ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac") + So(users[0].Username, ShouldEqual, "testUser1") + So(users[1].Guid, ShouldEqual, "f97f5699-c920-4633-aa23-bd70f3db0808") + So(users[1].Username, ShouldEqual, "testUser2") + So(users[2].Guid, ShouldEqual, "cadd6389-fcf6-4928-84f0-6153556bf693") + So(users[2].Username, ShouldEqual, "testUser3") + So(users[3].Guid, ShouldEqual, "79c854b0-c12a-41b7-8d3c-fdd6e116e385") + So(users[3].Username, ShouldEqual, "testUser4") + }) +} + +func TestListUserSpaces(t *testing.T) { + Convey("List User Spaces", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/spaces", []string{listUserSpacesPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaces, err := client.ListUserSpaces("cadd6389-fcf6-4928-84f0-6153556bf693") + So(err, ShouldBeNil) + + So(len(spaces), ShouldEqual, 1) + So(spaces[0].Guid, ShouldEqual, "9881c79e-d269-4a53-9d77-cb21b745356e") + So(spaces[0].Name, ShouldEqual, "dev") + So(spaces[0].OrganizationGuid, ShouldEqual, "6a2a2d18-7620-43cf-a332-353824b431b2") + }) +} + +func TestListUserManagedSpaces(t *testing.T) { + Convey("List User Audited Spaces", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/managed_spaces", []string{listUserSpacesPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaces, err := client.ListUserManagedSpaces("cadd6389-fcf6-4928-84f0-6153556bf693") + So(err, ShouldBeNil) + + So(len(spaces), ShouldEqual, 1) + So(spaces[0].Guid, ShouldEqual, "9881c79e-d269-4a53-9d77-cb21b745356e") + So(spaces[0].Name, ShouldEqual, "dev") + So(spaces[0].OrganizationGuid, ShouldEqual, "6a2a2d18-7620-43cf-a332-353824b431b2") + }) +} + +func TestListUserAuditedSpaces(t *testing.T) { + Convey("List User Managed Spaces", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/audited_spaces", []string{listUserSpacesPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaces, err := client.ListUserAuditedSpaces("cadd6389-fcf6-4928-84f0-6153556bf693") + So(err, ShouldBeNil) + + So(len(spaces), ShouldEqual, 1) + So(spaces[0].Guid, ShouldEqual, "9881c79e-d269-4a53-9d77-cb21b745356e") + So(spaces[0].Name, ShouldEqual, "dev") + So(spaces[0].OrganizationGuid, ShouldEqual, "6a2a2d18-7620-43cf-a332-353824b431b2") + }) +} + +func TestListUserOrgs(t *testing.T) { + Convey("List User Spaces", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/organizations", []string{listUserOrgsPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + orgs, err := client.ListUserOrgs("cadd6389-fcf6-4928-84f0-6153556bf693") + So(err, ShouldBeNil) + + So(len(orgs), ShouldEqual, 1) + So(orgs[0].Guid, ShouldEqual, "9881c79e-d269-4a53-9d77-cb21b745356e") + So(orgs[0].Name, ShouldEqual, "dev") + So(orgs[0].QuotaDefinitionGuid, ShouldEqual, "6a2a2d18-7620-43cf-a332-353824b431b2") + }) +} + +func TestListUserManagedOrgs(t *testing.T) { + Convey("List User Spaces", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/managed_organizations", []string{listUserOrgsPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + orgs, err := client.ListUserManagedOrgs("cadd6389-fcf6-4928-84f0-6153556bf693") + So(err, ShouldBeNil) + + So(len(orgs), ShouldEqual, 1) + So(orgs[0].Guid, ShouldEqual, "9881c79e-d269-4a53-9d77-cb21b745356e") + So(orgs[0].Name, ShouldEqual, "dev") + So(orgs[0].QuotaDefinitionGuid, ShouldEqual, "6a2a2d18-7620-43cf-a332-353824b431b2") + }) +} + +func TestListUserAuditedOrgs(t *testing.T) { + Convey("List User Audited Spaces", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/audited_organizations", []string{listUserOrgsPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + orgs, err := client.ListUserAuditedOrgs("cadd6389-fcf6-4928-84f0-6153556bf693") + So(err, ShouldBeNil) + + So(len(orgs), ShouldEqual, 1) + So(orgs[0].Guid, ShouldEqual, "9881c79e-d269-4a53-9d77-cb21b745356e") + So(orgs[0].Name, ShouldEqual, "dev") + So(orgs[0].QuotaDefinitionGuid, ShouldEqual, "6a2a2d18-7620-43cf-a332-353824b431b2") + }) +} + +func TestUserBillingManagedOrgs(t *testing.T) { + Convey("List User Managed Spaces", t, func() { + mocks := []MockRoute{ + {"GET", "/v2/users/cadd6389-fcf6-4928-84f0-6153556bf693/billing_managed_organizations", []string{listUserOrgsPayload}, "", 200, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + orgs, err := client.ListUserBillingManagedOrgs("cadd6389-fcf6-4928-84f0-6153556bf693") + So(err, ShouldBeNil) + + So(len(orgs), ShouldEqual, 1) + So(orgs[0].Guid, ShouldEqual, "9881c79e-d269-4a53-9d77-cb21b745356e") + So(orgs[0].Name, ShouldEqual, "dev") + So(orgs[0].QuotaDefinitionGuid, ShouldEqual, "6a2a2d18-7620-43cf-a332-353824b431b2") + }) +} + +func TestGetUserByUsername(t *testing.T) { + Convey("Get User by Username", t, func() { + user1 := User{Guid: "ccec6d06-5f71-48a0-a4c5-c91a1d9f2fac", Username: "testUser1"} + user2 := User{Guid: "f97f5699-c920-4633-aa23-bd70f3db0808", Username: "testUser2"} + user3 := User{Guid: "cadd6389-fcf6-4928-84f0-6153556bf693", Username: "testUser3"} + user4 := User{Guid: "79c854b0-c12a-41b7-8d3c-fdd6e116e385", Username: "testUser4"} + users := Users{user1, user2, user3, user4} + + So(users.GetUserByUsername("testUser1"), ShouldResemble, user1) + So(users.GetUserByUsername("testUser2"), ShouldResemble, user2) + So(users.GetUserByUsername("testUser3"), ShouldResemble, user3) + So(users.GetUserByUsername("testUser4"), ShouldResemble, user4) + }) +} + +func TestCreateUser(t *testing.T) { + Convey("Create user", t, func() { + setup(MockRoute{"POST", "/v2/users", []string{createUserPayload}, "", 201, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + user, err := client.CreateUser(UserRequest{Guid: "guid-cb24b36d-4656-468e-a50d-b53113ac6177"}) + So(err, ShouldBeNil) + So(user.Guid, ShouldEqual, "guid-cb24b36d-4656-468e-a50d-b53113ac6177") + }) +} + +func TestDeleteUser(t *testing.T) { + Convey("Delete user", t, func() { + setup(MockRoute{"DELETE", "/v2/users/guid-cb24b36d-4656-468e-a50d-b53113ac6177", []string{""}, "", 204, "", nil}, t) + defer teardown() + c := &Config{ + ApiAddress: server.URL, + Token: "foobar", + } + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteUser("guid-cb24b36d-4656-468e-a50d-b53113ac6177") + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/v3apps.go b/third_party/go-cfclient/v3apps.go new file mode 100644 index 000000000000..90a5806f0df3 --- /dev/null +++ b/third_party/go-cfclient/v3apps.go @@ -0,0 +1,285 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type V3App struct { + Name string `json:"name,omitempty"` + State string `json:"state,omitempty"` + Lifecycle V3Lifecycle `json:"lifecycle,omitempty"` + GUID string `json:"guid,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Relationships map[string]V3ToOneRelationship `json:"relationships,omitempty"` + Links map[string]Link `json:"links,omitempty"` + Metadata V3Metadata `json:"metadata,omitempty"` +} + +type V3Lifecycle struct { + Type string `json:"type,omitempty"` + BuildpackData V3BuildpackLifecycle `json:"data,omitempty"` +} + +type V3BuildpackLifecycle struct { + Buildpacks []string `json:"buildpacks,omitempty"` + Stack string `json:"stack,omitempty"` +} + +type CreateV3AppRequest struct { + Name string + SpaceGUID string + EnvironmentVariables map[string]string + Lifecycle *V3Lifecycle + Metadata *V3Metadata +} + +type UpdateV3AppRequest struct { + Name string `json:"name"` + Lifecycle *V3Lifecycle `json:"lifecycle"` + Metadata *V3Metadata `json:"metadata"` +} + +func (c *Client) CreateV3App(r CreateV3AppRequest) (*V3App, error) { + req := c.NewRequest("POST", "/v3/apps") + params := map[string]interface{}{ + "name": r.Name, + "relationships": map[string]interface{}{ + "space": V3ToOneRelationship{ + Data: V3Relationship{ + GUID: r.SpaceGUID, + }, + }, + }, + } + if len(r.EnvironmentVariables) > 0 { + params["environment_variables"] = r.EnvironmentVariables + } + if r.Lifecycle != nil { + params["lifecycle"] = r.Lifecycle + } + if r.Metadata != nil { + params["metadata"] = r.Metadata + } + + req.obj = params + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while creating v3 app") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("Error creating v3 app %s, response code: %d", r.Name, resp.StatusCode) + } + + var app V3App + if err := json.NewDecoder(resp.Body).Decode(&app); err != nil { + return nil, errors.Wrap(err, "Error reading v3 app JSON") + } + + return &app, nil +} + +func (c *Client) GetV3AppByGUID(guid string) (*V3App, error) { + req := c.NewRequest("GET", "/v3/apps/"+guid) + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while getting v3 app") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error getting v3 app with GUID [%s], response code: %d", guid, resp.StatusCode) + } + + var app V3App + if err := json.NewDecoder(resp.Body).Decode(&app); err != nil { + return nil, errors.Wrap(err, "Error reading v3 app JSON") + } + + return &app, nil +} + +func (c *Client) StartV3App(guid string) (*V3App, error) { + req := c.NewRequest("POST", "/v3/apps/"+guid+"/actions/start") + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while starting v3 app") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error starting v3 app with GUID [%s], response code: %d", guid, resp.StatusCode) + } + + var app V3App + if err := json.NewDecoder(resp.Body).Decode(&app); err != nil { + return nil, errors.Wrap(err, "Error reading v3 app JSON") + } + + return &app, nil +} + +func (c *Client) DeleteV3App(guid string) error { + req := c.NewRequest("DELETE", "/v3/apps/"+guid) + resp, err := c.DoRequest(req) + if err != nil { + return errors.Wrap(err, "Error while deleting v3 app") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error deleting v3 app with GUID [%s], response code: %d", guid, resp.StatusCode) + } + + return nil +} + +func (c *Client) UpdateV3App(appGUID string, r UpdateV3AppRequest) (*V3App, error) { + req := c.NewRequest("PATCH", "/v3/apps/"+appGUID) + params := make(map[string]interface{}) + if r.Name != "" { + params["name"] = r.Name + } + if r.Lifecycle != nil { + params["lifecycle"] = r.Lifecycle + } + if r.Metadata != nil { + params["metadata"] = r.Metadata + } + if len(params) > 0 { + req.obj = params + } + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while updating v3 app") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error updating v3 app %s, response code: %d", appGUID, resp.StatusCode) + } + + var app V3App + if err := json.NewDecoder(resp.Body).Decode(&app); err != nil { + return nil, errors.Wrap(err, "Error reading v3 app JSON") + } + + return &app, nil +} + +type listV3AppsResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3App `json:"resources,omitempty"` +} + +func (c *Client) ListV3AppsByQuery(query url.Values) ([]V3App, error) { + var apps []V3App + requestURL := "/v3/apps" + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + + for { + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 apps") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 apps, response code: %d", resp.StatusCode) + } + + var data listV3AppsResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 apps") + } + + apps = append(apps, data.Resources...) + + requestURL = data.Pagination.Next.Href + if requestURL == "" || query.Get("page") != "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, errors.Wrap(err, "Error parsing the next page request url for v3 apps") + } + } + + return apps, nil +} + +func extractPathFromURL(requestURL string) (string, error) { + url, err := url.Parse(requestURL) + if err != nil { + return "", err + } + result := url.Path + if q := url.Query().Encode(); q != "" { + result = result + "?" + q + } + return result, nil +} + +type V3AppEnvironment struct { + EnvVars map[string]string `json:"environment_variables,omitempty"` + StagingEnv map[string]string `json:"staging_env_json,omitempty"` + RunningEnv map[string]string `json:"running_env_json,omitempty"` + SystemEnvVars map[string]json.RawMessage `json:"system_env_json,omitempty"` // VCAP_SERVICES + AppEnvVars map[string]json.RawMessage `json:"application_env_json,omitempty"` // VCAP_APPLICATION +} + +func (c *Client) GetV3AppEnvironment(appGUID string) (V3AppEnvironment, error) { + var result V3AppEnvironment + + resp, err := c.DoRequest(c.NewRequest("GET", "/v3/apps/"+appGUID+"/env")) + if err != nil { + return result, errors.Wrapf(err, "Error requesting app env for %s", appGUID) + } + + defer resp.Body.Close() + if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { + return result, errors.Wrap(err, "Error parsing JSON for app env") + } + + return result, nil +} + +type V3EnvVar struct { + Var map[string]*string `json:"var"` +} + +type v3EnvVarResponse struct { + V3EnvVar + Links map[string]Link `json:"links"` +} + +func (c *Client) SetV3AppEnvVariables(appGUID string, envRequest V3EnvVar) (V3EnvVar, error) { + var result v3EnvVarResponse + + req := c.NewRequest("PATCH", "/v3/apps/"+appGUID+"/environment_variables") + req.obj = envRequest + + resp, err := c.DoRequest(req) + if err != nil { + return result.V3EnvVar, errors.Wrapf(err, "Error setting app env variables for %s", appGUID) + } + + defer resp.Body.Close() + if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { + return result.V3EnvVar, errors.Wrap(err, "Error parsing JSON for app env") + } + + return result.V3EnvVar, nil +} diff --git a/third_party/go-cfclient/v3apps_test.go b/third_party/go-cfclient/v3apps_test.go new file mode 100644 index 000000000000..cd318157a4cc --- /dev/null +++ b/third_party/go-cfclient/v3apps_test.go @@ -0,0 +1,205 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestCreateV3App(t *testing.T) { + Convey("Create V3 App", t, func() { + expectedBody := `{"environment_variables":{"FOO":"BAR"},"name":"my-app","relationships":{"space":{"data":{"guid":"space-guid"}}}}` + setup(MockRoute{"POST", "/v3/apps", []string{createV3AppPayload}, "", http.StatusCreated, "", &expectedBody}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + app, err := client.CreateV3App(CreateV3AppRequest{ + Name: "my-app", + SpaceGUID: "space-guid", + EnvironmentVariables: map[string]string{"FOO": "BAR"}, + }) + So(err, ShouldBeNil) + So(app, ShouldNotBeNil) + + So(app.GUID, ShouldEqual, "app-guid") + So(app.Relationships["space"].Data.GUID, ShouldEqual, "space-guid") + So(app.Lifecycle.Type, ShouldEqual, "buildpack") + So(app.Lifecycle.BuildpackData.Buildpacks, ShouldHaveLength, 1) + So(app.Lifecycle.BuildpackData.Buildpacks[0], ShouldEqual, "java_buildpack") + So(app.Lifecycle.BuildpackData.Stack, ShouldEqual, "cflinuxfs2") + So(app.Links["space"].Href, ShouldEqual, "https://api.example.org/v3/spaces/space-guid") + So(app.Metadata.Annotations, ShouldHaveLength, 0) + }) +} + +func TestGetV3App(t *testing.T) { + Convey("Get V3 App", t, func() { + setup(MockRoute{"GET", "/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446", []string{getV3AppPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + app, err := client.GetV3AppByGUID("1cb006ee-fb05-47e1-b541-c34179ddc446") + So(err, ShouldBeNil) + So(app, ShouldNotBeNil) + + So(app.GUID, ShouldEqual, "1cb006ee-fb05-47e1-b541-c34179ddc446") + So(app.Name, ShouldEqual, "my_app") + So(app.Lifecycle.Type, ShouldEqual, "buildpack") + So(app.Lifecycle.BuildpackData.Buildpacks, ShouldHaveLength, 1) + So(app.Lifecycle.BuildpackData.Buildpacks[0], ShouldEqual, "java_buildpack") + So(app.Lifecycle.BuildpackData.Stack, ShouldEqual, "cflinuxfs2") + So(app.Links["space"].Href, ShouldEqual, "https://api.example.org/v3/spaces/2f35885d-0c9d-4423-83ad-fd05066f8576") + So(app.Metadata.Annotations, ShouldHaveLength, 1) + So(app.Metadata.Annotations["contacts"], ShouldEqual, "Bill tel(1111111) email(bill@fixme), Bob tel(222222) pager(3333333#555) email(bob@fixme)") + }) +} + +func TestGetV3AppEnv(t *testing.T) { + Convey("Get V3 App Environment", t, func() { + setup(MockRoute{"GET", "/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/env", []string{getV3AppEnvPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + env, err := client.GetV3AppEnvironment("1cb006ee-fb05-47e1-b541-c34179ddc446") + So(err, ShouldBeNil) + + So(env.EnvVars, ShouldHaveLength, 1) + So(env.EnvVars["RAILS_ENV"], ShouldEqual, "production") + + So(env.StagingEnv, ShouldHaveLength, 1) + So(env.StagingEnv["GEM_CACHE"], ShouldEqual, "http://gem-cache.example.org") + + So(env.RunningEnv, ShouldHaveLength, 1) + So(env.RunningEnv["HTTP_PROXY"], ShouldEqual, "http://proxy.example.org") + + So(env.SystemEnvVars, ShouldHaveLength, 1) + So(env.SystemEnvVars, ShouldContainKey, "VCAP_SERVICES") + + So(env.AppEnvVars, ShouldHaveLength, 1) + So(env.AppEnvVars, ShouldContainKey, "VCAP_APPLICATION") + }) +} + +func TestSetV3AppEnvVariables(t *testing.T) { + Convey("Get V3 App Environment", t, func() { + setup(MockRoute{"PATCH", "/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/environment_variables", []string{setV3AppEnvironmentVariablesPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + falseVar := "false" + env, err := client.SetV3AppEnvVariables("1cb006ee-fb05-47e1-b541-c34179ddc446", + V3EnvVar{Var: map[string]*string{ + "DEBUG": &falseVar, + "USER": nil, + }}, + ) + So(err, ShouldBeNil) + So(env.Var, ShouldHaveLength, 2) + So(*env.Var["RAILS_ENV"], ShouldEqual, "production") + So(*env.Var["DEBUG"], ShouldEqual, "false") + }) +} + +func TestStartV3App(t *testing.T) { + Convey("Start V3 App", t, func() { + setup(MockRoute{"POST", "/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446/actions/start", []string{startV3AppPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + app, err := client.StartV3App("1cb006ee-fb05-47e1-b541-c34179ddc446") + So(err, ShouldBeNil) + So(app, ShouldNotBeNil) + + So(app.State, ShouldEqual, "STARTED") + So(app.GUID, ShouldEqual, "1cb006ee-fb05-47e1-b541-c34179ddc446") + So(app.Name, ShouldEqual, "my_app") + So(app.Lifecycle.Type, ShouldEqual, "buildpack") + So(app.Lifecycle.BuildpackData.Buildpacks, ShouldHaveLength, 1) + So(app.Lifecycle.BuildpackData.Buildpacks[0], ShouldEqual, "java_buildpack") + So(app.Lifecycle.BuildpackData.Stack, ShouldEqual, "cflinuxfs2") + So(app.Links["space"].Href, ShouldEqual, "https://api.example.org/v3/spaces/2f35885d-0c9d-4423-83ad-fd05066f8576") + So(app.Metadata.Annotations, ShouldHaveLength, 0) + }) +} + +func TestDeleteV3App(t *testing.T) { + Convey("Delete V3 App", t, func() { + setup(MockRoute{"DELETE", "/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446", []string{""}, "", http.StatusAccepted, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteV3App("1cb006ee-fb05-47e1-b541-c34179ddc446") + So(err, ShouldBeNil) + }) +} + +func TestUpdateV3App(t *testing.T) { + Convey("Update V3 App", t, func() { + setup(MockRoute{"PATCH", "/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446", []string{updateV3AppPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + app, err := client.UpdateV3App("1cb006ee-fb05-47e1-b541-c34179ddc446", UpdateV3AppRequest{}) + So(err, ShouldBeNil) + So(app, ShouldNotBeNil) + + So(app.GUID, ShouldEqual, "1cb006ee-fb05-47e1-b541-c34179ddc446") + So(app.State, ShouldEqual, "STARTED") + So(app.Name, ShouldEqual, "my_app") + So(app.Lifecycle.Type, ShouldEqual, "buildpack") + So(app.Lifecycle.BuildpackData.Buildpacks, ShouldHaveLength, 1) + So(app.Lifecycle.BuildpackData.Buildpacks[0], ShouldEqual, "java_buildpack") + So(app.Lifecycle.BuildpackData.Stack, ShouldEqual, "cflinuxfs2") + So(app.Links["space"].Href, ShouldEqual, "https://api.example.org/v3/spaces/2f35885d-0c9d-4423-83ad-fd05066f8576") + So(app.Metadata.Annotations, ShouldHaveLength, 0) + So(app.Metadata.Labels, ShouldHaveLength, 2) + So(app.Metadata.Labels["environment"], ShouldEqual, "production") + So(app.Metadata.Labels["internet-facing"], ShouldEqual, "false") + }) +} + +func TestListV3AppsByQuery(t *testing.T) { + Convey("List V3 Apps", t, func() { + setup(MockRoute{"GET", "/v3/apps", []string{listV3AppsPayload, listV3AppsPayloadPage2}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + apps, err := client.ListV3AppsByQuery(nil) + So(err, ShouldBeNil) + So(apps, ShouldHaveLength, 2) + + So(apps[0].Name, ShouldEqual, "my_app") + So(apps[1].Name, ShouldEqual, "my_app2") + + So(apps[1].State, ShouldEqual, "STOPPED") + + So(apps[0].Lifecycle.BuildpackData.Buildpacks[0], ShouldEqual, "java_buildpack") + So(apps[1].Lifecycle.BuildpackData.Buildpacks[0], ShouldEqual, "ruby_buildpack") + So(apps[1].Lifecycle.BuildpackData.Buildpacks[1], ShouldEqual, "staticfile_buildpack") + }) +} diff --git a/third_party/go-cfclient/v3build.go b/third_party/go-cfclient/v3build.go new file mode 100644 index 000000000000..432f8910e943 --- /dev/null +++ b/third_party/go-cfclient/v3build.go @@ -0,0 +1,77 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/pkg/errors" +) + +type V3Build struct { + State string `json:"state,omitempty"` + Error string `json:"error,omitempty"` + Lifecycle V3Lifecycle `json:"lifecycle,omitempty"` + Package V3Relationship `json:"package,omitempty"` + Droplet V3Relationship `json:"droplet,omitempty"` + GUID string `json:"guid,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + CreatedBy V3CreatedBy `json:"created_by,omitempty"` + Links map[string]Link `json:"links,omitempty"` + Metadata V3Metadata `json:"metadata,omitempty"` +} + +type V3CreatedBy struct { + GUID string `json:"guid,omitempty"` + Name string `json:"name,omitempty"` + Email string `json:"email,omitempty"` +} + +func (c *Client) GetV3BuildByGUID(buildGUID string) (*V3Build, error) { + resp, err := c.DoRequest(c.NewRequest("GET", "/v3/builds/"+buildGUID)) + if err != nil { + return nil, errors.Wrap(err, "Error getting V3 build") + } + defer resp.Body.Close() + + var build V3Build + if err := json.NewDecoder(resp.Body).Decode(&build); err != nil { + return nil, errors.Wrap(err, "Error reading V3 build JSON") + } + + return &build, nil +} + +func (c *Client) CreateV3Build(packageGUID string, lifecycle *V3Lifecycle, metadata *V3Metadata) (*V3Build, error) { + req := c.NewRequest("POST", "/v3/builds") + params := map[string]interface{}{ + "package": map[string]interface{}{ + "guid": packageGUID, + }, + } + if lifecycle != nil { + params["lifecycle"] = lifecycle + } + if metadata != nil { + params["metadata"] = metadata + } + req.obj = params + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while creating v3 build") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("Error creating v3 build, response code: %d", resp.StatusCode) + } + + var build V3Build + if err := json.NewDecoder(resp.Body).Decode(&build); err != nil { + return nil, errors.Wrap(err, "Error reading V3 Build JSON") + } + + return &build, nil +} diff --git a/third_party/go-cfclient/v3build_test.go b/third_party/go-cfclient/v3build_test.go new file mode 100644 index 000000000000..0c39d39e507c --- /dev/null +++ b/third_party/go-cfclient/v3build_test.go @@ -0,0 +1,29 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestCreateV3Build(t *testing.T) { + Convey("Get V3 App Environment", t, func() { + body := `{"metadata":{"labels":{"foo":"bar"}},"package":{"guid":"package-guid"}}` + setup(MockRoute{"POST", "/v3/builds", []string{createV3BuildPayload}, "", http.StatusCreated, "", &body}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + build, err := client.CreateV3Build("package-guid", nil, + &V3Metadata{Labels: map[string]string{"foo": "bar"}}) + So(err, ShouldBeNil) + So(build, ShouldNotBeNil) + + So(build.GUID, ShouldEqual, "585bc3c1-3743-497d-88b0-403ad6b56d16") + So(build.CreatedBy.Name, ShouldEqual, "bill") + So(build.Package.GUID, ShouldEqual, "8e4da443-f255-499c-8b47-b3729b5b7432") + }) +} diff --git a/third_party/go-cfclient/v3deployments.go b/third_party/go-cfclient/v3deployments.go new file mode 100644 index 000000000000..2314e95a9e1d --- /dev/null +++ b/third_party/go-cfclient/v3deployments.go @@ -0,0 +1,132 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/pkg/errors" +) + +type CreateV3DeploymentOptionalParameters struct { + Droplet *V3Relationship `json:"droplet,omitempty"` + Revision *V3DeploymentRevision `json:"revision,omitempty"` + Strategy *string `json:"strategy,omitempty"` + Metadata *V3Metadata `json:"metadata,omitempty"` +} + +type createV3DeploymentRequest struct { + *CreateV3DeploymentOptionalParameters `json:",inline"` + Relationships struct { + App V3ToOneRelationship `json:"app"` + } `json:"relationships"` +} + +type V3DeploymentRevision struct { + GUID string `json:"guid"` + Version int `json:"version"` +} + +type V3ProcessReference struct { + GUID string `json:"guid"` + Type string `type:"type"` +} + +type V3DeploymentStatus struct { + Value string `json:"value"` + Reason string `json:"reason"` + Details map[string]string `json:"details"` +} + +type V3Deployment struct { + GUID string `json:"guid"` + State string `json:"state"` + Status V3DeploymentStatus `json:"status"` + Strategy string `json:"strategy"` + Droplet V3Relationship `json:"droplet"` + PreviousDroplet V3Relationship `json:"previous_droplet"` + NewProcesses []V3ProcessReference `json:"new_processes"` + Revision V3DeploymentRevision `json:"revision"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Links map[string]Link `json:"links,omitempty"` + Metadata V3Metadata `json:"metadata,omitempty"` + Relationships map[string]V3ToOneRelationship `json:"relationships,omitempty"` +} + +func (c *Client) GetV3Deployment(deploymentGUID string) (*V3Deployment, error) { + req := c.NewRequest("GET", "/v3/deployments/"+deploymentGUID) + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error getting deployment") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error getting deployment with GUID [%s], response code: %d", deploymentGUID, resp.StatusCode) + } + + var r V3Deployment + if err := json.NewDecoder(resp.Body).Decode(&r); err != nil { + return nil, errors.Wrap(err, "Error reading deployment response JSON") + } + + return &r, nil +} + +func (c *Client) CreateV3Deployment(appGUID string, optionalParams *CreateV3DeploymentOptionalParameters) (*V3Deployment, error) { + // validate the params + if optionalParams != nil { + if optionalParams.Droplet != nil && optionalParams.Revision != nil { + return nil, errors.New("droplet and revision cannot both be set") + } + } + + requestBody := createV3DeploymentRequest{} + requestBody.CreateV3DeploymentOptionalParameters = optionalParams + + requestBody.Relationships = struct { + App V3ToOneRelationship "json:\"app\"" + }{ + App: V3ToOneRelationship{ + Data: V3Relationship{ + GUID: appGUID, + }, + }, + } + + req := c.NewRequest("POST", "/v3/deployments") + req.obj = requestBody + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error creating deployment") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("Error creating deployment for app GUID [%s], response code: %d", appGUID, resp.StatusCode) + } + + var r V3Deployment + if err = json.NewDecoder(resp.Body).Decode(&r); err != nil { + return nil, errors.Wrap(err, "Error reading deployment response JSON") + } + + return &r, nil +} + +func (c *Client) CancelV3Deployment(deploymentGUID string) error { + req := c.NewRequest("POST", "/v3/deployments/"+deploymentGUID+"/actions/cancel") + resp, err := c.DoRequest(req) + if err != nil { + return errors.Wrap(err, "Error canceling deployment") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("Error canceling deployment [%s], response code: %d", deploymentGUID, resp.StatusCode) + } + + return nil +} diff --git a/third_party/go-cfclient/v3deployments_test.go b/third_party/go-cfclient/v3deployments_test.go new file mode 100644 index 000000000000..81918833e60e --- /dev/null +++ b/third_party/go-cfclient/v3deployments_test.go @@ -0,0 +1,132 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestGetDeployment(t *testing.T) { + Convey("Get V3 Deployment", t, func() { + setup(MockRoute{"GET", "/v3/deployments/59c3d133-2b83-46f3-960e-7765a129aea4", []string{getV3DeploymentPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + resp, err := client.GetV3Deployment("59c3d133-2b83-46f3-960e-7765a129aea4") + So(err, ShouldBeNil) + So(resp, ShouldNotBeNil) + + So(resp.GUID, ShouldEqual, "59c3d133-2b83-46f3-960e-7765a129aea4") + So(resp.Status.Reason, ShouldEqual, "DEPLOYING") + So(resp.Relationships["app"].Data.GUID, ShouldEqual, "305cea31-5a44-45ca-b51b-e89c7a8ef8b2") + }) +} + +func TestCreateDeployment(t *testing.T) { + Convey("Create V3 Deployment without optional parameters", t, func() { + body := `{"relationships":{"app":{"data":{"guid":"305cea31-5a44-45ca-b51b-e89c7a8ef8b2"}}}}` + setup(MockRoute{"POST", "/v3/deployments", []string{getV3DeploymentPayload}, "", http.StatusCreated, "", &body}, t) + + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + resp, err := client.CreateV3Deployment("305cea31-5a44-45ca-b51b-e89c7a8ef8b2", nil) + So(err, ShouldBeNil) + So(resp, ShouldNotBeNil) + + So(resp.GUID, ShouldEqual, "59c3d133-2b83-46f3-960e-7765a129aea4") + So(resp.Status.Reason, ShouldEqual, "DEPLOYING") + So(resp.Relationships["app"].Data.GUID, ShouldEqual, "305cea31-5a44-45ca-b51b-e89c7a8ef8b2") + }) + + Convey("Create V3 Deployment with droplet", t, func() { + body := `{"droplet":{"guid":"44ccfa61-dbcf-4a0d-82fe-f668e9d2a962"},"relationships":{"app":{"data":{"guid":"305cea31-5a44-45ca-b51b-e89c7a8ef8b2"}}}}` + setup(MockRoute{"POST", "/v3/deployments", []string{getV3DeploymentPayload}, "", http.StatusCreated, "", &body}, t) + + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + resp, err := client.CreateV3Deployment("305cea31-5a44-45ca-b51b-e89c7a8ef8b2", &CreateV3DeploymentOptionalParameters{ + Droplet: &V3Relationship{ + GUID: "44ccfa61-dbcf-4a0d-82fe-f668e9d2a962", + }, + }) + So(err, ShouldBeNil) + So(resp, ShouldNotBeNil) + + So(resp.GUID, ShouldEqual, "59c3d133-2b83-46f3-960e-7765a129aea4") + So(resp.Status.Reason, ShouldEqual, "DEPLOYING") + So(resp.Relationships["app"].Data.GUID, ShouldEqual, "305cea31-5a44-45ca-b51b-e89c7a8ef8b2") + }) + + Convey("Create V3 Deployment with revision", t, func() { + body := `{"revision":{"guid":"56126cba-656a-4eba-a81e-7e9951b2df57","version":1},"relationships":{"app":{"data":{"guid":"305cea31-5a44-45ca-b51b-e89c7a8ef8b2"}}}}` + setup(MockRoute{"POST", "/v3/deployments", []string{getV3DeploymentPayload}, "", http.StatusCreated, "", &body}, t) + + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + resp, err := client.CreateV3Deployment("305cea31-5a44-45ca-b51b-e89c7a8ef8b2", &CreateV3DeploymentOptionalParameters{ + Revision: &V3DeploymentRevision{ + GUID: "56126cba-656a-4eba-a81e-7e9951b2df57", + Version: 1, + }, + }) + So(err, ShouldBeNil) + So(resp, ShouldNotBeNil) + + So(resp.GUID, ShouldEqual, "59c3d133-2b83-46f3-960e-7765a129aea4") + So(resp.Status.Reason, ShouldEqual, "DEPLOYING") + So(resp.Relationships["app"].Data.GUID, ShouldEqual, "305cea31-5a44-45ca-b51b-e89c7a8ef8b2") + }) + + Convey("Create V3 Deployment with revision and droplet", t, func() { + body := `{"droplet":{"guid":"44ccfa61-dbcf-4a0d-82fe-f668e9d2a962"},"revision":{"guid":"56126cba-656a-4eba-a81e-7e9951b2df57","version":1},"relationships":{"app":{"data":{"guid":"305cea31-5a44-45ca-b51b-e89c7a8ef8b2"}}}}` + setup(MockRoute{"POST", "/v3/deployments", []string{getV3DeploymentPayload}, "", http.StatusCreated, "", &body}, t) + + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + resp, err := client.CreateV3Deployment("305cea31-5a44-45ca-b51b-e89c7a8ef8b2", &CreateV3DeploymentOptionalParameters{ + Droplet: &V3Relationship{ + GUID: "44ccfa61-dbcf-4a0d-82fe-f668e9d2a962", + }, + Revision: &V3DeploymentRevision{ + GUID: "56126cba-656a-4eba-a81e-7e9951b2df57", + Version: 1, + }, + }) + So(err, ShouldNotBeNil) + So(resp, ShouldBeNil) + }) +} + +func TestCancelV3Deployment(t *testing.T) { + Convey("Cancel V3 deployment", t, func() { + setup(MockRoute{"POST", "/v3/deployments/59c3d133-2b83-46f3-960e-7765a129aea4/actions/cancel", []string{""}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.CancelV3Deployment("59c3d133-2b83-46f3-960e-7765a129aea4") + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/v3domains.go b/third_party/go-cfclient/v3domains.go new file mode 100644 index 000000000000..16b76329953a --- /dev/null +++ b/third_party/go-cfclient/v3domains.go @@ -0,0 +1,68 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/pkg/errors" +) + +type DomainRelationships struct { + Organization V3ToOneRelationship `json:"organization"` + SharedOrganizations V3ToManyRelationships `json:"shared_organizations"` +} + +type V3Domain struct { + Guid string `json:"guid"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + Name string `json:"name"` + Internal bool `json:"internal"` + Metadata Metadata `json:"metadata"` + Relationships DomainRelationships `json:"relationships"` + Links map[string]Link `json:"links"` +} + +type listV3DomainsResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3Domain `json:"resources,omitempty"` +} + +func (c *Client) ListV3Domains(query url.Values) ([]V3Domain, error) { + var domains []V3Domain + requestURL := "/v3/domains" + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + + for { + resp, err := c.DoRequest(c.NewRequest("GET", requestURL)) + if err != nil { + return nil, errors.Wrapf(err, "Error getting domains") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 app domains, response code: %d", resp.StatusCode) + } + + var data listV3DomainsResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 app domains") + } + + domains = append(domains, data.Resources...) + requestURL = data.Pagination.Next.Href + if requestURL == "" || query.Get("page") != "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, errors.Wrap(err, "Error parsing the next page request url for v3 domains") + } + } + return domains, nil +} diff --git a/third_party/go-cfclient/v3domains_test.go b/third_party/go-cfclient/v3domains_test.go new file mode 100644 index 000000000000..163c1849e0e0 --- /dev/null +++ b/third_party/go-cfclient/v3domains_test.go @@ -0,0 +1,35 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListV3Domains(t *testing.T) { + Convey("List V3 Domains ", t, func() { + setup(MockRoute{"GET", "/v3/domains", []string{listV3DomainsPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + resp, err := client.ListV3Domains(nil) + So(err, ShouldBeNil) + So(resp, ShouldNotBeNil) + + So(resp, ShouldHaveLength, 1) + So(resp[0].Name, ShouldEqual, "test-domain.com") + So(resp[0].Guid, ShouldEqual, "3a5d3d89-3f89-4f05-8188-8a2b298c79d5") + So(resp[0].Internal, ShouldEqual, false) + So(resp[0].Relationships.Organization.Data.GUID, ShouldEqual, "3a3f3d89-3f89-4f05-8188-751b298c79d5") + So(resp[0].Relationships.SharedOrganizations.Data[0].GUID, ShouldEqual, "404f3d89-3f89-6z72-8188-751b298d88d5") + So(resp[0].Relationships.SharedOrganizations.Data[1].GUID, ShouldEqual, "416d3d89-3f89-8h67-2189-123b298d3592") + So(resp[0].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5") + So(resp[0].Links["organization"].Href, ShouldEqual, "https://api.example.org/v3/organizations/3a3f3d89-3f89-4f05-8188-751b298c79d5") + So(resp[0].Links["route_reservations"].Href, ShouldEqual, "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/route_reservations") + So(resp[0].Links["shared_organizations"].Href, ShouldEqual, "https://api.example.org/v3/domains/3a5d3d89-3f89-4f05-8188-8a2b298c79d5/relationships/shared_organizations") + }) +} diff --git a/third_party/go-cfclient/v3droplet.go b/third_party/go-cfclient/v3droplet.go new file mode 100644 index 000000000000..d3a453d3ffb6 --- /dev/null +++ b/third_party/go-cfclient/v3droplet.go @@ -0,0 +1,106 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/pkg/errors" +) + +// V3Droplet is the result of staging an application package. +// There are two types (lifecycles) of droplets: buildpack and +// docker. In the case of buildpacks, the droplet contains the +// bits produced by the buildpack. +type V3Droplet struct { + State string `json:"state,omitempty"` + Error string `json:"error,omitempty"` + Lifecycle V3Lifecycle `json:"lifecycle,omitempty"` + GUID string `json:"guid,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Links map[string]Link `json:"links,omitempty"` + ExecutionMetadata string `json:"execution_metadata,omitempty"` + ProcessTypes map[string]string `json:"process_types,omitempty"` + Metadata V3Metadata `json:"metadata,omitempty"` + + // Only specified when the droplet is using the Docker lifecycle. + Image string `json:"image,omitempty"` + + // The following fields are specified when the droplet is using + // the buildpack lifecycle. + Checksum struct { + Type string `json:"type,omitempty"` + Value string `json:"value,omitempty"` + } `json:"checksum,omitempty"` + Stack string `json:"stack,omitempty"` + Buildpacks []V3DetectedBuildpack `json:"buildpacks,omitempty"` +} + +type V3DetectedBuildpack struct { + Name string `json:"name,omitempty"` // system buildpack name + BuildpackName string `json:"buildpack_name,omitempty"` // name reported by the buildpack + DetectOutput string `json:"detect_output,omitempty"` // output during detect process + Version string `json:"version,omitempty"` +} + +type CurrentDropletV3Response struct { + Data V3Relationship `json:"data,omitempty"` + Links map[string]Link `json:"links,omitempty"` +} + +func (c *Client) SetCurrentDropletForV3App(appGUID, dropletGUID string) (*CurrentDropletV3Response, error) { + req := c.NewRequest("PATCH", "/v3/apps/"+appGUID+"/relationships/current_droplet") + req.obj = V3ToOneRelationship{Data: V3Relationship{GUID: dropletGUID}} + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error setting droplet for v3 app") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error setting droplet for v3 app with GUID [%s], response code: %d", appGUID, resp.StatusCode) + } + + var r CurrentDropletV3Response + if err := json.NewDecoder(resp.Body).Decode(&r); err != nil { + return nil, errors.Wrap(err, "Error reading droplet response JSON") + } + + return &r, nil +} + +func (c *Client) GetCurrentDropletForV3App(appGUID string) (*V3Droplet, error) { + req := c.NewRequest("GET", "/v3/apps/"+appGUID+"/droplets/current") + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error getting droplet for v3 app") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error getting droplet for v3 app with GUID [%s], response code: %d", appGUID, resp.StatusCode) + } + + var r V3Droplet + if err := json.NewDecoder(resp.Body).Decode(&r); err != nil { + return nil, errors.Wrap(err, "Error reading droplet response JSON") + } + + return &r, nil +} + +func (c *Client) DeleteDroplet(dropletGUID string) error { + req := c.NewRequest("DELETE", "/v3/droplets/"+dropletGUID) + resp, err := c.DoRequest(req) + if err != nil { + return errors.Wrapf(err, "Error deleting droplet %s", dropletGUID) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error deleting droplet %s with response code %d", dropletGUID, resp.StatusCode) + } + + return nil +} diff --git a/third_party/go-cfclient/v3droplet_test.go b/third_party/go-cfclient/v3droplet_test.go new file mode 100644 index 000000000000..d6b7be570e8b --- /dev/null +++ b/third_party/go-cfclient/v3droplet_test.go @@ -0,0 +1,62 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestSetCurrentDropletForV3App(t *testing.T) { + Convey("Set Droplet for V3 App", t, func() { + body := `{"data":{"guid":"3fc0916f-2cea-4f3a-ae53-048388baa6bd"}}` + setup(MockRoute{"PATCH", "/v3/apps/9d8e007c-ce52-4ea7-8a57-f2825d2c6b39/relationships/current_droplet", []string{currentDropletV3AppPayload}, "", http.StatusOK, "", &body}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + resp, err := client.SetCurrentDropletForV3App("9d8e007c-ce52-4ea7-8a57-f2825d2c6b39", "3fc0916f-2cea-4f3a-ae53-048388baa6bd") + So(err, ShouldBeNil) + So(resp, ShouldNotBeNil) + + So(resp.Data.GUID, ShouldEqual, "9d8e007c-ce52-4ea7-8a57-f2825d2c6b39") + So(resp.Links["self"].Href, ShouldEqual, "https://api.example.org/v3/apps/d4c91047-7b29-4fda-b7f9-04033e5c9c9f/relationships/current_droplet") + So(resp.Links["related"].Href, ShouldEqual, "https://api.example.org/v3/apps/d4c91047-7b29-4fda-b7f9-04033e5c9c9f/droplets/current") + }) +} + +func TestGetCurrentDropletForV3App(t *testing.T) { + Convey("Get Droplet for V3 App", t, func() { + setup(MockRoute{"GET", "/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396/droplets/current", []string{getV3CurrentAppDropletPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + resp, err := client.GetCurrentDropletForV3App("7b34f1cf-7e73-428a-bb5a-8a17a8058396") + So(err, ShouldBeNil) + So(resp, ShouldNotBeNil) + + So(resp.GUID, ShouldEqual, "585bc3c1-3743-497d-88b0-403ad6b56d16") + So(resp.Links["self"].Href, ShouldEqual, "https://api.example.org/v3/droplets/585bc3c1-3743-497d-88b0-403ad6b56d16") + So(resp.Links["assign_current_droplet"].Href, ShouldEqual, "https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396/relationships/current_droplet") + So(resp.Links["assign_current_droplet"].Method, ShouldEqual, "PATCH") + }) +} + +func TestDeleteDroplet(t *testing.T) { + Convey("Delete Droplet", t, func() { + setup(MockRoute{"DELETE", "/v3/droplets/59c3d133-2b83-46f3-960e-7765a129aea4", []string{""}, "", http.StatusAccepted, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteDroplet("59c3d133-2b83-46f3-960e-7765a129aea4") + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/v3organizations.go b/third_party/go-cfclient/v3organizations.go new file mode 100644 index 000000000000..6eb0d28ae0a4 --- /dev/null +++ b/third_party/go-cfclient/v3organizations.go @@ -0,0 +1,178 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type V3Organization struct { + Name string `json:"name,omitempty"` + GUID string `json:"guid,omitempty"` + Suspended *bool `json:"suspended,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Relationships map[string]V3ToOneRelationship `json:"relationships,omitempty"` + Links map[string]Link `json:"links,omitempty"` + Metadata V3Metadata `json:"metadata,omitempty"` +} + +type CreateV3OrganizationRequest struct { + Name string + Suspended *bool `json:"suspended,omitempty"` + Metadata *V3Metadata +} + +type UpdateV3OrganizationRequest struct { + Name string + Suspended *bool `json:"suspended,omitempty"` + Metadata *V3Metadata +} + +func (c *Client) CreateV3Organization(r CreateV3OrganizationRequest) (*V3Organization, error) { + req := c.NewRequest("POST", "/v3/organizations") + params := map[string]interface{}{ + "name": r.Name, + } + if r.Suspended != nil { + params["suspended"] = r.Suspended + } + if r.Metadata != nil { + params["metadata"] = r.Metadata + } + + req.obj = params + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while creating v3 organization") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("Error creating v3 organization %s, response code: %d", r.Name, resp.StatusCode) + } + + var organization V3Organization + if err := json.NewDecoder(resp.Body).Decode(&organization); err != nil { + return nil, errors.Wrap(err, "Error reading v3 organization JSON") + } + + return &organization, nil +} + +func (c *Client) GetV3OrganizationByGUID(organizationGUID string) (*V3Organization, error) { + req := c.NewRequest("GET", "/v3/organizations/"+organizationGUID) + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while getting v3 organization") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error getting v3 organization with GUID [%s], response code: %d", organizationGUID, resp.StatusCode) + } + + var organization V3Organization + if err := json.NewDecoder(resp.Body).Decode(&organization); err != nil { + return nil, errors.Wrap(err, "Error reading v3 organization JSON") + } + + return &organization, nil +} + +func (c *Client) DeleteV3Organization(organizationGUID string) error { + req := c.NewRequest("DELETE", "/v3/organizations/"+organizationGUID) + resp, err := c.DoRequest(req) + if err != nil { + return errors.Wrap(err, "Error while deleting v3 organization") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error deleting v3 organization with GUID [%s], response code: %d", organizationGUID, resp.StatusCode) + } + + return nil +} + +func (c *Client) UpdateV3Organization(organizationGUID string, r UpdateV3OrganizationRequest) (*V3Organization, error) { + req := c.NewRequest("PATCH", "/v3/organizations/"+organizationGUID) + params := make(map[string]interface{}) + if r.Name != "" { + params["name"] = r.Name + } + if r.Suspended != nil { + params["suspended"] = r.Suspended + } + if r.Metadata != nil { + params["metadata"] = r.Metadata + } + if len(params) > 0 { + req.obj = params + } + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while updating v3 organization") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error updating v3 organization %s, response code: %d", organizationGUID, resp.StatusCode) + } + + var organization V3Organization + if err := json.NewDecoder(resp.Body).Decode(&organization); err != nil { + return nil, errors.Wrap(err, "Error reading v3 organization JSON") + } + + return &organization, nil +} + +type listV3OrganizationsResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3Organization `json:"resources,omitempty"` +} + +func (c *Client) ListV3OrganizationsByQuery(query url.Values) ([]V3Organization, error) { + var organizations []V3Organization + requestURL := "/v3/organizations" + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + + for { + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 organizations") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 organizations, response code: %d", resp.StatusCode) + } + + var data listV3OrganizationsResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 organizations") + } + + organizations = append(organizations, data.Resources...) + + requestURL = data.Pagination.Next.Href + if requestURL == "" || query.Get("page") != "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, errors.Wrap(err, "Error parsing the next page request url for v3 organizations") + } + } + + return organizations, nil +} diff --git a/third_party/go-cfclient/v3organizations_test.go b/third_party/go-cfclient/v3organizations_test.go new file mode 100644 index 000000000000..b6e2f89e74b7 --- /dev/null +++ b/third_party/go-cfclient/v3organizations_test.go @@ -0,0 +1,117 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestCreateV3Organization(t *testing.T) { + Convey("Create V3 Organization", t, func() { + expectedBody := `{"name":"my-org"}` + setup(MockRoute{"POST", "/v3/organizations", []string{createV3OrganizationPayload}, "", http.StatusCreated, "", &expectedBody}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + organization, err := client.CreateV3Organization(CreateV3OrganizationRequest{ + Name: "my-org", + }) + So(err, ShouldBeNil) + So(organization, ShouldNotBeNil) + + So(organization.GUID, ShouldEqual, "org-guid") + So(organization.Relationships["quota"].Data.GUID, ShouldEqual, "quota-guid") + So(organization.Links["domains"].Href, ShouldEqual, "https://api.example.org/v3/organizations/org-guid/domains") + So(organization.Metadata.Annotations, ShouldHaveLength, 0) + So(organization.Metadata.Labels, ShouldContainKey, "ORG_KEY") + So(organization.Metadata.Labels["ORG_KEY"], ShouldEqual, "org_value") + }) +} + +func TestGetV3Organization(t *testing.T) { + Convey("Get V3 Organization", t, func() { + setup(MockRoute{"GET", "/v3/organizations/org-guid", []string{getV3OrganizationPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + organization, err := client.GetV3OrganizationByGUID("org-guid") + So(err, ShouldBeNil) + So(organization, ShouldNotBeNil) + + So(organization.GUID, ShouldEqual, "org-guid") + So(organization.Relationships["quota"].Data.GUID, ShouldEqual, "quota-guid") + So(organization.Links["domains"].Href, ShouldEqual, "https://api.example.org/v3/organizations/org-guid/domains") + So(organization.Metadata.Annotations, ShouldHaveLength, 0) + So(organization.Metadata.Labels, ShouldContainKey, "ORG_KEY") + So(organization.Metadata.Labels["ORG_KEY"], ShouldEqual, "org_value") + }) +} + +func TestDeleteV3Organization(t *testing.T) { + Convey("Delete V3 Organization", t, func() { + setup(MockRoute{"DELETE", "/v3/organizations/org-guid", []string{""}, "", http.StatusAccepted, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteV3Organization("org-guid") + So(err, ShouldBeNil) + }) +} + +func TestUpdateV3Organization(t *testing.T) { + Convey("Update V3 Organization", t, func() { + setup(MockRoute{"PATCH", "/v3/organizations/org-guid", []string{updateV3OrganizationPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + organization, err := client.UpdateV3Organization("org-guid", UpdateV3OrganizationRequest{ + Name: "my-org", + }) + So(err, ShouldBeNil) + So(organization, ShouldNotBeNil) + + So(organization.Name, ShouldEqual, "my-org") + So(organization.GUID, ShouldEqual, "org-guid") + So(organization.Relationships["quota"].Data.GUID, ShouldEqual, "") + So(organization.Links["domains"].Href, ShouldEqual, "https://api.example.org/v3/organizations/org-guid/domains") + So(organization.Metadata.Annotations, ShouldHaveLength, 0) + So(organization.Metadata.Labels, ShouldContainKey, "ORG_KEY") + So(organization.Metadata.Labels["ORG_KEY"], ShouldEqual, "org_value") + }) +} + +func TestListV3OrganizationsByQuery(t *testing.T) { + Convey("List V3 Organizations", t, func() { + setup(MockRoute{"GET", "/v3/organizations", []string{listV3OrganizationsPayload, listV3OrganizationsPayloadPage2}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + organizations, err := client.ListV3OrganizationsByQuery(nil) + So(err, ShouldBeNil) + So(organizations, ShouldHaveLength, 2) + + So(organizations[0].Name, ShouldEqual, "my-org-1") + So(organizations[1].Name, ShouldEqual, "my-org-2") + + So(organizations[0].Relationships["quota"].Data.GUID, ShouldEqual, "quota-guid") + So(organizations[0].Links["domains"].Href, ShouldEqual, "https://api.example.org/v3/organizations/org-guid/domains") + So(organizations[1].Relationships["quota"].Data.GUID, ShouldEqual, "") + So(organizations[1].Links["domains"].Href, ShouldEqual, "https://api.example.org/v3/organizations/org-guid-2/domains") + }) +} diff --git a/third_party/go-cfclient/v3packages.go b/third_party/go-cfclient/v3packages.go new file mode 100644 index 000000000000..91905a8a0b41 --- /dev/null +++ b/third_party/go-cfclient/v3packages.go @@ -0,0 +1,192 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type V3PackageState string + +const ( + AwaitingUpload V3PackageState = "AWAITING_UPLOAD" + ProcessingUpload V3PackageState = "PROCESSING_UPLOAD" + Ready V3PackageState = "READY" + Failed V3PackageState = "FAILED" + Copying V3PackageState = "COPYING" + Expired V3PackageState = "EXPIRED" +) + +type V3Package struct { + Type string `json:"type,omitempty"` // bits or docker + Data json.RawMessage `json:"data,omitempty"` // depends on value of Type + State V3PackageState `json:"state,omitempty"` + GUID string `json:"guid,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Links map[string]Link `json:"links,omitempty"` + Metadata V3Metadata `json:"metadata,omitempty"` +} + +func (v *V3Package) BitsData() (V3BitsPackage, error) { + var bits V3BitsPackage + if v.Type != "bits" { + return bits, errors.New("this package is not of type bits") + } + + if err := json.Unmarshal(v.Data, &bits); err != nil { + return bits, err + } + + return bits, nil +} + +func (v *V3Package) DockerData() (V3DockerPackage, error) { + var docker V3DockerPackage + if v.Type != "docker" { + return docker, errors.New("this package is not of type docker") + } + + if err := json.Unmarshal(v.Data, &docker); err != nil { + return docker, err + } + + return docker, nil +} + +// V3BitsPackage is the data for V3Packages of type bits. +// It provides an upload link to which a zip file should be uploaded. +type V3BitsPackage struct { + Error string `json:"error,omitempty"` + Checksum struct { + Type string `json:"type,omitempty"` // eg. sha256 + Value string `json:"value,omitempty"` // populated after the bits are uploaded + } `json:"checksum,omitempty"` +} + +// V3DockerPackage is the data for V3Packages of type docker. +// It references a docker image from a registry. +type V3DockerPackage struct { + Image string `json:"image,omitempty"` + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` +} + +type listV3PackagesResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3Package `json:"resources,omitempty"` +} + +func (c *Client) ListPackagesForAppV3(appGUID string, query url.Values) ([]V3Package, error) { + var packages []V3Package + requestURL := "/v3/apps/" + appGUID + "/packages" + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + + for { + resp, err := c.DoRequest(c.NewRequest("GET", requestURL)) + if err != nil { + return nil, errors.Wrapf(err, "Error requesting packages for app %s", appGUID) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 app packages, response code: %d", resp.StatusCode) + } + + var data listV3PackagesResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 app packages") + } + + packages = append(packages, data.Resources...) + requestURL = data.Pagination.Next.Href + if requestURL == "" || query.Get("page") != "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, errors.Wrap(err, "Error parsing the next page request url for v3 packages") + } + } + return packages, nil +} + +// CopyPackageV3 makes a copy of a package that is associated with one app +// and associates the copy with a new app. +func (c *Client) CopyPackageV3(packageGUID, appGUID string) (*V3Package, error) { + req := c.NewRequest("POST", "/v3/packages?source_guid="+packageGUID) + req.obj = map[string]interface{}{ + "relationships": map[string]interface{}{ + "app": V3ToOneRelationship{ + Data: V3Relationship{ + GUID: appGUID, + }, + }, + }, + } + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while copying v3 package") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("Error copying v3 package %s, response code: %d", packageGUID, resp.StatusCode) + } + + var pkg V3Package + if err := json.NewDecoder(resp.Body).Decode(&pkg); err != nil { + return nil, errors.Wrap(err, "Error reading v3 app package") + } + + return &pkg, nil +} + +type v3DockerPackageData struct { + Image string `json:"image"` + *DockerCredentials +} + +type createV3DockerPackageRequest struct { + Type string `json:"type"` + Relationships map[string]V3ToOneRelationship `json:"relationships"` + Data v3DockerPackageData `json:"data"` +} + +// CreateV3DockerPackage creates a Docker package +func (c *Client) CreateV3DockerPackage(image string, appGUID string, dockerCredentials *DockerCredentials) (*V3Package, error) { + req := c.NewRequest("POST", "/v3/packages") + req.obj = createV3DockerPackageRequest{ + Type: "docker", + Relationships: map[string]V3ToOneRelationship{ + "app": {Data: V3Relationship{GUID: appGUID}}, + }, + Data: v3DockerPackageData{ + Image: image, + DockerCredentials: dockerCredentials, + }, + } + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while copying v3 package") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("error creating v3 docker package, response code: %d", resp.StatusCode) + } + + var pkg V3Package + if err := json.NewDecoder(resp.Body).Decode(&pkg); err != nil { + return nil, errors.Wrap(err, "Error reading v3 app package") + } + + return &pkg, nil +} diff --git a/third_party/go-cfclient/v3packages_test.go b/third_party/go-cfclient/v3packages_test.go new file mode 100644 index 000000000000..58f7a50d7fa0 --- /dev/null +++ b/third_party/go-cfclient/v3packages_test.go @@ -0,0 +1,100 @@ +package cfclient + +import ( + "encoding/json" + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListPackagesForAppV3(t *testing.T) { + Convey("List Package for V3 Apps", t, func() { + setup(MockRoute{"GET", "/v3/apps/f2efe391-2b5b-4836-8518-ad93fa9ebf69/packages", []string{listPackagesForV3AppPayloadPage1, listPackagesForV3AppPayloadPage2}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + packages, err := client.ListPackagesForAppV3("f2efe391-2b5b-4836-8518-ad93fa9ebf69", nil) + So(err, ShouldBeNil) + So(packages, ShouldHaveLength, 2) + + So(packages[0].Type, ShouldEqual, "bits") + So(packages[0].State, ShouldEqual, "READY") + So(packages[0].Links["app"].Href, ShouldEqual, "https://api.example.org/v3/apps/f2efe391-2b5b-4836-8518-ad93fa9ebf69") + So(packages[0].Links["download"].Href, ShouldEqual, "https://api.example.org/v3/packages/752edab0-2147-4f58-9c25-cd72ad8c3561/download") + So(packages[1].Type, ShouldEqual, "bits") + So(packages[1].State, ShouldEqual, "READY") + So(packages[1].Links["app"].Href, ShouldEqual, "https://api.example.org/v3/apps/f2efe391-2b5b-4836-8518-ad93fa9ebf69") + So(packages[1].Links["download"].Href, ShouldEqual, "https://api.example.org/v3/packages/2345ab-2147-4f58-9c25-cd72ad8c3561/download") + + }) +} + +func TestCopyPackageV3(t *testing.T) { + Convey("Copy V3 Package", t, func() { + expectedBody := `{"relationships":{"app":{"data":{"guid":"app-guid"}}}}` + setup(MockRoute{"POST", "/v3/packages", []string{copyPackageV3Payload}, "", http.StatusCreated, "source_guid=package-guid", &expectedBody}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + pkg, err := client.CopyPackageV3("package-guid", "app-guid") + So(err, ShouldBeNil) + + So(pkg.State, ShouldEqual, "COPYING") + So(pkg.Type, ShouldEqual, "docker") + So(pkg.GUID, ShouldEqual, "fec72fc1-e453-4463-a86d-5df426f337a3") + + docker, err := pkg.DockerData() + So(err, ShouldBeNil) + So(docker.Image, ShouldEqual, "http://awesome-sauce.example.org") + }) +} + +func TestV3PackageDataDocker(t *testing.T) { + Convey("V3 Package Data [type=docker]", t, func() { + Convey("Errors when type=bits", func() { + p := V3Package{Type: "bits"} + _, err := p.DockerData() + So(err, ShouldNotBeNil) + }) + + Convey("Unmarshals docker package", func() { + p := V3Package{ + Type: "docker", + Data: json.RawMessage(`{"image":"nginx","username":"admin","password":"password"}`), + } + d, err := p.DockerData() + So(err, ShouldBeNil) + So(d.Image, ShouldEqual, "nginx") + So(d.Username, ShouldEqual, "admin") + So(d.Password, ShouldEqual, "password") + }) + }) +} + +func TestV3PackageDataBits(t *testing.T) { + Convey("V3 Package Data [type=bits]", t, func() { + Convey("Errors when type=docker", func() { + p := V3Package{Type: "docker"} + _, err := p.BitsData() + So(err, ShouldNotBeNil) + }) + + Convey("Unmarshals docker package", func() { + p := V3Package{ + Type: "bits", + Data: json.RawMessage(`{"error":"None","checksum":{"type":"sha256","value":"foo"}}`), + } + b, err := p.BitsData() + So(err, ShouldBeNil) + So(b.Error, ShouldEqual, "None") + So(b.Checksum.Type, ShouldEqual, "sha256") + }) + }) +} diff --git a/third_party/go-cfclient/v3roles.go b/third_party/go-cfclient/v3roles.go new file mode 100644 index 000000000000..dce289f2660b --- /dev/null +++ b/third_party/go-cfclient/v3roles.go @@ -0,0 +1,273 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +// V3Role implements role object. Roles control access to resources in organizations and spaces. Roles are assigned to users. +type V3Role struct { + GUID string `json:"guid,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Type string `json:"type,omitempty"` + Relationships map[string]V3ToOneRelationship `json:"relationships,omitempty"` + Links map[string]Link `json:"links,omitempty"` +} + +type Included struct { + Users []V3User `json:"users,omitempty"` + Organizations []V3Organization `json:"organizations,omitempty"` + Spaces []V3Space `json:"spaces,omitempty"` +} + +type listV3RolesResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3Role `json:"resources,omitempty"` + Included Included `json:"included,omitempty"` +} + +type createV3SpaceRoleRequest struct { + RoleType string `json:"type"` + Relationships spaceUserRelationships `json:"relationships"` +} + +type createV3OrganizationRoleRequest struct { + RoleType string `json:"type"` + Relationships orgUserRelationships `json:"relationships"` +} + +type spaceUserRelationships struct { + Space V3ToOneRelationship `json:"space"` + User V3ToOneRelationship `json:"user"` +} + +type orgUserRelationships struct { + Org V3ToOneRelationship `json:"organization"` + User V3ToOneRelationship `json:"user"` +} + +func (c *Client) CreateV3SpaceRole(spaceGUID, userGUID, roleType string) (*V3Role, error) { + spaceRel := V3ToOneRelationship{Data: V3Relationship{GUID: spaceGUID}} + userRel := V3ToOneRelationship{Data: V3Relationship{GUID: userGUID}} + req := c.NewRequest("POST", "/v3/roles") + req.obj = createV3SpaceRoleRequest{ + RoleType: roleType, + Relationships: spaceUserRelationships{Space: spaceRel, User: userRel}, + } + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while creating v3 role") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("error creating v3 role, response code: %d", resp.StatusCode) + } + + var role V3Role + if err := json.NewDecoder(resp.Body).Decode(&role); err != nil { + return nil, errors.Wrap(err, "Error reading v3 role") + } + + return &role, nil +} + +func (c *Client) CreateV3OrganizationRole(orgGUID, userGUID, roleType string) (*V3Role, error) { + orgRel := V3ToOneRelationship{Data: V3Relationship{GUID: orgGUID}} + userRel := V3ToOneRelationship{Data: V3Relationship{GUID: userGUID}} + req := c.NewRequest("POST", "/v3/roles") + req.obj = createV3OrganizationRoleRequest{ + RoleType: roleType, + Relationships: orgUserRelationships{Org: orgRel, User: userRel}, + } + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while creating v3 role") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("error creating v3 role, response code: %d", resp.StatusCode) + } + + var role V3Role + if err := json.NewDecoder(resp.Body).Decode(&role); err != nil { + return nil, errors.Wrap(err, "Error reading v3 role") + } + + return &role, nil +} + +// ListV3RolesByQuery retrieves roles based on query +func (c *Client) ListV3RolesByQuery(query url.Values) ([]V3Role, error) { + var roles []V3Role + requestURL, err := url.Parse("/v3/roles") + if err != nil { + return nil, err + } + requestURL.RawQuery = query.Encode() + + for { + r := c.NewRequest("GET", fmt.Sprintf("%s?%s", requestURL.Path, requestURL.RawQuery)) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 space roles") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 space roles, response code: %d", resp.StatusCode) + } + + var data listV3RolesResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 space roles") + } + + roles = append(roles, data.Resources...) + + requestURL, err = url.Parse(data.Pagination.Next.Href) + if err != nil { + return nil, errors.Wrap(err, "Error parsing next page URL") + } + if requestURL.String() == "" { + break + } + } + + return roles, nil +} + +func (c *Client) ListV3RoleUsersByQuery(query url.Values) ([]V3User, error) { + var users []V3User + requestURL, err := url.Parse("/v3/roles") + if err != nil { + return nil, err + } + requestURL.RawQuery = query.Encode() + + for { + r := c.NewRequest("GET", fmt.Sprintf("%s?%s", requestURL.Path, requestURL.RawQuery)) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 roles") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 roles, response code: %d", resp.StatusCode) + } + + var data listV3RolesResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 roles") + } + + users = append(users, data.Included.Users...) + + requestURL, err = url.Parse(data.Pagination.Next.Href) + if err != nil { + return nil, errors.Wrap(err, "Error parsing next page URL") + } + if requestURL.String() == "" { + break + } + } + + return users, nil +} + +func (c *Client) ListV3RoleAndUsersByQuery(query url.Values) ([]V3Role, []V3User, error) { + var roles []V3Role + var users []V3User + requestURL, err := url.Parse("/v3/roles") + if err != nil { + return nil, nil, err + } + requestURL.RawQuery = query.Encode() + + for { + r := c.NewRequest("GET", fmt.Sprintf("%s?%s", requestURL.Path, requestURL.RawQuery)) + resp, err := c.DoRequest(r) + if err != nil { + return nil, nil, errors.Wrap(err, "Error requesting v3 roles") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, nil, fmt.Errorf("Error listing v3 roles, response code: %d", resp.StatusCode) + } + + var data listV3RolesResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, nil, errors.Wrap(err, "Error parsing JSON from list v3 roles") + } + + roles = append(roles, data.Resources...) + users = append(users, data.Included.Users...) + + requestURL, err = url.Parse(data.Pagination.Next.Href) + if err != nil { + return nil, nil, errors.Wrap(err, "Error parsing next page URL") + } + if requestURL.String() == "" { + break + } + } + + return roles, users, nil +} + +// ListV3SpaceRolesByGUID retrieves roles based on query +func (c *Client) ListV3SpaceRolesByGUID(spaceGUID string) ([]V3Role, []V3User, error) { + query := url.Values{} + query["space_guids"] = []string{spaceGUID} + query["include"] = []string{"user"} + return c.ListV3RoleAndUsersByQuery(query) +} + +// ListV3SpaceRolesByGUIDAndType retrieves roles based on query +func (c *Client) ListV3SpaceRolesByGUIDAndType(spaceGUID string, roleType string) ([]V3User, error) { + query := url.Values{} + query["space_guids"] = []string{spaceGUID} + query["types"] = []string{roleType} + query["include"] = []string{"user"} + return c.ListV3RoleUsersByQuery(query) +} + +// ListV3SpaceRolesByGUIDAndType retrieves roles based on query +func (c *Client) ListV3OrganizationRolesByGUIDAndType(orgGUID string, roleType string) ([]V3User, error) { + query := url.Values{} + query["organization_guids"] = []string{orgGUID} + query["types"] = []string{roleType} + query["include"] = []string{"user"} + return c.ListV3RoleUsersByQuery(query) +} + +// ListV3OrganizationRolesByGUID retrieves roles based on query +func (c *Client) ListV3OrganizationRolesByGUID(orgGUID string) ([]V3Role, []V3User, error) { + query := url.Values{} + query["organization_guids"] = []string{orgGUID} + query["include"] = []string{"user"} + return c.ListV3RoleAndUsersByQuery(query) +} + +func (c *Client) DeleteV3Role(roleGUID string) error { + req := c.NewRequest("DELETE", "/v3/roles/"+roleGUID) + resp, err := c.DoRequest(req) + if err != nil { + return errors.Wrap(err, "Error while deleting v3 role") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error deleting v3 role with GUID [%s], response code: %d", roleGUID, resp.StatusCode) + } + + return nil +} diff --git a/third_party/go-cfclient/v3roles_test.go b/third_party/go-cfclient/v3roles_test.go new file mode 100644 index 000000000000..91c60717479b --- /dev/null +++ b/third_party/go-cfclient/v3roles_test.go @@ -0,0 +1,255 @@ +package cfclient + +import ( + "net/http" + "net/url" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListV3SpaceRolesByQuery(t *testing.T) { + Convey("List V3 Space Roles By Space GUID", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/roles", []string{listV3SpaceRolesBySpaceGUIDPayload}, "", http.StatusOK, "space_guids=spaceGUID1", nil}, + {"GET", "/v3/rolespage2", []string{listV3SpaceRolesBySpaceGuidPayloadPage2}, "", http.StatusOK, "page=2&per_page=2&space_guids=spaceGUID1", nil}, + } + setupMultiple(mocks, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + query := url.Values{} + query["space_guids"] = []string{"spaceGUID1"} + + roles, err := client.ListV3RolesByQuery(query) + So(err, ShouldBeNil) + So(roles, ShouldHaveLength, 3) + + So(roles[0].Type, ShouldEqual, "space_developer") + So(roles[1].Type, ShouldEqual, "space_auditor") + So(roles[2].Type, ShouldEqual, "space_manager") + + So(roles[0].GUID, ShouldEqual, "roleGUID1") + So(roles[0].Relationships["user"].Data.GUID, ShouldEqual, "userGUID1") + So(roles[0].Relationships["space"].Data.GUID, ShouldEqual, "spaceGUID1") + So(roles[0].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/roles/roleGUID1") + So(roles[1].GUID, ShouldEqual, "roleGUID2") + So(roles[1].Relationships["user"].Data.GUID, ShouldEqual, "userGUID2") + So(roles[1].Relationships["space"].Data.GUID, ShouldEqual, "spaceGUID1") + So(roles[1].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/roles/roleGUID2") + So(roles[2].GUID, ShouldEqual, "roleGUID3") + So(roles[2].Relationships["user"].Data.GUID, ShouldEqual, "userGUID2") + So(roles[2].Relationships["space"].Data.GUID, ShouldEqual, "spaceGUID1") + So(roles[2].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/roles/roleGUID3") + }) + + Convey("List V3 Space Roles By User GUID", t, func() { + setup(MockRoute{"GET", "/v3/roles", []string{listV3SpaceRolesByUserGuidPayload}, "", http.StatusOK, "user_guids=userGUID1", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + query := url.Values{} + query["user_guids"] = []string{"userGUID1"} + + roles, err := client.ListV3RolesByQuery(query) + So(err, ShouldBeNil) + So(roles, ShouldHaveLength, 2) + + So(roles[0].Type, ShouldEqual, "space_developer") + So(roles[1].Type, ShouldEqual, "space_manager") + + So(roles[0].GUID, ShouldEqual, "roleGUID1") + So(roles[0].Relationships["user"].Data.GUID, ShouldEqual, "userGUID1") + So(roles[0].Relationships["space"].Data.GUID, ShouldEqual, "spaceGUID1") + So(roles[0].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/roles/roleGUID1") + So(roles[1].GUID, ShouldEqual, "roleGUID4") + So(roles[1].Relationships["user"].Data.GUID, ShouldEqual, "userGUID1") + So(roles[1].Relationships["space"].Data.GUID, ShouldEqual, "spaceGUID2") + So(roles[1].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/roles/roleGUID4") + }) + + Convey("List V3 Space Users By Space Guid and User GUID", t, func() { + setup(MockRoute{"GET", "/v3/roles", []string{listV3spaceRolesBySpaceAndUserGuidPayload}, "", http.StatusOK, "space_guids=spaceGUID2&user_guids=userGUID1", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + query := url.Values{} + query["space_guids"] = []string{"spaceGUID2"} + query["user_guids"] = []string{"userGUID1"} + + roles, err := client.ListV3RolesByQuery(query) + So(err, ShouldBeNil) + So(roles, ShouldHaveLength, 1) + + So(roles[0].Type, ShouldEqual, "space_manager") + + So(roles[0].GUID, ShouldEqual, "roleGUID4") + So(roles[0].Relationships["user"].Data.GUID, ShouldEqual, "userGUID1") + So(roles[0].Relationships["space"].Data.GUID, ShouldEqual, "spaceGUID2") + So(roles[0].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/roles/roleGUID4") + }) + +} + +func TestListV3SpaceRolesByGUID(t *testing.T) { + Convey("List V3 Space Roles By Space GUID and type", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/roles", []string{listV3SpaceRoleUsersBySpaceGUIDPayload}, "", http.StatusOK, "include=user&space_guids=spaceGUID1", nil}, + {"GET", "/v3/rolespage2", []string{listV3SpaceRoleUsersBySpaceGUIDPayloadPage2}, "", http.StatusOK, "page=2&per_page=2&include=user&space_guids=spaceGUID1", nil}, + } + setupMultiple(mocks, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + roles, users, err := client.ListV3SpaceRolesByGUID("spaceGUID1") + So(err, ShouldBeNil) + So(roles, ShouldHaveLength, 3) + So(users, ShouldHaveLength, 3) + + So(users[0].Username, ShouldEqual, "user1") + So(users[1].Username, ShouldEqual, "user2") + So(users[2].Username, ShouldEqual, "user3") + }) +} + +func TestListV3SpaceRolesByGUIDAndType(t *testing.T) { + Convey("List V3 Space Roles By Space GUID and type", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/roles", []string{listV3SpaceRolesBySpaceGUIDAndTypePayload}, "", http.StatusOK, "include=user&space_guids=spaceGUID1&types=space_supporter", nil}, + {"GET", "/v3/rolespage2", []string{listV3SpaceRolesBySpaceGuidAndTypePayloadPage2}, "", http.StatusOK, "page=2&per_page=2&include=user&space_guids=spaceGUID1&types=space_supporter", nil}, + } + setupMultiple(mocks, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + users, err := client.ListV3SpaceRolesByGUIDAndType("spaceGUID1", "space_supporter") + So(err, ShouldBeNil) + So(users, ShouldHaveLength, 3) + + So(users[0].Username, ShouldEqual, "user1") + So(users[1].Username, ShouldEqual, "user2") + So(users[2].Username, ShouldEqual, "user3") + }) +} + +func TestListV3OrgRolesByGUID(t *testing.T) { + Convey("List V3 Org Roles By Org GUID and type", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/roles", []string{listV3OrganizationRolesByOrganizationGUIDPayload}, "", http.StatusOK, "include=user&organization_guids=orgGUID1", nil}, + {"GET", "/v3/rolespage2", []string{listV3OrganizationRolesByOrganizationGuidPayloadPage2}, "", http.StatusOK, "page=2&per_page=2&include=user&organization_guids=orgGUID1", nil}, + } + setupMultiple(mocks, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + roles, users, err := client.ListV3OrganizationRolesByGUID("orgGUID1") + So(err, ShouldBeNil) + So(roles, ShouldHaveLength, 3) + So(users, ShouldHaveLength, 3) + + So(users[0].Username, ShouldEqual, "user1") + So(users[1].Username, ShouldEqual, "user2") + So(users[2].Username, ShouldEqual, "user3") + }) +} + +func TestListV3OrgRolesByGUIDAndType(t *testing.T) { + Convey("List V3 Org Roles By Org GUID and type", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/roles", []string{listV3OrganizationRolesByOrganizationGUIDAndTypePayload}, "", http.StatusOK, "include=user&organization_guids=orgGUID1&types=organization_auditor", nil}, + {"GET", "/v3/rolespage2", []string{listV3OrganizationRolesByOrganizationGuidAndTypePayloadPage2}, "", http.StatusOK, "page=2&per_page=2&include=user&organization_guids=orgGUID1&types=organization_auditor", nil}, + } + setupMultiple(mocks, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + users, err := client.ListV3OrganizationRolesByGUIDAndType("orgGUID1", "organization_auditor") + So(err, ShouldBeNil) + So(users, ShouldHaveLength, 3) + + So(users[0].Username, ShouldEqual, "user1") + So(users[1].Username, ShouldEqual, "user2") + So(users[2].Username, ShouldEqual, "user3") + }) +} + +func TestCreateV3SpaceRoles(t *testing.T) { + Convey("Create V3 Space Role", t, func() { + setup(MockRoute{"POST", "/v3/roles", []string{createV3SpaceRolePayload}, "", http.StatusCreated, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + role, err := client.CreateV3SpaceRole( + "b40a40c8-58b7-49a0-b47d-9d6fe5d72905", + "c4958204-6b65-43ea-832b-e4c57aea6641", + "space_supporter", + ) + So(err, ShouldBeNil) + So(role.Type, ShouldEqual, "space_supporter") + So(role.GUID, ShouldEqual, "b9f59ab2-2b09-438e-bebb-30e8704ffb89") + So(role.Links["self"].Href, ShouldEqual, "https://api.example.org/v3/roles/b9f59ab2-2b09-438e-bebb-30e8704ffb89") + So(role.Links["user"].Href, ShouldEqual, "https://api.example.org/v3/users/c4958204-6b65-43ea-832b-e4c57aea6641") + So(role.Links["space"].Href, ShouldEqual, "https://api.example.org/v3/spaces/b40a40c8-58b7-49a0-b47d-9d6fe5d72905") + }) +} + +func TestCreateV3OrgRoles(t *testing.T) { + Convey("Create V3 Org Role", t, func() { + setup(MockRoute{"POST", "/v3/roles", []string{createV3OrganizationRolePayload}, "", http.StatusCreated, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + role, err := client.CreateV3OrganizationRole( + "fa8a8346-0d92-4729-870c-77ee1934f973", + "ac2e02c9-2c5c-4712-a620-a68449d263c3", + "organization_user", + ) + So(err, ShouldBeNil) + So(role.Type, ShouldEqual, "organization_user") + So(role.GUID, ShouldEqual, "21cbfaeb-bff7-4cfd-a7a9-6c13ec76f246") + So(role.Links["self"].Href, ShouldEqual, "https://api.example.org/v3/roles/21cbfaeb-bff7-4cfd-a7a9-6c13ec76f246") + So(role.Links["user"].Href, ShouldEqual, "https://api.example.org/v3/users/ac2e02c9-2c5c-4712-a620-a68449d263c3") + So(role.Links["organization"].Href, ShouldEqual, "https://api.example.org/v3/organizations/fa8a8346-0d92-4729-870c-77ee1934f973") + }) +} + +func TestDeleteV3Role(t *testing.T) { + Convey("Delete V3 Role", t, func() { + setup(MockRoute{"DELETE", "/v3/roles/1cb006ee-fb05-47e1-b541-c34179ddc446", []string{""}, "", http.StatusAccepted, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteV3Role("1cb006ee-fb05-47e1-b541-c34179ddc446") + So(err, ShouldBeNil) + }) +} diff --git a/third_party/go-cfclient/v3routes.go b/third_party/go-cfclient/v3routes.go new file mode 100644 index 000000000000..fe16f22e2058 --- /dev/null +++ b/third_party/go-cfclient/v3routes.go @@ -0,0 +1,133 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/pkg/errors" +) + +type V3Route struct { + Guid string `json:"guid"` + Host string `json:"host"` + Path string `json:"path"` + Url string `json:"url"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + Metadata Metadata `json:"metadata"` + Destinations []Destination `json:"destinations"` + Relationships map[string]V3ToOneRelationship `json:"relationships"` + Links map[string]Link `json:"links"` +} + +type listV3RouteResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3Route `json:"resources,omitempty"` +} + +type Destination struct { + GUID string `json:"guid"` + App struct { + GUID string `json:"guid"` + Process struct { + Type string `json:"type"` + } `json:"process"` + } `json:"app"` + Weight interface{} `json:"weight"` + Port int `json:"port"` + Protocol string `json:"protocol"` +} + +func (c *Client) ListV3Routes() ([]V3Route, error) { + return c.ListV3RoutesByQuery(nil) +} + +func (c *Client) ListV3RoutesByQuery(query url.Values) ([]V3Route, error) { + var routes []V3Route + requestURL := "/v3/routes" + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + + for { + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 service instances") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error listing v3 service instances, response code: %d", resp.StatusCode) + } + + var data listV3RouteResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 service instances") + } + + routes = append(routes, data.Resources...) + + requestURL = data.Pagination.Next.Href + if requestURL == "" || query.Get("page") != "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, errors.Wrap(err, "Error parsing the next page request url for v3 service instances") + } + } + + return routes, nil +} + +type CreateV3RouteOptionalParameters struct { + Host string `json:"host,omitempty"` + Path string `json:"path,omitempty"` + Metadata Metadata `json:"metadata,omitempty"` +} + +type routeRelationships struct { + Space V3ToOneRelationship `json:"space"` + Domain V3ToOneRelationship `json:"domain"` +} + +type createV3RouteRequest struct { + Relationships routeRelationships `json:"relationships"` + *CreateV3RouteOptionalParameters +} + +func (c *Client) CreateV3Route( + spaceGUID string, + domainGUID string, + opt *CreateV3RouteOptionalParameters, +) (*V3Route, error) { + + spaceRel := V3ToOneRelationship{Data: V3Relationship{GUID: spaceGUID}} + domainRel := V3ToOneRelationship{Data: V3Relationship{GUID: domainGUID}} + + req := c.NewRequest("POST", "/v3/routes") + req.obj = createV3RouteRequest{ + Relationships: routeRelationships{Space: spaceRel, Domain: domainRel}, + CreateV3RouteOptionalParameters: opt, + } + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while creating v3 route") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("error creating v3 route, response code: %d", resp.StatusCode) + } + + var route V3Route + if err := json.NewDecoder(resp.Body).Decode(&route); err != nil { + return nil, errors.Wrap(err, "Error reading v3 app package") + } + + return &route, nil +} diff --git a/third_party/go-cfclient/v3routes_test.go b/third_party/go-cfclient/v3routes_test.go new file mode 100644 index 000000000000..8afd8f495851 --- /dev/null +++ b/third_party/go-cfclient/v3routes_test.go @@ -0,0 +1,61 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListV3Routes(t *testing.T) { + Convey("List V3 Routes", t, func() { + setup(MockRoute{"GET", "/v3/routes", []string{listV3RoutesPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + routes, err := client.ListV3Routes() + So(err, ShouldBeNil) + So(routes, ShouldHaveLength, 1) + + So(routes[0].Host, ShouldEqual, "a-hostname") + So(routes[0].Path, ShouldEqual, "/some_path") + So(routes[0].Url, ShouldEqual, "a-hostname.a-domain.com/some_path") + + So(routes[0].Relationships["space"].Data.GUID, ShouldEqual, "885a8cb3-c07b-4856-b448-eeb10bf36236") + So(routes[0].Relationships["domain"].Data.GUID, ShouldEqual, "0b5f3633-194c-42d2-9408-972366617e0e") + + So(routes[0].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/routes/cbad697f-cac1-48f4-9017-ac08f39dfb31") + So(routes[0].Links["space"].Href, ShouldEqual, "https://api.example.org/v3/spaces/885a8cb3-c07b-4856-b448-eeb10bf36236") + So(routes[0].Links["domain"].Href, ShouldEqual, "https://api.example.org/v3/domains/0b5f3633-194c-42d2-9408-972366617e0e") + So(routes[0].Links["destinations"].Href, ShouldEqual, "https://api.example.org/v3/routes/cbad697f-cac1-48f4-9017-ac08f39dfb31/destinations") + }) +} + +func TestCreateV3Routes(t *testing.T) { + Convey("Create V3 Route", t, func() { + setup(MockRoute{"POST", "/v3/routes", []string{createV3RoutePayload}, "", http.StatusCreated, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + route, err := client.CreateV3Route( + "885a8cb3-c07b-4856-b448-eeb10bf36236", + "0b5f3633-194c-42d2-9408-972366617e0e", + nil, + ) + So(err, ShouldBeNil) + So(route.Host, ShouldEqual, "a-hostname") + So(route.Path, ShouldEqual, "/some_path") + So(route.Relationships["space"].Data.GUID, ShouldEqual, "885a8cb3-c07b-4856-b448-eeb10bf36236") + So(route.Relationships["domain"].Data.GUID, ShouldEqual, "0b5f3633-194c-42d2-9408-972366617e0e") + So(route.Links["self"].Href, ShouldEqual, "https://api.example.org/v3/routes/cbad697f-cac1-48f4-9017-ac08f39dfb31") + So(route.Links["space"].Href, ShouldEqual, "https://api.example.org/v3/spaces/885a8cb3-c07b-4856-b448-eeb10bf36236") + So(route.Links["domain"].Href, ShouldEqual, "https://api.example.org/v3/domains/0b5f3633-194c-42d2-9408-972366617e0e") + So(route.Links["destinations"].Href, ShouldEqual, "https://api.example.org/v3/routes/cbad697f-cac1-48f4-9017-ac08f39dfb31/destinations") + }) +} diff --git a/third_party/go-cfclient/v3security_groups.go b/third_party/go-cfclient/v3security_groups.go new file mode 100644 index 000000000000..57c9f4d25d88 --- /dev/null +++ b/third_party/go-cfclient/v3security_groups.go @@ -0,0 +1,195 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +// V3SecurityGroup implements the security group object. Security groups are collections of egress traffic rules that can be applied to the staging or running state of applications. +type V3SecurityGroup struct { + Name string `json:"name,omitempty"` + GUID string `json:"guid,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + GloballyEnabled V3GloballyEnabled `json:"globally_enabled,omitempty"` + Rules []V3Rule `json:"rules,omitempty"` + Relationships map[string]V3ToManyRelationships `json:"relationships,omitempty"` + Links map[string]Link `json:"links,omitempty"` +} + +// V3GloballyEnabled object controls if the group is applied globally to the lifecycle of all applications +type V3GloballyEnabled struct { + Running bool `json:"running,omitempty"` + Staging bool `json:"staging,omitempty"` +} + +// V3Rule is an object that provide a rule that will be applied by a security group +type V3Rule struct { + Protocol string `json:"protocol,omitempty"` + Destination string `json:"destination,omitempty"` + Ports string `json:"ports,omitempty"` + Type *int `json:"type,omitempty"` + Code *int `json:"code,omitempty"` + Description string `json:"description,omitempty"` + Log bool `json:"log,omitempty"` +} + +type listV3SecurityGroupResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3SecurityGroup `json:"resources,omitempty"` +} + +// ListV3SecurityGroupsByQuery retrieves security groups based on query +func (c *Client) ListV3SecurityGroupsByQuery(query url.Values) ([]V3SecurityGroup, error) { + var securityGroups []V3SecurityGroup + requestURL, err := url.Parse("/v3/security_groups") + if err != nil { + return nil, err + } + requestURL.RawQuery = query.Encode() + + for { + r := c.NewRequest("GET", fmt.Sprintf("%s?%s", requestURL.Path, requestURL.RawQuery)) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 security groups") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 security groups, response code: %d", resp.StatusCode) + } + + var data listV3SecurityGroupResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 security groups") + } + + securityGroups = append(securityGroups, data.Resources...) + + requestURL, err = url.Parse(data.Pagination.Next.Href) + if err != nil { + return nil, errors.Wrap(err, "Error parsing next page URL") + } + if requestURL.String() == "" { + break + } + } + + return securityGroups, nil +} + +// CreateV3SecurityGroupRequest implements an object that is passed to CreateV3SecurityGroup method +type CreateV3SecurityGroupRequest struct { + Name string `json:"name"` + GloballyEnabled *V3GloballyEnabled `json:"globally_enabled,omitempty"` + Rules []*V3Rule `json:"rules,omitempty"` + Relationships map[string]V3ToManyRelationships `json:"relationships,omitempty"` +} + +// CreateV3SecurityGroup creates security group from CreateV3SecurityGroupRequest +func (c *Client) CreateV3SecurityGroup(r CreateV3SecurityGroupRequest) (*V3SecurityGroup, error) { + req := c.NewRequest("POST", "/v3/security_groups") + + buf := bytes.NewBuffer(nil) + enc := json.NewEncoder(buf) + if err := enc.Encode(r); err != nil { + return nil, err + } + req.body = buf + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while creating v3 security group") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("Error creating v3 security group %s, response code: %d", r.Name, resp.StatusCode) + } + + var securitygroup V3SecurityGroup + if err := json.NewDecoder(resp.Body).Decode(&securitygroup); err != nil { + return nil, errors.Wrap(err, "Error reading v3 security group JSON") + } + + return &securitygroup, nil +} + +// DeleteV3SecurityGroup deletes security group by GUID +func (c *Client) DeleteV3SecurityGroup(GUID string) error { + req := c.NewRequest("DELETE", "/v3/security_groups/"+GUID) + + resp, err := c.DoRequest(req) + if err != nil { + return errors.Wrap(err, "Error while deleting v3 security group") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error deleting v3 security group with GUID [%s], response code: %d", GUID, resp.StatusCode) + } + return nil +} + +// UpdateV3SecurityGroupRequest implements an object that is passed to UpdateV3SecurityGroup method +type UpdateV3SecurityGroupRequest struct { + Name string `json:"name,omitempty"` + GloballyEnabled *V3GloballyEnabled `json:"globally_enabled,omitempty"` + Rules []*V3Rule `json:"rules,omitempty"` +} + +// UpdateV3SecurityGroup updates security group by GUID and from UpdateV3SecurityGroupRequest +func (c *Client) UpdateV3SecurityGroup(GUID string, r UpdateV3SecurityGroupRequest) (*V3SecurityGroup, error) { + req := c.NewRequest("PATCH", "/v3/security_groups/"+GUID) + buf := bytes.NewBuffer(nil) + enc := json.NewEncoder(buf) + if err := enc.Encode(r); err != nil { + return nil, err + } + req.body = buf + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while updating v3 security group") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error updating v3 security group %s, response code: %d", GUID, resp.StatusCode) + } + + var securityGroup V3SecurityGroup + if err := json.NewDecoder(resp.Body).Decode(&securityGroup); err != nil { + return nil, errors.Wrap(err, "Error reading v3 security group JSON") + } + + return &securityGroup, nil +} + +// GetV3SecurityGroupByGUID retrieves security group base on provided GUID +func (c *Client) GetV3SecurityGroupByGUID(GUID string) (*V3SecurityGroup, error) { + req := c.NewRequest("GET", "/v3/security_groups/"+GUID) + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while getting v3 security group") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error getting v3 security group with GUID [%s], response code: %d", GUID, resp.StatusCode) + } + + var securityGroup V3SecurityGroup + if err := json.NewDecoder(resp.Body).Decode(&securityGroup); err != nil { + return nil, errors.Wrap(err, "Error reading v3 security group JSON") + } + + return &securityGroup, nil +} diff --git a/third_party/go-cfclient/v3security_groups_test.go b/third_party/go-cfclient/v3security_groups_test.go new file mode 100644 index 000000000000..e263cbad3e57 --- /dev/null +++ b/third_party/go-cfclient/v3security_groups_test.go @@ -0,0 +1,417 @@ +package cfclient + +import ( + "bytes" + "encoding/json" + "net/http" + "net/url" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListV3SecurityGroupsByQuery(t *testing.T) { + Convey("List All V3 Security Groups", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/security_groups", []string{listV3SecurityGroupsPayload}, "", http.StatusOK, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + securityGroups, err := client.ListV3SecurityGroupsByQuery(nil) + So(err, ShouldBeNil) + So(securityGroups, ShouldHaveLength, 2) + + So(securityGroups[0].Name, ShouldEqual, "my-group1") + So(securityGroups[0].GUID, ShouldEqual, "guid-1") + So(securityGroups[1].Name, ShouldEqual, "my-group2") + So(securityGroups[1].GUID, ShouldEqual, "guid-2") + + So(securityGroups[0].GloballyEnabled.Running, ShouldEqual, true) + So(securityGroups[0].Rules[0].Protocol, ShouldEqual, "tcp") + So(securityGroups[0].Rules[0].Destination, ShouldEqual, "1.2.3.4/10") + So(securityGroups[0].Rules[0].Ports, ShouldEqual, "443,80,8080") + So(*securityGroups[0].Rules[1].Type, ShouldEqual, 8) + So(*securityGroups[0].Rules[1].Code, ShouldEqual, 0) + So(securityGroups[0].Rules[1].Description, ShouldEqual, "test-desc-1") + So(securityGroups[0].Relationships["staging_spaces"].Data[0].GUID, ShouldEqual, "space-guid-1") + So(securityGroups[0].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/security_groups/guid-1") + So(securityGroups[1].GloballyEnabled.Staging, ShouldEqual, true) + So(securityGroups[1].Rules[1].Protocol, ShouldEqual, "icmp") + So(securityGroups[1].Rules[1].Destination, ShouldEqual, "1.2.3.4/16") + So(securityGroups[1].Rules[0].Ports, ShouldEqual, "443,80,8080") + So(*securityGroups[1].Rules[1].Type, ShouldEqual, 5) + So(*securityGroups[1].Rules[1].Code, ShouldEqual, 0) + So(securityGroups[1].Rules[1].Description, ShouldEqual, "test-desc-2") + So(securityGroups[1].Relationships["running_spaces"].Data[0].GUID, ShouldEqual, "space-guid-5") + So(securityGroups[1].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/security_groups/guid-2") + }) + + Convey("List V3 Security Groups By GUID", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/security_groups", []string{listV3SecurityGroupsByGuidPayload}, "", http.StatusOK, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + query := url.Values{} + query["guids"] = []string{"guid-1"} + + securityGroups, err := client.ListV3SecurityGroupsByQuery(query) + So(err, ShouldBeNil) + So(securityGroups, ShouldHaveLength, 1) + + So(securityGroups[0].Name, ShouldEqual, "my-group1") + So(securityGroups[0].GUID, ShouldEqual, "guid-1") + + So(securityGroups[0].GloballyEnabled.Running, ShouldEqual, true) + So(securityGroups[0].Rules[0].Protocol, ShouldEqual, "tcp") + So(securityGroups[0].Rules[0].Destination, ShouldEqual, "1.2.3.4/10") + So(securityGroups[0].Rules[0].Ports, ShouldEqual, "443,80,8080") + So(*securityGroups[0].Rules[1].Type, ShouldEqual, 8) + So(*securityGroups[0].Rules[1].Code, ShouldEqual, 0) + So(securityGroups[0].Rules[1].Description, ShouldEqual, "test-desc-1") + So(securityGroups[0].Relationships["staging_spaces"].Data[0].GUID, ShouldEqual, "space-guid-1") + So(securityGroups[0].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/security_groups/guid-1") + }) +} + +func TestCreateV3SecurityGroup(t *testing.T) { + Convey("Create V3 Security Group With Minimal Parameters", t, func() { + expectedRequestBody := `{"name":"my-sec-group"}` + expectedResponseBody := `{"guid":"guid-1", "name":"my-sec-group", "globally_enabled": {"running": false,"staging": false}, "rules": []}` + setup(MockRoute{"POST", "/v3/security_groups", []string{expectedResponseBody}, "", http.StatusCreated, "", &expectedRequestBody}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + securityGroups, err := client.CreateV3SecurityGroup(CreateV3SecurityGroupRequest{ + Name: "my-sec-group", + }) + So(err, ShouldBeNil) + So(securityGroups, ShouldNotBeNil) + So(securityGroups.GUID, ShouldEqual, "guid-1") + So(securityGroups.Name, ShouldEqual, "my-sec-group") + So(securityGroups.GloballyEnabled.Running, ShouldEqual, false) + So(securityGroups.GloballyEnabled.Staging, ShouldEqual, false) + So(len(securityGroups.Rules), ShouldEqual, 0) + }) + + Convey("Create V3 Security Group With Optional Parameters", t, func() { + requestBody := `{ + "name": "my-sec-group", + "globally_enabled": { + "running": true + }, + "rules": [ + { + "protocol": "tcp", + "destination": "10.10.10.0/24", + "ports": "443,80,8080" + }, + { + "protocol": "icmp", + "destination": "10.10.11.0/24", + "type": 8, + "code": 0, + "description": "Allow ping requests to private services" + } + ], + "relationships": { + "running_spaces": { + "data": [ + { + "guid": "space-guid-1" + }, + { + "guid": "space-guid-2" + } + ] + } + } + }` + buffer := new(bytes.Buffer) + err := json.Compact(buffer, []byte(requestBody)) + So(err, ShouldBeNil) + expectedRequestBody := buffer.String() + setup(MockRoute{"POST", "/v3/security_groups", []string{genericV3SecurityGroupPayload}, "", http.StatusCreated, "", &expectedRequestBody}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + icmpType := 8 + icmpCode := 0 + createV3SecGroupRequest := CreateV3SecurityGroupRequest{ + Name: "my-sec-group", + GloballyEnabled: &V3GloballyEnabled{ + Running: true, + Staging: false, + }, + Rules: []*V3Rule{ + { + Protocol: "tcp", + Destination: "10.10.10.0/24", + Ports: "443,80,8080", + }, + { + Protocol: "icmp", + Destination: "10.10.11.0/24", + Type: &icmpType, + Code: &icmpCode, + Description: "Allow ping requests to private services", + }, + }, + Relationships: map[string]V3ToManyRelationships{ + "running_spaces": { + Data: []V3Relationship{ + { + GUID: "space-guid-1", + }, + { + GUID: "space-guid-2", + }, + }, + }, + }, + } + + securityGroups, err := client.CreateV3SecurityGroup(createV3SecGroupRequest) + So(err, ShouldBeNil) + So(securityGroups, ShouldNotBeNil) + So(securityGroups.GUID, ShouldEqual, "guid-1") + So(securityGroups.Name, ShouldEqual, "my-sec-group") + So(securityGroups.GloballyEnabled.Running, ShouldEqual, true) + So(securityGroups.GloballyEnabled.Staging, ShouldEqual, false) + So(securityGroups.Rules[0].Protocol, ShouldEqual, "tcp") + So(securityGroups.Rules[0].Destination, ShouldEqual, "10.10.10.0/24") + So(securityGroups.Rules[0].Ports, ShouldEqual, "443,80,8080") + So(securityGroups.Rules[1].Protocol, ShouldEqual, "icmp") + So(securityGroups.Rules[1].Destination, ShouldEqual, "10.10.11.0/24") + So(*securityGroups.Rules[1].Type, ShouldEqual, 8) + So(*securityGroups.Rules[1].Code, ShouldEqual, 0) + So(securityGroups.Rules[1].Description, ShouldEqual, "Allow ping requests to private services") + So(len(securityGroups.Relationships["staging_spaces"].Data), ShouldEqual, 0) + So(securityGroups.Relationships["running_spaces"].Data[0].GUID, ShouldEqual, "space-guid-1") + So(securityGroups.Relationships["running_spaces"].Data[1].GUID, ShouldEqual, "space-guid-2") + So(securityGroups.Links["self"].Href, ShouldEqual, "https://api.example.org/v3/security_groups/guid-1") + }) + Convey("Create V3 Security Group with empty icmp type and code and no name", t, func() { + expectedRequestBody := `{"name":"","rules":[{"protocol":"icmp","destination":"10.10.11.0/24"}]}` + expectedResponseBody := `{ + "errors": [ + { + "code": 10008, + "detail": "Rules[0]: code is required for protocols of type ICMP, Rules[0]: code must be an integer between -1 and 255 (inclusive), Rules[0]: type is required for protocols of type ICMP, Rules[0]: type must be an integer between -1 and 255 (inclusive), Name can't be blank, Name must be a string", + "title": "CF-UnprocessableEntity" + } + ] + }` + setup(MockRoute{"POST", "/v3/security_groups", []string{expectedResponseBody}, "", http.StatusUnprocessableEntity, "", &expectedRequestBody}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + _, err = client.CreateV3SecurityGroup(CreateV3SecurityGroupRequest{ + Rules: []*V3Rule{ + { + Protocol: "icmp", + Destination: "10.10.11.0/24", + }, + }, + }) + So(err, ShouldNotBeNil) + So(err.Error(), ShouldContainSubstring, "code is required for protocols of type ICMP") + So(err.Error(), ShouldContainSubstring, "type is required for protocols of type ICMP") + So(err.Error(), ShouldContainSubstring, "Name can't be blank, Name must be a string") + + }) +} + +func TestDeleteV3SecurityGroup(t *testing.T) { + Convey("Delete V3 Security Group", t, func() { + setup(MockRoute{"DELETE", "/v3/security_groups/security-group-guid", []string{""}, "", http.StatusAccepted, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteV3SecurityGroup("security-group-guid") + So(err, ShouldBeNil) + }) +} + +func TestUpdateV3SecurityGroup(t *testing.T) { + Convey("Update V3 Security Group with empty type and code", t, func() { + expectedRequestBody := `{"rules":[{"protocol":"icmp","destination":"10.10.11.0/24"}]}` + expectedResponseBody := `{ + "errors": [ + { + "code": 10008, + "detail": "Rules[0]: code is required for protocols of type ICMP, Rules[0]: code must be an integer between -1 and 255 (inclusive), Rules[0]: type is required for protocols of type ICMP, Rules[0]: type must be an integer between -1 and 255 (inclusive)", + "title": "CF-UnprocessableEntity" + } + ] + }` + setup(MockRoute{"PATCH", "/v3/security_groups/guid-1", []string{expectedResponseBody}, "", http.StatusUnprocessableEntity, "", &expectedRequestBody}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + _, err = client.UpdateV3SecurityGroup("guid-1", UpdateV3SecurityGroupRequest{ + Rules: []*V3Rule{ + { + Protocol: "icmp", + Destination: "10.10.11.0/24", + }, + }, + }) + So(err, ShouldNotBeNil) + So(err.Error(), ShouldContainSubstring, "code is required for protocols of type ICMP") + So(err.Error(), ShouldContainSubstring, "type is required for protocols of type ICMP") + }) + + Convey("Update name of V3 Security Group", t, func() { + expectedRequestBody := `{"name":"my-sec-group"}` + expectedResponseBody := `{"guid":"guid-1", "name":"my-sec-group", "globally_enabled": {"running": false,"staging": false}, "rules": []}` + setup(MockRoute{"PATCH", "/v3/security_groups/guid-1", []string{expectedResponseBody}, "", http.StatusOK, "", &expectedRequestBody}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + securityGroups, err := client.UpdateV3SecurityGroup("guid-1", UpdateV3SecurityGroupRequest{ + Name: "my-sec-group", + }) + So(err, ShouldBeNil) + So(securityGroups, ShouldNotBeNil) + So(securityGroups.GUID, ShouldEqual, "guid-1") + So(securityGroups.Name, ShouldEqual, "my-sec-group") + So(securityGroups.GloballyEnabled.Running, ShouldEqual, false) + So(securityGroups.GloballyEnabled.Staging, ShouldEqual, false) + So(len(securityGroups.Rules), ShouldEqual, 0) + }) + + Convey("Update V3 Security Group With Optional Parameters", t, func() { + requestBody := `{ + "name": "my-sec-group", + "globally_enabled": { + "running": true + }, + "rules": [ + { + "protocol": "tcp", + "destination": "10.10.10.0/24", + "ports": "443,80,8080" + }, + { + "protocol": "icmp", + "destination": "10.10.11.0/24", + "type": 8, + "code": 0, + "description": "Allow ping requests to private services" + } + ] + }` + buffer := new(bytes.Buffer) + err := json.Compact(buffer, []byte(requestBody)) + So(err, ShouldBeNil) + expectedRequestBody := buffer.String() + setup(MockRoute{"PATCH", "/v3/security_groups/guid-1", []string{genericV3SecurityGroupPayload}, "", http.StatusOK, "", &expectedRequestBody}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + icmpType := 8 + icmpCode := 0 + updateV3SecGroupRequest := UpdateV3SecurityGroupRequest{ + Name: "my-sec-group", + GloballyEnabled: &V3GloballyEnabled{ + Running: true, + Staging: false, + }, + Rules: []*V3Rule{ + { + Protocol: "tcp", + Destination: "10.10.10.0/24", + Ports: "443,80,8080", + }, + { + Protocol: "icmp", + Destination: "10.10.11.0/24", + Type: &icmpType, + Code: &icmpCode, + Description: "Allow ping requests to private services", + }, + }, + } + + securityGroups, err := client.UpdateV3SecurityGroup("guid-1", updateV3SecGroupRequest) + So(err, ShouldBeNil) + So(securityGroups, ShouldNotBeNil) + So(securityGroups.GUID, ShouldEqual, "guid-1") + So(securityGroups.Name, ShouldEqual, "my-sec-group") + So(securityGroups.GloballyEnabled.Running, ShouldEqual, true) + So(securityGroups.GloballyEnabled.Staging, ShouldEqual, false) + So(securityGroups.Rules[0].Protocol, ShouldEqual, "tcp") + So(securityGroups.Rules[0].Destination, ShouldEqual, "10.10.10.0/24") + So(securityGroups.Rules[0].Ports, ShouldEqual, "443,80,8080") + So(securityGroups.Rules[1].Protocol, ShouldEqual, "icmp") + So(securityGroups.Rules[1].Destination, ShouldEqual, "10.10.11.0/24") + So(*securityGroups.Rules[1].Type, ShouldEqual, 8) + So(*securityGroups.Rules[1].Code, ShouldEqual, 0) + So(securityGroups.Rules[1].Description, ShouldEqual, "Allow ping requests to private services") + So(len(securityGroups.Relationships["staging_spaces"].Data), ShouldEqual, 0) + So(securityGroups.Relationships["running_spaces"].Data[0].GUID, ShouldEqual, "space-guid-1") + So(securityGroups.Relationships["running_spaces"].Data[1].GUID, ShouldEqual, "space-guid-2") + So(securityGroups.Links["self"].Href, ShouldEqual, "https://api.example.org/v3/security_groups/guid-1") + }) +} + +func TestGetV3SecurityGroup(t *testing.T) { + Convey("Get V3 Security Group", t, func() { + setup(MockRoute{"GET", "/v3/security_groups/guid-1", []string{genericV3SecurityGroupPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + securityGroup, err := client.GetV3SecurityGroupByGUID("guid-1") + So(err, ShouldBeNil) + So(securityGroup, ShouldNotBeNil) + So(securityGroup.GUID, ShouldEqual, "guid-1") + So(securityGroup.Name, ShouldEqual, "my-sec-group") + So(securityGroup.GloballyEnabled.Running, ShouldEqual, true) + So(securityGroup.GloballyEnabled.Staging, ShouldEqual, false) + So(securityGroup.Rules[0].Protocol, ShouldEqual, "tcp") + So(securityGroup.Rules[0].Destination, ShouldEqual, "10.10.10.0/24") + So(securityGroup.Rules[0].Ports, ShouldEqual, "443,80,8080") + So(securityGroup.Rules[1].Protocol, ShouldEqual, "icmp") + So(securityGroup.Rules[1].Destination, ShouldEqual, "10.10.11.0/24") + So(*securityGroup.Rules[1].Type, ShouldEqual, 8) + So(*securityGroup.Rules[1].Code, ShouldEqual, 0) + So(securityGroup.Rules[1].Description, ShouldEqual, "Allow ping requests to private services") + So(len(securityGroup.Relationships["staging_spaces"].Data), ShouldEqual, 0) + So(securityGroup.Relationships["running_spaces"].Data[0].GUID, ShouldEqual, "space-guid-1") + So(securityGroup.Relationships["running_spaces"].Data[1].GUID, ShouldEqual, "space-guid-2") + So(securityGroup.Links["self"].Href, ShouldEqual, "https://api.example.org/v3/security_groups/guid-1") + }) +} diff --git a/third_party/go-cfclient/v3service_credential_bindings.go b/third_party/go-cfclient/v3service_credential_bindings.go new file mode 100644 index 000000000000..0a06c151a768 --- /dev/null +++ b/third_party/go-cfclient/v3service_credential_bindings.go @@ -0,0 +1,97 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/pkg/errors" +) + +// V3ServiceCredentialBindings implements the service credential binding object. a credential binding can be a binding between apps and a service instance or a service key +type V3ServiceCredentialBindings struct { + GUID string `json:"guid"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + Name string `json:"name"` + Type string `json:"type"` + LastOperation LastOperation `json:"last_operation"` + Metadata Metadata `json:"metadata"` + Relationships map[string]V3ToOneRelationship `json:"relationships,omitempty"` + Links map[string]Link `json:"links"` +} + +type listV3ServiceCredentialBindingsResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3ServiceCredentialBindings `json:"resources,omitempty"` +} + +// ListV3ServiceCredentialBindings retrieves all service credential bindings +func (c *Client) ListV3ServiceCredentialBindings() ([]V3ServiceCredentialBindings, error) { + return c.ListV3ServiceCredentialBindingsByQuery(nil) +} + +// ListV3ServiceCredentialBindingsByQuery retrieves service credential bindings using a query +func (c *Client) ListV3ServiceCredentialBindingsByQuery(query url.Values) ([]V3ServiceCredentialBindings, error) { + var svcCredentialBindings []V3ServiceCredentialBindings + requestURL := "/v3/service_credential_bindings" + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + + for { + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 service credential bindings") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error listing v3 service credential bindings, response code: %d", resp.StatusCode) + } + + var data listV3ServiceCredentialBindingsResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 service credential bindings") + } + + svcCredentialBindings = append(svcCredentialBindings, data.Resources...) + + requestURL = data.Pagination.Next.Href + if requestURL == "" || query.Get("page") != "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, errors.Wrap(err, "Error parsing the next page request url for v3 service credential bindings") + } + } + + return svcCredentialBindings, nil +} + +// GetV3ServiceCredentialBindingsByGUID retrieves the service credential binding based on the provided guid +func (c *Client) GetV3ServiceCredentialBindingsByGUID(GUID string) (*V3ServiceCredentialBindings, error) { + requestURL := fmt.Sprintf("/v3/service_credential_bindings/%s", GUID) + req := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(req) + + if err != nil { + return nil, errors.Wrap(err, "Error while getting v3 service credential binding") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error getting v3 service credential binding with GUID [%s], response code: %d", GUID, resp.StatusCode) + } + + var svcCredentialBindings V3ServiceCredentialBindings + if err := json.NewDecoder(resp.Body).Decode(&svcCredentialBindings); err != nil { + return nil, errors.Wrap(err, "Error reading v3 service credential binding JSON") + } + + return &svcCredentialBindings, nil +} diff --git a/third_party/go-cfclient/v3service_credential_bindings_test.go b/third_party/go-cfclient/v3service_credential_bindings_test.go new file mode 100644 index 000000000000..ca8f4829a270 --- /dev/null +++ b/third_party/go-cfclient/v3service_credential_bindings_test.go @@ -0,0 +1,51 @@ +package cfclient + +import ( + "fmt" + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListV3ServiceCredentialBindingsByQuery(t *testing.T) { + Convey("List V3 Service Credential Bindings", t, func() { + setup(MockRoute{"GET", "/v3/service_credential_bindings", []string{listV3ServiceCredentialBindingsPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceCredentialsBindings, err := client.ListV3ServiceCredentialBindings() + So(err, ShouldBeNil) + So(serviceCredentialsBindings, ShouldHaveLength, 1) + + So(serviceCredentialsBindings[0].Name, ShouldEqual, "my_service_key") + So(serviceCredentialsBindings[0].Type, ShouldEqual, "key") + + So(serviceCredentialsBindings[0].Relationships["service_instance"].Data.GUID, ShouldEqual, "85ccdcad-d725-4109-bca4-fd6ba062b5c8") + So(serviceCredentialsBindings[0].Links["service_instance"].Href, ShouldEqual, "https://api.example.org/v3/service_instances/85ccdcad-d725-4109-bca4-fd6ba062b5c8") + }) +} + +func TestGetV3ServiceCredentialBindingsByGUID(t *testing.T) { + Convey("Get V3 Service Credential Binding by GUID", t, func() { + GUID := "d9634934-8e1f-4c2d-bb33-fa5df019cf9d" + setup(MockRoute{"GET", fmt.Sprintf("/v3/service_credential_bindings/%s", GUID), []string{GetV3ServiceCredentialBindingsByGUIDPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + serviceCredentialsBinding, err := client.GetV3ServiceCredentialBindingsByGUID(GUID) + So(err, ShouldBeNil) + + So(serviceCredentialsBinding.Name, ShouldEqual, "my_service_key") + So(serviceCredentialsBinding.Type, ShouldEqual, "key") + + So(serviceCredentialsBinding.Relationships["service_instance"].Data.GUID, ShouldEqual, "85ccdcad-d725-4109-bca4-fd6ba062b5c8") + So(serviceCredentialsBinding.Links["service_instance"].Href, ShouldEqual, "https://api.example.org/v3/service_instances/85ccdcad-d725-4109-bca4-fd6ba062b5c8") + }) +} diff --git a/third_party/go-cfclient/v3service_instances.go b/third_party/go-cfclient/v3service_instances.go new file mode 100644 index 000000000000..43f42712d9dc --- /dev/null +++ b/third_party/go-cfclient/v3service_instances.go @@ -0,0 +1,69 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/pkg/errors" +) + +type V3ServiceInstance struct { + Guid string `json:"guid"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + Name string `json:"name"` + Relationships map[string]V3ToOneRelationship `json:"relationships,omitempty"` + Metadata Metadata `json:"metadata"` + Links map[string]Link `json:"links"` +} + +type listV3ServiceInstancesResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3ServiceInstance `json:"resources,omitempty"` +} + +func (c *Client) ListV3ServiceInstances() ([]V3ServiceInstance, error) { + return c.ListV3ServiceInstancesByQuery(nil) +} + +func (c *Client) ListV3ServiceInstancesByQuery(query url.Values) ([]V3ServiceInstance, error) { + var svcInstances []V3ServiceInstance + requestURL := "/v3/service_instances" + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + + for { + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 service instances") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error listing v3 service instances, response code: %d", resp.StatusCode) + } + + var data listV3ServiceInstancesResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 service instances") + } + + svcInstances = append(svcInstances, data.Resources...) + + requestURL = data.Pagination.Next.Href + if requestURL == "" || query.Get("page") != "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, errors.Wrap(err, "Error parsing the next page request url for v3 service instances") + } + } + + return svcInstances, nil +} diff --git a/third_party/go-cfclient/v3service_instances_test.go b/third_party/go-cfclient/v3service_instances_test.go new file mode 100644 index 000000000000..80ae9ef9e287 --- /dev/null +++ b/third_party/go-cfclient/v3service_instances_test.go @@ -0,0 +1,28 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListV3ServiceInstancesByQuery(t *testing.T) { + Convey("List V3 Service Instances", t, func() { + setup(MockRoute{"GET", "/v3/service_instances", []string{listV3ServiceInstancesPayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + services, err := client.ListV3ServiceInstances() + So(err, ShouldBeNil) + So(services, ShouldHaveLength, 1) + + So(services[0].Name, ShouldEqual, "my_service_instance") + + So(services[0].Relationships["space"].Data.GUID, ShouldEqual, "ae0031f9-dd49-461c-a945-df40e77c39cb") + So(services[0].Links["space"].Href, ShouldEqual, "https://api.example.org/v3/spaces/ae0031f9-dd49-461c-a945-df40e77c39cb") + }) +} diff --git a/third_party/go-cfclient/v3spaces.go b/third_party/go-cfclient/v3spaces.go new file mode 100644 index 000000000000..3f5e4da0e641 --- /dev/null +++ b/third_party/go-cfclient/v3spaces.go @@ -0,0 +1,228 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +type V3Space struct { + Name string `json:"name,omitempty"` + GUID string `json:"guid,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Relationships map[string]V3ToOneRelationship `json:"relationships,omitempty"` + Links map[string]Link `json:"links,omitempty"` + Metadata V3Metadata `json:"metadata,omitempty"` +} + +type CreateV3SpaceRequest struct { + Name string + OrgGUID string + Metadata *V3Metadata +} + +type UpdateV3SpaceRequest struct { + Name string + Metadata *V3Metadata +} + +type V3SpaceUsers struct { + Name string `json:"name,omitempty"` + GUID string `json:"guid,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Relationships map[string]V3ToOneRelationship `json:"relationships,omitempty"` + Links map[string]Link `json:"links,omitempty"` + Metadata V3Metadata `json:"metadata,omitempty"` +} + +func (c *Client) CreateV3Space(r CreateV3SpaceRequest) (*V3Space, error) { + req := c.NewRequest("POST", "/v3/spaces") + params := map[string]interface{}{ + "name": r.Name, + "relationships": map[string]interface{}{ + "organization": V3ToOneRelationship{ + Data: V3Relationship{ + GUID: r.OrgGUID, + }, + }, + }, + } + if r.Metadata != nil { + params["metadata"] = r.Metadata + } + + req.obj = params + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while creating v3 space") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusCreated { + return nil, fmt.Errorf("Error creating v3 space %s, response code: %d", r.Name, resp.StatusCode) + } + + var space V3Space + if err := json.NewDecoder(resp.Body).Decode(&space); err != nil { + return nil, errors.Wrap(err, "Error reading v3 space JSON") + } + + return &space, nil +} + +func (c *Client) GetV3SpaceByGUID(spaceGUID string) (*V3Space, error) { + req := c.NewRequest("GET", "/v3/spaces/"+spaceGUID) + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while getting v3 space") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error getting v3 space with GUID [%s], response code: %d", spaceGUID, resp.StatusCode) + } + + var space V3Space + if err := json.NewDecoder(resp.Body).Decode(&space); err != nil { + return nil, errors.Wrap(err, "Error reading v3 space JSON") + } + + return &space, nil +} + +func (c *Client) DeleteV3Space(spaceGUID string) error { + req := c.NewRequest("DELETE", "/v3/spaces/"+spaceGUID) + resp, err := c.DoRequest(req) + if err != nil { + return errors.Wrap(err, "Error while deleting v3 space") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusAccepted { + return fmt.Errorf("Error deleting v3 space with GUID [%s], response code: %d", spaceGUID, resp.StatusCode) + } + + return nil +} + +func (c *Client) UpdateV3Space(spaceGUID string, r UpdateV3SpaceRequest) (*V3Space, error) { + req := c.NewRequest("PATCH", "/v3/spaces/"+spaceGUID) + params := make(map[string]interface{}) + if r.Name != "" { + params["name"] = r.Name + } + if r.Metadata != nil { + params["metadata"] = r.Metadata + } + if len(params) > 0 { + req.obj = params + } + + resp, err := c.DoRequest(req) + if err != nil { + return nil, errors.Wrap(err, "Error while updating v3 space") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error updating v3 space %s, response code: %d", spaceGUID, resp.StatusCode) + } + + var space V3Space + if err := json.NewDecoder(resp.Body).Decode(&space); err != nil { + return nil, errors.Wrap(err, "Error reading v3 space JSON") + } + + return &space, nil +} + +type listV3SpacesResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3Space `json:"resources,omitempty"` +} + +func (c *Client) ListV3SpacesByQuery(query url.Values) ([]V3Space, error) { + var spaces []V3Space + requestURL := "/v3/spaces" + if e := query.Encode(); len(e) > 0 { + requestURL += "?" + e + } + + for { + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 spaces") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 spaces, response code: %d", resp.StatusCode) + } + + var data listV3SpacesResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 spaces") + } + + spaces = append(spaces, data.Resources...) + + requestURL = data.Pagination.Next.Href + if requestURL == "" || query.Get("page") != "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, errors.Wrap(err, "Error parsing the next page request url for v3 spaces") + } + } + + return spaces, nil +} + +type listV3SpaceUsersResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3User `json:"resources,omitempty"` +} + +// ListV3SpaceUsers lists users by space GUID +func (c *Client) ListV3SpaceUsers(spaceGUID string) ([]V3User, error) { + var users []V3User + requestURL := "/v3/spaces/" + spaceGUID + "/users" + + for { + r := c.NewRequest("GET", requestURL) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 space users") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 space users, response code: %d", resp.StatusCode) + } + + var data listV3SpaceUsersResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 space users") + } + users = append(users, data.Resources...) + + requestURL = data.Pagination.Next.Href + if requestURL == "" { + break + } + requestURL, err = extractPathFromURL(requestURL) + if err != nil { + return nil, errors.Wrap(err, "Error parsing the next page request url for v3 space users") + } + } + + return users, nil +} diff --git a/third_party/go-cfclient/v3spaces_test.go b/third_party/go-cfclient/v3spaces_test.go new file mode 100644 index 000000000000..79808a5e3d6f --- /dev/null +++ b/third_party/go-cfclient/v3spaces_test.go @@ -0,0 +1,143 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestCreateV3Space(t *testing.T) { + Convey("Create V3 Space", t, func() { + expectedBody := `{"name":"my-space","relationships":{"organization":{"data":{"guid":"org-guid"}}}}` + setup(MockRoute{"POST", "/v3/spaces", []string{createV3SpacePayload}, "", http.StatusCreated, "", &expectedBody}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + space, err := client.CreateV3Space(CreateV3SpaceRequest{ + Name: "my-space", + OrgGUID: "org-guid", + }) + So(err, ShouldBeNil) + So(space, ShouldNotBeNil) + + So(space.GUID, ShouldEqual, "space-guid") + So(space.Relationships["organization"].Data.GUID, ShouldEqual, "org-guid") + So(space.Links["organization"].Href, ShouldEqual, "https://api.example.org/v3/organizations/org-guid") + So(space.Metadata.Annotations, ShouldHaveLength, 0) + So(space.Metadata.Labels, ShouldContainKey, "SPACE_KEY") + So(space.Metadata.Labels["SPACE_KEY"], ShouldEqual, "space_value") + }) +} + +func TestGetV3Space(t *testing.T) { + Convey("Get V3 Space", t, func() { + setup(MockRoute{"GET", "/v3/spaces/space-guid", []string{getV3SpacePayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + space, err := client.GetV3SpaceByGUID("space-guid") + So(err, ShouldBeNil) + So(space, ShouldNotBeNil) + + So(space.GUID, ShouldEqual, "space-guid") + So(space.Relationships["organization"].Data.GUID, ShouldEqual, "org-guid") + So(space.Links["organization"].Href, ShouldEqual, "https://api.example.org/v3/organizations/org-guid") + So(space.Metadata.Annotations, ShouldHaveLength, 0) + So(space.Metadata.Labels, ShouldContainKey, "SPACE_KEY") + So(space.Metadata.Labels["SPACE_KEY"], ShouldEqual, "space_value") + }) +} + +func TestDeleteV3Space(t *testing.T) { + Convey("Delete V3 Space", t, func() { + setup(MockRoute{"DELETE", "/v3/spaces/space-guid", []string{""}, "", http.StatusAccepted, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + err = client.DeleteV3Space("space-guid") + So(err, ShouldBeNil) + }) +} + +func TestUpdateV3Space(t *testing.T) { + Convey("Update V3 Space", t, func() { + setup(MockRoute{"PATCH", "/v3/spaces/space-guid", []string{updateV3SpacePayload}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + space, err := client.UpdateV3Space("space-guid", UpdateV3SpaceRequest{ + Name: "my-space", + }) + So(err, ShouldBeNil) + So(space, ShouldNotBeNil) + + So(space.Name, ShouldEqual, "my-space") + So(space.GUID, ShouldEqual, "space-guid") + So(space.Relationships["organization"].Data.GUID, ShouldEqual, "org-guid") + So(space.Links["organization"].Href, ShouldEqual, "https://api.example.org/v3/organizations/org-guid") + So(space.Metadata.Annotations, ShouldHaveLength, 0) + So(space.Metadata.Labels, ShouldContainKey, "SPACE_KEY") + So(space.Metadata.Labels["SPACE_KEY"], ShouldEqual, "space_value") + }) +} + +func TestListV3SpacesByQuery(t *testing.T) { + Convey("List V3 Spaces", t, func() { + setup(MockRoute{"GET", "/v3/spaces", []string{listV3SpacesPayload, listV3SpacesPayloadPage2}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + spaces, err := client.ListV3SpacesByQuery(nil) + So(err, ShouldBeNil) + So(spaces, ShouldHaveLength, 2) + + So(spaces[0].Name, ShouldEqual, "my-space-1") + So(spaces[1].Name, ShouldEqual, "my-space-2") + + So(spaces[0].Relationships["organization"].Data.GUID, ShouldEqual, "org-guid") + So(spaces[0].Links["organization"].Href, ShouldEqual, "https://api.example.org/v3/organizations/org-guid") + So(spaces[1].Relationships["organization"].Data.GUID, ShouldEqual, "org-guid") + So(spaces[1].Links["organization"].Href, ShouldEqual, "https://api.example.org/v3/organizations/org-guid") + }) +} + +func TestListV3SpaceUsersByQuery(t *testing.T) { + Convey("List V3 Space Users", t, func() { + setup(MockRoute{"GET", "/v3/spaces/space-guid/users", []string{listV3SpaceUsersPayload, listV3SpaceUsersPayloadPage2}, "", http.StatusOK, "", nil}, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + users, err := client.ListV3SpaceUsers("space-guid") + So(err, ShouldBeNil) + So(users, ShouldHaveLength, 2) + + So(users[0].Username, ShouldEqual, "some-name-1") + So(users[1].Username, ShouldEqual, "some-name-2") + + So(users[0].PresentationName, ShouldEqual, "some-name-1") + So(users[0].Origin, ShouldEqual, "uaa") + So(users[0].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/users/10a93b89-3f89-4f05-7238-8a2b123c79l9") + So(users[1].PresentationName, ShouldEqual, "some-name-2") + So(users[1].Origin, ShouldEqual, "ldap") + So(users[1].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/users/9da93b89-3f89-4f05-7238-8a2b123c79l9") + }) +} diff --git a/third_party/go-cfclient/v3stacks.go b/third_party/go-cfclient/v3stacks.go new file mode 100644 index 000000000000..74647d6a00e9 --- /dev/null +++ b/third_party/go-cfclient/v3stacks.go @@ -0,0 +1,66 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +// V3Stack implements stack object. Stacks are the base operating system and file system that your application will execute in. A stack is how you configure applications to run against different operating systems (like Windows or Linux) and different versions of those operating systems. +type V3Stack struct { + Name string `json:"name,omitempty"` + GUID string `json:"guid,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Description string `json:"description,omitempty"` + Links map[string]Link `json:"links,omitempty"` + Metadata V3Metadata `json:"metadata,omitempty"` +} + +type listV3StacksResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3Stack `json:"resources,omitempty"` +} + +// ListV3StacksByQuery retrieves stacks based on query +func (c *Client) ListV3StacksByQuery(query url.Values) ([]V3Stack, error) { + var stacks []V3Stack + requestURL, err := url.Parse("/v3/stacks") + if err != nil { + return nil, err + } + requestURL.RawQuery = query.Encode() + + for { + r := c.NewRequest("GET", fmt.Sprintf("%s?%s", requestURL.Path, requestURL.RawQuery)) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 stacks") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 stacks, response code: %d", resp.StatusCode) + } + + var data listV3StacksResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 stacks") + } + + stacks = append(stacks, data.Resources...) + + requestURL, err = url.Parse(data.Pagination.Next.Href) + if err != nil { + return nil, errors.Wrap(err, "Error parsing next page URL") + } + if requestURL.String() == "" { + break + } + } + + return stacks, nil +} diff --git a/third_party/go-cfclient/v3stacks_test.go b/third_party/go-cfclient/v3stacks_test.go new file mode 100644 index 000000000000..aab7e6ae7205 --- /dev/null +++ b/third_party/go-cfclient/v3stacks_test.go @@ -0,0 +1,35 @@ +package cfclient + +import ( + "net/http" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListV3StacksByQuery(t *testing.T) { + Convey("List All V3 stacks", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/stacks", []string{listV3StacksPayload}, "", http.StatusOK, "", nil}, + } + setupMultiple(mocks, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + stacks, err := client.ListV3StacksByQuery(nil) + So(err, ShouldBeNil) + So(stacks, ShouldHaveLength, 2) + + So(stacks[0].Name, ShouldEqual, "my-stack-1") + So(stacks[0].Description, ShouldEqual, "This is my first stack!") + So(stacks[0].GUID, ShouldEqual, "guid-1") + So(stacks[0].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/stacks/guid-1") + So(stacks[1].Name, ShouldEqual, "my-stack-2") + So(stacks[1].Description, ShouldEqual, "This is my second stack!") + So(stacks[1].GUID, ShouldEqual, "guid-2") + So(stacks[1].Links["self"].Href, ShouldEqual, "https://api.example.org/v3/stacks/guid-2") + }) +} diff --git a/third_party/go-cfclient/v3types.go b/third_party/go-cfclient/v3types.go new file mode 100644 index 000000000000..65bbd4eb7921 --- /dev/null +++ b/third_party/go-cfclient/v3types.go @@ -0,0 +1,36 @@ +package cfclient + +// Pagination is used by the V3 apis +type Pagination struct { + TotalResults int `json:"total_results"` + TotalPages int `json:"total_pages"` + First Link `json:"first"` + Last Link `json:"last"` + Next Link `json:"next"` + Previous Link `json:"previous"` +} + +// Link is a HATEOAS-style link for v3 apis +type Link struct { + Href string `json:"href"` + Method string `json:"method,omitempty"` +} + +// V3ToOneRelationship is a relationship to a single object +type V3ToOneRelationship struct { + Data V3Relationship `json:"data,omitempty"` +} + +// V3ToManyRelationships is a relationship to multiple objects +type V3ToManyRelationships struct { + Data []V3Relationship `json:"data,omitempty"` +} + +type V3Relationship struct { + GUID string `json:"guid,omitempty"` +} + +type V3Metadata struct { + Labels map[string]string `json:"labels,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` +} diff --git a/third_party/go-cfclient/v3users.go b/third_party/go-cfclient/v3users.go new file mode 100644 index 000000000000..c66aaa54eb6b --- /dev/null +++ b/third_party/go-cfclient/v3users.go @@ -0,0 +1,67 @@ +package cfclient + +import ( + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +// V3User implements the user object +type V3User struct { + GUID string `json:"guid,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + UpdatedAt string `json:"updated_at,omitempty"` + Username string `json:"username,omitempty"` + PresentationName string `json:"presentation_name,omitempty"` + Origin string `json:"origin,omitempty"` + Links map[string]Link `json:"links,omitempty"` + Metadata V3Metadata `json:"metadata,omitempty"` +} + +type listV3UsersResponse struct { + Pagination Pagination `json:"pagination,omitempty"` + Resources []V3User `json:"resources,omitempty"` +} + +// ListV3UsersByQuery by query +func (c *Client) ListV3UsersByQuery(query url.Values) ([]V3User, error) { + var users []V3User + requestURL, err := url.Parse("/v3/users") + if err != nil { + return nil, err + } + requestURL.RawQuery = query.Encode() + + for { + r := c.NewRequest("GET", fmt.Sprintf("%s?%s", requestURL.Path, requestURL.RawQuery)) + resp, err := c.DoRequest(r) + if err != nil { + return nil, errors.Wrap(err, "Error requesting v3 users") + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("Error listing v3 users, response code: %d", resp.StatusCode) + } + + var data listV3UsersResponse + if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { + return nil, errors.Wrap(err, "Error parsing JSON from list v3 users") + } + + users = append(users, data.Resources...) + + requestURL, err = url.Parse(data.Pagination.Next.Href) + if err != nil { + return nil, errors.Wrap(err, "Error parsing next page URL") + } + if requestURL.String() == "" { + break + } + } + + return users, nil +} diff --git a/third_party/go-cfclient/v3users_test.go b/third_party/go-cfclient/v3users_test.go new file mode 100644 index 000000000000..05d4df97754f --- /dev/null +++ b/third_party/go-cfclient/v3users_test.go @@ -0,0 +1,34 @@ +package cfclient + +import ( + "net/http" + "net/url" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestListV3UserByQuery(t *testing.T) { + Convey("List V3 Users by Query", t, func() { + mocks := []MockRoute{ + {"GET", "/v3/users", []string{listV3UsersPayload}, "", http.StatusOK, "", nil}, + {"GET", "/v3/userspage2", []string{listV3UsersPayloadPage2}, "", http.StatusOK, "page=2&per_page=2", nil}, + } + setupMultiple(mocks, t) + defer teardown() + + c := &Config{ApiAddress: server.URL, Token: "foobar"} + client, err := NewClient(c) + So(err, ShouldBeNil) + + query := url.Values{} + users, err := client.ListV3UsersByQuery(query) + So(err, ShouldBeNil) + So(users, ShouldHaveLength, 3) + + So(users[0].Username, ShouldEqual, "smoke_tests") + So(users[1].Username, ShouldEqual, "test1") + So(users[2].Username, ShouldEqual, "test2") + }) + +} diff --git a/third_party/go-ordered-map/.circleci/circle_build.sh b/third_party/go-ordered-map/.circleci/circle_build.sh new file mode 100755 index 000000000000..398f5e7c94db --- /dev/null +++ b/third_party/go-ordered-map/.circleci/circle_build.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -ex + +# might as well run a little longer +export FUZZ_TIME=20s + +# there are too many golangci plugins that don't work for 1.19 just yet, so just skip linting for it +if [[ "$GO_VER" == 1.18.* ]]; then + make +else + make test_with_fuzz +fi diff --git a/third_party/go-ordered-map/.circleci/config.yml b/third_party/go-ordered-map/.circleci/config.yml new file mode 100644 index 000000000000..c77a890e17d1 --- /dev/null +++ b/third_party/go-ordered-map/.circleci/config.yml @@ -0,0 +1,23 @@ +version: 2.1 + +jobs: + test: + parameters: + golang-version: + type: string + docker: + - image: cimg/go:<< parameters.golang-version >> + steps: + - checkout + - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2 + - run: .circleci/circle_build.sh + +workflows: + test-workflow: + jobs: + - test: + matrix: + parameters: + golang-version: + - '1.18' + - '1.19' diff --git a/third_party/go-ordered-map/.gitignore b/third_party/go-ordered-map/.gitignore new file mode 100644 index 000000000000..57872d0f1e5f --- /dev/null +++ b/third_party/go-ordered-map/.gitignore @@ -0,0 +1 @@ +/vendor/ diff --git a/third_party/go-ordered-map/.golangci.yml b/third_party/go-ordered-map/.golangci.yml new file mode 100644 index 000000000000..2417df10d92c --- /dev/null +++ b/third_party/go-ordered-map/.golangci.yml @@ -0,0 +1,80 @@ +run: + tests: false + +linters: + disable-all: true + enable: + - asciicheck + - bidichk + - bodyclose + - containedctx + - contextcheck + - decorder + - depguard + - dogsled + - dupl + - durationcheck + - errcheck + - errchkjson + # FIXME: commented out as it crashes with 1.18 for now + # - errname + - errorlint + - exportloopref + - forbidigo + - funlen + - gci + - gochecknoglobals + - gochecknoinits + - gocognit + - goconst + - gocritic + - gocyclo + - godox + - gofmt + - gofumpt + - goheader + - goimports + - gomnd + - gomoddirectives + - gomodguard + - goprintffuncname + - gosec + - gosimple + - govet + - grouper + - ifshort + - importas + - ineffassign + - lll + - maintidx + - makezero + - misspell + - nakedret + - nilerr + - nilnil + - noctx + - nolintlint + - paralleltest + - prealloc + - predeclared + - promlinter + # FIXME: doesn't support 1.18 yet + # - revive + - rowserrcheck + - sqlclosecheck + - staticcheck + - structcheck + - stylecheck + - tagliatelle + - tenv + - testpackage + - thelper + - tparallel + - typecheck + - unconvert + - unparam + - unused + - varcheck + - varnamelen + - wastedassign + - whitespace diff --git a/third_party/go-ordered-map/CHANGELOG.md b/third_party/go-ordered-map/CHANGELOG.md new file mode 100644 index 000000000000..f27126f84ffc --- /dev/null +++ b/third_party/go-ordered-map/CHANGELOG.md @@ -0,0 +1,38 @@ +# Changelog + +[comment]: # (Changes since last release go here) + +## 2.1.8 - Jun 27th 2023 + +* Added support for YAML serialization/deserialization + +## 2.1.7 - Apr 13th 2023 + +* Renamed test_utils.go to utils_test.go + +## 2.1.6 - Feb 15th 2023 + +* Added `GetAndMoveToBack()` and `GetAndMoveToFront()` methods + +## 2.1.5 - Dec 13th 2022 + +* Added `Value()` method + +## 2.1.4 - Dec 12th 2022 + +* Fixed a bug with UTF-8 special characters in JSON keys + +## 2.1.3 - Dec 11th 2022 + +* Added support for JSON marshalling/unmarshalling of wrapper of primitive types + +## 2.1.2 - Dec 10th 2022 +* Allowing to pass options to `New`, to give a capacity hint, or initial data +* Allowing to deserialize nested ordered maps from JSON without having to explicitly instantiate them +* Added the `AddPairs` method + +## 2.1.1 - Dec 9th 2022 +* Fixing a bug with JSON marshalling + +## 2.1.0 - Dec 7th 2022 +* Added support for JSON serialization/deserialization diff --git a/third_party/go-ordered-map/LICENSE b/third_party/go-ordered-map/LICENSE new file mode 100644 index 000000000000..8dada3edaf50 --- /dev/null +++ b/third_party/go-ordered-map/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/third_party/go-ordered-map/LONG_PATHS.sha256 b/third_party/go-ordered-map/LONG_PATHS.sha256 new file mode 100644 index 000000000000..5508a1bc0413 --- /dev/null +++ b/third_party/go-ordered-map/LONG_PATHS.sha256 @@ -0,0 +1,2 @@ +62c005f96216d8ba8f62ac0799dfc1a6893e68418238a831ee79cd9c39b4cfc6 testdata/fuzz/FuzzRoundTripJSON/62c005f96216d8ba8f62ac0799dfc1a6893e68418238a831ee79cd9c39b4cfc6 +8093511184ad3e258aa13b957e75ff26c7fae64672dae0c0bc0a9fa5b61a05e7 testdata/fuzz/FuzzRoundTripJSON/8093511184ad3e258aa13b957e75ff26c7fae64672dae0c0bc0a9fa5b61a05e7 diff --git a/third_party/go-ordered-map/LONG_PATHS.tar.gz b/third_party/go-ordered-map/LONG_PATHS.tar.gz new file mode 100644 index 000000000000..6221eda0aa32 Binary files /dev/null and b/third_party/go-ordered-map/LONG_PATHS.tar.gz differ diff --git a/third_party/go-ordered-map/Makefile b/third_party/go-ordered-map/Makefile new file mode 100644 index 000000000000..6e0e18a1b9ac --- /dev/null +++ b/third_party/go-ordered-map/Makefile @@ -0,0 +1,32 @@ +.DEFAULT_GOAL := all + +.PHONY: all +all: test_with_fuzz lint + +# the TEST_FLAGS env var can be set to eg run only specific tests +TEST_COMMAND = go test -v -count=1 -race -cover $(TEST_FLAGS) + +.PHONY: test +test: + $(TEST_COMMAND) + +.PHONY: bench +bench: + go test -bench=. + +FUZZ_TIME ?= 10s + +# see https://github.com/golang/go/issues/46312 +# and https://stackoverflow.com/a/72673487/4867444 +# if we end up having more fuzz tests +.PHONY: test_with_fuzz +test_with_fuzz: + $(TEST_COMMAND) -fuzz=FuzzRoundTripJSON -fuzztime=$(FUZZ_TIME) + $(TEST_COMMAND) -fuzz=FuzzRoundTripYAML -fuzztime=$(FUZZ_TIME) + +.PHONY: fuzz +fuzz: test_with_fuzz + +.PHONY: lint +lint: + golangci-lint run diff --git a/third_party/go-ordered-map/PROVENANCE.md b/third_party/go-ordered-map/PROVENANCE.md new file mode 100644 index 000000000000..6a1028379ce6 --- /dev/null +++ b/third_party/go-ordered-map/PROVENANCE.md @@ -0,0 +1,30 @@ +# Temporary maintained-YAML backport + +Source: https://github.com/wk8/go-ordered-map +Exact source commit: `85ca4a2b29d3241fa4513f82be3d38fe2392a791` (v2.1.8). +Logical module identity: `github.com/wk8/go-ordered-map/v2`. + +Upstream source, tests, fixtures, licenses and attribution are retained. Upstream +CI metadata and vendored dependency snapshots are excluded; dependency sources +continue to resolve through Go modules. The only code edits select the matching +maintained YAML v2/v3 API, including typed YAML node methods and tests. Module +metadata changes select those parsers and satisfy their Go minima. + +Tracking and temporary ownership: https://github.com/StackVista/stackstate/issues/717 +Removal condition: adopt a compatible owning-library release (or Datadog +lightweight OPA patch release) with maintained YAML and passing consumer tests, +then remove this source and its explicit root/workspace/consumer selections. +Dependency replacements do not propagate: external consumers must explicitly +select this independently addressable nested module as well. + +Long upstream fixture/document paths are stored byte-for-byte in +`LONG_PATHS.tar.gz` with `LONG_PATHS.sha256` verification, preserving the agent's +Windows checkout path limit without weakening its filename gate. Before running +all upstream fixtures, restore them from this module directory with: + +```sh +tar -xzf LONG_PATHS.tar.gz +sha256sum -c LONG_PATHS.sha256 +``` + +These are fixture/docs assets, not Go source or embedded production resources. diff --git a/third_party/go-ordered-map/README.md b/third_party/go-ordered-map/README.md new file mode 100644 index 000000000000..b02894443773 --- /dev/null +++ b/third_party/go-ordered-map/README.md @@ -0,0 +1,154 @@ +[![Go Reference](https://pkg.go.dev/badge/github.com/wk8/go-ordered-map/v2.svg)](https://pkg.go.dev/github.com/wk8/go-ordered-map/v2) +[![Build Status](https://circleci.com/gh/wk8/go-ordered-map.svg?style=svg)](https://app.circleci.com/pipelines/github/wk8/go-ordered-map) + +# Golang Ordered Maps + +Same as regular maps, but also remembers the order in which keys were inserted, akin to [Python's `collections.OrderedDict`s](https://docs.python.org/3.7/library/collections.html#ordereddict-objects). + +It offers the following features: +* optimal runtime performance (all operations are constant time) +* optimal memory usage (only one copy of values, no unnecessary memory allocation) +* allows iterating from newest or oldest keys indifferently, without memory copy, allowing to `break` the iteration, and in time linear to the number of keys iterated over rather than the total length of the ordered map +* supports any generic types for both keys and values. If you're running go < 1.18, you can use [version 1](https://github.com/wk8/go-ordered-map/tree/v1) that takes and returns generic `interface{}`s instead of using generics +* idiomatic API, akin to that of [`container/list`](https://golang.org/pkg/container/list) +* support for JSON and YAML marshalling + +## Documentation + +[The full documentation is available on pkg.go.dev](https://pkg.go.dev/github.com/wk8/go-ordered-map/v2). + +## Installation +```bash +go get -u github.com/wk8/go-ordered-map/v2 +``` + +Or use your favorite golang vendoring tool! + +## Supported go versions + +Go >= 1.18 is required to use version >= 2 of this library, as it uses generics. + +If you're running go < 1.18, you can use [version 1](https://github.com/wk8/go-ordered-map/tree/v1) instead. + +## Example / usage + +```go +package main + +import ( + "fmt" + + "github.com/wk8/go-ordered-map/v2" +) + +func main() { + om := orderedmap.New[string, string]() + + om.Set("foo", "bar") + om.Set("bar", "baz") + om.Set("coucou", "toi") + + fmt.Println(om.Get("foo")) // => "bar", true + fmt.Println(om.Get("i dont exist")) // => "", false + + // iterating pairs from oldest to newest: + for pair := om.Oldest(); pair != nil; pair = pair.Next() { + fmt.Printf("%s => %s\n", pair.Key, pair.Value) + } // prints: + // foo => bar + // bar => baz + // coucou => toi + + // iterating over the 2 newest pairs: + i := 0 + for pair := om.Newest(); pair != nil; pair = pair.Prev() { + fmt.Printf("%s => %s\n", pair.Key, pair.Value) + i++ + if i >= 2 { + break + } + } // prints: + // coucou => toi + // bar => baz +} +``` + +An `OrderedMap`'s keys must implement `comparable`, and its values can be anything, for example: + +```go +type myStruct struct { + payload string +} + +func main() { + om := orderedmap.New[int, *myStruct]() + + om.Set(12, &myStruct{"foo"}) + om.Set(1, &myStruct{"bar"}) + + value, present := om.Get(12) + if !present { + panic("should be there!") + } + fmt.Println(value.payload) // => foo + + for pair := om.Oldest(); pair != nil; pair = pair.Next() { + fmt.Printf("%d => %s\n", pair.Key, pair.Value.payload) + } // prints: + // 12 => foo + // 1 => bar +} +``` + +Also worth noting that you can provision ordered maps with a capacity hint, as you would do by passing an optional hint to `make(map[K]V, capacity`): +```go +om := orderedmap.New[int, *myStruct](28) +``` + +You can also pass in some initial data to store in the map: +```go +om := orderedmap.New[int, string](orderedmap.WithInitialData[int, string]( + orderedmap.Pair[int, string]{ + Key: 12, + Value: "foo", + }, + orderedmap.Pair[int, string]{ + Key: 28, + Value: "bar", + }, +)) +``` + +`OrderedMap`s also support JSON serialization/deserialization, and preserves order: + +```go +// serialization +data, err := json.Marshal(om) +... + +// deserialization +om := orderedmap.New[string, string]() // or orderedmap.New[int, any](), or any type you expect +err := json.Unmarshal(data, &om) +... +``` + +Similarly, it also supports YAML serialization/deserialization using the yaml.v3 package, which also preserves order: + +```go +// serialization +data, err := yaml.Marshal(om) +... + +// deserialization +om := orderedmap.New[string, string]() // or orderedmap.New[int, any](), or any type you expect +err := yaml.Unmarshal(data, &om) +... +``` + +## Alternatives + +There are several other ordered map golang implementations out there, but I believe that at the time of writing none of them offer the same functionality as this library; more specifically: +* [iancoleman/orderedmap](https://github.com/iancoleman/orderedmap) only accepts `string` keys, its `Delete` operations are linear +* [cevaris/ordered_map](https://github.com/cevaris/ordered_map) uses a channel for iterations, and leaks goroutines if the iteration is interrupted before fully traversing the map +* [mantyr/iterator](https://github.com/mantyr/iterator) also uses a channel for iterations, and its `Delete` operations are linear +* [samdolan/go-ordered-map](https://github.com/samdolan/go-ordered-map) adds unnecessary locking (users should add their own locking instead if they need it), its `Delete` and `Get` operations are linear, iterations trigger a linear memory allocation diff --git a/third_party/go-ordered-map/example_test.go b/third_party/go-ordered-map/example_test.go new file mode 100644 index 000000000000..aeb23be1c7b2 --- /dev/null +++ b/third_party/go-ordered-map/example_test.go @@ -0,0 +1,67 @@ +package orderedmap_test + +import ( + "encoding/json" + "fmt" + + "github.com/wk8/go-ordered-map/v2" +) + +func Example() { + om := orderedmap.New[string, string](3) + + om.Set("foo", "bar") + om.Set("bar", "baz") + om.Set("coucou", "toi") + + fmt.Println("## Get operations: ##") + fmt.Println(om.Get("foo")) + fmt.Println(om.Get("i dont exist")) + fmt.Println(om.Value("coucou")) + + fmt.Println("## Iterating over pairs from oldest to newest: ##") + for pair := om.Oldest(); pair != nil; pair = pair.Next() { + fmt.Printf("%s => %s\n", pair.Key, pair.Value) + } + + fmt.Println("## Iterating over the 2 newest pairs: ##") + i := 0 + for pair := om.Newest(); pair != nil; pair = pair.Prev() { + fmt.Printf("%s => %s\n", pair.Key, pair.Value) + i++ + if i >= 2 { + break + } + } + + fmt.Println("## JSON serialization: ##") + data, err := json.Marshal(om) + if err != nil { + panic(err) + } + fmt.Println(string(data)) + + fmt.Println("## JSON deserialization: ##") + om2 := orderedmap.New[string, string]() + if err := json.Unmarshal(data, &om2); err != nil { + panic(err) + } + fmt.Println(om2.Oldest().Key) + + // Output: + // ## Get operations: ## + // bar true + // false + // toi + // ## Iterating over pairs from oldest to newest: ## + // foo => bar + // bar => baz + // coucou => toi + // ## Iterating over the 2 newest pairs: ## + // coucou => toi + // bar => baz + // ## JSON serialization: ## + // {"foo":"bar","bar":"baz","coucou":"toi"} + // ## JSON deserialization: ## + // foo +} diff --git a/third_party/go-ordered-map/go.mod b/third_party/go-ordered-map/go.mod new file mode 100644 index 000000000000..09c8bba109cb --- /dev/null +++ b/third_party/go-ordered-map/go.mod @@ -0,0 +1,11 @@ +module github.com/wk8/go-ordered-map/v2 + +go 1.18 + +require ( + github.com/bahlo/generic-list-go v0.2.0 + github.com/buger/jsonparser v1.1.1 + github.com/mailru/easyjson v0.7.7 + github.com/stretchr/testify v1.12.1 + go.yaml.in/yaml/v3 v3.0.5 +) diff --git a/third_party/go-ordered-map/go.sum b/third_party/go-ordered-map/go.sum new file mode 100644 index 000000000000..4a7ac8d054da --- /dev/null +++ b/third_party/go-ordered-map/go.sum @@ -0,0 +1,11 @@ +github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= +github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= +github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= +github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/third_party/go-ordered-map/json.go b/third_party/go-ordered-map/json.go new file mode 100644 index 000000000000..a545b536b33d --- /dev/null +++ b/third_party/go-ordered-map/json.go @@ -0,0 +1,182 @@ +package orderedmap + +import ( + "bytes" + "encoding" + "encoding/json" + "fmt" + "reflect" + "unicode/utf8" + + "github.com/buger/jsonparser" + "github.com/mailru/easyjson/jwriter" +) + +var ( + _ json.Marshaler = &OrderedMap[int, any]{} + _ json.Unmarshaler = &OrderedMap[int, any]{} +) + +// MarshalJSON implements the json.Marshaler interface. +func (om *OrderedMap[K, V]) MarshalJSON() ([]byte, error) { //nolint:funlen + if om == nil || om.list == nil { + return []byte("null"), nil + } + + writer := jwriter.Writer{} + writer.RawByte('{') + + for pair, firstIteration := om.Oldest(), true; pair != nil; pair = pair.Next() { + if firstIteration { + firstIteration = false + } else { + writer.RawByte(',') + } + + switch key := any(pair.Key).(type) { + case string: + writer.String(key) + case encoding.TextMarshaler: + writer.RawByte('"') + writer.Raw(key.MarshalText()) + writer.RawByte('"') + case int: + writer.IntStr(key) + case int8: + writer.Int8Str(key) + case int16: + writer.Int16Str(key) + case int32: + writer.Int32Str(key) + case int64: + writer.Int64Str(key) + case uint: + writer.UintStr(key) + case uint8: + writer.Uint8Str(key) + case uint16: + writer.Uint16Str(key) + case uint32: + writer.Uint32Str(key) + case uint64: + writer.Uint64Str(key) + default: + + // this switch takes care of wrapper types around primitive types, such as + // type myType string + switch keyValue := reflect.ValueOf(key); keyValue.Type().Kind() { + case reflect.String: + writer.String(keyValue.String()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + writer.Int64Str(keyValue.Int()) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + writer.Uint64Str(keyValue.Uint()) + default: + return nil, fmt.Errorf("unsupported key type: %T", key) + } + } + + writer.RawByte(':') + // the error is checked at the end of the function + writer.Raw(json.Marshal(pair.Value)) //nolint:errchkjson + } + + writer.RawByte('}') + + return dumpWriter(&writer) +} + +func dumpWriter(writer *jwriter.Writer) ([]byte, error) { + if writer.Error != nil { + return nil, writer.Error + } + + var buf bytes.Buffer + buf.Grow(writer.Size()) + if _, err := writer.DumpTo(&buf); err != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (om *OrderedMap[K, V]) UnmarshalJSON(data []byte) error { + if om.list == nil { + om.initialize(0) + } + + return jsonparser.ObjectEach( + data, + func(keyData []byte, valueData []byte, dataType jsonparser.ValueType, offset int) error { + if dataType == jsonparser.String { + // jsonparser removes the enclosing quotes; we need to restore them to make a valid JSON + valueData = data[offset-len(valueData)-2 : offset] + } + + var key K + var value V + + switch typedKey := any(&key).(type) { + case *string: + s, err := decodeUTF8(keyData) + if err != nil { + return err + } + *typedKey = s + case encoding.TextUnmarshaler: + if err := typedKey.UnmarshalText(keyData); err != nil { + return err + } + case *int, *int8, *int16, *int32, *int64, *uint, *uint8, *uint16, *uint32, *uint64: + if err := json.Unmarshal(keyData, typedKey); err != nil { + return err + } + default: + // this switch takes care of wrapper types around primitive types, such as + // type myType string + switch reflect.TypeOf(key).Kind() { + case reflect.String: + s, err := decodeUTF8(keyData) + if err != nil { + return err + } + + convertedKeyData := reflect.ValueOf(s).Convert(reflect.TypeOf(key)) + reflect.ValueOf(&key).Elem().Set(convertedKeyData) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + if err := json.Unmarshal(keyData, &key); err != nil { + return err + } + default: + return fmt.Errorf("unsupported key type: %T", key) + } + } + + if err := json.Unmarshal(valueData, &value); err != nil { + return err + } + + om.Set(key, value) + return nil + }) +} + +func decodeUTF8(input []byte) (string, error) { + remaining, offset := input, 0 + runes := make([]rune, 0, len(remaining)) + + for len(remaining) > 0 { + r, size := utf8.DecodeRune(remaining) + if r == utf8.RuneError && size <= 1 { + return "", fmt.Errorf("not a valid UTF-8 string (at position %d): %s", offset, string(input)) + } + + runes = append(runes, r) + remaining = remaining[size:] + offset += size + } + + return string(runes), nil +} diff --git a/third_party/go-ordered-map/json_fuzz_test.go b/third_party/go-ordered-map/json_fuzz_test.go new file mode 100644 index 000000000000..f556cea49ddb --- /dev/null +++ b/third_party/go-ordered-map/json_fuzz_test.go @@ -0,0 +1,117 @@ +package orderedmap + +// Adapted from https://github.com/dvyukov/go-fuzz-corpus/blob/c42c1b2/json/json.go + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func FuzzRoundTripJSON(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + for _, testCase := range []struct { + name string + constructor func() any + // should be a function that asserts that 2 objects of the type returned by constructor are equal + equalityAssertion func(*testing.T, any, any) bool + }{ + { + name: "with a string -> string map", + constructor: func() any { return &OrderedMap[string, string]{} }, + equalityAssertion: assertOrderedMapsEqual[string, string], + }, + { + name: "with a string -> int map", + constructor: func() any { return &OrderedMap[string, int]{} }, + equalityAssertion: assertOrderedMapsEqual[string, int], + }, + { + name: "with a string -> any map", + constructor: func() any { return &OrderedMap[string, any]{} }, + equalityAssertion: assertOrderedMapsEqual[string, any], + }, + { + name: "with a struct with map fields", + constructor: func() any { return new(testFuzzStruct) }, + equalityAssertion: assertTestFuzzStructEqual, + }, + } { + t.Run(testCase.name, func(t *testing.T) { + v1 := testCase.constructor() + if json.Unmarshal(data, v1) != nil { + return + } + + jsonData, err := json.Marshal(v1) + require.NoError(t, err) + + v2 := testCase.constructor() + require.NoError(t, json.Unmarshal(jsonData, v2)) + + if !assert.True(t, testCase.equalityAssertion(t, v1, v2), "failed with input data %q", string(data)) { + // look at that what the standard lib does with regular map, to help with debugging + + var m1 map[string]any + require.NoError(t, json.Unmarshal(data, &m1)) + + mapJsonData, err := json.Marshal(m1) + require.NoError(t, err) + + var m2 map[string]any + require.NoError(t, json.Unmarshal(mapJsonData, &m2)) + + t.Logf("initial data = %s", string(data)) + t.Logf("unmarshalled map = %v", m1) + t.Logf("re-marshalled from map = %s", string(mapJsonData)) + t.Logf("re-marshalled from test obj = %s", string(jsonData)) + t.Logf("re-unmarshalled map = %s", m2) + } + }) + } + }) +} + +// only works for fairly basic maps, that's why it's just in this file +func assertOrderedMapsEqual[K comparable, V any](t *testing.T, v1, v2 any) bool { + om1, ok1 := v1.(*OrderedMap[K, V]) + om2, ok2 := v2.(*OrderedMap[K, V]) + + if !assert.True(t, ok1, "v1 not an orderedmap") || + !assert.True(t, ok2, "v2 not an orderedmap") { + return false + } + + success := assert.Equal(t, om1.Len(), om2.Len(), "om1 and om2 have different lengths: %d vs %d", om1.Len(), om2.Len()) + + for i, pair1, pair2 := 0, om1.Oldest(), om2.Oldest(); pair1 != nil && pair2 != nil; i, pair1, pair2 = i+1, pair1.Next(), pair2.Next() { + success = assert.Equal(t, pair1.Key, pair2.Key, "different keys at position %d: %v vs %v", i, pair1.Key, pair2.Key) && success + success = assert.Equal(t, pair1.Value, pair2.Value, "different values at position %d: %v vs %v", i, pair1.Value, pair2.Value) && success + } + + return success +} + +type testFuzzStruct struct { + M1 *OrderedMap[int, any] + M2 *OrderedMap[int, string] + M3 *OrderedMap[string, string] +} + +func assertTestFuzzStructEqual(t *testing.T, v1, v2 any) bool { + s1, ok := v1.(*testFuzzStruct) + s2, ok := v2.(*testFuzzStruct) + + if !assert.True(t, ok, "v1 not an testFuzzStruct") || + !assert.True(t, ok, "v2 not an testFuzzStruct") { + return false + } + + success := assertOrderedMapsEqual[int, any](t, s1.M1, s2.M1) + success = assertOrderedMapsEqual[int, string](t, s1.M2, s2.M2) && success + success = assertOrderedMapsEqual[string, string](t, s1.M3, s2.M3) && success + + return success +} diff --git a/third_party/go-ordered-map/json_test.go b/third_party/go-ordered-map/json_test.go new file mode 100644 index 000000000000..42b89ab36259 --- /dev/null +++ b/third_party/go-ordered-map/json_test.go @@ -0,0 +1,338 @@ +package orderedmap + +import ( + "encoding/json" + "errors" + "fmt" + "strconv" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// to test marshalling TextMarshalers and unmarshalling TextUnmarshalers +type marshallable int + +func (m marshallable) MarshalText() ([]byte, error) { + return []byte(fmt.Sprintf("#%d#", m)), nil +} + +func (m *marshallable) UnmarshalText(text []byte) error { + if len(text) < 3 { + return errors.New("too short") + } + if text[0] != '#' || text[len(text)-1] != '#' { + return errors.New("missing prefix or suffix") + } + + value, err := strconv.Atoi(string(text[1 : len(text)-1])) + if err != nil { + return err + } + + *m = marshallable(value) + return nil +} + +func TestMarshalJSON(t *testing.T) { + t.Run("int key", func(t *testing.T) { + om := New[int, any]() + om.Set(1, "bar") + om.Set(7, "baz") + om.Set(2, 28) + om.Set(3, 100) + om.Set(4, "baz") + om.Set(5, "28") + om.Set(6, "100") + om.Set(8, "baz") + om.Set(8, "baz") + om.Set(9, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque auctor augue accumsan mi maximus, quis viverra massa pretium. Phasellus imperdiet sapien a interdum sollicitudin. Duis at commodo lectus, a lacinia sem.") + + b, err := json.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, `{"1":"bar","7":"baz","2":28,"3":100,"4":"baz","5":"28","6":"100","8":"baz","9":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque auctor augue accumsan mi maximus, quis viverra massa pretium. Phasellus imperdiet sapien a interdum sollicitudin. Duis at commodo lectus, a lacinia sem."}`, string(b)) + }) + + t.Run("string key", func(t *testing.T) { + om := New[string, any]() + om.Set("test", "bar") + om.Set("abc", true) + + b, err := json.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, `{"test":"bar","abc":true}`, string(b)) + }) + + t.Run("typed string key", func(t *testing.T) { + type myString string + om := New[myString, any]() + om.Set("test", "bar") + om.Set("abc", true) + + b, err := json.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, `{"test":"bar","abc":true}`, string(b)) + }) + + t.Run("typed int key", func(t *testing.T) { + type myInt uint32 + om := New[myInt, any]() + om.Set(1, "bar") + om.Set(7, "baz") + om.Set(2, 28) + om.Set(3, 100) + om.Set(4, "baz") + + b, err := json.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, `{"1":"bar","7":"baz","2":28,"3":100,"4":"baz"}`, string(b)) + }) + + t.Run("TextMarshaller key", func(t *testing.T) { + om := New[marshallable, any]() + om.Set(marshallable(1), "bar") + om.Set(marshallable(28), true) + + b, err := json.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, `{"#1#":"bar","#28#":true}`, string(b)) + }) + + t.Run("empty map", func(t *testing.T) { + om := New[string, any]() + + b, err := json.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, `{}`, string(b)) + }) +} + +func TestUnmarshallJSON(t *testing.T) { + t.Run("int key", func(t *testing.T) { + data := `{"1":"bar","7":"baz","2":28,"3":100,"4":"baz","5":"28","6":"100","8":"baz"}` + + om := New[int, any]() + require.NoError(t, json.Unmarshal([]byte(data), &om)) + + assertOrderedPairsEqual(t, om, + []int{1, 7, 2, 3, 4, 5, 6, 8}, + []any{"bar", "baz", float64(28), float64(100), "baz", "28", "100", "baz"}) + }) + + t.Run("string key", func(t *testing.T) { + data := `{"test":"bar","abc":true}` + + om := New[string, any]() + require.NoError(t, json.Unmarshal([]byte(data), &om)) + + assertOrderedPairsEqual(t, om, + []string{"test", "abc"}, + []any{"bar", true}) + }) + + t.Run("typed string key", func(t *testing.T) { + data := `{"test":"bar","abc":true}` + + type myString string + om := New[myString, any]() + require.NoError(t, json.Unmarshal([]byte(data), &om)) + + assertOrderedPairsEqual(t, om, + []myString{"test", "abc"}, + []any{"bar", true}) + }) + + t.Run("typed int key", func(t *testing.T) { + data := `{"1":"bar","7":"baz","2":28,"3":100,"4":"baz","5":"28","6":"100","8":"baz"}` + + type myInt uint32 + om := New[myInt, any]() + require.NoError(t, json.Unmarshal([]byte(data), &om)) + + assertOrderedPairsEqual(t, om, + []myInt{1, 7, 2, 3, 4, 5, 6, 8}, + []any{"bar", "baz", float64(28), float64(100), "baz", "28", "100", "baz"}) + }) + + t.Run("TextUnmarshaler key", func(t *testing.T) { + data := `{"#1#":"bar","#28#":true}` + + om := New[marshallable, any]() + require.NoError(t, json.Unmarshal([]byte(data), &om)) + + assertOrderedPairsEqual(t, om, + []marshallable{1, 28}, + []any{"bar", true}) + }) + + t.Run("when fed with an input that's not an object", func(t *testing.T) { + for _, data := range []string{"true", `["foo"]`, "42", `"foo"`} { + om := New[int, any]() + require.Error(t, json.Unmarshal([]byte(data), &om)) + } + }) + + t.Run("empty map", func(t *testing.T) { + data := `{}` + + om := New[int, any]() + require.NoError(t, json.Unmarshal([]byte(data), &om)) + + assertLenEqual(t, om, 0) + }) +} + +// const specialCharacters = "\\\\/\"\b\f\n\r\t\x00\uffff\ufffd世界\u007f\u00ff\U0010FFFF" +const specialCharacters = "\uffff\ufffd世界\u007f\u00ff\U0010FFFF" + +func TestJSONSpecialCharacters(t *testing.T) { + baselineMap := map[string]any{specialCharacters: specialCharacters} + baselineData, err := json.Marshal(baselineMap) + require.NoError(t, err) // baseline proves this key is supported by official json library + t.Logf("specialCharacters: %#v as []rune:%v", specialCharacters, []rune(specialCharacters)) + t.Logf("baseline json data: %s", baselineData) + + t.Run("marshal special characters", func(t *testing.T) { + om := New[string, any]() + om.Set(specialCharacters, specialCharacters) + b, err := json.Marshal(om) + require.NoError(t, err) + require.Equal(t, baselineData, b) + + type myString string + om2 := New[myString, myString]() + om2.Set(specialCharacters, specialCharacters) + b, err = json.Marshal(om2) + require.NoError(t, err) + require.Equal(t, baselineData, b) + }) + + t.Run("unmarshall special characters", func(t *testing.T) { + om := New[string, any]() + require.NoError(t, json.Unmarshal(baselineData, &om)) + assertOrderedPairsEqual(t, om, + []string{specialCharacters}, + []any{specialCharacters}) + + type myString string + om2 := New[myString, myString]() + require.NoError(t, json.Unmarshal(baselineData, &om2)) + assertOrderedPairsEqual(t, om2, + []myString{specialCharacters}, + []myString{specialCharacters}) + }) +} + +// to test structs that have nested map fields +type nestedMaps struct { + X int `json:"x" yaml:"x"` + M *OrderedMap[string, []*OrderedMap[int, *OrderedMap[string, any]]] `json:"m" yaml:"m"` +} + +func TestJSONRoundTrip(t *testing.T) { + for _, testCase := range []struct { + name string + input string + targetFactory func() any + isPrettyPrinted bool + }{ + { + name: "", + input: `{ + "x": 28, + "m": { + "foo": [ + { + "12": { + "i": 12, + "b": true, + "n": null, + "m": { + "a": "b", + "c": 28 + } + }, + "28": { + "a": false, + "b": [ + 1, + 2, + 3 + ] + } + }, + { + "3": { + "c": null, + "d": 87 + }, + "4": { + "e": true + }, + "5": { + "f": 4, + "g": 5, + "h": 6 + } + } + ], + "bar": [ + { + "5": { + "foo": "bar" + } + } + ] + } +}`, + targetFactory: func() any { return &nestedMaps{} }, + isPrettyPrinted: true, + }, + { + name: "with UTF-8 special chars in key", + input: `{"�":0}`, + targetFactory: func() any { return &OrderedMap[string, int]{} }, + }, + } { + t.Run(testCase.name, func(t *testing.T) { + target := testCase.targetFactory() + + require.NoError(t, json.Unmarshal([]byte(testCase.input), target)) + + var ( + out []byte + err error + ) + if testCase.isPrettyPrinted { + out, err = json.MarshalIndent(target, "", " ") + } else { + out, err = json.Marshal(target) + } + + if assert.NoError(t, err) { + assert.Equal(t, strings.TrimSpace(testCase.input), string(out)) + } + }) + } +} + +func BenchmarkMarshalJSON(b *testing.B) { + om := New[int, any]() + om.Set(1, "bar") + om.Set(7, "baz") + om.Set(2, 28) + om.Set(3, 100) + om.Set(4, "baz") + om.Set(5, "28") + om.Set(6, "100") + om.Set(8, "baz") + om.Set(8, "baz") + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _, _ = json.Marshal(om) + } +} diff --git a/third_party/go-ordered-map/orderedmap.go b/third_party/go-ordered-map/orderedmap.go new file mode 100644 index 000000000000..0647141919ae --- /dev/null +++ b/third_party/go-ordered-map/orderedmap.go @@ -0,0 +1,296 @@ +// Package orderedmap implements an ordered map, i.e. a map that also keeps track of +// the order in which keys were inserted. +// +// All operations are constant-time. +// +// Github repo: https://github.com/wk8/go-ordered-map +// +package orderedmap + +import ( + "fmt" + + list "github.com/bahlo/generic-list-go" +) + +type Pair[K comparable, V any] struct { + Key K + Value V + + element *list.Element[*Pair[K, V]] +} + +type OrderedMap[K comparable, V any] struct { + pairs map[K]*Pair[K, V] + list *list.List[*Pair[K, V]] +} + +type initConfig[K comparable, V any] struct { + capacity int + initialData []Pair[K, V] +} + +type InitOption[K comparable, V any] func(config *initConfig[K, V]) + +// WithCapacity allows giving a capacity hint for the map, akin to the standard make(map[K]V, capacity). +func WithCapacity[K comparable, V any](capacity int) InitOption[K, V] { + return func(c *initConfig[K, V]) { + c.capacity = capacity + } +} + +// WithInitialData allows passing in initial data for the map. +func WithInitialData[K comparable, V any](initialData ...Pair[K, V]) InitOption[K, V] { + return func(c *initConfig[K, V]) { + c.initialData = initialData + if c.capacity < len(initialData) { + c.capacity = len(initialData) + } + } +} + +// New creates a new OrderedMap. +// options can either be one or several InitOption[K, V], or a single integer, +// which is then interpreted as a capacity hint, à la make(map[K]V, capacity). +func New[K comparable, V any](options ...any) *OrderedMap[K, V] { //nolint:varnamelen + orderedMap := &OrderedMap[K, V]{} + + var config initConfig[K, V] + for _, untypedOption := range options { + switch option := untypedOption.(type) { + case int: + if len(options) != 1 { + invalidOption() + } + config.capacity = option + + case InitOption[K, V]: + option(&config) + + default: + invalidOption() + } + } + + orderedMap.initialize(config.capacity) + orderedMap.AddPairs(config.initialData...) + + return orderedMap +} + +const invalidOptionMessage = `when using orderedmap.New[K,V]() with options, either provide one or several InitOption[K, V]; or a single integer which is then interpreted as a capacity hint, à la make(map[K]V, capacity).` //nolint:lll + +func invalidOption() { panic(invalidOptionMessage) } + +func (om *OrderedMap[K, V]) initialize(capacity int) { + om.pairs = make(map[K]*Pair[K, V], capacity) + om.list = list.New[*Pair[K, V]]() +} + +// Get looks for the given key, and returns the value associated with it, +// or V's nil value if not found. The boolean it returns says whether the key is present in the map. +func (om *OrderedMap[K, V]) Get(key K) (val V, present bool) { + if pair, present := om.pairs[key]; present { + return pair.Value, true + } + + return +} + +// Load is an alias for Get, mostly to present an API similar to `sync.Map`'s. +func (om *OrderedMap[K, V]) Load(key K) (V, bool) { + return om.Get(key) +} + +// Value returns the value associated with the given key or the zero value. +func (om *OrderedMap[K, V]) Value(key K) (val V) { + if pair, present := om.pairs[key]; present { + val = pair.Value + } + return +} + +// GetPair looks for the given key, and returns the pair associated with it, +// or nil if not found. The Pair struct can then be used to iterate over the ordered map +// from that point, either forward or backward. +func (om *OrderedMap[K, V]) GetPair(key K) *Pair[K, V] { + return om.pairs[key] +} + +// Set sets the key-value pair, and returns what `Get` would have returned +// on that key prior to the call to `Set`. +func (om *OrderedMap[K, V]) Set(key K, value V) (val V, present bool) { + if pair, present := om.pairs[key]; present { + oldValue := pair.Value + pair.Value = value + return oldValue, true + } + + pair := &Pair[K, V]{ + Key: key, + Value: value, + } + pair.element = om.list.PushBack(pair) + om.pairs[key] = pair + + return +} + +// AddPairs allows setting multiple pairs at a time. It's equivalent to calling +// Set on each pair sequentially. +func (om *OrderedMap[K, V]) AddPairs(pairs ...Pair[K, V]) { + for _, pair := range pairs { + om.Set(pair.Key, pair.Value) + } +} + +// Store is an alias for Set, mostly to present an API similar to `sync.Map`'s. +func (om *OrderedMap[K, V]) Store(key K, value V) (V, bool) { + return om.Set(key, value) +} + +// Delete removes the key-value pair, and returns what `Get` would have returned +// on that key prior to the call to `Delete`. +func (om *OrderedMap[K, V]) Delete(key K) (val V, present bool) { + if pair, present := om.pairs[key]; present { + om.list.Remove(pair.element) + delete(om.pairs, key) + return pair.Value, true + } + return +} + +// Len returns the length of the ordered map. +func (om *OrderedMap[K, V]) Len() int { + if om == nil || om.pairs == nil { + return 0 + } + return len(om.pairs) +} + +// Oldest returns a pointer to the oldest pair. It's meant to be used to iterate on the ordered map's +// pairs from the oldest to the newest, e.g.: +// for pair := orderedMap.Oldest(); pair != nil; pair = pair.Next() { fmt.Printf("%v => %v\n", pair.Key, pair.Value) } +func (om *OrderedMap[K, V]) Oldest() *Pair[K, V] { + if om == nil || om.list == nil { + return nil + } + return listElementToPair(om.list.Front()) +} + +// Newest returns a pointer to the newest pair. It's meant to be used to iterate on the ordered map's +// pairs from the newest to the oldest, e.g.: +// for pair := orderedMap.Oldest(); pair != nil; pair = pair.Next() { fmt.Printf("%v => %v\n", pair.Key, pair.Value) } +func (om *OrderedMap[K, V]) Newest() *Pair[K, V] { + if om == nil || om.list == nil { + return nil + } + return listElementToPair(om.list.Back()) +} + +// Next returns a pointer to the next pair. +func (p *Pair[K, V]) Next() *Pair[K, V] { + return listElementToPair(p.element.Next()) +} + +// Prev returns a pointer to the previous pair. +func (p *Pair[K, V]) Prev() *Pair[K, V] { + return listElementToPair(p.element.Prev()) +} + +func listElementToPair[K comparable, V any](element *list.Element[*Pair[K, V]]) *Pair[K, V] { + if element == nil { + return nil + } + return element.Value +} + +// KeyNotFoundError may be returned by functions in this package when they're called with keys that are not present +// in the map. +type KeyNotFoundError[K comparable] struct { + MissingKey K +} + +func (e *KeyNotFoundError[K]) Error() string { + return fmt.Sprintf("missing key: %v", e.MissingKey) +} + +// MoveAfter moves the value associated with key to its new position after the one associated with markKey. +// Returns an error iff key or markKey are not present in the map. If an error is returned, +// it will be a KeyNotFoundError. +func (om *OrderedMap[K, V]) MoveAfter(key, markKey K) error { + elements, err := om.getElements(key, markKey) + if err != nil { + return err + } + om.list.MoveAfter(elements[0], elements[1]) + return nil +} + +// MoveBefore moves the value associated with key to its new position before the one associated with markKey. +// Returns an error iff key or markKey are not present in the map. If an error is returned, +// it will be a KeyNotFoundError. +func (om *OrderedMap[K, V]) MoveBefore(key, markKey K) error { + elements, err := om.getElements(key, markKey) + if err != nil { + return err + } + om.list.MoveBefore(elements[0], elements[1]) + return nil +} + +func (om *OrderedMap[K, V]) getElements(keys ...K) ([]*list.Element[*Pair[K, V]], error) { + elements := make([]*list.Element[*Pair[K, V]], len(keys)) + for i, k := range keys { + pair, present := om.pairs[k] + if !present { + return nil, &KeyNotFoundError[K]{k} + } + elements[i] = pair.element + } + return elements, nil +} + +// MoveToBack moves the value associated with key to the back of the ordered map, +// i.e. makes it the newest pair in the map. +// Returns an error iff key is not present in the map. If an error is returned, +// it will be a KeyNotFoundError. +func (om *OrderedMap[K, V]) MoveToBack(key K) error { + _, err := om.GetAndMoveToBack(key) + return err +} + +// MoveToFront moves the value associated with key to the front of the ordered map, +// i.e. makes it the oldest pair in the map. +// Returns an error iff key is not present in the map. If an error is returned, +// it will be a KeyNotFoundError. +func (om *OrderedMap[K, V]) MoveToFront(key K) error { + _, err := om.GetAndMoveToFront(key) + return err +} + +// GetAndMoveToBack combines Get and MoveToBack in the same call. If an error is returned, +// it will be a KeyNotFoundError. +func (om *OrderedMap[K, V]) GetAndMoveToBack(key K) (val V, err error) { + if pair, present := om.pairs[key]; present { + val = pair.Value + om.list.MoveToBack(pair.element) + } else { + err = &KeyNotFoundError[K]{key} + } + + return +} + +// GetAndMoveToFront combines Get and MoveToFront in the same call. If an error is returned, +// it will be a KeyNotFoundError. +func (om *OrderedMap[K, V]) GetAndMoveToFront(key K) (val V, err error) { + if pair, present := om.pairs[key]; present { + val = pair.Value + om.list.MoveToFront(pair.element) + } else { + err = &KeyNotFoundError[K]{key} + } + + return +} diff --git a/third_party/go-ordered-map/orderedmap_test.go b/third_party/go-ordered-map/orderedmap_test.go new file mode 100644 index 000000000000..a3137eb054a0 --- /dev/null +++ b/third_party/go-ordered-map/orderedmap_test.go @@ -0,0 +1,384 @@ +package orderedmap + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestBasicFeatures(t *testing.T) { + n := 100 + om := New[int, int]() + + // set(i, 2 * i) + for i := 0; i < n; i++ { + assertLenEqual(t, om, i) + oldValue, present := om.Set(i, 2*i) + assertLenEqual(t, om, i+1) + + assert.Equal(t, 0, oldValue) + assert.False(t, present) + } + + // get what we just set + for i := 0; i < n; i++ { + value, present := om.Get(i) + + assert.Equal(t, 2*i, value) + assert.Equal(t, value, om.Value(i)) + assert.True(t, present) + } + + // get pairs of what we just set + for i := 0; i < n; i++ { + pair := om.GetPair(i) + + assert.NotNil(t, pair) + assert.Equal(t, 2*i, pair.Value) + } + + // forward iteration + i := 0 + for pair := om.Oldest(); pair != nil; pair = pair.Next() { + assert.Equal(t, i, pair.Key) + assert.Equal(t, 2*i, pair.Value) + i++ + } + // backward iteration + i = n - 1 + for pair := om.Newest(); pair != nil; pair = pair.Prev() { + assert.Equal(t, i, pair.Key) + assert.Equal(t, 2*i, pair.Value) + i-- + } + + // forward iteration starting from known key + i = 42 + for pair := om.GetPair(i); pair != nil; pair = pair.Next() { + assert.Equal(t, i, pair.Key) + assert.Equal(t, 2*i, pair.Value) + i++ + } + + // double values for pairs with even keys + for j := 0; j < n/2; j++ { + i = 2 * j + oldValue, present := om.Set(i, 4*i) + + assert.Equal(t, 2*i, oldValue) + assert.True(t, present) + } + // and delete pairs with odd keys + for j := 0; j < n/2; j++ { + i = 2*j + 1 + assertLenEqual(t, om, n-j) + value, present := om.Delete(i) + assertLenEqual(t, om, n-j-1) + + assert.Equal(t, 2*i, value) + assert.True(t, present) + + // deleting again shouldn't change anything + value, present = om.Delete(i) + assertLenEqual(t, om, n-j-1) + assert.Equal(t, 0, value) + assert.False(t, present) + } + + // get the whole range + for j := 0; j < n/2; j++ { + i = 2 * j + value, present := om.Get(i) + assert.Equal(t, 4*i, value) + assert.Equal(t, value, om.Value(i)) + assert.True(t, present) + + i = 2*j + 1 + value, present = om.Get(i) + assert.Equal(t, 0, value) + assert.Equal(t, value, om.Value(i)) + assert.False(t, present) + } + + // check iterations again + i = 0 + for pair := om.Oldest(); pair != nil; pair = pair.Next() { + assert.Equal(t, i, pair.Key) + assert.Equal(t, 4*i, pair.Value) + i += 2 + } + i = 2 * ((n - 1) / 2) + for pair := om.Newest(); pair != nil; pair = pair.Prev() { + assert.Equal(t, i, pair.Key) + assert.Equal(t, 4*i, pair.Value) + i -= 2 + } +} + +func TestUpdatingDoesntChangePairsOrder(t *testing.T) { + om := New[string, any]() + om.Set("foo", "bar") + om.Set("wk", 28) + om.Set("po", 100) + om.Set("bar", "baz") + + oldValue, present := om.Set("po", 102) + assert.Equal(t, 100, oldValue) + assert.True(t, present) + + assertOrderedPairsEqual(t, om, + []string{"foo", "wk", "po", "bar"}, + []any{"bar", 28, 102, "baz"}) +} + +func TestDeletingAndReinsertingChangesPairsOrder(t *testing.T) { + om := New[string, any]() + om.Set("foo", "bar") + om.Set("wk", 28) + om.Set("po", 100) + om.Set("bar", "baz") + + // delete a pair + oldValue, present := om.Delete("po") + assert.Equal(t, 100, oldValue) + assert.True(t, present) + + // re-insert the same pair + oldValue, present = om.Set("po", 100) + assert.Nil(t, oldValue) + assert.False(t, present) + + assertOrderedPairsEqual(t, om, + []string{"foo", "wk", "bar", "po"}, + []any{"bar", 28, "baz", 100}) +} + +func TestEmptyMapOperations(t *testing.T) { + om := New[string, any]() + + oldValue, present := om.Get("foo") + assert.Nil(t, oldValue) + assert.Nil(t, om.Value("foo")) + assert.False(t, present) + + oldValue, present = om.Delete("bar") + assert.Nil(t, oldValue) + assert.False(t, present) + + assertLenEqual(t, om, 0) + + assert.Nil(t, om.Oldest()) + assert.Nil(t, om.Newest()) +} + +type dummyTestStruct struct { + value string +} + +func TestPackUnpackStructs(t *testing.T) { + om := New[string, dummyTestStruct]() + om.Set("foo", dummyTestStruct{"foo!"}) + om.Set("bar", dummyTestStruct{"bar!"}) + + value, present := om.Get("foo") + assert.True(t, present) + assert.Equal(t, value, om.Value("foo")) + if assert.NotNil(t, value) { + assert.Equal(t, "foo!", value.value) + } + + value, present = om.Set("bar", dummyTestStruct{"baz!"}) + assert.True(t, present) + if assert.NotNil(t, value) { + assert.Equal(t, "bar!", value.value) + } + + value, present = om.Get("bar") + assert.Equal(t, value, om.Value("bar")) + assert.True(t, present) + if assert.NotNil(t, value) { + assert.Equal(t, "baz!", value.value) + } +} + +// shamelessly stolen from https://github.com/python/cpython/blob/e19a91e45fd54a56e39c2d12e6aaf4757030507f/Lib/test/test_ordered_dict.py#L55-L61 +func TestShuffle(t *testing.T) { + ranLen := 100 + + for _, n := range []int{0, 10, 20, 100, 1000, 10000} { + t.Run(fmt.Sprintf("shuffle test with %d items", n), func(t *testing.T) { + om := New[string, string]() + + keys := make([]string, n) + values := make([]string, n) + + for i := 0; i < n; i++ { + // we prefix with the number to ensure that we don't get any duplicates + keys[i] = fmt.Sprintf("%d_%s", i, randomHexString(t, ranLen)) + values[i] = randomHexString(t, ranLen) + + value, present := om.Set(keys[i], values[i]) + assert.Equal(t, "", value) + assert.False(t, present) + } + + assertOrderedPairsEqual(t, om, keys, values) + }) + } +} + +func TestMove(t *testing.T) { + om := New[int, any]() + om.Set(1, "bar") + om.Set(2, 28) + om.Set(3, 100) + om.Set(4, "baz") + om.Set(5, "28") + om.Set(6, "100") + om.Set(7, "baz") + om.Set(8, "baz") + + err := om.MoveAfter(2, 3) + assert.Nil(t, err) + assertOrderedPairsEqual(t, om, + []int{1, 3, 2, 4, 5, 6, 7, 8}, + []any{"bar", 100, 28, "baz", "28", "100", "baz", "baz"}) + + err = om.MoveBefore(6, 4) + assert.Nil(t, err) + assertOrderedPairsEqual(t, om, + []int{1, 3, 2, 6, 4, 5, 7, 8}, + []any{"bar", 100, 28, "100", "baz", "28", "baz", "baz"}) + + err = om.MoveToBack(3) + assert.Nil(t, err) + assertOrderedPairsEqual(t, om, + []int{1, 2, 6, 4, 5, 7, 8, 3}, + []any{"bar", 28, "100", "baz", "28", "baz", "baz", 100}) + + err = om.MoveToFront(5) + assert.Nil(t, err) + assertOrderedPairsEqual(t, om, + []int{5, 1, 2, 6, 4, 7, 8, 3}, + []any{"28", "bar", 28, "100", "baz", "baz", "baz", 100}) + + err = om.MoveToFront(100) + assert.Equal(t, &KeyNotFoundError[int]{100}, err) +} + +func TestGetAndMove(t *testing.T) { + om := New[int, any]() + om.Set(1, "bar") + om.Set(2, 28) + om.Set(3, 100) + om.Set(4, "baz") + om.Set(5, "28") + om.Set(6, "100") + om.Set(7, "baz") + om.Set(8, "baz") + + value, err := om.GetAndMoveToBack(3) + assert.Nil(t, err) + assert.Equal(t, 100, value) + assertOrderedPairsEqual(t, om, + []int{1, 2, 4, 5, 6, 7, 8, 3}, + []any{"bar", 28, "baz", "28", "100", "baz", "baz", 100}) + + value, err = om.GetAndMoveToFront(5) + assert.Nil(t, err) + assert.Equal(t, "28", value) + assertOrderedPairsEqual(t, om, + []int{5, 1, 2, 4, 6, 7, 8, 3}, + []any{"28", "bar", 28, "baz", "100", "baz", "baz", 100}) + + value, err = om.GetAndMoveToBack(100) + assert.Equal(t, &KeyNotFoundError[int]{100}, err) +} + +func TestAddPairs(t *testing.T) { + om := New[int, any]() + om.AddPairs( + Pair[int, any]{ + Key: 28, + Value: "foo", + }, + Pair[int, any]{ + Key: 12, + Value: "bar", + }, + Pair[int, any]{ + Key: 28, + Value: "baz", + }, + ) + + assertOrderedPairsEqual(t, om, + []int{28, 12}, + []any{"baz", "bar"}) +} + +// sadly, we can't test the "actual" capacity here, see https://github.com/golang/go/issues/52157 +func TestNewWithCapacity(t *testing.T) { + zero := New[int, string](0) + assert.Empty(t, zero.Len()) + + assert.PanicsWithValue(t, invalidOptionMessage, func() { + _ = New[int, string](1, 2) + }) + assert.PanicsWithValue(t, invalidOptionMessage, func() { + _ = New[int, string](1, 2, 3) + }) + + om := New[int, string](-1) + om.Set(1337, "quarante-deux") + assert.Equal(t, 1, om.Len()) +} + +func TestNewWithOptions(t *testing.T) { + t.Run("wih capacity", func(t *testing.T) { + om := New[string, any](WithCapacity[string, any](98)) + assert.Equal(t, 0, om.Len()) + }) + + t.Run("with initial data", func(t *testing.T) { + om := New[string, int](WithInitialData( + Pair[string, int]{ + Key: "a", + Value: 1, + }, + Pair[string, int]{ + Key: "b", + Value: 2, + }, + Pair[string, int]{ + Key: "c", + Value: 3, + }, + )) + + assertOrderedPairsEqual(t, om, + []string{"a", "b", "c"}, + []int{1, 2, 3}) + }) + + t.Run("with an invalid option type", func(t *testing.T) { + assert.PanicsWithValue(t, invalidOptionMessage, func() { + _ = New[int, string]("foo") + }) + }) +} + +func TestNilMap(t *testing.T) { + // we want certain behaviors of a nil ordered map to be the same as they are for standard nil maps + var om *OrderedMap[int, any] + + t.Run("len", func(t *testing.T) { + assert.Equal(t, 0, om.Len()) + }) + + t.Run("iterating - akin to range", func(t *testing.T) { + assert.Nil(t, om.Oldest()) + assert.Nil(t, om.Newest()) + }) +} diff --git a/third_party/go-ordered-map/utils_test.go b/third_party/go-ordered-map/utils_test.go new file mode 100644 index 000000000000..9f1cc3bf906e --- /dev/null +++ b/third_party/go-ordered-map/utils_test.go @@ -0,0 +1,76 @@ +package orderedmap + +import ( + "crypto/rand" + "encoding/hex" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +// assertOrderedPairsEqual asserts that the map contains the given keys and values +// from oldest to newest. +func assertOrderedPairsEqual[K comparable, V any]( + t *testing.T, orderedMap *OrderedMap[K, V], expectedKeys []K, expectedValues []V, +) { + t.Helper() + + assertOrderedPairsEqualFromNewest(t, orderedMap, expectedKeys, expectedValues) + assertOrderedPairsEqualFromOldest(t, orderedMap, expectedKeys, expectedValues) +} + +func assertOrderedPairsEqualFromNewest[K comparable, V any]( + t *testing.T, orderedMap *OrderedMap[K, V], expectedKeys []K, expectedValues []V, +) { + t.Helper() + + if assert.Equal(t, len(expectedKeys), len(expectedValues)) && assert.Equal(t, len(expectedKeys), orderedMap.Len()) { + i := orderedMap.Len() - 1 + for pair := orderedMap.Newest(); pair != nil; pair = pair.Prev() { + assert.Equal(t, expectedKeys[i], pair.Key, "from newest index=%d on key", i) + assert.Equal(t, expectedValues[i], pair.Value, "from newest index=%d on value", i) + i-- + } + } +} + +func assertOrderedPairsEqualFromOldest[K comparable, V any]( + t *testing.T, orderedMap *OrderedMap[K, V], expectedKeys []K, expectedValues []V, +) { + t.Helper() + + if assert.Equal(t, len(expectedKeys), len(expectedValues)) && assert.Equal(t, len(expectedKeys), orderedMap.Len()) { + i := 0 + for pair := orderedMap.Oldest(); pair != nil; pair = pair.Next() { + assert.Equal(t, expectedKeys[i], pair.Key, "from oldest index=%d on key", i) + assert.Equal(t, expectedValues[i], pair.Value, "from oldest index=%d on value", i) + i++ + } + } +} + +func assertLenEqual[K comparable, V any](t *testing.T, orderedMap *OrderedMap[K, V], expectedLen int) { + t.Helper() + + assert.Equal(t, expectedLen, orderedMap.Len()) + + // also check the list length, for good measure + assert.Equal(t, expectedLen, orderedMap.list.Len()) +} + +func randomHexString(t *testing.T, length int) string { + t.Helper() + + b := length / 2 //nolint:gomnd + randBytes := make([]byte, b) + + if n, err := rand.Read(randBytes); err != nil || n != b { + if err == nil { + err = fmt.Errorf("only got %v random bytes, expected %v", n, b) + } + t.Fatal(err) + } + + return hex.EncodeToString(randBytes) +} diff --git a/third_party/go-ordered-map/yaml.go b/third_party/go-ordered-map/yaml.go new file mode 100644 index 000000000000..5366401ab830 --- /dev/null +++ b/third_party/go-ordered-map/yaml.go @@ -0,0 +1,71 @@ +package orderedmap + +import ( + "fmt" + + "go.yaml.in/yaml/v3" +) + +var ( + _ yaml.Marshaler = &OrderedMap[int, any]{} + _ yaml.Unmarshaler = &OrderedMap[int, any]{} +) + +// MarshalYAML implements the yaml.Marshaler interface. +func (om *OrderedMap[K, V]) MarshalYAML() (interface{}, error) { + if om == nil { + return []byte("null"), nil + } + + node := yaml.Node{ + Kind: yaml.MappingNode, + } + + for pair := om.Oldest(); pair != nil; pair = pair.Next() { + key, value := pair.Key, pair.Value + + keyNode := &yaml.Node{} + + // serialize key to yaml, then deserialize it back into the node + // this is a hack to get the correct tag for the key + if err := keyNode.Encode(key); err != nil { + return nil, err + } + + valueNode := &yaml.Node{} + if err := valueNode.Encode(value); err != nil { + return nil, err + } + + node.Content = append(node.Content, keyNode, valueNode) + } + + return &node, nil +} + +// UnmarshalYAML implements the yaml.Unmarshaler interface. +func (om *OrderedMap[K, V]) UnmarshalYAML(value *yaml.Node) error { + if value.Kind != yaml.MappingNode { + return fmt.Errorf("pipeline must contain YAML mapping, has %v", value.Kind) + } + + if om.list == nil { + om.initialize(0) + } + + for index := 0; index < len(value.Content); index += 2 { + var key K + var val V + + if err := value.Content[index].Decode(&key); err != nil { + return err + } + if err := value.Content[index+1].Decode(&val); err != nil { + return err + } + + om.Set(key, val) + } + + return nil +} diff --git a/third_party/go-ordered-map/yaml_fuzz_test.go b/third_party/go-ordered-map/yaml_fuzz_test.go new file mode 100644 index 000000000000..453a6a9496d9 --- /dev/null +++ b/third_party/go-ordered-map/yaml_fuzz_test.go @@ -0,0 +1,81 @@ +package orderedmap + +// Adapted from https://github.com/dvyukov/go-fuzz-corpus/blob/c42c1b2/json/json.go + +import ( + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.yaml.in/yaml/v3" + "testing" +) + +func FuzzRoundTripYAML(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + for _, testCase := range []struct { + name string + constructor func() any + // should be a function that asserts that 2 objects of the type returned by constructor are equal + equalityAssertion func(*testing.T, any, any) bool + }{ + { + name: "with a string -> string map", + constructor: func() any { return &OrderedMap[string, string]{} }, + equalityAssertion: assertOrderedMapsEqual[string, string], + }, + { + name: "with a string -> int map", + constructor: func() any { return &OrderedMap[string, int]{} }, + equalityAssertion: assertOrderedMapsEqual[string, int], + }, + { + name: "with a string -> any map", + constructor: func() any { return &OrderedMap[string, any]{} }, + equalityAssertion: assertOrderedMapsEqual[string, any], + }, + { + name: "with a struct with map fields", + constructor: func() any { return new(testFuzzStruct) }, + equalityAssertion: assertTestFuzzStructEqual, + }, + } { + t.Run(testCase.name, func(t *testing.T) { + v1 := testCase.constructor() + if yaml.Unmarshal(data, v1) != nil { + return + } + t.Log(data) + t.Log(v1) + + yamlData, err := yaml.Marshal(v1) + require.NoError(t, err) + t.Log(string(yamlData)) + + v2 := testCase.constructor() + err = yaml.Unmarshal(yamlData, v2) + if err != nil { + t.Log(string(yamlData)) + t.Fatal(err) + } + + if !assert.True(t, testCase.equalityAssertion(t, v1, v2), "failed with input data %q", string(data)) { + // look at that what the standard lib does with regular map, to help with debugging + + var m1 map[string]any + require.NoError(t, yaml.Unmarshal(data, &m1)) + + mapJsonData, err := yaml.Marshal(m1) + require.NoError(t, err) + + var m2 map[string]any + require.NoError(t, yaml.Unmarshal(mapJsonData, &m2)) + + t.Logf("initial data = %s", string(data)) + t.Logf("unmarshalled map = %v", m1) + t.Logf("re-marshalled from map = %s", string(mapJsonData)) + t.Logf("re-marshalled from test obj = %s", string(yamlData)) + t.Logf("re-unmarshalled map = %s", m2) + } + }) + } + }) +} diff --git a/third_party/go-ordered-map/yaml_test.go b/third_party/go-ordered-map/yaml_test.go new file mode 100644 index 000000000000..dcf3df6599c1 --- /dev/null +++ b/third_party/go-ordered-map/yaml_test.go @@ -0,0 +1,333 @@ +package orderedmap + +import ( + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.yaml.in/yaml/v3" + "testing" +) + +func TestMarshalYAML(t *testing.T) { + t.Run("int key", func(t *testing.T) { + om := New[int, any]() + om.Set(1, "bar") + om.Set(7, "baz") + om.Set(2, 28) + om.Set(3, 100) + om.Set(4, "baz") + om.Set(5, "28") + om.Set(6, "100") + om.Set(8, "baz") + om.Set(8, "baz") + om.Set(9, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque auctor augue accumsan mi maximus, quis viverra massa pretium. Phasellus imperdiet sapien a interdum sollicitudin. Duis at commodo lectus, a lacinia sem.") + + b, err := yaml.Marshal(om) + + expected := `1: bar +7: baz +2: 28 +3: 100 +4: baz +5: "28" +6: "100" +8: baz +9: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque auctor augue accumsan mi maximus, quis viverra massa pretium. Phasellus imperdiet sapien a interdum sollicitudin. Duis at commodo lectus, a lacinia sem. +` + assert.NoError(t, err) + assert.Equal(t, expected, string(b)) + }) + + t.Run("string key", func(t *testing.T) { + om := New[string, any]() + om.Set("test", "bar") + om.Set("abc", true) + + b, err := yaml.Marshal(om) + assert.NoError(t, err) + expected := `test: bar +abc: true +` + assert.Equal(t, expected, string(b)) + }) + + t.Run("typed string key", func(t *testing.T) { + type myString string + om := New[myString, any]() + om.Set("test", "bar") + om.Set("abc", true) + + b, err := yaml.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, `test: bar +abc: true +`, string(b)) + }) + + t.Run("typed int key", func(t *testing.T) { + type myInt uint32 + om := New[myInt, any]() + om.Set(1, "bar") + om.Set(7, "baz") + om.Set(2, 28) + om.Set(3, 100) + om.Set(4, "baz") + + b, err := yaml.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, `1: bar +7: baz +2: 28 +3: 100 +4: baz +`, string(b)) + }) + + t.Run("TextMarshaller key", func(t *testing.T) { + om := New[marshallable, any]() + om.Set(marshallable(1), "bar") + om.Set(marshallable(28), true) + + b, err := yaml.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, `'#1#': bar +'#28#': true +`, string(b)) + }) + + t.Run("empty map with 0 elements", func(t *testing.T) { + om := New[string, any]() + + b, err := yaml.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, "{}\n", string(b)) + }) + + t.Run("empty map with no elements (null)", func(t *testing.T) { + om := &OrderedMap[string, string]{} + + b, err := yaml.Marshal(om) + assert.NoError(t, err) + assert.Equal(t, "{}\n", string(b)) + }) +} + +func TestUnmarshallYAML(t *testing.T) { + t.Run("int key", func(t *testing.T) { + data := ` +1: bar +7: baz +2: 28 +3: 100 +4: baz +5: "28" +6: "100" +8: baz +` + om := New[int, any]() + require.NoError(t, yaml.Unmarshal([]byte(data), &om)) + + assertOrderedPairsEqual(t, om, + []int{1, 7, 2, 3, 4, 5, 6, 8}, + []any{"bar", "baz", 28, 100, "baz", "28", "100", "baz"}) + + // serialize back to yaml to make sure things are equal + }) + + t.Run("string key", func(t *testing.T) { + data := `{"test":"bar","abc":true}` + + om := New[string, any]() + require.NoError(t, yaml.Unmarshal([]byte(data), &om)) + + assertOrderedPairsEqual(t, om, + []string{"test", "abc"}, + []any{"bar", true}) + }) + + t.Run("typed string key", func(t *testing.T) { + data := `{"test":"bar","abc":true}` + + type myString string + om := New[myString, any]() + require.NoError(t, yaml.Unmarshal([]byte(data), &om)) + + assertOrderedPairsEqual(t, om, + []myString{"test", "abc"}, + []any{"bar", true}) + }) + + t.Run("typed int key", func(t *testing.T) { + data := ` +1: bar +7: baz +2: 28 +3: 100 +4: baz +5: "28" +6: "100" +8: baz +` + type myInt uint32 + om := New[myInt, any]() + require.NoError(t, yaml.Unmarshal([]byte(data), &om)) + + assertOrderedPairsEqual(t, om, + []myInt{1, 7, 2, 3, 4, 5, 6, 8}, + []any{"bar", "baz", 28, 100, "baz", "28", "100", "baz"}) + }) + + t.Run("TextUnmarshaler key", func(t *testing.T) { + data := `{"#1#":"bar","#28#":true}` + + om := New[marshallable, any]() + require.NoError(t, yaml.Unmarshal([]byte(data), &om)) + + assertOrderedPairsEqual(t, om, + []marshallable{1, 28}, + []any{"bar", true}) + }) + + t.Run("when fed with an input that's not an object", func(t *testing.T) { + for _, data := range []string{"true", `["foo"]`, "42", `"foo"`} { + om := New[int, any]() + require.Error(t, yaml.Unmarshal([]byte(data), &om)) + } + }) + + t.Run("empty map", func(t *testing.T) { + data := `{}` + + om := New[int, any]() + require.NoError(t, yaml.Unmarshal([]byte(data), &om)) + + assertLenEqual(t, om, 0) + }) +} + +func TestYAMLSpecialCharacters(t *testing.T) { + baselineMap := map[string]any{specialCharacters: specialCharacters} + baselineData, err := yaml.Marshal(baselineMap) + require.NoError(t, err) // baseline proves this key is supported by official yaml library + t.Logf("specialCharacters: %#v as []rune:%v", specialCharacters, []rune(specialCharacters)) + t.Logf("baseline yaml data: %s", baselineData) + + t.Run("marshal special characters", func(t *testing.T) { + om := New[string, any]() + om.Set(specialCharacters, specialCharacters) + b, err := yaml.Marshal(om) + require.NoError(t, err) + require.Equal(t, baselineData, b) + + type myString string + om2 := New[myString, myString]() + om2.Set(specialCharacters, specialCharacters) + b, err = yaml.Marshal(om2) + require.NoError(t, err) + require.Equal(t, baselineData, b) + }) + + t.Run("unmarshall special characters", func(t *testing.T) { + om := New[string, any]() + require.NoError(t, yaml.Unmarshal(baselineData, &om)) + assertOrderedPairsEqual(t, om, + []string{specialCharacters}, + []any{specialCharacters}) + + type myString string + om2 := New[myString, myString]() + require.NoError(t, yaml.Unmarshal(baselineData, &om2)) + assertOrderedPairsEqual(t, om2, + []myString{specialCharacters}, + []myString{specialCharacters}) + }) +} + +func TestYAMLRoundTrip(t *testing.T) { + for _, testCase := range []struct { + name string + input string + targetFactory func() any + }{ + { + name: "empty map", + input: "{}\n", + targetFactory: func() any { + return &OrderedMap[string, any]{} + }, + }, + { + name: "", + input: `x: 28 +m: + bar: + - 5: + foo: bar + foo: + - 12: + b: true + i: 12 + m: + a: b + c: 28 + "n": null + 28: + a: false + b: + - 1 + - 2 + - 3 + - 3: + c: null + d: 87 + 4: + e: true + 5: + f: 4 + g: 5 + h: 6 +`, + targetFactory: func() any { return &nestedMaps{} }, + }, + { + name: "with UTF-8 special chars in key", + input: "�: 0\n", + targetFactory: func() any { return &OrderedMap[string, int]{} }, + }, + } { + t.Run(testCase.name, func(t *testing.T) { + target := testCase.targetFactory() + + require.NoError(t, yaml.Unmarshal([]byte(testCase.input), target)) + + var ( + out []byte + err error + ) + + out, err = yaml.Marshal(target) + + if assert.NoError(t, err) { + assert.Equal(t, testCase.input, string(out)) + } + }) + } +} + +func BenchmarkMarshalYAML(b *testing.B) { + om := New[int, any]() + om.Set(1, "bar") + om.Set(7, "baz") + om.Set(2, 28) + om.Set(3, 100) + om.Set(4, "baz") + om.Set(5, "28") + om.Set(6, "100") + om.Set(8, "baz") + om.Set(8, "baz") + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _, _ = yaml.Marshal(om) + } +} diff --git a/third_party/goflow2/.gitignore b/third_party/goflow2/.gitignore new file mode 100644 index 000000000000..a261f2917554 --- /dev/null +++ b/third_party/goflow2/.gitignore @@ -0,0 +1 @@ +dist/* diff --git a/third_party/goflow2/Dockerfile b/third_party/goflow2/Dockerfile new file mode 100644 index 000000000000..a836949f3e2e --- /dev/null +++ b/third_party/goflow2/Dockerfile @@ -0,0 +1,36 @@ +FROM golang:alpine as builder +ARG LDFLAGS="" + +RUN apk --update --no-cache add git build-base gcc + +COPY . /build +WORKDIR /build + +RUN go build -ldflags "${LDFLAGS}" -o goflow2 cmd/goflow2/main.go + +FROM alpine:latest +ARG src_dir +ARG VERSION="" +ARG CREATED="" +ARG DESCRIPTION="" +ARG NAME="" +ARG MAINTAINER="" +ARG URL="" +ARG LICENSE="" +ARG REV="" + +LABEL org.opencontainers.image.created="${CREATED}" +LABEL org.opencontainers.image.authors="${MAINTAINER}" +LABEL org.opencontainers.image.url="${URL}" +LABEL org.opencontainers.image.title="${NAME}" +LABEL org.opencontainers.image.version="${VERSION}" +LABEL org.opencontainers.image.description="${DESCRIPTION}" +LABEL org.opencontainers.image.licenses="${LICENSE}" +LABEL org.opencontainers.image.revision="${REV}" + +RUN apk update --no-cache && \ + adduser -S -D -H -h / flow +USER flow +COPY --from=builder /build/goflow2 / + +ENTRYPOINT ["./goflow2"] diff --git a/third_party/goflow2/LICENSE b/third_party/goflow2/LICENSE new file mode 100644 index 000000000000..a2fee077c3c2 --- /dev/null +++ b/third_party/goflow2/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2021, NetSampler +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. 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. + +3. Neither the name of the copyright holder nor the names of its + contributors may 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/third_party/goflow2/Makefile b/third_party/goflow2/Makefile new file mode 100644 index 000000000000..6c935c38705e --- /dev/null +++ b/third_party/goflow2/Makefile @@ -0,0 +1,128 @@ +EXTENSION ?= +DIST_DIR ?= dist/ +GOOS ?= linux +ARCH ?= $(shell uname -m) +BUILDINFOSDET ?= + +DOCKER_REPO ?= netsampler/ +NAME := goflow2 +VERSION ?= $(shell git describe --abbrev --long HEAD) +ABBREV ?= $(shell git rev-parse --short HEAD) +COMMIT ?= $(shell git rev-parse HEAD) +TAG ?= $(shell git describe --tags --abbrev=0 HEAD) +VERSION_PKG ?= $(shell echo $(VERSION) | sed 's/^v//g') +LICENSE := BSD-3-Clause +URL := https://github.com/netsampler/goflow2 +DESCRIPTION := GoFlow2: Open-Source and Scalable Network Sample Collector +DATE := $(shell date +%FT%T%z) +BUILDINFOS ?= ($(DATE)$(BUILDINFOSDET)) +LDFLAGS ?= '-X main.version=$(VERSION) -X main.buildinfos=$(BUILDINFOS)' +MAINTAINER := lspgn@users.noreply.github.com +DOCKER_BIN ?= docker +DOCKER_CMD ?= build +DOCKER_SUFFIX ?= + +OUTPUT := $(DIST_DIR)goflow2-$(VERSION_PKG)-$(GOOS)-$(ARCH)$(EXTENSION) + +.PHONY: proto +proto: + @echo generating protobuf + protoc --go_opt=paths=source_relative --go_out=. pb/*.proto + protoc --go_opt=paths=source_relative --go_out=. cmd/enricher/pb/*.proto + +.PHONY: vet +vet: + go vet cmd/goflow2/main.go + +.PHONY: test +test: + go test -v ./... + +.PHONY: prepare +prepare: + mkdir -p $(DIST_DIR) + +PHONY: clean +clean: + rm -rf $(DIST_DIR) + +.PHONY: build +build: prepare + go build -ldflags $(LDFLAGS) -o $(OUTPUT) cmd/goflow2/main.go + +.PHONY: docker +docker: + $(DOCKER_BIN) $(DOCKER_CMD) \ + --build-arg LDFLAGS=$(LDFLAGS) \ + --build-arg CREATED="$(DATE)" \ + --build-arg MAINTAINER="$(MAINTAINER)" \ + --build-arg URL="$(URL)" \ + --build-arg NAME="$(NAME)" \ + --build-arg DESCRIPTION="$(DESCRIPTION)" \ + --build-arg LICENSE="$(LICENSE)" \ + --build-arg VERSION="$(VERSION)" \ + --build-arg REV="$(COMMIT)" \ + -t $(DOCKER_REPO)$(NAME):$(ABBREV)$(DOCKER_SUFFIX) . + +.PHONY: push-docker +push-docker: + $(DOCKER_BIN) push $(DOCKER_REPO)$(NAME):$(ABBREV)$(DOCKER_SUFFIX) + +.PHONY: docker-manifest +docker-manifest: + $(DOCKER_BIN) manifest create $(DOCKER_REPO)$(NAME):$(ABBREV) \ + --amend $(DOCKER_REPO)$(NAME):$(ABBREV)-amd64 \ + --amend $(DOCKER_REPO)$(NAME):$(ABBREV)-arm64 + $(DOCKER_BIN) manifest push $(DOCKER_REPO)$(NAME):$(ABBREV) + + $(DOCKER_BIN) manifest create $(DOCKER_REPO)$(NAME):latest \ + --amend $(DOCKER_REPO)$(NAME):$(ABBREV)-amd64 \ + --amend $(DOCKER_REPO)$(NAME):$(ABBREV)-arm64 + $(DOCKER_BIN) manifest push $(DOCKER_REPO)$(NAME):latest + +.PHONY: docker-manifest-buildx +docker-manifest-buildx: + $(DOCKER_BIN) buildx imagetools create \ + -t $(DOCKER_REPO)$(NAME):$(ABBREV) \ + $(DOCKER_REPO)$(NAME):$(ABBREV)-amd64 \ + $(DOCKER_REPO)$(NAME):$(ABBREV)-arm64 + +.PHONY: docker-manifest-release +docker-manifest-release: + $(DOCKER_BIN) manifest create $(DOCKER_REPO)$(NAME):$(VERSION) \ + --amend $(DOCKER_REPO)$(NAME):$(ABBREV)-amd64 \ + --amend $(DOCKER_REPO)$(NAME):$(ABBREV)-arm64 + $(DOCKER_BIN) manifest push $(DOCKER_REPO)$(NAME):$(VERSION) + +.PHONY: docker-manifest-release-buildx +docker-manifest-release-buildx: + $(DOCKER_BIN) buildx imagetools create \ + -t $(DOCKER_REPO)$(NAME):$(VERSION) \ + $(DOCKER_REPO)$(NAME):$(ABBREV)-amd64 \ + $(DOCKER_REPO)$(NAME):$(ABBREV)-arm64 + +.PHONY: package-deb +package-deb: prepare + fpm -s dir -t deb -n $(NAME) -v $(VERSION_PKG) \ + --maintainer "$(MAINTAINER)" \ + --description "$(DESCRIPTION)" \ + --url "$(URL)" \ + --architecture $(ARCH) \ + --license "$(LICENSE)" \ + --package $(DIST_DIR) \ + $(OUTPUT)=/usr/bin/goflow2 \ + package/goflow2.service=/lib/systemd/system/goflow2.service \ + package/goflow2.env=/etc/default/goflow2 + +.PHONY: package-rpm +package-rpm: prepare + fpm -s dir -t rpm -n $(NAME) -v $(VERSION_PKG) \ + --maintainer "$(MAINTAINER)" \ + --description "$(DESCRIPTION)" \ + --url "$(URL)" \ + --architecture $(ARCH) \ + --license "$(LICENSE) "\ + --package $(DIST_DIR) \ + $(OUTPUT)=/usr/bin/goflow2 \ + package/goflow2.service=/lib/systemd/system/goflow2.service \ + package/goflow2.env=/etc/default/goflow2 diff --git a/third_party/goflow2/PROVENANCE.md b/third_party/goflow2/PROVENANCE.md new file mode 100644 index 000000000000..905be3b32333 --- /dev/null +++ b/third_party/goflow2/PROVENANCE.md @@ -0,0 +1,18 @@ +# Temporary maintained-YAML backport + +Source: https://github.com/netsampler/goflow2 +Exact source commit: `69a6eaf99e205ed3cd02d29f044a01659107dd02` (v1.3.3). +Logical module identity: `github.com/netsampler/goflow2`. + +Upstream source, tests, fixtures, licenses and attribution are retained. Upstream +CI metadata and vendored dependency snapshots are excluded; dependency sources +continue to resolve through Go modules. The only code edits select the matching +maintained YAML v2/v3 API, including typed YAML node methods and tests. Module +metadata changes select those parsers and satisfy their Go minima. + +Tracking and temporary ownership: https://github.com/StackVista/stackstate/issues/717 +Removal condition: adopt a compatible owning-library release (or Datadog +lightweight OPA patch release) with maintained YAML and passing consumer tests, +then remove this source and its explicit root/workspace/consumer selections. +Dependency replacements do not propagate: external consumers must explicitly +select this independently addressable nested module as well. diff --git a/third_party/goflow2/README.md b/third_party/goflow2/README.md new file mode 100644 index 000000000000..36804b2402e8 --- /dev/null +++ b/third_party/goflow2/README.md @@ -0,0 +1,253 @@ +# GoFlow2 + +[![Build Status](https://github.com/netsampler/goflow2/workflows/Build/badge.svg)](https://github.com/netsampler/goflow2/actions?query=workflow%3ABuild) +[![Go Reference](https://pkg.go.dev/badge/github.com/netsampler/goflow2.svg)](https://pkg.go.dev/github.com/netsampler/goflow2) + +This application is a NetFlow/IPFIX/sFlow collector in Go. + +It gathers network information (IP, interfaces, routers) from different flow protocols, +serializes it in a common format. + +You will want to use GoFlow if: +* You receive a decent amount of network samples and need horizontal scalability +* Have protocol diversity and need a consistent format +* Require raw samples and build aggregation and custom enrichment + +This software is the entry point of a pipeline. The storage, transport, enrichment, graphing, alerting are +not provided. + +![GoFlow2 System diagram](/graphics/diagram.png) + +## Origins + +This work is a fork of a previous [open-source GoFlow code](https://github.com/cloudflare/goflow) built and used at Cloudflare. +It lives in its own GitHub organization to be maintained more easily. + +Among the differences with the original code: +The serializer and transport options have been revamped to make this program more user-friendly +and target new use-cases like logging providers. +Minimal changes in the decoding libraries. + +## Modularity + +In order to enable load-balancing and optimizations, the GoFlow library has a `decoder` which converts +the payload of a flow packet into a Go structure. + +The `producer` functions (one per protocol) then converts those structures into a protobuf (`pb/flow.pb`) +which contains the fields a network engineer is interested in. +The flow packets usually contains multiples samples +This acts as an abstraction of a sample. + +The `format` directory offers various utilities to process the protobuf. It can convert + +The `transport` provides different way of processing the protobuf. Either sending it via Kafka or +send it to a file (or stdout). + +GoFlow2 is a wrapper of all the functions and chains thems. + +You can build your own collector using this base and replace parts: +* Use different transport (e.g: RabbitMQ instead of Kafka) +* Convert to another format (e.g: Cap'n Proto, Avro, instead of protobuf) +* Decode different samples (e.g: not only IP networks, add MPLS) +* Different metrics system (e.g: [OpenTelemetry](https://opentelemetry.io/)) + +### Protocol difference + +The sampling protocols have distinct features: + +**sFlow** is a stateless protocol which sends the full header of a packet with router information +(interfaces, destination AS) while **NetFlow/IPFIX** rely on templates that contain fields (e.g: source IPv6). + +The sampling rate in NetFlow/IPFIX is provided by **Option Data Sets**. This is why it can take a few minutes +for the packets to be decoded until all the templates are received (**Option Template** and **Data Template**). + +Both of these protocols bundle multiple samples (**Data Set** in NetFlow/IPFIX and **Flow Sample** in sFlow) +in one packet. + +The advantages of using an abstract network flow format, such as protobuf, is it enables summing over the +protocols (e.g: per ASN or per port, rather than per (ASN, router) and (port, router)). + +To read more about the protocols and how they are mapped inside, check out [page](/docs/protocols.md) + +### Features of GoFlow2 + +Collection: +* NetFlow v5 +* IPFIX/NetFlow v9 (sampling rate provided by the Option Data Set) +* sFlow v5 + +(adding NetFlow v1,7,8 is being evaluated) + +Production: +* Convert to protobuf or json +* Prints to the console/file +* Sends to Kafka and partition + +Monitoring via Prometheus metrics + +## Get started + +To read about agents that samples network traffic, check this [page](/docs/agents.md). + +To set up the collector, download the latest release corresponding to your OS +and run the following command (the binaries have a suffix with the version): + +```bash +$ ./goflow2 +``` + +By default, this command will launch an sFlow collector on port `:6343` and +a NetFlowV9/IPFIX collector on port `:2055`. + +By default, the samples received will be printed in JSON format on the stdout. + +```json +{ + "Type": "SFLOW_5", + "TimeFlowEnd": 1621820000, + "TimeFlowStart": 1621820000, + "TimeReceived": 1621820000, + "Bytes": 70, + "Packets": 1, + "SamplingRate": 100, + "SamplerAddress": "192.168.1.254", + "DstAddr": "10.0.0.1", + "DstMac": "ff:ff:ff:ff:ff:ff", + "SrcAddr": "192.168.1.1", + "SrcMac": "ff:ff:ff:ff:ff:ff", + "InIf": 1, + "OutIf": 2, + "Etype": 2048, + "EtypeName": "IPv4", + "Proto": 6, + "ProtoName": "TCP", + "SrcPort": 443, + "DstPort": 46344, + "FragmentId": 54044, + "FragmentOffset": 16384, + ... + "IPTTL": 64, + "IPTos": 0, + "TCPFlags": 16, +} +``` + +If you are using a log integration (e.g: Loki with Promtail, Splunk, Fluentd, Google Cloud Logs, etc.), +just send the output into a file. +```bash +$ ./goflow2 -transport.file /var/logs/goflow2.log +``` + +To enable Kafka and send protobuf, use the following arguments: +```bash +$ ./goflow2 -transport=kafka -transport.kafka.brokers=localhost:9092 -transport.kafka.topic=flows -format=pb +``` + +By default, the distribution will be randomized. +To partition the feed (any field of the protobuf is available), the following options can be used: +``` +-transport.kafka.hashing=true \ +-format.hash=SamplerAddress,DstAS +``` + +By default, compression is disabled when sending data to Kafka. +To change the kafka compression type of the producer side configure the following option: +``` +-transport.kafka.compression.type=gzip +``` +The list of codecs is available in the [Sarama documentation](https://pkg.go.dev/github.com/Shopify/sarama#CompressionCodec). + + +By default, the collector will listen for IPFIX/NetFlow V9 on port 2055 +and sFlow on port 6343. +To change the sockets binding, you can set the `-listen` argument and a URI +for each protocol (`netflow`, `sflow` and `nfl` as scheme) separated by a comma. +For instance, to create 4 parallel sockets of sFlow and one of NetFlow V5, you can use: + +```bash +$ ./goflow2 -listen 'sflow://:6343?count=4,nfl://:2055' +``` + +### Docker + +You can also run directly with a container: +``` +$ sudo docker run -p 6343:6343/udp -p 2055:2055/udp -ti netsampler/goflow2:latest +``` + +### Mapping extra fields + +In the case of exotic template fields or extra payload not supported by GoFlow2 +of out the box, it is possible to pass a mapping file using `-mapping mapping.yaml`. +A [sample file](cmd/goflow2/mapping.yaml) is available in the `cmd/goflow2` directory. + +For instance, certain devices producing IPFIX use `ingressPhysicalInterface` (id: 252) +and do not use `ingressInterface` (id: 10). Using the following you can have the interface mapped +in the InIf protobuf field without changing the code. + +```yaml +ipfix: + mapping: + - field: 252 + destination: InIf + - field: 253 + destination: OutIf +``` + +### Output format considerations + +The JSON format is advised only when consuming a small amount of data directly. +For bigger workloads, the protobuf output format provides a binary representation +and is preferred. +It can also be extended with enrichment as long as the user keep the same IDs. + +If you want to develop applications, build `pb/flow.proto` into the language you want: +When adding custom fields, picking a field ID ≥ 1000 is suggested. + +Check the docs for more information about [compiling protobuf](/docs/protobuf.md). + +## Flow Pipeline + +A basic enrichment tool is available in the `cmd/enricher` directory. +You need to load the Maxmind GeoIP ASN and Country databases using `-db.asn` and `-db.country`. + +Running a flow enrichment system is as simple as a pipe. +Once you plug the stdin of the enricher to the stdout of GoFlow in protobuf, +the source and destination IP addresses will automatically be mapped +with a database for Autonomous System Number and Country. +Similar output options as GoFlow are provided. + +```bash +$ ./goflow2 -transport.file.sep= -format=pb -format.protobuf.fixedlen=true | ./enricher -db.asn path-to/GeoLite2-ASN.mmdb -db.country path-to/GeoLite2-Country.mmdb +``` + +For a more scalable production setting, Kafka and protobuf are recommended. +Stream operations (aggregation and filtering) can be done with stream-processor tools. +For instance Flink, or the more recent Kafka Streams and kSQLdb. +Direct storage can be done with data-warehouses like Clickhouse. + +In some cases, the consumer will require protobuf messages to be prefixed by +length. To do this, use the flag `-format.protobuf.fixedlen=true`. + +This repository contains [examples of pipelines](./compose) with docker-compose. +The available pipelines are: +* [Kafka+Clickhouse+Grafana](./compose/kcg) +* [Logstash+Elastic+Kibana](./compose/elk) + +## User stories + +Are you using GoFlow2 in production at scale? Add yourself here! + +### Contributions + +This project welcomes pull-requests, whether it's documentation, +instrumentation (e.g: docker-compose, metrics), internals (protocol libraries), +integration (new CLI feature) or else! +Just make sure to check for the use-cases via an issue. + +This software would not exist without the testing and commits from +its users and [contributors](docs/contributors.md). + +## License + +Licensed under the BSD-3 License. diff --git a/third_party/goflow2/cmd/enricher/main.go b/third_party/goflow2/cmd/enricher/main.go new file mode 100644 index 000000000000..81b44810f208 --- /dev/null +++ b/third_party/goflow2/cmd/enricher/main.go @@ -0,0 +1,197 @@ +package main + +import ( + "bufio" + "bytes" + "context" + "encoding/binary" + "flag" + "fmt" + "io" + "net" + "net/http" + "os" + "strings" + + "github.com/oschwald/geoip2-golang" + + "github.com/golang/protobuf/proto" + flowmessage "github.com/netsampler/goflow2/cmd/enricher/pb" + + // import various formatters + "github.com/netsampler/goflow2/format" + _ "github.com/netsampler/goflow2/format/json" + _ "github.com/netsampler/goflow2/format/protobuf" + _ "github.com/netsampler/goflow2/format/text" + + // import various transports + "github.com/netsampler/goflow2/transport" + _ "github.com/netsampler/goflow2/transport/file" + _ "github.com/netsampler/goflow2/transport/kafka" + + "github.com/prometheus/client_golang/prometheus/promhttp" + log "github.com/sirupsen/logrus" +) + +var ( + version = "" + buildinfos = "" + AppVersion = "Enricher " + version + " " + buildinfos + + DbAsn = flag.String("db.asn", "", "IP->ASN database") + DbCountry = flag.String("db.country", "", "IP->Country database") + + LogLevel = flag.String("loglevel", "info", "Log level") + LogFmt = flag.String("logfmt", "normal", "Log formatter") + + SamplingRate = flag.Int("samplingrate", 0, "Set sampling rate (values > 0)") + + Format = flag.String("format", "json", fmt.Sprintf("Choose the format (available: %s)", strings.Join(format.GetFormats(), ", "))) + Transport = flag.String("transport", "file", fmt.Sprintf("Choose the transport (available: %s)", strings.Join(transport.GetTransports(), ", "))) + + MetricsAddr = flag.String("metrics.addr", ":8081", "Metrics address") + MetricsPath = flag.String("metrics.path", "/metrics", "Metrics path") + + TemplatePath = flag.String("templates.path", "/templates", "NetFlow/IPFIX templates list") + + Version = flag.Bool("v", false, "Print version") +) + +func httpServer() { + http.Handle(*MetricsPath, promhttp.Handler()) + log.Fatal(http.ListenAndServe(*MetricsAddr, nil)) +} + +func MapAsn(db *geoip2.Reader, addr []byte, dest *uint32) { + entry, err := db.ASN(net.IP(addr)) + if err != nil { + return + } + *dest = uint32(entry.AutonomousSystemNumber) +} +func MapCountry(db *geoip2.Reader, addr []byte, dest *string) { + entry, err := db.Country(net.IP(addr)) + if err != nil { + return + } + *dest = entry.Country.IsoCode +} + +func MapFlow(dbAsn, dbCountry *geoip2.Reader, msg *flowmessage.FlowMessageExt) { + if dbAsn != nil { + MapAsn(dbAsn, msg.SrcAddr, &(msg.SrcAs)) + MapAsn(dbAsn, msg.DstAddr, &(msg.DstAs)) + } + if dbCountry != nil { + MapCountry(dbCountry, msg.SrcAddr, &(msg.SrcCountry)) + MapCountry(dbCountry, msg.DstAddr, &(msg.DstCountry)) + } +} + +func main() { + flag.Parse() + + if *Version { + fmt.Println(AppVersion) + os.Exit(0) + } + + lvl, _ := log.ParseLevel(*LogLevel) + log.SetLevel(lvl) + + var dbAsn, dbCountry *geoip2.Reader + var err error + if *DbAsn != "" { + dbAsn, err = geoip2.Open(*DbAsn) + if err != nil { + log.Fatal(err) + } + defer dbAsn.Close() + } + + if *DbCountry != "" { + dbCountry, err = geoip2.Open(*DbCountry) + if err != nil { + log.Fatal(err) + } + defer dbCountry.Close() + } + + ctx := context.Background() + + formatter, err := format.FindFormat(ctx, *Format) + if err != nil { + log.Fatal(err) + } + + transporter, err := transport.FindTransport(ctx, *Transport) + if err != nil { + log.Fatal(err) + } + defer transporter.Close(ctx) + + switch *LogFmt { + case "json": + log.SetFormatter(&log.JSONFormatter{}) + } + + log.Info("Starting enricher") + + go httpServer() + + rdr := bufio.NewReader(os.Stdin) + + msg := &flowmessage.FlowMessageExt{} + lenBufSize := binary.MaxVarintLen64 + for { + msgLen, err := rdr.Peek(lenBufSize) + if err != nil && err != io.EOF { + log.Error(err) + continue + } + + l, vn := proto.DecodeVarint(msgLen) + if l == 0 { + continue + } + + _, err = rdr.Discard(vn) + if err != nil { + log.Error(err) + continue + } + + line := make([]byte, l) + + _, err = io.ReadFull(rdr, line) + if err != nil && err != io.EOF { + log.Error(err) + continue + } + line = bytes.TrimSuffix(line, []byte("\n")) + + err = proto.Unmarshal(line, msg) + if err != nil { + log.Error(err) + continue + } + + MapFlow(dbAsn, dbCountry, msg) + + if *SamplingRate > 0 { + msg.SamplingRate = uint64(*SamplingRate) + } + + key, data, err := formatter.Format(msg) + if err != nil { + log.Error(err) + continue + } + + err = transporter.Send(key, data) + if err != nil { + log.Error(err) + continue + } + } +} diff --git a/third_party/goflow2/cmd/enricher/pb/flowext.pb.go b/third_party/goflow2/cmd/enricher/pb/flowext.pb.go new file mode 100644 index 000000000000..6bfd79a778e9 --- /dev/null +++ b/third_party/goflow2/cmd/enricher/pb/flowext.pb.go @@ -0,0 +1,830 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.21.4 +// source: cmd/enricher/pb/flowext.proto + +package flowpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +type FlowMessageExt_FlowType int32 + +const ( + FlowMessageExt_FLOWUNKNOWN FlowMessageExt_FlowType = 0 + FlowMessageExt_SFLOW_5 FlowMessageExt_FlowType = 1 + FlowMessageExt_NETFLOW_V5 FlowMessageExt_FlowType = 2 + FlowMessageExt_NETFLOW_V9 FlowMessageExt_FlowType = 3 + FlowMessageExt_IPFIX FlowMessageExt_FlowType = 4 +) + +// Enum value maps for FlowMessageExt_FlowType. +var ( + FlowMessageExt_FlowType_name = map[int32]string{ + 0: "FLOWUNKNOWN", + 1: "SFLOW_5", + 2: "NETFLOW_V5", + 3: "NETFLOW_V9", + 4: "IPFIX", + } + FlowMessageExt_FlowType_value = map[string]int32{ + "FLOWUNKNOWN": 0, + "SFLOW_5": 1, + "NETFLOW_V5": 2, + "NETFLOW_V9": 3, + "IPFIX": 4, + } +) + +func (x FlowMessageExt_FlowType) Enum() *FlowMessageExt_FlowType { + p := new(FlowMessageExt_FlowType) + *p = x + return p +} + +func (x FlowMessageExt_FlowType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FlowMessageExt_FlowType) Descriptor() protoreflect.EnumDescriptor { + return file_cmd_enricher_pb_flowext_proto_enumTypes[0].Descriptor() +} + +func (FlowMessageExt_FlowType) Type() protoreflect.EnumType { + return &file_cmd_enricher_pb_flowext_proto_enumTypes[0] +} + +func (x FlowMessageExt_FlowType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use FlowMessageExt_FlowType.Descriptor instead. +func (FlowMessageExt_FlowType) EnumDescriptor() ([]byte, []int) { + return file_cmd_enricher_pb_flowext_proto_rawDescGZIP(), []int{0, 0} +} + +type FlowMessageExt struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type FlowMessageExt_FlowType `protobuf:"varint,1,opt,name=type,proto3,enum=flowpb.FlowMessageExt_FlowType" json:"type,omitempty"` + TimeReceived uint64 `protobuf:"varint,2,opt,name=time_received,json=timeReceived,proto3" json:"time_received,omitempty"` + SequenceNum uint32 `protobuf:"varint,4,opt,name=sequence_num,json=sequenceNum,proto3" json:"sequence_num,omitempty"` + SamplingRate uint64 `protobuf:"varint,3,opt,name=sampling_rate,json=samplingRate,proto3" json:"sampling_rate,omitempty"` + FlowDirection uint32 `protobuf:"varint,42,opt,name=flow_direction,json=flowDirection,proto3" json:"flow_direction,omitempty"` + // Sampler information + SamplerAddress []byte `protobuf:"bytes,11,opt,name=sampler_address,json=samplerAddress,proto3" json:"sampler_address,omitempty"` + // Found inside packet + TimeFlowStart uint64 `protobuf:"varint,38,opt,name=time_flow_start,json=timeFlowStart,proto3" json:"time_flow_start,omitempty"` + TimeFlowEnd uint64 `protobuf:"varint,5,opt,name=time_flow_end,json=timeFlowEnd,proto3" json:"time_flow_end,omitempty"` + TimeFlowStartMs uint64 `protobuf:"varint,63,opt,name=time_flow_start_ms,json=timeFlowStartMs,proto3" json:"time_flow_start_ms,omitempty"` + TimeFlowEndMs uint64 `protobuf:"varint,64,opt,name=time_flow_end_ms,json=timeFlowEndMs,proto3" json:"time_flow_end_ms,omitempty"` + // Size of the sampled packet + Bytes uint64 `protobuf:"varint,9,opt,name=bytes,proto3" json:"bytes,omitempty"` + Packets uint64 `protobuf:"varint,10,opt,name=packets,proto3" json:"packets,omitempty"` + // Source/destination addresses + SrcAddr []byte `protobuf:"bytes,6,opt,name=src_addr,json=srcAddr,proto3" json:"src_addr,omitempty"` + DstAddr []byte `protobuf:"bytes,7,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"` + // Layer 3 protocol (IPv4/IPv6/ARP/MPLS...) + Etype uint32 `protobuf:"varint,30,opt,name=etype,proto3" json:"etype,omitempty"` + // Layer 4 protocol + Proto uint32 `protobuf:"varint,20,opt,name=proto,proto3" json:"proto,omitempty"` + // Ports for UDP and TCP + SrcPort uint32 `protobuf:"varint,21,opt,name=src_port,json=srcPort,proto3" json:"src_port,omitempty"` + DstPort uint32 `protobuf:"varint,22,opt,name=dst_port,json=dstPort,proto3" json:"dst_port,omitempty"` + // Interfaces + InIf uint32 `protobuf:"varint,18,opt,name=in_if,json=inIf,proto3" json:"in_if,omitempty"` + OutIf uint32 `protobuf:"varint,19,opt,name=out_if,json=outIf,proto3" json:"out_if,omitempty"` + // Ethernet information + SrcMac uint64 `protobuf:"varint,27,opt,name=src_mac,json=srcMac,proto3" json:"src_mac,omitempty"` + DstMac uint64 `protobuf:"varint,28,opt,name=dst_mac,json=dstMac,proto3" json:"dst_mac,omitempty"` + // Vlan + SrcVlan uint32 `protobuf:"varint,33,opt,name=src_vlan,json=srcVlan,proto3" json:"src_vlan,omitempty"` + DstVlan uint32 `protobuf:"varint,34,opt,name=dst_vlan,json=dstVlan,proto3" json:"dst_vlan,omitempty"` + // 802.1q VLAN in sampled packet + VlanId uint32 `protobuf:"varint,29,opt,name=vlan_id,json=vlanId,proto3" json:"vlan_id,omitempty"` + // VRF + IngressVrfId uint32 `protobuf:"varint,39,opt,name=ingress_vrf_id,json=ingressVrfId,proto3" json:"ingress_vrf_id,omitempty"` + EgressVrfId uint32 `protobuf:"varint,40,opt,name=egress_vrf_id,json=egressVrfId,proto3" json:"egress_vrf_id,omitempty"` + // IP and TCP special flags + IpTos uint32 `protobuf:"varint,23,opt,name=ip_tos,json=ipTos,proto3" json:"ip_tos,omitempty"` + ForwardingStatus uint32 `protobuf:"varint,24,opt,name=forwarding_status,json=forwardingStatus,proto3" json:"forwarding_status,omitempty"` + IpTtl uint32 `protobuf:"varint,25,opt,name=ip_ttl,json=ipTtl,proto3" json:"ip_ttl,omitempty"` + TcpFlags uint32 `protobuf:"varint,26,opt,name=tcp_flags,json=tcpFlags,proto3" json:"tcp_flags,omitempty"` + IcmpType uint32 `protobuf:"varint,31,opt,name=icmp_type,json=icmpType,proto3" json:"icmp_type,omitempty"` + IcmpCode uint32 `protobuf:"varint,32,opt,name=icmp_code,json=icmpCode,proto3" json:"icmp_code,omitempty"` + Ipv6FlowLabel uint32 `protobuf:"varint,37,opt,name=ipv6_flow_label,json=ipv6FlowLabel,proto3" json:"ipv6_flow_label,omitempty"` + // Fragments (IPv4/IPv6) + FragmentId uint32 `protobuf:"varint,35,opt,name=fragment_id,json=fragmentId,proto3" json:"fragment_id,omitempty"` + FragmentOffset uint32 `protobuf:"varint,36,opt,name=fragment_offset,json=fragmentOffset,proto3" json:"fragment_offset,omitempty"` + BiFlowDirection uint32 `protobuf:"varint,41,opt,name=bi_flow_direction,json=biFlowDirection,proto3" json:"bi_flow_direction,omitempty"` + // Autonomous system information + SrcAs uint32 `protobuf:"varint,14,opt,name=src_as,json=srcAs,proto3" json:"src_as,omitempty"` + DstAs uint32 `protobuf:"varint,15,opt,name=dst_as,json=dstAs,proto3" json:"dst_as,omitempty"` + NextHop []byte `protobuf:"bytes,12,opt,name=next_hop,json=nextHop,proto3" json:"next_hop,omitempty"` + NextHopAs uint32 `protobuf:"varint,13,opt,name=next_hop_as,json=nextHopAs,proto3" json:"next_hop_as,omitempty"` + // Prefix size + SrcNet uint32 `protobuf:"varint,16,opt,name=src_net,json=srcNet,proto3" json:"src_net,omitempty"` + DstNet uint32 `protobuf:"varint,17,opt,name=dst_net,json=dstNet,proto3" json:"dst_net,omitempty"` + // BGP information + BgpNextHop []byte `protobuf:"bytes,100,opt,name=bgp_next_hop,json=bgpNextHop,proto3" json:"bgp_next_hop,omitempty"` + BgpCommunities []uint32 `protobuf:"varint,101,rep,packed,name=bgp_communities,json=bgpCommunities,proto3" json:"bgp_communities,omitempty"` + AsPath []uint32 `protobuf:"varint,102,rep,packed,name=as_path,json=asPath,proto3" json:"as_path,omitempty"` + // MPLS information + HasMpls bool `protobuf:"varint,53,opt,name=has_mpls,json=hasMpls,proto3" json:"has_mpls,omitempty"` + MplsCount uint32 `protobuf:"varint,54,opt,name=mpls_count,json=mplsCount,proto3" json:"mpls_count,omitempty"` + Mpls_1Ttl uint32 `protobuf:"varint,55,opt,name=mpls_1_ttl,json=mpls1Ttl,proto3" json:"mpls_1_ttl,omitempty"` // First TTL + Mpls_1Label uint32 `protobuf:"varint,56,opt,name=mpls_1_label,json=mpls1Label,proto3" json:"mpls_1_label,omitempty"` // First Label + Mpls_2Ttl uint32 `protobuf:"varint,57,opt,name=mpls_2_ttl,json=mpls2Ttl,proto3" json:"mpls_2_ttl,omitempty"` // Second TTL + Mpls_2Label uint32 `protobuf:"varint,58,opt,name=mpls_2_label,json=mpls2Label,proto3" json:"mpls_2_label,omitempty"` // Second Label + Mpls_3Ttl uint32 `protobuf:"varint,59,opt,name=mpls_3_ttl,json=mpls3Ttl,proto3" json:"mpls_3_ttl,omitempty"` // Third TTL + Mpls_3Label uint32 `protobuf:"varint,60,opt,name=mpls_3_label,json=mpls3Label,proto3" json:"mpls_3_label,omitempty"` // Third Label + MplsLastTtl uint32 `protobuf:"varint,61,opt,name=mpls_last_ttl,json=mplsLastTtl,proto3" json:"mpls_last_ttl,omitempty"` // Last TTL + MplsLastLabel uint32 `protobuf:"varint,62,opt,name=mpls_last_label,json=mplsLastLabel,proto3" json:"mpls_last_label,omitempty"` // Last Label + MplsLabelIp []byte `protobuf:"bytes,65,opt,name=mpls_label_ip,json=mplsLabelIp,proto3" json:"mpls_label_ip,omitempty"` // MPLS TOP Label IP + ObservationDomainId uint32 `protobuf:"varint,70,opt,name=observation_domain_id,json=observationDomainId,proto3" json:"observation_domain_id,omitempty"` + ObservationPointId uint32 `protobuf:"varint,71,opt,name=observation_point_id,json=observationPointId,proto3" json:"observation_point_id,omitempty"` + SrcCountry string `protobuf:"bytes,1000,opt,name=src_country,json=srcCountry,proto3" json:"src_country,omitempty"` + DstCountry string `protobuf:"bytes,1001,opt,name=dst_country,json=dstCountry,proto3" json:"dst_country,omitempty"` +} + +func (x *FlowMessageExt) Reset() { + *x = FlowMessageExt{} + if protoimpl.UnsafeEnabled { + mi := &file_cmd_enricher_pb_flowext_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FlowMessageExt) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FlowMessageExt) ProtoMessage() {} + +func (x *FlowMessageExt) ProtoReflect() protoreflect.Message { + mi := &file_cmd_enricher_pb_flowext_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FlowMessageExt.ProtoReflect.Descriptor instead. +func (*FlowMessageExt) Descriptor() ([]byte, []int) { + return file_cmd_enricher_pb_flowext_proto_rawDescGZIP(), []int{0} +} + +func (x *FlowMessageExt) GetType() FlowMessageExt_FlowType { + if x != nil { + return x.Type + } + return FlowMessageExt_FLOWUNKNOWN +} + +func (x *FlowMessageExt) GetTimeReceived() uint64 { + if x != nil { + return x.TimeReceived + } + return 0 +} + +func (x *FlowMessageExt) GetSequenceNum() uint32 { + if x != nil { + return x.SequenceNum + } + return 0 +} + +func (x *FlowMessageExt) GetSamplingRate() uint64 { + if x != nil { + return x.SamplingRate + } + return 0 +} + +func (x *FlowMessageExt) GetFlowDirection() uint32 { + if x != nil { + return x.FlowDirection + } + return 0 +} + +func (x *FlowMessageExt) GetSamplerAddress() []byte { + if x != nil { + return x.SamplerAddress + } + return nil +} + +func (x *FlowMessageExt) GetTimeFlowStart() uint64 { + if x != nil { + return x.TimeFlowStart + } + return 0 +} + +func (x *FlowMessageExt) GetTimeFlowEnd() uint64 { + if x != nil { + return x.TimeFlowEnd + } + return 0 +} + +func (x *FlowMessageExt) GetTimeFlowStartMs() uint64 { + if x != nil { + return x.TimeFlowStartMs + } + return 0 +} + +func (x *FlowMessageExt) GetTimeFlowEndMs() uint64 { + if x != nil { + return x.TimeFlowEndMs + } + return 0 +} + +func (x *FlowMessageExt) GetBytes() uint64 { + if x != nil { + return x.Bytes + } + return 0 +} + +func (x *FlowMessageExt) GetPackets() uint64 { + if x != nil { + return x.Packets + } + return 0 +} + +func (x *FlowMessageExt) GetSrcAddr() []byte { + if x != nil { + return x.SrcAddr + } + return nil +} + +func (x *FlowMessageExt) GetDstAddr() []byte { + if x != nil { + return x.DstAddr + } + return nil +} + +func (x *FlowMessageExt) GetEtype() uint32 { + if x != nil { + return x.Etype + } + return 0 +} + +func (x *FlowMessageExt) GetProto() uint32 { + if x != nil { + return x.Proto + } + return 0 +} + +func (x *FlowMessageExt) GetSrcPort() uint32 { + if x != nil { + return x.SrcPort + } + return 0 +} + +func (x *FlowMessageExt) GetDstPort() uint32 { + if x != nil { + return x.DstPort + } + return 0 +} + +func (x *FlowMessageExt) GetInIf() uint32 { + if x != nil { + return x.InIf + } + return 0 +} + +func (x *FlowMessageExt) GetOutIf() uint32 { + if x != nil { + return x.OutIf + } + return 0 +} + +func (x *FlowMessageExt) GetSrcMac() uint64 { + if x != nil { + return x.SrcMac + } + return 0 +} + +func (x *FlowMessageExt) GetDstMac() uint64 { + if x != nil { + return x.DstMac + } + return 0 +} + +func (x *FlowMessageExt) GetSrcVlan() uint32 { + if x != nil { + return x.SrcVlan + } + return 0 +} + +func (x *FlowMessageExt) GetDstVlan() uint32 { + if x != nil { + return x.DstVlan + } + return 0 +} + +func (x *FlowMessageExt) GetVlanId() uint32 { + if x != nil { + return x.VlanId + } + return 0 +} + +func (x *FlowMessageExt) GetIngressVrfId() uint32 { + if x != nil { + return x.IngressVrfId + } + return 0 +} + +func (x *FlowMessageExt) GetEgressVrfId() uint32 { + if x != nil { + return x.EgressVrfId + } + return 0 +} + +func (x *FlowMessageExt) GetIpTos() uint32 { + if x != nil { + return x.IpTos + } + return 0 +} + +func (x *FlowMessageExt) GetForwardingStatus() uint32 { + if x != nil { + return x.ForwardingStatus + } + return 0 +} + +func (x *FlowMessageExt) GetIpTtl() uint32 { + if x != nil { + return x.IpTtl + } + return 0 +} + +func (x *FlowMessageExt) GetTcpFlags() uint32 { + if x != nil { + return x.TcpFlags + } + return 0 +} + +func (x *FlowMessageExt) GetIcmpType() uint32 { + if x != nil { + return x.IcmpType + } + return 0 +} + +func (x *FlowMessageExt) GetIcmpCode() uint32 { + if x != nil { + return x.IcmpCode + } + return 0 +} + +func (x *FlowMessageExt) GetIpv6FlowLabel() uint32 { + if x != nil { + return x.Ipv6FlowLabel + } + return 0 +} + +func (x *FlowMessageExt) GetFragmentId() uint32 { + if x != nil { + return x.FragmentId + } + return 0 +} + +func (x *FlowMessageExt) GetFragmentOffset() uint32 { + if x != nil { + return x.FragmentOffset + } + return 0 +} + +func (x *FlowMessageExt) GetBiFlowDirection() uint32 { + if x != nil { + return x.BiFlowDirection + } + return 0 +} + +func (x *FlowMessageExt) GetSrcAs() uint32 { + if x != nil { + return x.SrcAs + } + return 0 +} + +func (x *FlowMessageExt) GetDstAs() uint32 { + if x != nil { + return x.DstAs + } + return 0 +} + +func (x *FlowMessageExt) GetNextHop() []byte { + if x != nil { + return x.NextHop + } + return nil +} + +func (x *FlowMessageExt) GetNextHopAs() uint32 { + if x != nil { + return x.NextHopAs + } + return 0 +} + +func (x *FlowMessageExt) GetSrcNet() uint32 { + if x != nil { + return x.SrcNet + } + return 0 +} + +func (x *FlowMessageExt) GetDstNet() uint32 { + if x != nil { + return x.DstNet + } + return 0 +} + +func (x *FlowMessageExt) GetBgpNextHop() []byte { + if x != nil { + return x.BgpNextHop + } + return nil +} + +func (x *FlowMessageExt) GetBgpCommunities() []uint32 { + if x != nil { + return x.BgpCommunities + } + return nil +} + +func (x *FlowMessageExt) GetAsPath() []uint32 { + if x != nil { + return x.AsPath + } + return nil +} + +func (x *FlowMessageExt) GetHasMpls() bool { + if x != nil { + return x.HasMpls + } + return false +} + +func (x *FlowMessageExt) GetMplsCount() uint32 { + if x != nil { + return x.MplsCount + } + return 0 +} + +func (x *FlowMessageExt) GetMpls_1Ttl() uint32 { + if x != nil { + return x.Mpls_1Ttl + } + return 0 +} + +func (x *FlowMessageExt) GetMpls_1Label() uint32 { + if x != nil { + return x.Mpls_1Label + } + return 0 +} + +func (x *FlowMessageExt) GetMpls_2Ttl() uint32 { + if x != nil { + return x.Mpls_2Ttl + } + return 0 +} + +func (x *FlowMessageExt) GetMpls_2Label() uint32 { + if x != nil { + return x.Mpls_2Label + } + return 0 +} + +func (x *FlowMessageExt) GetMpls_3Ttl() uint32 { + if x != nil { + return x.Mpls_3Ttl + } + return 0 +} + +func (x *FlowMessageExt) GetMpls_3Label() uint32 { + if x != nil { + return x.Mpls_3Label + } + return 0 +} + +func (x *FlowMessageExt) GetMplsLastTtl() uint32 { + if x != nil { + return x.MplsLastTtl + } + return 0 +} + +func (x *FlowMessageExt) GetMplsLastLabel() uint32 { + if x != nil { + return x.MplsLastLabel + } + return 0 +} + +func (x *FlowMessageExt) GetMplsLabelIp() []byte { + if x != nil { + return x.MplsLabelIp + } + return nil +} + +func (x *FlowMessageExt) GetObservationDomainId() uint32 { + if x != nil { + return x.ObservationDomainId + } + return 0 +} + +func (x *FlowMessageExt) GetObservationPointId() uint32 { + if x != nil { + return x.ObservationPointId + } + return 0 +} + +func (x *FlowMessageExt) GetSrcCountry() string { + if x != nil { + return x.SrcCountry + } + return "" +} + +func (x *FlowMessageExt) GetDstCountry() string { + if x != nil { + return x.DstCountry + } + return "" +} + +var File_cmd_enricher_pb_flowext_proto protoreflect.FileDescriptor + +var file_cmd_enricher_pb_flowext_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x63, 0x6d, 0x64, 0x2f, 0x65, 0x6e, 0x72, 0x69, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x70, + 0x62, 0x2f, 0x66, 0x6c, 0x6f, 0x77, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x06, 0x66, 0x6c, 0x6f, 0x77, 0x70, 0x62, 0x22, 0x9b, 0x10, 0x0a, 0x0e, 0x46, 0x6c, 0x6f, 0x77, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x78, 0x74, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x66, 0x6c, 0x6f, 0x77, 0x70, + 0x62, 0x2e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x78, 0x74, + 0x2e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x23, 0x0a, 0x0d, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, + 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x73, 0x65, 0x71, 0x75, + 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x61, 0x6d, 0x70, 0x6c, + 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, + 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x69, 0x6e, 0x67, 0x52, 0x61, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x0e, + 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x2a, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x66, 0x6c, 0x6f, 0x77, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x73, 0x61, + 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, + 0x26, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x74, 0x69, 0x6d, 0x65, 0x46, 0x6c, 0x6f, 0x77, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x66, 0x6c, 0x6f, + 0x77, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x74, 0x69, 0x6d, + 0x65, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x6e, 0x64, 0x12, 0x2b, 0x0a, 0x12, 0x74, 0x69, 0x6d, 0x65, + 0x5f, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6d, 0x73, 0x18, 0x3f, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x4d, 0x73, 0x12, 0x27, 0x0a, 0x10, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x66, 0x6c, + 0x6f, 0x77, 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x6d, 0x73, 0x18, 0x40, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0d, 0x74, 0x69, 0x6d, 0x65, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x6e, 0x64, 0x4d, 0x73, 0x12, 0x14, + 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x19, + 0x0a, 0x08, 0x73, 0x72, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x73, 0x72, 0x63, 0x41, 0x64, 0x64, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x73, 0x74, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x64, 0x73, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x74, 0x79, 0x70, 0x65, 0x18, 0x1e, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x05, 0x65, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x19, 0x0a, 0x08, 0x73, 0x72, 0x63, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x15, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x07, 0x73, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x64, + 0x73, 0x74, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x64, + 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x13, 0x0a, 0x05, 0x69, 0x6e, 0x5f, 0x69, 0x66, 0x18, + 0x12, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x69, 0x6e, 0x49, 0x66, 0x12, 0x15, 0x0a, 0x06, 0x6f, + 0x75, 0x74, 0x5f, 0x69, 0x66, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6f, 0x75, 0x74, + 0x49, 0x66, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x72, 0x63, 0x5f, 0x6d, 0x61, 0x63, 0x18, 0x1b, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x06, 0x73, 0x72, 0x63, 0x4d, 0x61, 0x63, 0x12, 0x17, 0x0a, 0x07, 0x64, + 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x63, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x64, 0x73, + 0x74, 0x4d, 0x61, 0x63, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x72, 0x63, 0x5f, 0x76, 0x6c, 0x61, 0x6e, + 0x18, 0x21, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x73, 0x72, 0x63, 0x56, 0x6c, 0x61, 0x6e, 0x12, + 0x19, 0x0a, 0x08, 0x64, 0x73, 0x74, 0x5f, 0x76, 0x6c, 0x61, 0x6e, 0x18, 0x22, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x07, 0x64, 0x73, 0x74, 0x56, 0x6c, 0x61, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x76, 0x6c, + 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x6c, 0x61, + 0x6e, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x6e, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x76, + 0x72, 0x66, 0x5f, 0x69, 0x64, 0x18, 0x27, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x69, 0x6e, 0x67, + 0x72, 0x65, 0x73, 0x73, 0x56, 0x72, 0x66, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x65, 0x67, 0x72, + 0x65, 0x73, 0x73, 0x5f, 0x76, 0x72, 0x66, 0x5f, 0x69, 0x64, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x0b, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x56, 0x72, 0x66, 0x49, 0x64, 0x12, 0x15, 0x0a, + 0x06, 0x69, 0x70, 0x5f, 0x74, 0x6f, 0x73, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, + 0x70, 0x54, 0x6f, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, + 0x6e, 0x67, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x10, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x15, 0x0a, 0x06, 0x69, 0x70, 0x5f, 0x74, 0x74, 0x6c, 0x18, 0x19, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x69, 0x70, 0x54, 0x74, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x63, 0x70, 0x5f, + 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x74, 0x63, 0x70, + 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x63, 0x6d, 0x70, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x69, 0x63, 0x6d, 0x70, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x63, 0x6d, 0x70, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, + 0x20, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x69, 0x63, 0x6d, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x26, 0x0a, 0x0f, 0x69, 0x70, 0x76, 0x36, 0x5f, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x6c, 0x61, 0x62, + 0x65, 0x6c, 0x18, 0x25, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x69, 0x70, 0x76, 0x36, 0x46, 0x6c, + 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x72, 0x61, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x66, 0x72, + 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x66, 0x72, 0x61, 0x67, + 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x24, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0e, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x62, 0x69, 0x5f, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x64, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x29, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x62, 0x69, + 0x46, 0x6c, 0x6f, 0x77, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, + 0x06, 0x73, 0x72, 0x63, 0x5f, 0x61, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x73, + 0x72, 0x63, 0x41, 0x73, 0x12, 0x15, 0x0a, 0x06, 0x64, 0x73, 0x74, 0x5f, 0x61, 0x73, 0x18, 0x0f, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x73, 0x74, 0x41, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x6e, + 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6e, + 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, 0x12, 0x1e, 0x0a, 0x0b, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, + 0x6f, 0x70, 0x5f, 0x61, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x6e, 0x65, 0x78, + 0x74, 0x48, 0x6f, 0x70, 0x41, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x72, 0x63, 0x5f, 0x6e, 0x65, + 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x72, 0x63, 0x4e, 0x65, 0x74, 0x12, + 0x17, 0x0a, 0x07, 0x64, 0x73, 0x74, 0x5f, 0x6e, 0x65, 0x74, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x06, 0x64, 0x73, 0x74, 0x4e, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x62, 0x67, 0x70, 0x5f, + 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x68, 0x6f, 0x70, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, + 0x62, 0x67, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x6f, 0x70, 0x12, 0x27, 0x0a, 0x0f, 0x62, 0x67, + 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x65, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x0e, 0x62, 0x67, 0x70, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x66, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x61, 0x73, 0x50, 0x61, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x08, + 0x68, 0x61, 0x73, 0x5f, 0x6d, 0x70, 0x6c, 0x73, 0x18, 0x35, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x68, 0x61, 0x73, 0x4d, 0x70, 0x6c, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x70, 0x6c, 0x73, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x36, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x6d, 0x70, 0x6c, + 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x0a, 0x6d, 0x70, 0x6c, 0x73, 0x5f, 0x31, + 0x5f, 0x74, 0x74, 0x6c, 0x18, 0x37, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6d, 0x70, 0x6c, 0x73, + 0x31, 0x54, 0x74, 0x6c, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x70, 0x6c, 0x73, 0x5f, 0x31, 0x5f, 0x6c, + 0x61, 0x62, 0x65, 0x6c, 0x18, 0x38, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6d, 0x70, 0x6c, 0x73, + 0x31, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x0a, 0x6d, 0x70, 0x6c, 0x73, 0x5f, 0x32, + 0x5f, 0x74, 0x74, 0x6c, 0x18, 0x39, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6d, 0x70, 0x6c, 0x73, + 0x32, 0x54, 0x74, 0x6c, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x70, 0x6c, 0x73, 0x5f, 0x32, 0x5f, 0x6c, + 0x61, 0x62, 0x65, 0x6c, 0x18, 0x3a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6d, 0x70, 0x6c, 0x73, + 0x32, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x0a, 0x6d, 0x70, 0x6c, 0x73, 0x5f, 0x33, + 0x5f, 0x74, 0x74, 0x6c, 0x18, 0x3b, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6d, 0x70, 0x6c, 0x73, + 0x33, 0x54, 0x74, 0x6c, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x70, 0x6c, 0x73, 0x5f, 0x33, 0x5f, 0x6c, + 0x61, 0x62, 0x65, 0x6c, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6d, 0x70, 0x6c, 0x73, + 0x33, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x70, 0x6c, 0x73, 0x5f, 0x6c, + 0x61, 0x73, 0x74, 0x5f, 0x74, 0x74, 0x6c, 0x18, 0x3d, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x6d, + 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x73, 0x74, 0x54, 0x74, 0x6c, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x70, + 0x6c, 0x73, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x3e, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x6d, 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x73, 0x74, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x70, 0x6c, 0x73, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, + 0x5f, 0x69, 0x70, 0x18, 0x41, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x6d, 0x70, 0x6c, 0x73, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x49, 0x70, 0x12, 0x32, 0x0a, 0x15, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x46, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x13, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x14, 0x6f, 0x62, + 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x47, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, + 0x73, 0x72, 0x63, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0xe8, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x73, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x20, + 0x0a, 0x0b, 0x64, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0xe9, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, + 0x22, 0x53, 0x0a, 0x08, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, + 0x46, 0x4c, 0x4f, 0x57, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, + 0x07, 0x53, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x35, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x45, + 0x54, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x56, 0x35, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x45, + 0x54, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x56, 0x39, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x50, + 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x65, 0x74, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2f, 0x67, + 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x32, 0x2f, 0x63, 0x6d, 0x64, 0x2f, 0x65, 0x6e, 0x72, 0x69, 0x63, + 0x68, 0x65, 0x72, 0x2f, 0x70, 0x62, 0x3b, 0x66, 0x6c, 0x6f, 0x77, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cmd_enricher_pb_flowext_proto_rawDescOnce sync.Once + file_cmd_enricher_pb_flowext_proto_rawDescData = file_cmd_enricher_pb_flowext_proto_rawDesc +) + +func file_cmd_enricher_pb_flowext_proto_rawDescGZIP() []byte { + file_cmd_enricher_pb_flowext_proto_rawDescOnce.Do(func() { + file_cmd_enricher_pb_flowext_proto_rawDescData = protoimpl.X.CompressGZIP(file_cmd_enricher_pb_flowext_proto_rawDescData) + }) + return file_cmd_enricher_pb_flowext_proto_rawDescData +} + +var file_cmd_enricher_pb_flowext_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_cmd_enricher_pb_flowext_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cmd_enricher_pb_flowext_proto_goTypes = []interface{}{ + (FlowMessageExt_FlowType)(0), // 0: flowpb.FlowMessageExt.FlowType + (*FlowMessageExt)(nil), // 1: flowpb.FlowMessageExt +} +var file_cmd_enricher_pb_flowext_proto_depIdxs = []int32{ + 0, // 0: flowpb.FlowMessageExt.type:type_name -> flowpb.FlowMessageExt.FlowType + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_cmd_enricher_pb_flowext_proto_init() } +func file_cmd_enricher_pb_flowext_proto_init() { + if File_cmd_enricher_pb_flowext_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cmd_enricher_pb_flowext_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FlowMessageExt); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_cmd_enricher_pb_flowext_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cmd_enricher_pb_flowext_proto_goTypes, + DependencyIndexes: file_cmd_enricher_pb_flowext_proto_depIdxs, + EnumInfos: file_cmd_enricher_pb_flowext_proto_enumTypes, + MessageInfos: file_cmd_enricher_pb_flowext_proto_msgTypes, + }.Build() + File_cmd_enricher_pb_flowext_proto = out.File + file_cmd_enricher_pb_flowext_proto_rawDesc = nil + file_cmd_enricher_pb_flowext_proto_goTypes = nil + file_cmd_enricher_pb_flowext_proto_depIdxs = nil +} diff --git a/third_party/goflow2/cmd/enricher/pb/flowext.proto b/third_party/goflow2/cmd/enricher/pb/flowext.proto new file mode 100644 index 000000000000..a779b925942f --- /dev/null +++ b/third_party/goflow2/cmd/enricher/pb/flowext.proto @@ -0,0 +1,115 @@ +syntax = "proto3"; +package flowpb; +option go_package = "github.com/netsampler/goflow2/cmd/enricher/pb;flowpb"; + +message FlowMessageExt { + + enum FlowType { + FLOWUNKNOWN = 0; + SFLOW_5 = 1; + NETFLOW_V5 = 2; + NETFLOW_V9 = 3; + IPFIX = 4; + } + FlowType type = 1; + + uint64 time_received = 2; + uint32 sequence_num = 4; + uint64 sampling_rate = 3; + + uint32 flow_direction = 42; + + // Sampler information + bytes sampler_address = 11; + + // Found inside packet + uint64 time_flow_start = 38; + uint64 time_flow_end = 5; + uint64 time_flow_start_ms = 63; + uint64 time_flow_end_ms = 64; + + // Size of the sampled packet + uint64 bytes = 9; + uint64 packets = 10; + + // Source/destination addresses + bytes src_addr = 6; + bytes dst_addr = 7; + + // Layer 3 protocol (IPv4/IPv6/ARP/MPLS...) + uint32 etype = 30; + + // Layer 4 protocol + uint32 proto = 20; + + // Ports for UDP and TCP + uint32 src_port = 21; + uint32 dst_port = 22; + + // Interfaces + uint32 in_if = 18; + uint32 out_if = 19; + + // Ethernet information + uint64 src_mac = 27; + uint64 dst_mac = 28; + + // Vlan + uint32 src_vlan = 33; + uint32 dst_vlan = 34; + // 802.1q VLAN in sampled packet + uint32 vlan_id = 29; + + // VRF + uint32 ingress_vrf_id = 39; + uint32 egress_vrf_id = 40; + + // IP and TCP special flags + uint32 ip_tos = 23; + uint32 forwarding_status = 24; + uint32 ip_ttl = 25; + uint32 tcp_flags = 26; + uint32 icmp_type = 31; + uint32 icmp_code = 32; + uint32 ipv6_flow_label = 37; + // Fragments (IPv4/IPv6) + uint32 fragment_id = 35; + uint32 fragment_offset = 36; + uint32 bi_flow_direction = 41; + + // Autonomous system information + uint32 src_as = 14; + uint32 dst_as = 15; + + bytes next_hop = 12; + uint32 next_hop_as = 13; + + // Prefix size + uint32 src_net = 16; + uint32 dst_net = 17; + + // BGP information + bytes bgp_next_hop = 100; + repeated uint32 bgp_communities = 101; + repeated uint32 as_path = 102; + + // MPLS information + bool has_mpls = 53; + uint32 mpls_count = 54; + uint32 mpls_1_ttl = 55; // First TTL + uint32 mpls_1_label = 56; // First Label + uint32 mpls_2_ttl = 57; // Second TTL + uint32 mpls_2_label = 58; // Second Label + uint32 mpls_3_ttl = 59; // Third TTL + uint32 mpls_3_label = 60; // Third Label + uint32 mpls_last_ttl = 61; // Last TTL + uint32 mpls_last_label = 62; // Last Label + bytes mpls_label_ip = 65; // MPLS TOP Label IP + + uint32 observation_domain_id = 70; + uint32 observation_point_id = 71; + + string src_country = 1000; + string dst_country = 1001; + +} diff --git a/third_party/goflow2/cmd/goflow2/main.go b/third_party/goflow2/cmd/goflow2/main.go new file mode 100644 index 000000000000..99a7a18129d9 --- /dev/null +++ b/third_party/goflow2/cmd/goflow2/main.go @@ -0,0 +1,199 @@ +package main + +import ( + "context" + "flag" + "fmt" + "net/http" + "net/url" + "os" + "strconv" + "strings" + "sync" + + // import various formatters + "github.com/netsampler/goflow2/format" + _ "github.com/netsampler/goflow2/format/json" + _ "github.com/netsampler/goflow2/format/protobuf" + _ "github.com/netsampler/goflow2/format/text" + + // import various transports + "github.com/netsampler/goflow2/transport" + _ "github.com/netsampler/goflow2/transport/file" + _ "github.com/netsampler/goflow2/transport/kafka" + + // import various NetFlow/IPFIX templates + "github.com/netsampler/goflow2/decoders/netflow/templates" + _ "github.com/netsampler/goflow2/decoders/netflow/templates/file" + _ "github.com/netsampler/goflow2/decoders/netflow/templates/memory" + + "github.com/netsampler/goflow2/utils" + "github.com/prometheus/client_golang/prometheus/promhttp" + log "github.com/sirupsen/logrus" +) + +var ( + version = "" + buildinfos = "" + AppVersion = "GoFlow2 " + version + " " + buildinfos + + ReusePort = flag.Bool("reuseport", false, "Enable so_reuseport") + ListenAddresses = flag.String("listen", "sflow://:6343,netflow://:2055", "listen addresses") + + Workers = flag.Int("workers", 1, "Number of workers per collector") + LogLevel = flag.String("loglevel", "info", "Log level") + LogFmt = flag.String("logfmt", "normal", "Log formatter") + + NetFlowTemplates = flag.String("netflow.templates", "memory", fmt.Sprintf("Choose the format (available: %s)", strings.Join(templates.GetTemplates(), ", "))) + + Format = flag.String("format", "json", fmt.Sprintf("Choose the format (available: %s)", strings.Join(format.GetFormats(), ", "))) + Transport = flag.String("transport", "file", fmt.Sprintf("Choose the transport (available: %s)", strings.Join(transport.GetTransports(), ", "))) + + MetricsAddr = flag.String("metrics.addr", ":8080", "Metrics address") + MetricsPath = flag.String("metrics.path", "/metrics", "Metrics path") + + TemplatePath = flag.String("templates.path", "/templates", "NetFlow/IPFIX templates list") + + MappingFile = flag.String("mapping", "", "Configuration file for custom mappings") + + Version = flag.Bool("v", false, "Print version") +) + +func httpServer( /*state *utils.StateNetFlow*/ ) { + http.Handle(*MetricsPath, promhttp.Handler()) + //http.HandleFunc(*TemplatePath, state.ServeHTTPTemplates) + log.Fatal(http.ListenAndServe(*MetricsAddr, nil)) +} + +func main() { + flag.Parse() + + if *Version { + fmt.Println(AppVersion) + os.Exit(0) + } + + lvl, _ := log.ParseLevel(*LogLevel) + log.SetLevel(lvl) + + var config utils.ProducerConfig + if *MappingFile != "" { + f, err := os.Open(*MappingFile) + if err != nil { + log.Fatal(err) + } + config, err = utils.LoadMapping(f) + f.Close() + if err != nil { + log.Fatal(err) + } + } + + ctx := context.Background() + + formatter, err := format.FindFormat(ctx, *Format) + if err != nil { + log.Fatal(err) + } + + transporter, err := transport.FindTransport(ctx, *Transport) + if err != nil { + log.Fatal(err) + } + defer transporter.Close(ctx) + + // the following is only useful when parsing NetFlowV9/IPFIX (template-based flow) + templateSystem, err := templates.FindTemplateSystem(ctx, *NetFlowTemplates) + if err != nil { + log.Fatal(err) + } + defer templateSystem.Close(ctx) + + switch *LogFmt { + case "json": + log.SetFormatter(&log.JSONFormatter{}) + } + + log.Info("Starting GoFlow2") + + go httpServer() + //go httpServer(sNF) + + wg := &sync.WaitGroup{} + + for _, listenAddress := range strings.Split(*ListenAddresses, ",") { + wg.Add(1) + go func(listenAddress string) { + defer wg.Done() + listenAddrUrl, err := url.Parse(listenAddress) + if err != nil { + log.Fatal(err) + } + numSockets := 1 + if listenAddrUrl.Query().Has("count") { + if numSocketsTmp, err := strconv.ParseUint(listenAddrUrl.Query().Get("count"), 10, 64); err != nil { + log.Fatal(err) + } else { + numSockets = int(numSocketsTmp) + } + } + if numSockets == 0 { + numSockets = 1 + } + + hostname := listenAddrUrl.Hostname() + port, err := strconv.ParseUint(listenAddrUrl.Port(), 10, 64) + if err != nil { + log.Errorf("Port %s could not be converted to integer", listenAddrUrl.Port()) + return + } + + logFields := log.Fields{ + "scheme": listenAddrUrl.Scheme, + "hostname": hostname, + "port": port, + "count": numSockets, + } + + log.WithFields(logFields).Info("Starting collection") + + for i := 0; i < numSockets; i++ { + if listenAddrUrl.Scheme == "sflow" { + sSFlow := &utils.StateSFlow{ + Format: formatter, + Transport: transporter, + Logger: log.StandardLogger(), + Config: config, + } + err = sSFlow.FlowRoutine(*Workers, hostname, int(port), *ReusePort) + } else if listenAddrUrl.Scheme == "netflow" { + sNF := utils.NewStateNetFlow() + sNF.Format = formatter + sNF.Transport = transporter + sNF.Logger = log.StandardLogger() + sNF.Config = config + sNF.TemplateSystem = templateSystem + err = sNF.FlowRoutine(*Workers, hostname, int(port), *ReusePort) + } else if listenAddrUrl.Scheme == "nfl" { + sNFL := &utils.StateNFLegacy{ + Format: formatter, + Transport: transporter, + Logger: log.StandardLogger(), + } + err = sNFL.FlowRoutine(*Workers, hostname, int(port), *ReusePort) + } else { + log.Errorf("scheme %s does not exist", listenAddrUrl.Scheme) + return + } + + if err != nil { + log.WithFields(logFields).Fatal(err) + } + } + + }(listenAddress) + + } + + wg.Wait() +} diff --git a/third_party/goflow2/cmd/goflow2/mapping.yaml b/third_party/goflow2/cmd/goflow2/mapping.yaml new file mode 100644 index 000000000000..bc0fb58ad0f1 --- /dev/null +++ b/third_party/goflow2/cmd/goflow2/mapping.yaml @@ -0,0 +1,31 @@ +ipfix: + mapping: + - field: 7 # IPFIX_FIELD_sourceTransportPort + destination: CustomInteger1 + - field: 11 # IPFIX_FIELD_destinationTransportPort + destination: CustomInteger2 + # penprovided: false + # pen: 0 + - field: 137 + destination: CustomList_1 + penprovided: true + pen: 2636 +netflowv9: + mapping: + - field: 7 + destination: CustomInteger1 + - field: 11 + destination: CustomInteger2 + - field: 34 # samplingInterval + destination: SamplingRate + endian: little +sflow: + mapping: + - layer: 4 # Layer 4: TCP or UDP + offset: 0 # Source port + length: 16 # 2 bytes + destination: CustomInteger1 + - layer: 4 + offset: 16 # Destination port + length: 16 # 2 bytes + destination: CustomInteger2 \ No newline at end of file diff --git a/third_party/goflow2/compose/elk/README.md b/third_party/goflow2/compose/elk/README.md new file mode 100644 index 000000000000..1fa01ee9c5da --- /dev/null +++ b/third_party/goflow2/compose/elk/README.md @@ -0,0 +1,25 @@ +# Flows + Logstash + Elastic + Kibana + +Clickhouse is a powerful data warehouse. + +A sample [docker-compose](./docker-compose.yml) is provided. +It's composed of: +* GoFlow2 +* Logstash +* Elastic +* Kibana + +To start the containers, use: +```bash +$ docker-compose up +``` + +This command will automatically build the GoFlow2 container. + +GoFlow2 collects NetFlow v9/IPFIX and sFlow packets and logs them into a file (`/var/log/goflow/goflow.log`). +Logstash collects the log messages, parse the JSON and sends to Elastic. +Kibana can be used to visualize the data. You can access the dashboard at http://localhost:5601. + +This stack requires to create an [index pattern](http://localhost:5601/app/management/kibana/indexPatterns/create). +Define the index pattern to be `logstash-*`. Select `@timestamp` to be the time filter. +You can then visualize flows in the [Discover](http://localhost:5601/app/discover) section. \ No newline at end of file diff --git a/third_party/goflow2/compose/elk/docker-compose.yml b/third_party/goflow2/compose/elk/docker-compose.yml new file mode 100644 index 000000000000..834769059c77 --- /dev/null +++ b/third_party/goflow2/compose/elk/docker-compose.yml @@ -0,0 +1,55 @@ +version: "3" +services: + goflow2: + build: + context: ../../ + dockerfile: Dockerfile + args: + VERSION: compose + LDFLAGS: -X main.version=compose + image: netsampler/goflow2 + user: root # because docker-compose mount as root + ports: + - '8080:8080' + - '6343:6343/udp' + - '2055:2055/udp' + command: + - -transport=file + - -transport.file=/var/log/goflow/goflow2.log + - -format=json + restart: always + logging: + driver: gelf + options: + gelf-address: "udp://localhost:12201" + tag: "flows" + volumes: + - logs:/var/log/goflow + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:7.13.0 + environment: + - discovery.type=single-node + ports: + - 9200:9200 + kibana: + image: docker.elastic.co/kibana/kibana:7.13.0 + ports: + - 5601:5601 + depends_on: + - elasticsearch + - logstash + logstash: + image: docker.elastic.co/logstash/logstash:7.13.0 + user: root # because docker-compose mount as root + links: + - elasticsearch + volumes: + - ./logstash.conf:/etc/logstash/logstash.conf + - logs:/var/log/goflow + command: logstash -f /etc/logstash/logstash.conf + ports: + - 12201:12201/udp + depends_on: + - elasticsearch +volumes: + logs: diff --git a/third_party/goflow2/compose/elk/logstash.conf b/third_party/goflow2/compose/elk/logstash.conf new file mode 100644 index 000000000000..0fea621c01b6 --- /dev/null +++ b/third_party/goflow2/compose/elk/logstash.conf @@ -0,0 +1,22 @@ +input { + gelf { + port => 12201 + } + file { + path => "/var/log/goflow/*.log" + type => "log" + } +} +filter { + json { + source => "message" + target => "flow" + remove_field => ["message"] + } +} +output { + elasticsearch { + hosts => ["elasticsearch:9200"] + index => "logstash-%{+YYYY-MM-dd}" + } +} \ No newline at end of file diff --git a/third_party/goflow2/compose/kcg/README.md b/third_party/goflow2/compose/kcg/README.md new file mode 100644 index 000000000000..17959d65d67f --- /dev/null +++ b/third_party/goflow2/compose/kcg/README.md @@ -0,0 +1,28 @@ +# Flows + Kafka + Clicklhouse + Grafana + Prometheus + +Clickhouse is a powerful data warehouse. + +A sample [docker-compose](./docker-compose.yml) is provided. +It's composed of: +* Apache Kafka +* Apache Zookeeper +* GoFlow2 +* Prometheus +* Clickhouse +* Grafana + +To start the containers, use: +```bash +$ docker-compose up +``` + +This command will automatically build Grafana and GoFlow2 containers. + +GoFlow2 collects NetFlow v9/IPFIX and sFlow packets and sends as a protobuf into Kafka. +Zookeeper coordinates Kafka and can also be used by Clickhouse to ensure replication. +Prometheus scrapes the metrics of the collector. +Clickhouse consumes from Kafka, stores raw data and aggregates over specific columns +using `MATERIALIZED TABLES` and `VIEWS` defined in a [schema file](./clickhouse/create.sh). + +You can visualize the data in Grafana at http://localhost:3000 (credentials: admin/admin) with the +pre-made dashboards. diff --git a/third_party/goflow2/compose/kcg/clickhouse/create.sh b/third_party/goflow2/compose/kcg/clickhouse/create.sh new file mode 100755 index 000000000000..0ccf95d56a35 --- /dev/null +++ b/third_party/goflow2/compose/kcg/clickhouse/create.sh @@ -0,0 +1,125 @@ +#!/bin/bash +set -e + +clickhouse client -n <<-EOSQL + + CREATE DATABASE IF NOT EXISTS dictionaries; + + CREATE DICTIONARY IF NOT EXISTS dictionaries.protocols ( + proto UInt8, + name String, + description String + ) + PRIMARY KEY proto + LAYOUT(FLAT()) + SOURCE (FILE(path '/var/lib/clickhouse/user_files/protocols.csv' format 'CSVWithNames')) + LIFETIME(3600); + + CREATE TABLE IF NOT EXISTS flows + ( + time_received UInt64, + time_flow_start UInt64, + + sequence_num UInt32, + sampling_rate UInt64, + sampler_address FixedString(16), + + src_addr FixedString(16), + dst_addr FixedString(16), + + src_as UInt32, + dst_as UInt32, + + etype UInt32, + proto UInt32, + + src_port UInt32, + dst_port UInt32, + + bytes UInt64, + packets UInt64 + ) ENGINE = Kafka() + SETTINGS + kafka_broker_list = 'kafka:9092', + kafka_topic_list = 'flows', + kafka_group_name = 'clickhouse', + kafka_format = 'Protobuf', + kafka_schema = 'flow.proto:FlowMessage'; + + CREATE TABLE IF NOT EXISTS flows_raw + ( + date Date, + time_received DateTime, + time_flow_start DateTime, + + sequence_num UInt32, + sampling_rate UInt64, + sampler_address FixedString(16), + + src_addr FixedString(16), + dst_addr FixedString(16), + + src_as UInt32, + dst_as UInt32, + + etype UInt32, + proto UInt32, + + src_port UInt32, + dst_port UInt32, + + bytes UInt64, + packets UInt64 + ) ENGINE = MergeTree() + PARTITION BY date + ORDER BY time_received; + + CREATE MATERIALIZED VIEW IF NOT EXISTS flows_raw_view TO flows_raw + AS SELECT + toDate(time_received) AS date, + * + FROM flows; + + CREATE TABLE IF NOT EXISTS flows_5m + ( + date Date, + timeslot DateTime, + + src_as UInt32, + dst_as UInt32, + + etypeMap Nested ( + etype UInt32, + bytes UInt64, + packets UInt64, + count UInt64 + ), + + bytes UInt64, + packets UInt64, + count UInt64 + ) ENGINE = SummingMergeTree() + PARTITION BY date + ORDER BY (date, timeslot, src_as, dst_as, \`etypeMap.etype\`); + + CREATE MATERIALIZED VIEW IF NOT EXISTS flows_5m_view TO flows_5m + AS + SELECT + date, + toStartOfFiveMinute(time_received) AS timeslot, + src_as, + dst_as, + + [etype] AS \`etypeMap.etype\`, + [bytes] AS \`etypeMap.bytes\`, + [packets] AS \`etypeMap.packets\`, + [count] AS \`etypeMap.count\`, + + sum(bytes) AS bytes, + sum(packets) AS packets, + count() AS count + + FROM flows_raw + GROUP BY date, timeslot, src_as, dst_as, \`etypeMap.etype\`; + +EOSQL diff --git a/third_party/goflow2/compose/kcg/clickhouse/protocols.csv b/third_party/goflow2/compose/kcg/clickhouse/protocols.csv new file mode 100644 index 000000000000..20065a9d9c8f --- /dev/null +++ b/third_party/goflow2/compose/kcg/clickhouse/protocols.csv @@ -0,0 +1,30 @@ +proto,name,description +0,HOPOPT,IPv6 Hop-by-Hop Option +1,ICMP,Internet Control Message +2,IGMP,Internet Group Management +4,IPv4,IPv4 encapsulation +6,TCP,Transmission Control Protocol +8,EGP,Exterior Gateway Protocol +9,IGP,Interior Gateway Protocol +16,CHAOS,Chaos +17,UDP,User Datagram Protocol +27,RDP,Reliable Data Protocol +41,IPv6,IPv6 encapsulation +43,IPv6-Route,Routing Header for IPv6 +44,IPv6-Frag,Fragment Header for IPv6 +45,IDRP,Inter-Domain Routing Protocol +46,RSVP,Reservation Protocol +47,GRE,Generic Routing Encapsulation +50,ESP,Encap Security Payload +51,AH,Authentication Header +55,MOBILE,IP Mobility +58,IPv6-ICMP,ICMP for IPv6 +59,IPv6-NoNxt,No Next Header for IPv6 +60,IPv6-Opts,Destination Options for IPv6 +88,EIGRP,EIGRP +89,OSPFIGP,OSPFIGP +92,MTP,Multicast Transport Protocol +94,IPIP,IP-within-IP Encapsulation Protocol +97,ETHERIP,Ethernet-within-IP Encapsulation +98,ENCAP,Encapsulation Header +112,VRRP,Virtual Router Redundancy Protocol \ No newline at end of file diff --git a/third_party/goflow2/compose/kcg/docker-compose.yml b/third_party/goflow2/compose/kcg/docker-compose.yml new file mode 100644 index 000000000000..01ef81a31073 --- /dev/null +++ b/third_party/goflow2/compose/kcg/docker-compose.yml @@ -0,0 +1,71 @@ +version: "3" +services: + zookeeper: + image: bitnami/zookeeper:3.7.1 + ports: + - 2181:2181 + environment: + - ALLOW_ANONYMOUS_LOGIN=yes + restart: always + kafka: + image: bitnami/kafka:3.4.0 + ports: + - 9092:9092 + environment: + - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 + - ALLOW_PLAINTEXT_LISTENER=yes + - KAFKA_DELETE_TOPIC_ENABLE=true + restart: always + depends_on: + - zookeeper + grafana: + image: grafana/grafana:9.4.3 + environment: + - GF_INSTALL_PLUGINS=vertamedia-clickhouse-datasource + # - GF_INSTALL_PLUGINS=grafana-clickhouse-datasource + # - GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=vertamedia-clickhouse-datasource + ports: + - 3000:3000 + restart: always + volumes: + - ./grafana/datasources-ch.yml:/etc/grafana/provisioning/datasources/datasources-ch.yml + - ./grafana/dashboards.yml:/etc/grafana/provisioning/dashboards/dashboards.yml + - ./grafana/dashboards:/var/lib/grafana/dashboards + prometheus: + image: prom/prometheus:v2.37.6 + ports: + - 9090:9090 + restart: always + volumes: + - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml + goflow2: + build: + context: ../../ + dockerfile: Dockerfile + args: + VERSION: compose + LDFLAGS: -X main.version=compose + image: netsampler/goflow2 + depends_on: + - kafka + ports: + - 8080:8080 + - 6343:6343/udp + - 2055:2055/udp + restart: always + command: + - -transport.kafka.brokers=kafka:9092 + - -transport=kafka + - -transport.kafka.topic=flows + - -format=pb + - -format.protobuf.fixedlen=true + db: + image: clickhouse/clickhouse-server:22.8.14.53-alpine + ports: + - 8123:8123 + volumes: + - ./clickhouse:/docker-entrypoint-initdb.d/ + - ../../pb/flow.proto:/var/lib/clickhouse/format_schemas/flow.proto + - ./clickhouse/protocols.csv:/var/lib/clickhouse/user_files/protocols.csv + depends_on: + - kafka diff --git a/third_party/goflow2/compose/kcg/grafana/Dockerfile b/third_party/goflow2/compose/kcg/grafana/Dockerfile new file mode 100644 index 000000000000..424914ac0b78 --- /dev/null +++ b/third_party/goflow2/compose/kcg/grafana/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu AS builder + +RUN apt-get update && apt-get install -y git +RUN git clone https://github.com/Vertamedia/clickhouse-grafana.git + +FROM grafana/grafana:9.1.7 + +COPY --from=builder /clickhouse-grafana /var/lib/grafana/plugins \ No newline at end of file diff --git a/third_party/goflow2/compose/kcg/grafana/dashboards.yml b/third_party/goflow2/compose/kcg/grafana/dashboards.yml new file mode 100644 index 000000000000..909a621ca187 --- /dev/null +++ b/third_party/goflow2/compose/kcg/grafana/dashboards.yml @@ -0,0 +1,6 @@ +- name: 'default' + org_id: 1 + folder: '' + type: file + options: + folder: /var/lib/grafana/dashboards \ No newline at end of file diff --git a/third_party/goflow2/compose/kcg/grafana/dashboards/perfs.json b/third_party/goflow2/compose/kcg/grafana/dashboards/perfs.json new file mode 100644 index 000000000000..957b6904132c --- /dev/null +++ b/third_party/goflow2/compose/kcg/grafana/dashboards/perfs.json @@ -0,0 +1,2106 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Metrics about the NetFlow+sFlow collector", + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 2, + "links": [], + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 53, + "panels": [], + "repeat": null, + "title": "Totals", + "type": "row" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "datasource": "Prometheus", + "format": "pps", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 9, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": true, + "lineColor": "rgb(31, 120, 193)", + "show": true + }, + "tableColumn": "", + "targets": [ + { + "expr": "sum(rate(flow_process_nf_flowset_records_sum[5m]))", + "format": "time_series", + "intervalFactor": 1, + "refId": "A" + } + ], + "thresholds": "", + "title": "NetFlows Total", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "datasource": "Prometheus", + "format": "pps", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 10, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": true, + "lineColor": "rgb(31, 120, 193)", + "show": true + }, + "tableColumn": "", + "targets": [ + { + "expr": "sum(rate(flow_process_sf_samples_sum[5m]))", + "format": "time_series", + "intervalFactor": 1, + "refId": "A" + } + ], + "thresholds": "", + "title": "sFlows Total", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 8 + }, + "id": 54, + "panels": [], + "repeat": null, + "title": "Flows UDP Metrics", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 10, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 51, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/Total*/", + "color": "#DEDAF7", + "fill": 0, + "stack": false + } + ], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(udp_traffic_bytes[5m])) by (remote_ip)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ remote_ip }}", + "refId": "A" + }, + { + "expr": "sum(rate(udp_traffic_bytes[5m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Total", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "UDP2Kafka Bandwidth", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 10, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 52, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/Total*/", + "color": "#DEDAF7", + "fill": 0, + "stack": false + } + ], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(udp_traffic_packets[5m])) by (remote_ip)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ remote_ip }}", + "refId": "A" + }, + { + "expr": "sum(rate(udp_traffic_packets[5m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Total", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "UDP2Kafka packets", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 10, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 16 + }, + "id": 1, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/Total*/", + "color": "#DEDAF7", + "fill": 0, + "stack": false + } + ], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_traffic_bytes{type=\"sFlow\"}[5m])) by (remote_ip)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ remote_ip }}", + "refId": "A" + }, + { + "aggregator": "sum", + "alias": "$tag_type | Total", + "currentTagKey": "", + "currentTagValue": "", + "downsampleAggregator": "avg", + "downsampleFillPolicy": "none", + "downsampleInterval": "", + "expr": "sum(rate(flow_traffic_bytes{type=\"sFlow\"}[5m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "sFlow | Total", + "metric": "goflow.flow_traffic_bytes", + "refId": "B", + "shouldComputeRate": true, + "tags": { + "type": "sFlow" + } + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "sFlow UDP Bandwidth", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 10, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 16 + }, + "id": 2, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/Total*/", + "color": "#DEDAF7", + "fill": 0, + "stack": false + } + ], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_traffic_packets{type=\"sFlow\"}[5m])) by (remote_ip)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ remote_ip }}", + "refId": "A" + }, + { + "aggregator": "sum", + "alias": "$tag_type | Total", + "currentTagKey": "", + "currentTagValue": "", + "downsampleAggregator": "avg", + "downsampleFillPolicy": "none", + "downsampleInterval": "", + "expr": "sum(rate(flow_traffic_packets{type=\"sFlow\"}[5m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "sFlow | Total", + "metric": "goflow-kafka.flow_traffic_packets", + "refId": "B", + "shouldComputeRate": true, + "tags": { + "type": "sFlow" + } + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "sFlow UDP Packets", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 10, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 23 + }, + "id": 48, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/Total*/", + "color": "#DEDAF7", + "fill": 0, + "stack": false + } + ], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_traffic_bytes{type=\"NetFlow\"}[5m])) by (remote_ip)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ remote_ip }}", + "refId": "A" + }, + { + "expr": "sum(rate(flow_traffic_bytes{type=\"NetFlow\"}[5m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "NetFlow | Total", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NetFlow UDP Bandwidth", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 10, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 23 + }, + "id": 47, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/Total*/", + "color": "#DEDAF7", + "fill": 0, + "stack": false + } + ], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_traffic_packets{type=\"NetFlow\"}[5m])) by (remote_ip)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ remote_ip }}", + "refId": "A" + }, + { + "aggregator": "sum", + "alias": "$tag_type | Total", + "currentTagKey": "", + "currentTagValue": "", + "downsampleAggregator": "avg", + "downsampleFillPolicy": "none", + "downsampleInterval": "", + "expr": "sum(rate(flow_traffic_packets{type=\"NetFlow\"}[5m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "NetFlow | Total", + "metric": "goflow-kafka.flow_traffic_packets", + "refId": "B", + "shouldComputeRate": true, + "tags": { + "type": "NetFlow" + } + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NetFlow UDP Packets", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 30 + }, + "id": 55, + "panels": [], + "repeat": null, + "title": "NetFlow metrics", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 31 + }, + "id": 3, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_process_nf_flowset_records_sum[5m])) by (version,type)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ version }} | {{ type }} ", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NetFlows by type and version", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 31 + }, + "id": 4, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_process_nf_errors_count[5m])) by (error)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ error }}", + "metric": "goflow-kafka.flow_process_nf_errors_count", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NetFlows errors", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "hertz", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 38 + }, + "id": 6, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_process_nf_templates_count[5m])) by (version,router,type)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ version }} | {{ router }} | {{ type }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NetFlow templates", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 38 + }, + "id": 7, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_process_nf_flowset_records_sum[5m])) by (router,version)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ router }} | {{ version }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NetFlows - DataFlowSets by router and version", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 45 + }, + "id": 14, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_process_nf_delay_summary_seconds[5m])) by (quantile,router,version)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Q{{ quantile }} | {{ router }} | {{ version }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Time between flow and processing", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 52 + }, + "id": 56, + "panels": [], + "repeat": null, + "title": "sFlow metrics", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 53 + }, + "id": 5, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_process_sf_samples_sum[5m])) by (version,type)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ version }} | {{ type }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "sFlows by type", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 53 + }, + "id": 8, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_process_sf_samples_records_sum{type=\"FlowSample\"}[5m])) by (agent,version)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{ agent }} | {{ version }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "sFlows Flow records by agent and version", + "tooltip": { + "shared": false, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 60 + }, + "id": 57, + "panels": [], + "repeat": null, + "title": "NetFlow decoder metrics", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 61 + }, + "id": 11, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": false, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "avg(flow_summary_decoding_time_us{name=\"NetFlow\"}) by (quantile)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Q{{ quantile }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NetFlow decoding time quantiles", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 61 + }, + "id": 12, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": false, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "avg(flow_summary_processing_time_us{name=\"NetFlow\"}) by (quantile)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Q{{ quantile }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NetFlow processing time quantiles", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 61 + }, + "id": 13, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": null, + "sortDesc": null, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_decoder_count{name=\"NetFlow\"}[5m])) by (worker)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Worker {{ worker }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "NetFlow worker rate", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 68 + }, + "id": 58, + "panels": [], + "repeat": null, + "title": "sFlow decoder metrics", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 69 + }, + "id": 15, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "sort": "current", + "sortDesc": false, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "avg(flow_summary_decoding_time_us{name=\"sFlow\"}) by (quantile)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Q{{ quantile }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "sFlow decoding time quantiles", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 69 + }, + "id": 16, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "show": true, + "sort": "current", + "sortDesc": false, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "avg(flow_summary_decoding_time_us{name=\"sFlow\"}) by (quantile)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Q{{ quantile }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "sFlow processing time quantiles", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "µs", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 0, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 69 + }, + "id": 17, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": null, + "sortDesc": null, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flow_decoder_count{name=\"sFlow\"}[5m])) by (worker)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Worker {{ worker }}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "sFlow worker rate", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "pps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "refresh": false, + "schemaVersion": 16, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-24h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "utc", + "title": "GoFlow - Internals", + "uid": "4U5xQZPmz", + "version": 2 +} \ No newline at end of file diff --git a/third_party/goflow2/compose/kcg/grafana/dashboards/viz-ch.json b/third_party/goflow2/compose/kcg/grafana/dashboards/viz-ch.json new file mode 100644 index 000000000000..e92ecda0c10f --- /dev/null +++ b/third_party/goflow2/compose/kcg/grafana/dashboards/viz-ch.json @@ -0,0 +1,643 @@ +{ + "annotations": { + "list": [ + { + "$$hashKey": "object:631", + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "links": [], + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "ClickHouse", + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 0 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "maxDataPoints": 200, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "database": "default", + "dateColDataType": "date", + "dateLoading": false, + "dateTimeColDataType": "time_flow_start", + "dateTimeType": "DATETIME", + "datetimeLoading": false, + "format": "time_series", + "group": [], + "intervalFactor": 1, + "metricColumn": "none", + "query": "SELECT\n t,\n sum(sumbytes) AS sumbytes\nFROM (\n SELECT\n $timeSeries AS t,\n sum(bytes*sampling_rate) as sumbytes\n FROM $table\n WHERE $timeFilter\n GROUP BY t\n\n UNION ALL\n\n SELECT\n intDiv($from+number*$interval, $interval)*$interval*1000 AS t,\n 0 AS sumbytes\n FROM numbers(intDiv($to-$from, $interval))\n)\nGROUP BY t\nORDER BY t", "refId": "A", + "round": "0s", + "select": [ + [ + { + "params": [ + "bytes" + ], + "type": "column" + } + ] + ], + "table": "flows_raw", + "tableLoading": false, + "timeColumn": "date_inserted", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Instant traffic", + "type": "timeseries" + }, + { + "columns": [], + "datasource": "ClickHouse", + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fontSize": "100%", + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 7, + "links": [], + "pageSize": null, + "scroll": true, + "showHeader": true, + "sort": { + "col": 1, + "desc": true + }, + "styles": [ + { + "alias": "Time", + "align": "auto", + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "pattern": "Time", + "type": "date" + }, + { + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 0, + "mappingType": 1, + "pattern": ".*_port", + "thresholds": [], + "type": "number", + "unit": "none" + }, + { + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "mappingType": 1, + "pattern": "sumbytes", + "thresholds": [], + "type": "number", + "unit": "decbytes" + }, + { + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "decimals": 0, + "pattern": "/.*/", + "thresholds": [], + "type": "number", + "unit": "short" + } + ], + "targets": [ + { + "database": "default", + "dateColDataType": "date", + "dateLoading": false, + "dateTimeColDataType": "time_flow_start", + "dateTimeType": "DATETIME", + "datetimeLoading": false, + "format": "table", + "group": [], + "intervalFactor": 1, + "metricColumn": "none", + "query": "SELECT\n if(etype = 0x800, IPv4NumToString(reinterpretAsUInt32(substring(reverse(src_addr), 13,4))), IPv6NumToString(src_addr)) as srcip,\n sum(bytes*sampling_rate) AS sumbytes\nFROM $table\nWHERE $timeFilter\nGROUP BY srcip\nORDER BY sumbytes DESC", + "refId": "A", + "round": "0s", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "table": "flows_raw", + "tableLoading": false, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Top source IPs", + "transform": "table", + "type": "table" + }, + { + "columns": [], + "datasource": "ClickHouse", + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fontSize": "100%", + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 9, + "links": [], + "pageSize": null, + "scroll": true, + "showHeader": true, + "sort": { + "col": 1, + "desc": true + }, + "styles": [ + { + "$$hashKey": "object:1506", + "alias": "Time", + "align": "auto", + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "pattern": "Time", + "type": "date" + }, + { + "$$hashKey": "object:1507", + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 0, + "mappingType": 1, + "pattern": "port", + "thresholds": [], + "type": "number", + "unit": "none" + }, + { + "$$hashKey": "object:1508", + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "mappingType": 1, + "pattern": "sumbytes", + "thresholds": [], + "type": "number", + "unit": "decbytes" + }, + { + "$$hashKey": "object:1509", + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "decimals": 0, + "pattern": "/.*/", + "thresholds": [], + "type": "number", + "unit": "short" + } + ], + "targets": [ + { + "database": "default", + "dateColDataType": "date", + "dateLoading": false, + "dateTimeColDataType": "time_flow_start", + "dateTimeType": "DATETIME", + "datetimeLoading": false, + "extrapolate": true, + "format": "table", + "group": [], + "intervalFactor": 1, + "metricColumn": "none", + "query": "WITH dictGetString('dictionaries.protocols', 'name', toUInt64(proto)) AS protoName\nSELECT\n if(protoName = '', toString(proto), protoName) || '/' || toString(src_port) as port,\n sum(bytes*sampling_rate) AS sumbytes\nFROM $table\nWHERE $timeFilter\nGROUP BY port\nORDER BY sumbytes DESC", + "refId": "A", + "round": "0s", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "table": "flows_raw", + "tableLoading": false, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Top source ports", + "transform": "table", + "type": "table" + }, + { + "columns": [], + "datasource": "ClickHouse", + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fontSize": "100%", + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 18 + }, + "id": 10, + "links": [], + "pageSize": null, + "scroll": true, + "showHeader": true, + "sort": { + "col": 1, + "desc": true + }, + "styles": [ + { + "alias": "Time", + "align": "auto", + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "pattern": "Time", + "type": "date" + }, + { + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 0, + "mappingType": 1, + "pattern": ".*_port", + "thresholds": [], + "type": "number", + "unit": "none" + }, + { + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "mappingType": 1, + "pattern": "sumbytes", + "thresholds": [], + "type": "number", + "unit": "decbytes" + }, + { + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "decimals": 0, + "pattern": "/.*/", + "thresholds": [], + "type": "number", + "unit": "short" + } + ], + "targets": [ + { + "database": "default", + "dateColDataType": "date", + "dateLoading": false, + "dateTimeColDataType": "time_flow_start", + "dateTimeType": "DATETIME", + "datetimeLoading": false, + "format": "table", + "group": [], + "intervalFactor": 1, + "metricColumn": "none", + "query": "SELECT\n if(etype = 0x800, IPv4NumToString(reinterpretAsUInt32(substring(reverse(dst_addr), 13,4))), IPv6NumToString(dst_addr)) as dstip,\n sum(bytes*sampling_rate) AS sumbytes\nFROM $table\nWHERE $timeFilter\nGROUP BY dstip\nORDER BY sumbytes DESC", + "refId": "A", + "round": "0s", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "table": "flows_raw", + "tableLoading": false, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Top destination IPs", + "transform": "table", + "type": "table" + }, + { + "columns": [], + "datasource": "ClickHouse", + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fontSize": "100%", + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 18 + }, + "id": 11, + "links": [], + "pageSize": null, + "scroll": true, + "showHeader": true, + "sort": { + "col": 1, + "desc": false + }, + "styles": [ + { + "$$hashKey": "object:1428", + "alias": "Time", + "align": "auto", + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "pattern": "Time", + "type": "date" + }, + { + "$$hashKey": "object:1429", + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 0, + "mappingType": 1, + "pattern": "port", + "thresholds": [], + "type": "number", + "unit": "none" + }, + { + "$$hashKey": "object:1430", + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "mappingType": 1, + "pattern": "sumbytes", + "thresholds": [], + "type": "number", + "unit": "decbytes" + }, + { + "$$hashKey": "object:1431", + "alias": "", + "align": "auto", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "decimals": 0, + "pattern": "/.*/", + "thresholds": [], + "type": "number", + "unit": "short" + } + ], + "targets": [ + { + "database": "default", + "dateColDataType": "date", + "dateLoading": false, + "dateTimeColDataType": "time_flow_start", + "dateTimeType": "DATETIME", + "datetimeLoading": false, + "extrapolate": true, + "format": "table", + "group": [], + "intervalFactor": 1, + "metricColumn": "none", + "query": "WITH dictGetString('dictionaries.protocols', 'name', toUInt64(proto)) AS protoName\nSELECT\n if(protoName = '', toString(proto), protoName) || '/' || toString(dst_port) as port,\n sum(bytes*sampling_rate) AS sumbytes\nFROM $table\nWHERE $timeFilter\nGROUP BY port\nORDER BY sumbytes DESC", + "refId": "A", + "round": "0s", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "table": "flows_raw", + "tableLoading": false, + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Top destination ports", + "transform": "table", + "type": "table" + } + ], + "refresh": "", + "schemaVersion": 25, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "", + "title": "Traffic (ClickHouse)", + "uid": "tkNEAd9Zk", + "version": 1 +} \ No newline at end of file diff --git a/third_party/goflow2/compose/kcg/grafana/datasources-ch.yml b/third_party/goflow2/compose/kcg/grafana/datasources-ch.yml new file mode 100644 index 000000000000..60e93dce6a20 --- /dev/null +++ b/third_party/goflow2/compose/kcg/grafana/datasources-ch.yml @@ -0,0 +1,26 @@ +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + access: proxy + orgId: 1 + url: http://prometheus:9090 + version: 1 + editable: true + - name: ClickHouse + type: vertamedia-clickhouse-datasource + typeLogoUrl: '' + access: proxy + url: http://db:8123 + password: '' + user: '' + database: '' + basicAuth: false + basicAuthUser: '' + basicAuthPassword: '' + withCredentials: false + isDefault: true + secureJsonFields: {} + version: 3 + readOnly: false diff --git a/third_party/goflow2/compose/kcg/prometheus/prometheus.yml b/third_party/goflow2/compose/kcg/prometheus/prometheus.yml new file mode 100644 index 000000000000..b7745309b2cc --- /dev/null +++ b/third_party/goflow2/compose/kcg/prometheus/prometheus.yml @@ -0,0 +1,14 @@ +global: + scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. + evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. +alerting: + alertmanagers: + - static_configs: + - targets: + +rule_files: + +scrape_configs: + - job_name: 'prometheus' + static_configs: + - targets: ['localhost:9090', 'goflow2:8080'] \ No newline at end of file diff --git a/third_party/goflow2/decoders/decoder.go b/third_party/goflow2/decoders/decoder.go new file mode 100644 index 000000000000..8eebaf3bd473 --- /dev/null +++ b/third_party/goflow2/decoders/decoder.go @@ -0,0 +1,115 @@ +package decoder + +import ( + "time" +) + +type Message interface{} +type MessageDecoded interface{} + +type DecoderFunc func(Message interface{}) error +type DoneCallback func(string, int, time.Time, time.Time) +type ErrorCallback func(string, int, time.Time, time.Time, error) + +// Worker structure +type Worker struct { + Id int + DecoderParams DecoderParams + WorkerPool chan chan Message + Name string + InMsg chan Message + Quit chan bool +} + +// Create a worker and add it to the pool. +func CreateWorker(workerPool chan chan Message, decoderParams DecoderParams, id int, name string) Worker { + return Worker{ + Id: id, + DecoderParams: decoderParams, + WorkerPool: workerPool, + Name: name, + InMsg: make(chan Message), + Quit: make(chan bool), + } +} + +// Start the worker. Launches a goroutine to process NFv9 messages. +// The worker will add its input channel of NFv9 messages to decode to the pool. +func (w Worker) Start() { + go func() { + //log.Debugf("Worker %v started", w.Id) + for { + select { + case <-w.Quit: + break + case w.WorkerPool <- w.InMsg: + msg := <-w.InMsg + timeTrackStart := time.Now() + err := w.DecoderParams.DecoderFunc(msg) + timeTrackStop := time.Now() + + if err != nil && w.DecoderParams.ErrorCallback != nil { + w.DecoderParams.ErrorCallback(w.Name, w.Id, timeTrackStart, timeTrackStop, err) + } else if err == nil && w.DecoderParams.DoneCallback != nil { + w.DecoderParams.DoneCallback(w.Name, w.Id, timeTrackStart, timeTrackStop) + } + } + } + //log.Debugf("Worker %v done", w.Id) + }() +} + +// Stop the worker. +func (w Worker) Stop() { + //log.Debugf("Stopping worker %v", w.Id) + w.Quit <- true +} + +// Processor structure +type Processor struct { + workerpool chan chan Message + workerlist []Worker + DecoderParams DecoderParams + Name string +} + +// Decoder structure. Define the function to call and the config specific to the type of packets. +type DecoderParams struct { + DecoderFunc DecoderFunc + DoneCallback DoneCallback + ErrorCallback ErrorCallback +} + +// Create a message processor which is going to create all the workers and set-up the pool. +func CreateProcessor(numWorkers int, decoderParams DecoderParams, name string) Processor { + processor := Processor{ + workerpool: make(chan chan Message), + workerlist: make([]Worker, numWorkers), + DecoderParams: decoderParams, + Name: name, + } + for i := 0; i < numWorkers; i++ { + worker := CreateWorker(processor.workerpool, decoderParams, i, name) + processor.workerlist[i] = worker + } + return processor +} + +// Start message processor +func (p Processor) Start() { + for _, worker := range p.workerlist { + worker.Start() + } +} + +func (p Processor) Stop() { + for _, worker := range p.workerlist { + worker.Stop() + } +} + +// Send a message to be decoded to the pool. +func (p Processor) ProcessMessage(msg Message) { + sendChannel := <-p.workerpool + sendChannel <- msg +} diff --git a/third_party/goflow2/decoders/netflow/ipfix.go b/third_party/goflow2/decoders/netflow/ipfix.go new file mode 100644 index 000000000000..954b7d38cc2f --- /dev/null +++ b/third_party/goflow2/decoders/netflow/ipfix.go @@ -0,0 +1,989 @@ +package netflow + +import ( + "fmt" + "time" +) + +const ( + IPFIX_FIELD_Reserved = 0 + IPFIX_FIELD_octetDeltaCount = 1 + IPFIX_FIELD_packetDeltaCount = 2 + IPFIX_FIELD_deltaFlowCount = 3 + IPFIX_FIELD_protocolIdentifier = 4 + IPFIX_FIELD_ipClassOfService = 5 + IPFIX_FIELD_tcpControlBits = 6 + IPFIX_FIELD_sourceTransportPort = 7 + IPFIX_FIELD_sourceIPv4Address = 8 + IPFIX_FIELD_sourceIPv4PrefixLength = 9 + IPFIX_FIELD_ingressInterface = 10 + IPFIX_FIELD_destinationTransportPort = 11 + IPFIX_FIELD_destinationIPv4Address = 12 + IPFIX_FIELD_destinationIPv4PrefixLength = 13 + IPFIX_FIELD_egressInterface = 14 + IPFIX_FIELD_ipNextHopIPv4Address = 15 + IPFIX_FIELD_bgpSourceAsNumber = 16 + IPFIX_FIELD_bgpDestinationAsNumber = 17 + IPFIX_FIELD_bgpNextHopIPv4Address = 18 + IPFIX_FIELD_postMCastPacketDeltaCount = 19 + IPFIX_FIELD_postMCastOctetDeltaCount = 20 + IPFIX_FIELD_flowEndSysUpTime = 21 + IPFIX_FIELD_flowStartSysUpTime = 22 + IPFIX_FIELD_postOctetDeltaCount = 23 + IPFIX_FIELD_postPacketDeltaCount = 24 + IPFIX_FIELD_minimumIpTotalLength = 25 + IPFIX_FIELD_maximumIpTotalLength = 26 + IPFIX_FIELD_sourceIPv6Address = 27 + IPFIX_FIELD_destinationIPv6Address = 28 + IPFIX_FIELD_sourceIPv6PrefixLength = 29 + IPFIX_FIELD_destinationIPv6PrefixLength = 30 + IPFIX_FIELD_flowLabelIPv6 = 31 + IPFIX_FIELD_icmpTypeCodeIPv4 = 32 + IPFIX_FIELD_igmpType = 33 + IPFIX_FIELD_samplingInterval = 34 + IPFIX_FIELD_samplingAlgorithm = 35 + IPFIX_FIELD_flowActiveTimeout = 36 + IPFIX_FIELD_flowIdleTimeout = 37 + IPFIX_FIELD_engineType = 38 + IPFIX_FIELD_engineId = 39 + IPFIX_FIELD_exportedOctetTotalCount = 40 + IPFIX_FIELD_exportedMessageTotalCount = 41 + IPFIX_FIELD_exportedFlowRecordTotalCount = 42 + IPFIX_FIELD_ipv4RouterSc = 43 + IPFIX_FIELD_sourceIPv4Prefix = 44 + IPFIX_FIELD_destinationIPv4Prefix = 45 + IPFIX_FIELD_mplsTopLabelType = 46 + IPFIX_FIELD_mplsTopLabelIPv4Address = 47 + IPFIX_FIELD_samplerId = 48 + IPFIX_FIELD_samplerMode = 49 + IPFIX_FIELD_samplerRandomInterval = 50 + IPFIX_FIELD_classId = 51 + IPFIX_FIELD_minimumTTL = 52 + IPFIX_FIELD_maximumTTL = 53 + IPFIX_FIELD_fragmentIdentification = 54 + IPFIX_FIELD_postIpClassOfService = 55 + IPFIX_FIELD_sourceMacAddress = 56 + IPFIX_FIELD_postDestinationMacAddress = 57 + IPFIX_FIELD_vlanId = 58 + IPFIX_FIELD_postVlanId = 59 + IPFIX_FIELD_ipVersion = 60 + IPFIX_FIELD_flowDirection = 61 + IPFIX_FIELD_ipNextHopIPv6Address = 62 + IPFIX_FIELD_bgpNextHopIPv6Address = 63 + IPFIX_FIELD_ipv6ExtensionHeaders = 64 + IPFIX_FIELD_mplsTopLabelStackSection = 70 + IPFIX_FIELD_mplsLabelStackSection2 = 71 + IPFIX_FIELD_mplsLabelStackSection3 = 72 + IPFIX_FIELD_mplsLabelStackSection4 = 73 + IPFIX_FIELD_mplsLabelStackSection5 = 74 + IPFIX_FIELD_mplsLabelStackSection6 = 75 + IPFIX_FIELD_mplsLabelStackSection7 = 76 + IPFIX_FIELD_mplsLabelStackSection8 = 77 + IPFIX_FIELD_mplsLabelStackSection9 = 78 + IPFIX_FIELD_mplsLabelStackSection10 = 79 + IPFIX_FIELD_destinationMacAddress = 80 + IPFIX_FIELD_postSourceMacAddress = 81 + IPFIX_FIELD_interfaceName = 82 + IPFIX_FIELD_interfaceDescription = 83 + IPFIX_FIELD_samplerName = 84 + IPFIX_FIELD_octetTotalCount = 85 + IPFIX_FIELD_packetTotalCount = 86 + IPFIX_FIELD_flagsAndSamplerId = 87 + IPFIX_FIELD_fragmentOffset = 88 + IPFIX_FIELD_forwardingStatus = 89 + IPFIX_FIELD_mplsVpnRouteDistinguisher = 90 + IPFIX_FIELD_mplsTopLabelPrefixLength = 91 + IPFIX_FIELD_srcTrafficIndex = 92 + IPFIX_FIELD_dstTrafficIndex = 93 + IPFIX_FIELD_applicationDescription = 94 + IPFIX_FIELD_applicationId = 95 + IPFIX_FIELD_applicationName = 96 + IPFIX_FIELD_postIpDiffServCodePoint = 98 + IPFIX_FIELD_multicastReplicationFactor = 99 + IPFIX_FIELD_className = 100 + IPFIX_FIELD_classificationEngineId = 101 + IPFIX_FIELD_layer2packetSectionOffset = 102 + IPFIX_FIELD_layer2packetSectionSize = 103 + IPFIX_FIELD_layer2packetSectionData = 104 + IPFIX_FIELD_bgpNextAdjacentAsNumber = 128 + IPFIX_FIELD_bgpPrevAdjacentAsNumber = 129 + IPFIX_FIELD_exporterIPv4Address = 130 + IPFIX_FIELD_exporterIPv6Address = 131 + IPFIX_FIELD_droppedOctetDeltaCount = 132 + IPFIX_FIELD_droppedPacketDeltaCount = 133 + IPFIX_FIELD_droppedOctetTotalCount = 134 + IPFIX_FIELD_droppedPacketTotalCount = 135 + IPFIX_FIELD_flowEndReason = 136 + IPFIX_FIELD_commonPropertiesId = 137 + IPFIX_FIELD_observationPointId = 138 + IPFIX_FIELD_icmpTypeCodeIPv6 = 139 + IPFIX_FIELD_mplsTopLabelIPv6Address = 140 + IPFIX_FIELD_lineCardId = 141 + IPFIX_FIELD_portId = 142 + IPFIX_FIELD_meteringProcessId = 143 + IPFIX_FIELD_exportingProcessId = 144 + IPFIX_FIELD_templateId = 145 + IPFIX_FIELD_wlanChannelId = 146 + IPFIX_FIELD_wlanSSID = 147 + IPFIX_FIELD_flowId = 148 + IPFIX_FIELD_observationDomainId = 149 + IPFIX_FIELD_flowStartSeconds = 150 + IPFIX_FIELD_flowEndSeconds = 151 + IPFIX_FIELD_flowStartMilliseconds = 152 + IPFIX_FIELD_flowEndMilliseconds = 153 + IPFIX_FIELD_flowStartMicroseconds = 154 + IPFIX_FIELD_flowEndMicroseconds = 155 + IPFIX_FIELD_flowStartNanoseconds = 156 + IPFIX_FIELD_flowEndNanoseconds = 157 + IPFIX_FIELD_flowStartDeltaMicroseconds = 158 + IPFIX_FIELD_flowEndDeltaMicroseconds = 159 + IPFIX_FIELD_systemInitTimeMilliseconds = 160 + IPFIX_FIELD_flowDurationMilliseconds = 161 + IPFIX_FIELD_flowDurationMicroseconds = 162 + IPFIX_FIELD_observedFlowTotalCount = 163 + IPFIX_FIELD_ignoredPacketTotalCount = 164 + IPFIX_FIELD_ignoredOctetTotalCount = 165 + IPFIX_FIELD_notSentFlowTotalCount = 166 + IPFIX_FIELD_notSentPacketTotalCount = 167 + IPFIX_FIELD_notSentOctetTotalCount = 168 + IPFIX_FIELD_destinationIPv6Prefix = 169 + IPFIX_FIELD_sourceIPv6Prefix = 170 + IPFIX_FIELD_postOctetTotalCount = 171 + IPFIX_FIELD_postPacketTotalCount = 172 + IPFIX_FIELD_flowKeyIndicator = 173 + IPFIX_FIELD_postMCastPacketTotalCount = 174 + IPFIX_FIELD_postMCastOctetTotalCount = 175 + IPFIX_FIELD_icmpTypeIPv4 = 176 + IPFIX_FIELD_icmpCodeIPv4 = 177 + IPFIX_FIELD_icmpTypeIPv6 = 178 + IPFIX_FIELD_icmpCodeIPv6 = 179 + IPFIX_FIELD_udpSourcePort = 180 + IPFIX_FIELD_udpDestinationPort = 181 + IPFIX_FIELD_tcpSourcePort = 182 + IPFIX_FIELD_tcpDestinationPort = 183 + IPFIX_FIELD_tcpSequenceNumber = 184 + IPFIX_FIELD_tcpAcknowledgementNumber = 185 + IPFIX_FIELD_tcpWindowSize = 186 + IPFIX_FIELD_tcpUrgentPointer = 187 + IPFIX_FIELD_tcpHeaderLength = 188 + IPFIX_FIELD_ipHeaderLength = 189 + IPFIX_FIELD_totalLengthIPv4 = 190 + IPFIX_FIELD_payloadLengthIPv6 = 191 + IPFIX_FIELD_ipTTL = 192 + IPFIX_FIELD_nextHeaderIPv6 = 193 + IPFIX_FIELD_mplsPayloadLength = 194 + IPFIX_FIELD_ipDiffServCodePoint = 195 + IPFIX_FIELD_ipPrecedence = 196 + IPFIX_FIELD_fragmentFlags = 197 + IPFIX_FIELD_octetDeltaSumOfSquares = 198 + IPFIX_FIELD_octetTotalSumOfSquares = 199 + IPFIX_FIELD_mplsTopLabelTTL = 200 + IPFIX_FIELD_mplsLabelStackLength = 201 + IPFIX_FIELD_mplsLabelStackDepth = 202 + IPFIX_FIELD_mplsTopLabelExp = 203 + IPFIX_FIELD_ipPayloadLength = 204 + IPFIX_FIELD_udpMessageLength = 205 + IPFIX_FIELD_isMulticast = 206 + IPFIX_FIELD_ipv4IHL = 207 + IPFIX_FIELD_ipv4Options = 208 + IPFIX_FIELD_tcpOptions = 209 + IPFIX_FIELD_paddingOctets = 210 + IPFIX_FIELD_collectorIPv4Address = 211 + IPFIX_FIELD_collectorIPv6Address = 212 + IPFIX_FIELD_exportInterface = 213 + IPFIX_FIELD_exportProtocolVersion = 214 + IPFIX_FIELD_exportTransportProtocol = 215 + IPFIX_FIELD_collectorTransportPort = 216 + IPFIX_FIELD_exporterTransportPort = 217 + IPFIX_FIELD_tcpSynTotalCount = 218 + IPFIX_FIELD_tcpFinTotalCount = 219 + IPFIX_FIELD_tcpRstTotalCount = 220 + IPFIX_FIELD_tcpPshTotalCount = 221 + IPFIX_FIELD_tcpAckTotalCount = 222 + IPFIX_FIELD_tcpUrgTotalCount = 223 + IPFIX_FIELD_ipTotalLength = 224 + IPFIX_FIELD_postNATSourceIPv4Address = 225 + IPFIX_FIELD_postNATDestinationIPv4Address = 226 + IPFIX_FIELD_postNAPTSourceTransportPort = 227 + IPFIX_FIELD_postNAPTDestinationTransportPort = 228 + IPFIX_FIELD_natOriginatingAddressRealm = 229 + IPFIX_FIELD_natEvent = 230 + IPFIX_FIELD_initiatorOctets = 231 + IPFIX_FIELD_responderOctets = 232 + IPFIX_FIELD_firewallEvent = 233 + IPFIX_FIELD_ingressVRFID = 234 + IPFIX_FIELD_egressVRFID = 235 + IPFIX_FIELD_VRFname = 236 + IPFIX_FIELD_postMplsTopLabelExp = 237 + IPFIX_FIELD_tcpWindowScale = 238 + IPFIX_FIELD_biflowDirection = 239 + IPFIX_FIELD_ethernetHeaderLength = 240 + IPFIX_FIELD_ethernetPayloadLength = 241 + IPFIX_FIELD_ethernetTotalLength = 242 + IPFIX_FIELD_dot1qVlanId = 243 + IPFIX_FIELD_dot1qPriority = 244 + IPFIX_FIELD_dot1qCustomerVlanId = 245 + IPFIX_FIELD_dot1qCustomerPriority = 246 + IPFIX_FIELD_metroEvcId = 247 + IPFIX_FIELD_metroEvcType = 248 + IPFIX_FIELD_pseudoWireId = 249 + IPFIX_FIELD_pseudoWireType = 250 + IPFIX_FIELD_pseudoWireControlWord = 251 + IPFIX_FIELD_ingressPhysicalInterface = 252 + IPFIX_FIELD_egressPhysicalInterface = 253 + IPFIX_FIELD_postDot1qVlanId = 254 + IPFIX_FIELD_postDot1qCustomerVlanId = 255 + IPFIX_FIELD_ethernetType = 256 + IPFIX_FIELD_postIpPrecedence = 257 + IPFIX_FIELD_collectionTimeMilliseconds = 258 + IPFIX_FIELD_exportSctpStreamId = 259 + IPFIX_FIELD_maxExportSeconds = 260 + IPFIX_FIELD_maxFlowEndSeconds = 261 + IPFIX_FIELD_messageMD5Checksum = 262 + IPFIX_FIELD_messageScope = 263 + IPFIX_FIELD_minExportSeconds = 264 + IPFIX_FIELD_minFlowStartSeconds = 265 + IPFIX_FIELD_opaqueOctets = 266 + IPFIX_FIELD_sessionScope = 267 + IPFIX_FIELD_maxFlowEndMicroseconds = 268 + IPFIX_FIELD_maxFlowEndMilliseconds = 269 + IPFIX_FIELD_maxFlowEndNanoseconds = 270 + IPFIX_FIELD_minFlowStartMicroseconds = 271 + IPFIX_FIELD_minFlowStartMilliseconds = 272 + IPFIX_FIELD_minFlowStartNanoseconds = 273 + IPFIX_FIELD_collectorCertificate = 274 + IPFIX_FIELD_exporterCertificate = 275 + IPFIX_FIELD_dataRecordsReliability = 276 + IPFIX_FIELD_observationPointType = 277 + IPFIX_FIELD_newConnectionDeltaCount = 278 + IPFIX_FIELD_connectionSumDurationSeconds = 279 + IPFIX_FIELD_connectionTransactionId = 280 + IPFIX_FIELD_postNATSourceIPv6Address = 281 + IPFIX_FIELD_postNATDestinationIPv6Address = 282 + IPFIX_FIELD_natPoolId = 283 + IPFIX_FIELD_natPoolName = 284 + IPFIX_FIELD_anonymizationFlags = 285 + IPFIX_FIELD_anonymizationTechnique = 286 + IPFIX_FIELD_informationElementIndex = 287 + IPFIX_FIELD_p2pTechnology = 288 + IPFIX_FIELD_tunnelTechnology = 289 + IPFIX_FIELD_encryptedTechnology = 290 + IPFIX_FIELD_basicList = 291 + IPFIX_FIELD_subTemplateList = 292 + IPFIX_FIELD_subTemplateMultiList = 293 + IPFIX_FIELD_bgpValidityState = 294 + IPFIX_FIELD_IPSecSPI = 295 + IPFIX_FIELD_greKey = 296 + IPFIX_FIELD_natType = 297 + IPFIX_FIELD_initiatorPackets = 298 + IPFIX_FIELD_responderPackets = 299 + IPFIX_FIELD_observationDomainName = 300 + IPFIX_FIELD_selectionSequenceId = 301 + IPFIX_FIELD_selectorId = 302 + IPFIX_FIELD_informationElementId = 303 + IPFIX_FIELD_selectorAlgorithm = 304 + IPFIX_FIELD_samplingPacketInterval = 305 + IPFIX_FIELD_samplingPacketSpace = 306 + IPFIX_FIELD_samplingTimeInterval = 307 + IPFIX_FIELD_samplingTimeSpace = 308 + IPFIX_FIELD_samplingSize = 309 + IPFIX_FIELD_samplingPopulation = 310 + IPFIX_FIELD_samplingProbability = 311 + IPFIX_FIELD_dataLinkFrameSize = 312 + IPFIX_FIELD_ipHeaderPacketSection = 313 + IPFIX_FIELD_ipPayloadPacketSection = 314 + IPFIX_FIELD_dataLinkFrameSection = 315 + IPFIX_FIELD_mplsLabelStackSection = 316 + IPFIX_FIELD_mplsPayloadPacketSection = 317 + IPFIX_FIELD_selectorIdTotalPktsObserved = 318 + IPFIX_FIELD_selectorIdTotalPktsSelected = 319 + IPFIX_FIELD_absoluteError = 320 + IPFIX_FIELD_relativeError = 321 + IPFIX_FIELD_observationTimeSeconds = 322 + IPFIX_FIELD_observationTimeMilliseconds = 323 + IPFIX_FIELD_observationTimeMicroseconds = 324 + IPFIX_FIELD_observationTimeNanoseconds = 325 + IPFIX_FIELD_digestHashValue = 326 + IPFIX_FIELD_hashIPPayloadOffset = 327 + IPFIX_FIELD_hashIPPayloadSize = 328 + IPFIX_FIELD_hashOutputRangeMin = 329 + IPFIX_FIELD_hashOutputRangeMax = 330 + IPFIX_FIELD_hashSelectedRangeMin = 331 + IPFIX_FIELD_hashSelectedRangeMax = 332 + IPFIX_FIELD_hashDigestOutput = 333 + IPFIX_FIELD_hashInitialiserValue = 334 + IPFIX_FIELD_selectorName = 335 + IPFIX_FIELD_upperCILimit = 336 + IPFIX_FIELD_lowerCILimit = 337 + IPFIX_FIELD_confidenceLevel = 338 + IPFIX_FIELD_informationElementDataType = 339 + IPFIX_FIELD_informationElementDescription = 340 + IPFIX_FIELD_informationElementName = 341 + IPFIX_FIELD_informationElementRangeBegin = 342 + IPFIX_FIELD_informationElementRangeEnd = 343 + IPFIX_FIELD_informationElementSemantics = 344 + IPFIX_FIELD_informationElementUnits = 345 + IPFIX_FIELD_privateEnterpriseNumber = 346 + IPFIX_FIELD_virtualStationInterfaceId = 347 + IPFIX_FIELD_virtualStationInterfaceName = 348 + IPFIX_FIELD_virtualStationUUID = 349 + IPFIX_FIELD_virtualStationName = 350 + IPFIX_FIELD_layer2SegmentId = 351 + IPFIX_FIELD_layer2OctetDeltaCount = 352 + IPFIX_FIELD_layer2OctetTotalCount = 353 + IPFIX_FIELD_ingressUnicastPacketTotalCount = 354 + IPFIX_FIELD_ingressMulticastPacketTotalCount = 355 + IPFIX_FIELD_ingressBroadcastPacketTotalCount = 356 + IPFIX_FIELD_egressUnicastPacketTotalCount = 357 + IPFIX_FIELD_egressBroadcastPacketTotalCount = 358 + IPFIX_FIELD_monitoringIntervalStartMilliSeconds = 359 + IPFIX_FIELD_monitoringIntervalEndMilliSeconds = 360 + IPFIX_FIELD_portRangeStart = 361 + IPFIX_FIELD_portRangeEnd = 362 + IPFIX_FIELD_portRangeStepSize = 363 + IPFIX_FIELD_portRangeNumPorts = 364 + IPFIX_FIELD_staMacAddress = 365 + IPFIX_FIELD_staIPv4Address = 366 + IPFIX_FIELD_wtpMacAddress = 367 + IPFIX_FIELD_ingressInterfaceType = 368 + IPFIX_FIELD_egressInterfaceType = 369 + IPFIX_FIELD_rtpSequenceNumber = 370 + IPFIX_FIELD_userName = 371 + IPFIX_FIELD_applicationCategoryName = 372 + IPFIX_FIELD_applicationSubCategoryName = 373 + IPFIX_FIELD_applicationGroupName = 374 + IPFIX_FIELD_originalFlowsPresent = 375 + IPFIX_FIELD_originalFlowsInitiated = 376 + IPFIX_FIELD_originalFlowsCompleted = 377 + IPFIX_FIELD_distinctCountOfSourceIPAddress = 378 + IPFIX_FIELD_distinctCountOfDestinationIPAddress = 379 + IPFIX_FIELD_distinctCountOfSourceIPv4Address = 380 + IPFIX_FIELD_distinctCountOfDestinationIPv4Address = 381 + IPFIX_FIELD_distinctCountOfSourceIPv6Address = 382 + IPFIX_FIELD_distinctCountOfDestinationIPv6Address = 383 + IPFIX_FIELD_valueDistributionMethod = 384 + IPFIX_FIELD_rfc3550JitterMilliseconds = 385 + IPFIX_FIELD_rfc3550JitterMicroseconds = 386 + IPFIX_FIELD_rfc3550JitterNanoseconds = 387 + IPFIX_FIELD_dot1qDEI = 388 + IPFIX_FIELD_dot1qCustomerDEI = 389 + IPFIX_FIELD_flowSelectorAlgorithm = 390 + IPFIX_FIELD_flowSelectedOctetDeltaCount = 391 + IPFIX_FIELD_flowSelectedPacketDeltaCount = 392 + IPFIX_FIELD_flowSelectedFlowDeltaCount = 393 + IPFIX_FIELD_selectorIDTotalFlowsObserved = 394 + IPFIX_FIELD_selectorIDTotalFlowsSelected = 395 + IPFIX_FIELD_samplingFlowInterval = 396 + IPFIX_FIELD_samplingFlowSpacing = 397 + IPFIX_FIELD_flowSamplingTimeInterval = 398 + IPFIX_FIELD_flowSamplingTimeSpacing = 399 + IPFIX_FIELD_hashFlowDomain = 400 + IPFIX_FIELD_transportOctetDeltaCount = 401 + IPFIX_FIELD_transportPacketDeltaCount = 402 + IPFIX_FIELD_originalExporterIPv4Address = 403 + IPFIX_FIELD_originalExporterIPv6Address = 404 + IPFIX_FIELD_originalObservationDomainId = 405 + IPFIX_FIELD_intermediateProcessId = 406 + IPFIX_FIELD_ignoredDataRecordTotalCount = 407 + IPFIX_FIELD_dataLinkFrameType = 408 + IPFIX_FIELD_sectionOffset = 409 + IPFIX_FIELD_sectionExportedOctets = 410 + IPFIX_FIELD_dot1qServiceInstanceTag = 411 + IPFIX_FIELD_dot1qServiceInstanceId = 412 + IPFIX_FIELD_dot1qServiceInstancePriority = 413 + IPFIX_FIELD_dot1qCustomerSourceMacAddress = 414 + IPFIX_FIELD_dot1qCustomerDestinationMacAddress = 415 + IPFIX_FIELD_postLayer2OctetDeltaCount = 417 + IPFIX_FIELD_postMCastLayer2OctetDeltaCount = 418 + IPFIX_FIELD_postLayer2OctetTotalCount = 420 + IPFIX_FIELD_postMCastLayer2OctetTotalCount = 421 + IPFIX_FIELD_minimumLayer2TotalLength = 422 + IPFIX_FIELD_maximumLayer2TotalLength = 423 + IPFIX_FIELD_droppedLayer2OctetDeltaCount = 424 + IPFIX_FIELD_droppedLayer2OctetTotalCount = 425 + IPFIX_FIELD_ignoredLayer2OctetTotalCount = 426 + IPFIX_FIELD_notSentLayer2OctetTotalCount = 427 + IPFIX_FIELD_layer2OctetDeltaSumOfSquares = 428 + IPFIX_FIELD_layer2OctetTotalSumOfSquares = 429 + IPFIX_FIELD_layer2FrameDeltaCount = 430 + IPFIX_FIELD_layer2FrameTotalCount = 431 + IPFIX_FIELD_pseudoWireDestinationIPv4Address = 432 + IPFIX_FIELD_ignoredLayer2FrameTotalCount = 433 + IPFIX_FIELD_mibObjectValueInteger = 434 + IPFIX_FIELD_mibObjectValueOctetString = 435 + IPFIX_FIELD_mibObjectValueOID = 436 + IPFIX_FIELD_mibObjectValueBits = 437 + IPFIX_FIELD_mibObjectValueIPAddress = 438 + IPFIX_FIELD_mibObjectValueCounter = 439 + IPFIX_FIELD_mibObjectValueGauge = 440 + IPFIX_FIELD_mibObjectValueTimeTicks = 441 + IPFIX_FIELD_mibObjectValueUnsigned = 442 + IPFIX_FIELD_mibObjectValueTable = 443 + IPFIX_FIELD_mibObjectValueRow = 444 + IPFIX_FIELD_mibObjectIdentifier = 445 + IPFIX_FIELD_mibSubIdentifier = 446 + IPFIX_FIELD_mibIndexIndicator = 447 + IPFIX_FIELD_mibCaptureTimeSemantics = 448 + IPFIX_FIELD_mibContextEngineID = 449 + IPFIX_FIELD_mibContextName = 450 + IPFIX_FIELD_mibObjectName = 451 + IPFIX_FIELD_mibObjectDescription = 452 + IPFIX_FIELD_mibObjectSyntax = 453 + IPFIX_FIELD_mibModuleName = 454 + IPFIX_FIELD_mobileIMSI = 455 + IPFIX_FIELD_mobileMSISDN = 456 + IPFIX_FIELD_httpStatusCode = 457 + IPFIX_FIELD_sourceTransportPortsLimit = 458 + IPFIX_FIELD_httpRequestMethod = 459 + IPFIX_FIELD_httpRequestHost = 460 + IPFIX_FIELD_httpRequestTarget = 461 + IPFIX_FIELD_httpMessageVersion = 462 + IPFIX_FIELD_natInstanceID = 463 + IPFIX_FIELD_internalAddressRealm = 464 + IPFIX_FIELD_externalAddressRealm = 465 + IPFIX_FIELD_natQuotaExceededEvent = 466 + IPFIX_FIELD_natThresholdEvent = 467 +) + +type IPFIXPacket struct { + Version uint16 + Length uint16 + ExportTime uint32 + SequenceNumber uint32 + ObservationDomainId uint32 + FlowSets []interface{} +} + +type IPFIXOptionsTemplateFlowSet struct { + FlowSetHeader + Records []IPFIXOptionsTemplateRecord +} + +type IPFIXOptionsTemplateRecord struct { + TemplateId uint16 + FieldCount uint16 + ScopeFieldCount uint16 + Options []Field + Scopes []Field +} + +func IPFIXTypeToString(typeId uint16) string { + + nameList := map[uint16]string{ + 0: "Reserved", + 1: "octetDeltaCount", + 2: "packetDeltaCount", + 3: "deltaFlowCount", + 4: "protocolIdentifier", + 5: "ipClassOfService", + 6: "tcpControlBits", + 7: "sourceTransportPort", + 8: "sourceIPv4Address", + 9: "sourceIPv4PrefixLength", + 10: "ingressInterface", + 11: "destinationTransportPort", + 12: "destinationIPv4Address", + 13: "destinationIPv4PrefixLength", + 14: "egressInterface", + 15: "ipNextHopIPv4Address", + 16: "bgpSourceAsNumber", + 17: "bgpDestinationAsNumber", + 18: "bgpNextHopIPv4Address", + 19: "postMCastPacketDeltaCount", + 20: "postMCastOctetDeltaCount", + 21: "flowEndSysUpTime", + 22: "flowStartSysUpTime", + 23: "postOctetDeltaCount", + 24: "postPacketDeltaCount", + 25: "minimumIpTotalLength", + 26: "maximumIpTotalLength", + 27: "sourceIPv6Address", + 28: "destinationIPv6Address", + 29: "sourceIPv6PrefixLength", + 30: "destinationIPv6PrefixLength", + 31: "flowLabelIPv6", + 32: "icmpTypeCodeIPv4", + 33: "igmpType", + 34: "samplingInterval", + 35: "samplingAlgorithm", + 36: "flowActiveTimeout", + 37: "flowIdleTimeout", + 38: "engineType", + 39: "engineId", + 40: "exportedOctetTotalCount", + 41: "exportedMessageTotalCount", + 42: "exportedFlowRecordTotalCount", + 43: "ipv4RouterSc", + 44: "sourceIPv4Prefix", + 45: "destinationIPv4Prefix", + 46: "mplsTopLabelType", + 47: "mplsTopLabelIPv4Address", + 48: "samplerId", + 49: "samplerMode", + 50: "samplerRandomInterval", + 51: "classId", + 52: "minimumTTL", + 53: "maximumTTL", + 54: "fragmentIdentification", + 55: "postIpClassOfService", + 56: "sourceMacAddress", + 57: "postDestinationMacAddress", + 58: "vlanId", + 59: "postVlanId", + 60: "ipVersion", + 61: "flowDirection", + 62: "ipNextHopIPv6Address", + 63: "bgpNextHopIPv6Address", + 64: "ipv6ExtensionHeaders", + 65: "Assigned for NetFlow v9 compatibility", + 66: "Assigned for NetFlow v9 compatibility", + 67: "Assigned for NetFlow v9 compatibility", + 68: "Assigned for NetFlow v9 compatibility", + 69: "Assigned for NetFlow v9 compatibility", + 70: "mplsTopLabelStackSection", + 71: "mplsLabelStackSection2", + 72: "mplsLabelStackSection3", + 73: "mplsLabelStackSection4", + 74: "mplsLabelStackSection5", + 75: "mplsLabelStackSection6", + 76: "mplsLabelStackSection7", + 77: "mplsLabelStackSection8", + 78: "mplsLabelStackSection9", + 79: "mplsLabelStackSection10", + 80: "destinationMacAddress", + 81: "postSourceMacAddress", + 82: "interfaceName", + 83: "interfaceDescription", + 84: "samplerName", + 85: "octetTotalCount", + 86: "packetTotalCount", + 87: "flagsAndSamplerId", + 88: "fragmentOffset", + 89: "forwardingStatus", + 90: "mplsVpnRouteDistinguisher", + 91: "mplsTopLabelPrefixLength", + 92: "srcTrafficIndex", + 93: "dstTrafficIndex", + 94: "applicationDescription", + 95: "applicationId", + 96: "applicationName", + 97: "Assigned for NetFlow v9 compatibility", + 98: "postIpDiffServCodePoint", + 99: "multicastReplicationFactor", + 100: "className", + 101: "classificationEngineId", + 102: "layer2packetSectionOffset", + 103: "layer2packetSectionSize", + 104: "layer2packetSectionData", + 128: "bgpNextAdjacentAsNumber", + 129: "bgpPrevAdjacentAsNumber", + 130: "exporterIPv4Address", + 131: "exporterIPv6Address", + 132: "droppedOctetDeltaCount", + 133: "droppedPacketDeltaCount", + 134: "droppedOctetTotalCount", + 135: "droppedPacketTotalCount", + 136: "flowEndReason", + 137: "commonPropertiesId", + 138: "observationPointId", + 139: "icmpTypeCodeIPv6", + 140: "mplsTopLabelIPv6Address", + 141: "lineCardId", + 142: "portId", + 143: "meteringProcessId", + 144: "exportingProcessId", + 145: "templateId", + 146: "wlanChannelId", + 147: "wlanSSID", + 148: "flowId", + 149: "observationDomainId", + 150: "flowStartSeconds", + 151: "flowEndSeconds", + 152: "flowStartMilliseconds", + 153: "flowEndMilliseconds", + 154: "flowStartMicroseconds", + 155: "flowEndMicroseconds", + 156: "flowStartNanoseconds", + 157: "flowEndNanoseconds", + 158: "flowStartDeltaMicroseconds", + 159: "flowEndDeltaMicroseconds", + 160: "systemInitTimeMilliseconds", + 161: "flowDurationMilliseconds", + 162: "flowDurationMicroseconds", + 163: "observedFlowTotalCount", + 164: "ignoredPacketTotalCount", + 165: "ignoredOctetTotalCount", + 166: "notSentFlowTotalCount", + 167: "notSentPacketTotalCount", + 168: "notSentOctetTotalCount", + 169: "destinationIPv6Prefix", + 170: "sourceIPv6Prefix", + 171: "postOctetTotalCount", + 172: "postPacketTotalCount", + 173: "flowKeyIndicator", + 174: "postMCastPacketTotalCount", + 175: "postMCastOctetTotalCount", + 176: "icmpTypeIPv4", + 177: "icmpCodeIPv4", + 178: "icmpTypeIPv6", + 179: "icmpCodeIPv6", + 180: "udpSourcePort", + 181: "udpDestinationPort", + 182: "tcpSourcePort", + 183: "tcpDestinationPort", + 184: "tcpSequenceNumber", + 185: "tcpAcknowledgementNumber", + 186: "tcpWindowSize", + 187: "tcpUrgentPointer", + 188: "tcpHeaderLength", + 189: "ipHeaderLength", + 190: "totalLengthIPv4", + 191: "payloadLengthIPv6", + 192: "ipTTL", + 193: "nextHeaderIPv6", + 194: "mplsPayloadLength", + 195: "ipDiffServCodePoint", + 196: "ipPrecedence", + 197: "fragmentFlags", + 198: "octetDeltaSumOfSquares", + 199: "octetTotalSumOfSquares", + 200: "mplsTopLabelTTL", + 201: "mplsLabelStackLength", + 202: "mplsLabelStackDepth", + 203: "mplsTopLabelExp", + 204: "ipPayloadLength", + 205: "udpMessageLength", + 206: "isMulticast", + 207: "ipv4IHL", + 208: "ipv4Options", + 209: "tcpOptions", + 210: "paddingOctets", + 211: "collectorIPv4Address", + 212: "collectorIPv6Address", + 213: "exportInterface", + 214: "exportProtocolVersion", + 215: "exportTransportProtocol", + 216: "collectorTransportPort", + 217: "exporterTransportPort", + 218: "tcpSynTotalCount", + 219: "tcpFinTotalCount", + 220: "tcpRstTotalCount", + 221: "tcpPshTotalCount", + 222: "tcpAckTotalCount", + 223: "tcpUrgTotalCount", + 224: "ipTotalLength", + 225: "postNATSourceIPv4Address", + 226: "postNATDestinationIPv4Address", + 227: "postNAPTSourceTransportPort", + 228: "postNAPTDestinationTransportPort", + 229: "natOriginatingAddressRealm", + 230: "natEvent", + 231: "initiatorOctets", + 232: "responderOctets", + 233: "firewallEvent", + 234: "ingressVRFID", + 235: "egressVRFID", + 236: "VRFname", + 237: "postMplsTopLabelExp", + 238: "tcpWindowScale", + 239: "biflowDirection", + 240: "ethernetHeaderLength", + 241: "ethernetPayloadLength", + 242: "ethernetTotalLength", + 243: "dot1qVlanId", + 244: "dot1qPriority", + 245: "dot1qCustomerVlanId", + 246: "dot1qCustomerPriority", + 247: "metroEvcId", + 248: "metroEvcType", + 249: "pseudoWireId", + 250: "pseudoWireType", + 251: "pseudoWireControlWord", + 252: "ingressPhysicalInterface", + 253: "egressPhysicalInterface", + 254: "postDot1qVlanId", + 255: "postDot1qCustomerVlanId", + 256: "ethernetType", + 257: "postIpPrecedence", + 258: "collectionTimeMilliseconds", + 259: "exportSctpStreamId", + 260: "maxExportSeconds", + 261: "maxFlowEndSeconds", + 262: "messageMD5Checksum", + 263: "messageScope", + 264: "minExportSeconds", + 265: "minFlowStartSeconds", + 266: "opaqueOctets", + 267: "sessionScope", + 268: "maxFlowEndMicroseconds", + 269: "maxFlowEndMilliseconds", + 270: "maxFlowEndNanoseconds", + 271: "minFlowStartMicroseconds", + 272: "minFlowStartMilliseconds", + 273: "minFlowStartNanoseconds", + 274: "collectorCertificate", + 275: "exporterCertificate", + 276: "dataRecordsReliability", + 277: "observationPointType", + 278: "newConnectionDeltaCount", + 279: "connectionSumDurationSeconds", + 280: "connectionTransactionId", + 281: "postNATSourceIPv6Address", + 282: "postNATDestinationIPv6Address", + 283: "natPoolId", + 284: "natPoolName", + 285: "anonymizationFlags", + 286: "anonymizationTechnique", + 287: "informationElementIndex", + 288: "p2pTechnology", + 289: "tunnelTechnology", + 290: "encryptedTechnology", + 291: "basicList", + 292: "subTemplateList", + 293: "subTemplateMultiList", + 294: "bgpValidityState", + 295: "IPSecSPI", + 296: "greKey", + 297: "natType", + 298: "initiatorPackets", + 299: "responderPackets", + 300: "observationDomainName", + 301: "selectionSequenceId", + 302: "selectorId", + 303: "informationElementId", + 304: "selectorAlgorithm", + 305: "samplingPacketInterval", + 306: "samplingPacketSpace", + 307: "samplingTimeInterval", + 308: "samplingTimeSpace", + 309: "samplingSize", + 310: "samplingPopulation", + 311: "samplingProbability", + 312: "dataLinkFrameSize", + 313: "ipHeaderPacketSection", + 314: "ipPayloadPacketSection", + 315: "dataLinkFrameSection", + 316: "mplsLabelStackSection", + 317: "mplsPayloadPacketSection", + 318: "selectorIdTotalPktsObserved", + 319: "selectorIdTotalPktsSelected", + 320: "absoluteError", + 321: "relativeError", + 322: "observationTimeSeconds", + 323: "observationTimeMilliseconds", + 324: "observationTimeMicroseconds", + 325: "observationTimeNanoseconds", + 326: "digestHashValue", + 327: "hashIPPayloadOffset", + 328: "hashIPPayloadSize", + 329: "hashOutputRangeMin", + 330: "hashOutputRangeMax", + 331: "hashSelectedRangeMin", + 332: "hashSelectedRangeMax", + 333: "hashDigestOutput", + 334: "hashInitialiserValue", + 335: "selectorName", + 336: "upperCILimit", + 337: "lowerCILimit", + 338: "confidenceLevel", + 339: "informationElementDataType", + 340: "informationElementDescription", + 341: "informationElementName", + 342: "informationElementRangeBegin", + 343: "informationElementRangeEnd", + 344: "informationElementSemantics", + 345: "informationElementUnits", + 346: "privateEnterpriseNumber", + 347: "virtualStationInterfaceId", + 348: "virtualStationInterfaceName", + 349: "virtualStationUUID", + 350: "virtualStationName", + 351: "layer2SegmentId", + 352: "layer2OctetDeltaCount", + 353: "layer2OctetTotalCount", + 354: "ingressUnicastPacketTotalCount", + 355: "ingressMulticastPacketTotalCount", + 356: "ingressBroadcastPacketTotalCount", + 357: "egressUnicastPacketTotalCount", + 358: "egressBroadcastPacketTotalCount", + 359: "monitoringIntervalStartMilliSeconds", + 360: "monitoringIntervalEndMilliSeconds", + 361: "portRangeStart", + 362: "portRangeEnd", + 363: "portRangeStepSize", + 364: "portRangeNumPorts", + 365: "staMacAddress", + 366: "staIPv4Address", + 367: "wtpMacAddress", + 368: "ingressInterfaceType", + 369: "egressInterfaceType", + 370: "rtpSequenceNumber", + 371: "userName", + 372: "applicationCategoryName", + 373: "applicationSubCategoryName", + 374: "applicationGroupName", + 375: "originalFlowsPresent", + 376: "originalFlowsInitiated", + 377: "originalFlowsCompleted", + 378: "distinctCountOfSourceIPAddress", + 379: "distinctCountOfDestinationIPAddress", + 380: "distinctCountOfSourceIPv4Address", + 381: "distinctCountOfDestinationIPv4Address", + 382: "distinctCountOfSourceIPv6Address", + 383: "distinctCountOfDestinationIPv6Address", + 384: "valueDistributionMethod", + 385: "rfc3550JitterMilliseconds", + 386: "rfc3550JitterMicroseconds", + 387: "rfc3550JitterNanoseconds", + 388: "dot1qDEI", + 389: "dot1qCustomerDEI", + 390: "flowSelectorAlgorithm", + 391: "flowSelectedOctetDeltaCount", + 392: "flowSelectedPacketDeltaCount", + 393: "flowSelectedFlowDeltaCount", + 394: "selectorIDTotalFlowsObserved", + 395: "selectorIDTotalFlowsSelected", + 396: "samplingFlowInterval", + 397: "samplingFlowSpacing", + 398: "flowSamplingTimeInterval", + 399: "flowSamplingTimeSpacing", + 400: "hashFlowDomain", + 401: "transportOctetDeltaCount", + 402: "transportPacketDeltaCount", + 403: "originalExporterIPv4Address", + 404: "originalExporterIPv6Address", + 405: "originalObservationDomainId", + 406: "intermediateProcessId", + 407: "ignoredDataRecordTotalCount", + 408: "dataLinkFrameType", + 409: "sectionOffset", + 410: "sectionExportedOctets", + 411: "dot1qServiceInstanceTag", + 412: "dot1qServiceInstanceId", + 413: "dot1qServiceInstancePriority", + 414: "dot1qCustomerSourceMacAddress", + 415: "dot1qCustomerDestinationMacAddress", + 416: "", + 417: "postLayer2OctetDeltaCount", + 418: "postMCastLayer2OctetDeltaCount", + 419: "", + 420: "postLayer2OctetTotalCount", + 421: "postMCastLayer2OctetTotalCount", + 422: "minimumLayer2TotalLength", + 423: "maximumLayer2TotalLength", + 424: "droppedLayer2OctetDeltaCount", + 425: "droppedLayer2OctetTotalCount", + 426: "ignoredLayer2OctetTotalCount", + 427: "notSentLayer2OctetTotalCount", + 428: "layer2OctetDeltaSumOfSquares", + 429: "layer2OctetTotalSumOfSquares", + 430: "layer2FrameDeltaCount", + 431: "layer2FrameTotalCount", + 432: "pseudoWireDestinationIPv4Address", + 433: "ignoredLayer2FrameTotalCount", + 434: "mibObjectValueInteger", + 435: "mibObjectValueOctetString", + 436: "mibObjectValueOID", + 437: "mibObjectValueBits", + 438: "mibObjectValueIPAddress", + 439: "mibObjectValueCounter", + 440: "mibObjectValueGauge", + 441: "mibObjectValueTimeTicks", + 442: "mibObjectValueUnsigned", + 443: "mibObjectValueTable", + 444: "mibObjectValueRow", + 445: "mibObjectIdentifier", + 446: "mibSubIdentifier", + 447: "mibIndexIndicator", + 448: "mibCaptureTimeSemantics", + 449: "mibContextEngineID", + 450: "mibContextName", + 451: "mibObjectName", + 452: "mibObjectDescription", + 453: "mibObjectSyntax", + 454: "mibModuleName", + 455: "mobileIMSI", + 456: "mobileMSISDN", + 457: "httpStatusCode", + 458: "sourceTransportPortsLimit", + 459: "httpRequestMethod", + 460: "httpRequestHost", + 461: "httpRequestTarget", + 462: "httpMessageVersion", + 463: "natInstanceID", + 464: "internalAddressRealm", + 465: "externalAddressRealm", + 466: "natQuotaExceededEvent", + 467: "natThresholdEvent", + } + + if typeId >= 105 && typeId <= 127 { + return "Assigned for NetFlow v9 compatibility" + } else if typeId >= 468 && typeId <= 32767 { + return "Unassigned" + } else { + return nameList[typeId] + } +} + +func (flowSet IPFIXOptionsTemplateFlowSet) String(TypeToString func(uint16) string) string { + str := fmt.Sprintf(" Id %v\n", flowSet.Id) + str += fmt.Sprintf(" Length: %v\n", flowSet.Length) + str += fmt.Sprintf(" Records (%v records):\n", len(flowSet.Records)) + + for j, record := range flowSet.Records { + str += fmt.Sprintf(" - Record %v:\n", j) + str += fmt.Sprintf(" TemplateId: %v\n", record.TemplateId) + str += fmt.Sprintf(" FieldCount: %v\n", record.FieldCount) + str += fmt.Sprintf(" ScopeFieldCount: %v\n", record.ScopeFieldCount) + + str += fmt.Sprintf(" Scopes (%v):\n", len(record.Scopes)) + + for k, field := range record.Scopes { + str += fmt.Sprintf(" - %v. %v (%v): %v\n", k, TypeToString(field.Type), field.Type, field.Length) + } + + str += fmt.Sprintf(" Options (%v):\n", len(record.Options)) + + for k, field := range record.Options { + str += fmt.Sprintf(" - %v. %v (%v): %v\n", k, TypeToString(field.Type), field.Type, field.Length) + } + + } + + return str +} + +func (p IPFIXPacket) String() string { + str := "Flow Packet\n" + str += "------------\n" + str += fmt.Sprintf(" Version: %v\n", p.Version) + str += fmt.Sprintf(" Length: %v\n", p.Length) + + exportTime := time.Unix(int64(p.ExportTime), 0) + str += fmt.Sprintf(" ExportTime: %v\n", exportTime.String()) + str += fmt.Sprintf(" SequenceNumber: %v\n", p.SequenceNumber) + str += fmt.Sprintf(" ObservationDomainId: %v\n", p.ObservationDomainId) + str += fmt.Sprintf(" FlowSets (%v):\n", len(p.FlowSets)) + + for i, flowSet := range p.FlowSets { + switch flowSet := flowSet.(type) { + case TemplateFlowSet: + str += fmt.Sprintf(" - TemplateFlowSet %v:\n", i) + str += flowSet.String(IPFIXTypeToString) + case IPFIXOptionsTemplateFlowSet: + str += fmt.Sprintf(" - OptionsTemplateFlowSet %v:\n", i) + str += flowSet.String(IPFIXTypeToString) + case DataFlowSet: + str += fmt.Sprintf(" - DataFlowSet %v:\n", i) + str += flowSet.String(IPFIXTypeToString) + case OptionsDataFlowSet: + str += fmt.Sprintf(" - OptionsDataFlowSet %v:\n", i) + str += flowSet.String(IPFIXTypeToString, IPFIXTypeToString) + default: + str += fmt.Sprintf(" - (unknown type) %v: %v\n", i, flowSet) + } + } + + return str +} diff --git a/third_party/goflow2/decoders/netflow/netflow.go b/third_party/goflow2/decoders/netflow/netflow.go new file mode 100644 index 000000000000..cd17bc81dd67 --- /dev/null +++ b/third_party/goflow2/decoders/netflow/netflow.go @@ -0,0 +1,534 @@ +package netflow + +import ( + "bytes" + "context" + "encoding/binary" + "fmt" + "sync" + + "github.com/netsampler/goflow2/decoders/netflow/templates" + "github.com/netsampler/goflow2/decoders/utils" +) + +type FlowBaseTemplateSet map[uint16]map[uint32]map[uint16]interface{} + +type NetFlowTemplateSystem interface { + GetTemplate(version uint16, obsDomainId uint32, templateId uint16) (interface{}, error) + AddTemplate(version uint16, obsDomainId uint32, template interface{}) +} + +// Transition structure to ease the conversion with the new template systems +type TemplateWrapper struct { + Ctx context.Context + Key string + Inner templates.TemplateInterface +} + +func (w *TemplateWrapper) getTemplateId(template interface{}) (templateId uint16) { + switch templateIdConv := template.(type) { + case IPFIXOptionsTemplateRecord: + templateId = templateIdConv.TemplateId + case NFv9OptionsTemplateRecord: + templateId = templateIdConv.TemplateId + case TemplateRecord: + templateId = templateIdConv.TemplateId + } + return templateId +} + +func (w TemplateWrapper) GetTemplate(version uint16, obsDomainId uint32, templateId uint16) (interface{}, error) { + return w.Inner.GetTemplate(w.Ctx, &templates.TemplateKey{w.Key, version, obsDomainId, templateId}) +} + +func (w TemplateWrapper) AddTemplate(version uint16, obsDomainId uint32, template interface{}) { + w.Inner.AddTemplate(w.Ctx, &templates.TemplateKey{w.Key, version, obsDomainId, w.getTemplateId(template)}, template) +} + +func DecodeNFv9OptionsTemplateSet(payload *bytes.Buffer) ([]NFv9OptionsTemplateRecord, error) { + var records []NFv9OptionsTemplateRecord + var err error + for payload.Len() >= 4 { + optsTemplateRecord := NFv9OptionsTemplateRecord{} + err = utils.BinaryDecoder(payload, &optsTemplateRecord.TemplateId, &optsTemplateRecord.ScopeLength, &optsTemplateRecord.OptionLength) + if err != nil { + return records, err + } + + sizeScope := int(optsTemplateRecord.ScopeLength) / 4 + sizeOptions := int(optsTemplateRecord.OptionLength) / 4 + if sizeScope < 0 || sizeOptions < 0 { + return records, fmt.Errorf("Error decoding OptionsTemplateSet: negative length.") + } + + fields := make([]Field, sizeScope) + for i := 0; i < sizeScope; i++ { + field := Field{} + if err := DecodeField(payload, &field, false); err != nil { + return records, err + } + fields[i] = field + } + optsTemplateRecord.Scopes = fields + + fields = make([]Field, sizeOptions) + for i := 0; i < sizeOptions; i++ { + field := Field{} + if err := DecodeField(payload, &field, false); err != nil { + return records, err + } + fields[i] = field + } + optsTemplateRecord.Options = fields + + records = append(records, optsTemplateRecord) + } + + return records, err +} + +func DecodeField(payload *bytes.Buffer, field *Field, pen bool) error { + err := utils.BinaryDecoder(payload, &field.Type, &field.Length) + if pen && err == nil && field.Type&0x8000 != 0 { + field.PenProvided = true + err = utils.BinaryDecoder(payload, &field.Pen) + } + return err +} + +func DecodeIPFIXOptionsTemplateSet(payload *bytes.Buffer) ([]IPFIXOptionsTemplateRecord, error) { + var records []IPFIXOptionsTemplateRecord + var err error + for payload.Len() >= 4 { + optsTemplateRecord := IPFIXOptionsTemplateRecord{} + err = utils.BinaryDecoder(payload, &optsTemplateRecord.TemplateId, &optsTemplateRecord.FieldCount, &optsTemplateRecord.ScopeFieldCount) + if err != nil { + return records, err + } + + fields := make([]Field, int(optsTemplateRecord.ScopeFieldCount)) + for i := 0; i < int(optsTemplateRecord.ScopeFieldCount); i++ { + field := Field{} + if err := DecodeField(payload, &field, true); err != nil { + return records, err + } + fields[i] = field + } + optsTemplateRecord.Scopes = fields + + optionsSize := int(optsTemplateRecord.FieldCount) - int(optsTemplateRecord.ScopeFieldCount) + if optionsSize < 0 { + return records, fmt.Errorf("Error decoding OptionsTemplateSet: negative length.") + } + fields = make([]Field, optionsSize) + for i := 0; i < optionsSize; i++ { + field := Field{} + if err := DecodeField(payload, &field, true); err != nil { + return records, err + } + fields[i] = field + } + optsTemplateRecord.Options = fields + + records = append(records, optsTemplateRecord) + } + + return records, nil +} + +func DecodeTemplateSet(version uint16, payload *bytes.Buffer) ([]TemplateRecord, error) { + var records []TemplateRecord + var err error + for payload.Len() >= 4 { + templateRecord := TemplateRecord{} + err = utils.BinaryDecoder(payload, &templateRecord.TemplateId, &templateRecord.FieldCount) + if err != nil { + return records, err + } + + if int(templateRecord.FieldCount) < 0 { + return records, fmt.Errorf("Error decoding TemplateSet: zero count.") + } + + fields := make([]Field, int(templateRecord.FieldCount)) + for i := 0; i < int(templateRecord.FieldCount); i++ { + field := Field{} + err := utils.BinaryDecoder(payload, &field.Type, &field.Length) + if err == nil && version == 10 && field.Type&0x8000 != 0 { + field.PenProvided = true + field.Type = field.Type ^ 0x8000 + err = utils.BinaryDecoder(payload, &field.Pen) + } + if err != nil { + return records, err + } + fields[i] = field + } + templateRecord.Fields = fields + records = append(records, templateRecord) + } + + return records, nil +} + +func GetTemplateSize(version uint16, template []Field) int { + sum := 0 + for _, templateField := range template { + if templateField.Length == 0xffff { + continue + } + + sum += int(templateField.Length) + } + return sum +} + +func DecodeDataSetUsingFields(version uint16, payload *bytes.Buffer, listFields []Field) []DataField { + for payload.Len() >= GetTemplateSize(version, listFields) { + + dataFields := make([]DataField, len(listFields)) + for i, templateField := range listFields { + + finalLength := int(templateField.Length) + if templateField.Length == 0xffff { + var variableLen8 byte + var variableLen16 uint16 + err := utils.BinaryDecoder(payload, &variableLen8) + if err != nil { + return []DataField{} + } + if variableLen8 == 0xff { + err := utils.BinaryDecoder(payload, &variableLen16) + if err != nil { + return []DataField{} + } + finalLength = int(variableLen16) + } else { + finalLength = int(variableLen8) + } + } + + value := payload.Next(finalLength) + nfvalue := DataField{ + Type: templateField.Type, + PenProvided: templateField.PenProvided, + Pen: templateField.Pen, + Value: value, + } + dataFields[i] = nfvalue + } + return dataFields + } + return []DataField{} +} + +type ErrorTemplateNotFound struct { + version uint16 + obsDomainId uint32 + templateId uint16 + typeTemplate string +} + +func NewErrorTemplateNotFound(version uint16, obsDomainId uint32, templateId uint16, typeTemplate string) *ErrorTemplateNotFound { + return &ErrorTemplateNotFound{ + version: version, + obsDomainId: obsDomainId, + templateId: templateId, + typeTemplate: typeTemplate, + } +} + +func (e *ErrorTemplateNotFound) Error() string { + return fmt.Sprintf("No %v template %v found for and domain id %v", e.typeTemplate, e.templateId, e.obsDomainId) +} + +func DecodeOptionsDataSet(version uint16, payload *bytes.Buffer, listFieldsScopes, listFieldsOption []Field) ([]OptionsDataRecord, error) { + var records []OptionsDataRecord + + listFieldsScopesSize := GetTemplateSize(version, listFieldsScopes) + listFieldsOptionSize := GetTemplateSize(version, listFieldsOption) + + for payload.Len() >= listFieldsScopesSize+listFieldsOptionSize { + scopeValues := DecodeDataSetUsingFields(version, payload, listFieldsScopes) + optionValues := DecodeDataSetUsingFields(version, payload, listFieldsOption) + + record := OptionsDataRecord{ + ScopesValues: scopeValues, + OptionsValues: optionValues, + } + + records = append(records, record) + } + return records, nil +} + +func DecodeDataSet(version uint16, payload *bytes.Buffer, listFields []Field) ([]DataRecord, error) { + var records []DataRecord + + listFieldsSize := GetTemplateSize(version, listFields) + for payload.Len() >= listFieldsSize { + values := DecodeDataSetUsingFields(version, payload, listFields) + + record := DataRecord{ + Values: values, + } + + records = append(records, record) + } + return records, nil +} + +func (ts *BasicTemplateSystem) GetTemplates() map[uint16]map[uint32]map[uint16]interface{} { + ts.templateslock.RLock() + tmp := ts.templates + ts.templateslock.RUnlock() + return tmp +} + +func (ts *BasicTemplateSystem) AddTemplate(version uint16, obsDomainId uint32, template interface{}) { + ts.templateslock.Lock() + defer ts.templateslock.Unlock() + _, exists := ts.templates[version] + if exists != true { + ts.templates[version] = make(map[uint32]map[uint16]interface{}) + } + _, exists = ts.templates[version][obsDomainId] + if exists != true { + ts.templates[version][obsDomainId] = make(map[uint16]interface{}) + } + var templateId uint16 + switch templateIdConv := template.(type) { + case IPFIXOptionsTemplateRecord: + templateId = templateIdConv.TemplateId + case NFv9OptionsTemplateRecord: + templateId = templateIdConv.TemplateId + case TemplateRecord: + templateId = templateIdConv.TemplateId + } + ts.templates[version][obsDomainId][templateId] = template +} + +func (ts *BasicTemplateSystem) GetTemplate(version uint16, obsDomainId uint32, templateId uint16) (interface{}, error) { + ts.templateslock.RLock() + defer ts.templateslock.RUnlock() + templatesVersion, okver := ts.templates[version] + if okver { + templatesObsDom, okobs := templatesVersion[obsDomainId] + if okobs { + template, okid := templatesObsDom[templateId] + if okid { + return template, nil + } + } + } + return nil, NewErrorTemplateNotFound(version, obsDomainId, templateId, "info") +} + +type BasicTemplateSystem struct { + templates FlowBaseTemplateSet + templateslock *sync.RWMutex +} + +func CreateTemplateSystem() *BasicTemplateSystem { + ts := &BasicTemplateSystem{ + templates: make(FlowBaseTemplateSet), + templateslock: &sync.RWMutex{}, + } + return ts +} + +func DecodeMessage(payload *bytes.Buffer, templates NetFlowTemplateSystem) (interface{}, error) { + return DecodeMessageContext(context.Background(), payload, "", templates) +} + +func DecodeMessageContext(ctx context.Context, payload *bytes.Buffer, templateKey string, tpli NetFlowTemplateSystem) (interface{}, error) { + var size uint16 + packetNFv9 := NFv9Packet{} + packetIPFIX := IPFIXPacket{} + var returnItem interface{} + + var version uint16 + var obsDomainId uint32 + if err := binary.Read(payload, binary.BigEndian, &version); err != nil { + return nil, fmt.Errorf("Error decoding version: %v", err) + } + + if version == 9 { + err := utils.BinaryDecoder(payload, &packetNFv9.Count, &packetNFv9.SystemUptime, &packetNFv9.UnixSeconds, &packetNFv9.SequenceNumber, &packetNFv9.SourceId) + if err != nil { + return nil, fmt.Errorf("Error decoding NetFlow v9 header: %v", err) + } + size = packetNFv9.Count + packetNFv9.Version = version + returnItem = *(&packetNFv9) + obsDomainId = packetNFv9.SourceId + } else if version == 10 { + err := utils.BinaryDecoder(payload, &packetIPFIX.Length, &packetIPFIX.ExportTime, &packetIPFIX.SequenceNumber, &packetIPFIX.ObservationDomainId) + if err != nil { + return nil, fmt.Errorf("Error decoding IPFIX header: %v", err) + } + size = packetIPFIX.Length + packetIPFIX.Version = version + returnItem = *(&packetIPFIX) + obsDomainId = packetIPFIX.ObservationDomainId + } else { + return nil, fmt.Errorf("NetFlow/IPFIX version error: %d", version) + } + + for i := 0; ((i < int(size) && version == 9) || version == 10) && payload.Len() > 0; i++ { + fsheader := FlowSetHeader{} + if err := utils.BinaryDecoder(payload, &fsheader); err != nil { + return returnItem, fmt.Errorf("Error decoding FlowSet header: %v", err) + } + + nextrelpos := int(fsheader.Length) - binary.Size(fsheader) + if nextrelpos < 0 { + return returnItem, fmt.Errorf("Error decoding packet: non-terminated stream") + } + + var flowSet interface{} + + if fsheader.Id == 0 && version == 9 { + templateReader := bytes.NewBuffer(payload.Next(nextrelpos)) + records, err := DecodeTemplateSet(version, templateReader) + if err != nil { + return returnItem, fmt.Errorf("Error decoding FlowSet header: %v", err) + } + templatefs := TemplateFlowSet{ + FlowSetHeader: fsheader, + Records: records, + } + + flowSet = templatefs + + if tpli != nil { + for _, record := range records { + tpli.AddTemplate(version, obsDomainId, record) + //tpli.AddTemplate(ctx, templates.NewTemplateKey(templateKey, version, obsDomainId, record.TemplateId), record) + } + } + + } else if fsheader.Id == 1 && version == 9 { + templateReader := bytes.NewBuffer(payload.Next(nextrelpos)) + records, err := DecodeNFv9OptionsTemplateSet(templateReader) + if err != nil { + return returnItem, fmt.Errorf("Error decoding NetFlow OptionsTemplateSet: %v", err) + } + optsTemplatefs := NFv9OptionsTemplateFlowSet{ + FlowSetHeader: fsheader, + Records: records, + } + flowSet = optsTemplatefs + + if tpli != nil { + for _, record := range records { + tpli.AddTemplate(version, obsDomainId, record) + //tpli.AddTemplate(ctx, templates.NewTemplateKey(templateKey, version, obsDomainId, record.TemplateId), record) + } + } + + } else if fsheader.Id == 2 && version == 10 { + templateReader := bytes.NewBuffer(payload.Next(nextrelpos)) + records, err := DecodeTemplateSet(version, templateReader) + if err != nil { + return returnItem, fmt.Errorf("Error decoding IPFIX TemplateSet: %v", err) + } + templatefs := TemplateFlowSet{ + FlowSetHeader: fsheader, + Records: records, + } + flowSet = templatefs + + if tpli != nil { + for _, record := range records { + tpli.AddTemplate(version, obsDomainId, record) + //tpli.AddTemplate(ctx, templates.NewTemplateKey(templateKey, version, obsDomainId, record.TemplateId), record) + } + } + + } else if fsheader.Id == 3 && version == 10 { + templateReader := bytes.NewBuffer(payload.Next(nextrelpos)) + records, err := DecodeIPFIXOptionsTemplateSet(templateReader) + if err != nil { + return returnItem, fmt.Errorf("Error decoding IPFIX OptionsTemplateSet: %v", err) + } + optsTemplatefs := IPFIXOptionsTemplateFlowSet{ + FlowSetHeader: fsheader, + Records: records, + } + flowSet = optsTemplatefs + + if tpli != nil { + for _, record := range records { + tpli.AddTemplate(version, obsDomainId, record) + //tpli.AddTemplate(ctx, templates.NewTemplateKey(templateKey, version, obsDomainId, record.TemplateId), record) + } + } + + } else if fsheader.Id >= 256 { + dataReader := bytes.NewBuffer(payload.Next(nextrelpos)) + + if tpli == nil { + continue + } + + template, err := tpli.GetTemplate(version, obsDomainId, fsheader.Id) + //template, err := tpli.GetTemplate(ctx, templates.NewTemplateKey(templateKey, version, obsDomainId, fsheader.Id)) + + if err == nil { + switch templatec := template.(type) { + case TemplateRecord: + records, err := DecodeDataSet(version, dataReader, templatec.Fields) + if err != nil { + return returnItem, fmt.Errorf("Error decoding DataSet: %v", err) + } + datafs := DataFlowSet{ + FlowSetHeader: fsheader, + Records: records, + } + flowSet = datafs + case IPFIXOptionsTemplateRecord: + records, err := DecodeOptionsDataSet(version, dataReader, templatec.Scopes, templatec.Options) + if err != nil { + return returnItem, fmt.Errorf("Error decoding DataSet: %v", err) + } + + datafs := OptionsDataFlowSet{ + FlowSetHeader: fsheader, + Records: records, + } + flowSet = datafs + case NFv9OptionsTemplateRecord: + records, err := DecodeOptionsDataSet(version, dataReader, templatec.Scopes, templatec.Options) + if err != nil { + return returnItem, fmt.Errorf("Error decoding OptionDataSet: %v", err) + } + + datafs := OptionsDataFlowSet{ + FlowSetHeader: fsheader, + Records: records, + } + flowSet = datafs + } + } else { + return returnItem, err + } + } else { + return returnItem, fmt.Errorf("Error with ID %d", fsheader.Id) + } + + if version == 9 && flowSet != nil { + packetNFv9.FlowSets = append(packetNFv9.FlowSets, flowSet) + } else if version == 10 && flowSet != nil { + packetIPFIX.FlowSets = append(packetIPFIX.FlowSets, flowSet) + } + } + + if version == 9 { + return packetNFv9, nil + } else if version == 10 { + return packetIPFIX, nil + } else { + return returnItem, fmt.Errorf("Unknown version: %d", version) + } +} diff --git a/third_party/goflow2/decoders/netflow/netflow_test.go b/third_party/goflow2/decoders/netflow/netflow_test.go new file mode 100644 index 000000000000..5097c7d7b684 --- /dev/null +++ b/third_party/goflow2/decoders/netflow/netflow_test.go @@ -0,0 +1,416 @@ +package netflow + +import ( + "bytes" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestDecodeNetFlowV9(t *testing.T) { + templates := CreateTemplateSystem() + + // Decode a template + template := []byte{ + 0x00, 0x09, 0x00, 0x01, 0xb3, 0xbf, 0xf6, 0x83, 0x61, 0x8a, 0xa3, 0xa8, 0x32, 0x01, 0xee, 0x98, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x64, 0x01, 0x04, 0x00, 0x17, 0x00, 0x02, 0x00, 0x04, + 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x04, + 0x00, 0x0e, 0x00, 0x04, 0x00, 0x15, 0x00, 0x04, 0x00, 0x16, 0x00, 0x04, 0x00, 0x07, 0x00, 0x02, + 0x00, 0x0b, 0x00, 0x02, 0x00, 0x10, 0x00, 0x04, 0x00, 0x11, 0x00, 0x04, 0x00, 0x12, 0x00, 0x04, + 0x00, 0x09, 0x00, 0x01, 0x00, 0x0d, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x06, 0x00, 0x01, + 0x00, 0x05, 0x00, 0x01, 0x00, 0x3d, 0x00, 0x01, 0x00, 0x59, 0x00, 0x01, 0x00, 0x30, 0x00, 0x02, + 0x00, 0xea, 0x00, 0x04, 0x00, 0xeb, 0x00, 0x04, + } + buf := bytes.NewBuffer(template) + dec, err := DecodeMessage(buf, templates) + assert.Nil(t, err) + assert.NotNil(t, dec) + decNfv9 := dec.(NFv9Packet) + assert.Equal(t, + NFv9Packet{ + Version: 9, + Count: 1, + SystemUptime: 0xb3bff683, + UnixSeconds: 0x618aa3a8, + SequenceNumber: 838987416, + SourceId: 256, + FlowSets: []interface{}{ + TemplateFlowSet{ + FlowSetHeader: FlowSetHeader{Id: 0x0, Length: 100}, + Records: []TemplateRecord{ + { + TemplateId: 260, + FieldCount: 23, + Fields: []Field{ + {PenProvided: false, Type: 0x2, Length: 0x4}, + {PenProvided: false, Type: 0x1, Length: 0x4}, + {PenProvided: false, Type: 0x8, Length: 0x4}, + {PenProvided: false, Type: 0xc, Length: 0x4}, + {PenProvided: false, Type: 0xa, Length: 0x4}, + {PenProvided: false, Type: 0xe, Length: 0x4}, + {PenProvided: false, Type: 0x15, Length: 0x4}, + {PenProvided: false, Type: 0x16, Length: 0x4}, + {PenProvided: false, Type: 0x7, Length: 0x2}, + {PenProvided: false, Type: 0xb, Length: 0x2}, + {PenProvided: false, Type: 0x10, Length: 0x4}, + {PenProvided: false, Type: 0x11, Length: 0x4}, + {PenProvided: false, Type: 0x12, Length: 0x4}, + {PenProvided: false, Type: 0x9, Length: 0x1}, + {PenProvided: false, Type: 0xd, Length: 0x1}, + {PenProvided: false, Type: 0x4, Length: 0x1}, + {PenProvided: false, Type: 0x6, Length: 0x1}, + {PenProvided: false, Type: 0x5, Length: 0x1}, + {PenProvided: false, Type: 0x3d, Length: 0x1}, + {PenProvided: false, Type: 0x59, Length: 0x1}, + {PenProvided: false, Type: 0x30, Length: 0x2}, + {PenProvided: false, Type: 0xea, Length: 0x4}, + {PenProvided: false, Type: 0xeb, Length: 0x4}, + }, + }, + }, + }, + }, + }, decNfv9) + assert.Equal(t, + `Flow Packet +------------ + Version: 9 + Count: 1 + SystemUptime: 3015702147 + UnixSeconds: 2021-11-09 16:36:56 +0000 UTC + SequenceNumber: 838987416 + SourceId: 256 + FlowSets (1): + - TemplateFlowSet 0: + Id 0 + Length: 100 + Records (1 records): + - 0. Record: + TemplateId: 260 + FieldCount: 23 + Fields (23): + - 0. IN_PKTS (2/false): 4 + - 1. IN_BYTES (1/false): 4 + - 2. IPV4_SRC_ADDR (8/false): 4 + - 3. IPV4_DST_ADDR (12/false): 4 + - 4. INPUT_SNMP (10/false): 4 + - 5. OUTPUT_SNMP (14/false): 4 + - 6. LAST_SWITCHED (21/false): 4 + - 7. FIRST_SWITCHED (22/false): 4 + - 8. L4_SRC_PORT (7/false): 2 + - 9. L4_DST_PORT (11/false): 2 + - 10. SRC_AS (16/false): 4 + - 11. DST_AS (17/false): 4 + - 12. BGP_IPV4_NEXT_HOP (18/false): 4 + - 13. SRC_MASK (9/false): 1 + - 14. DST_MASK (13/false): 1 + - 15. PROTOCOL (4/false): 1 + - 16. TCP_FLAGS (6/false): 1 + - 17. SRC_TOS (5/false): 1 + - 18. DIRECTION (61/false): 1 + - 19. FORWARDING STATUS (89/false): 1 + - 20. FLOW_SAMPLER_ID (48/false): 2 + - 21. Unassigned (234/false): 4 + - 22. Unassigned (235/false): 4 +`, + decNfv9.String()) + + // Decode some data using the above template + data := []byte{ + 0x00, 0x09, 0x00, 0x15, 0xb3, 0xbf, 0xf6, 0x83, 0x61, 0x8a, 0xa3, 0xa8, 0x32, 0x01, 0xee, 0x9c, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x04, 0x05, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xdc, + 0xc6, 0x26, 0x78, 0xde, 0x58, 0x79, 0xd9, 0xd0, 0x00, 0x00, 0x01, 0x62, 0x00, 0x00, 0x01, 0x30, + 0xb3, 0xbf, 0xe6, 0xf9, 0xb3, 0xbf, 0xe6, 0xf9, 0x01, 0xbb, 0x3b, 0x50, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x18, 0x0e, 0x06, 0x10, 0x00, 0x00, 0x40, 0x00, + 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0b, + 0xb8, 0x6d, 0x47, 0xa2, 0xc4, 0x5b, 0xad, 0x61, 0xe0, 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, 0x01, + 0x30, 0xb3, 0xbf, 0xe8, 0x1c, 0xb3, 0xbf, 0xe6, 0xf9, 0x01, 0xbb, 0x7b, 0x99, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x18, 0x0d, 0x06, 0x10, 0x48, 0x00, 0x40, + 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x05, 0xdc, 0xc6, 0x26, 0x78, 0xd3, 0x5b, 0xa5, 0xd2, 0xee, 0x00, 0x00, 0x01, 0x62, 0x00, 0x00, + 0x01, 0x75, 0xb3, 0xbf, 0xe6, 0xfc, 0xb3, 0xbf, 0xe6, 0xfc, 0x00, 0x50, 0x8f, 0xb8, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x95, 0xae, 0x3b, 0x18, 0x0e, 0x06, 0x10, 0x00, 0x00, + 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x05, 0xdc, 0x5f, 0x64, 0x56, 0x42, 0x5b, 0xa9, 0x1a, 0xbe, 0x00, 0x00, 0x01, 0x61, 0x00, + 0x00, 0x01, 0x31, 0xb3, 0xbf, 0xe6, 0xfc, 0xb3, 0xbf, 0xe6, 0xfc, 0x00, 0x50, 0xbf, 0xc3, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x18, 0x0e, 0x06, 0x10, 0x28, + 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x05, 0xdc, 0xc6, 0x26, 0x78, 0xc6, 0x5b, 0xab, 0x33, 0x34, 0x00, 0x00, 0x01, 0x62, + 0x00, 0x00, 0x01, 0x31, 0xb3, 0xbf, 0xe6, 0xfc, 0xb3, 0xbf, 0xe6, 0xfc, 0x01, 0xbb, 0xf9, 0xd5, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x18, 0x0e, 0x06, 0x10, + 0x00, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x05, 0xdc, 0xc6, 0x26, 0x78, 0x83, 0x4e, 0xf2, 0x8c, 0x81, 0x00, 0x00, 0x01, + 0x62, 0x00, 0x00, 0x01, 0x31, 0xb3, 0xbf, 0xe6, 0xfe, 0xb3, 0xbf, 0xe6, 0xfe, 0x01, 0xbb, 0xb3, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x18, 0x18, 0x06, + 0x10, 0x00, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x05, 0xdc, 0xc6, 0x26, 0x78, 0xb8, 0x5b, 0xaa, 0xab, 0x01, 0x00, 0x00, + 0x01, 0x62, 0x00, 0x00, 0x01, 0x31, 0xb3, 0xbf, 0xe6, 0xff, 0xb3, 0xbf, 0xe6, 0xff, 0x01, 0xbb, + 0xe5, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x18, 0x0e, + 0x06, 0x10, 0x00, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xdc, 0xc6, 0x26, 0x78, 0xc5, 0x5b, 0xa5, 0x22, 0x65, 0x00, + 0x00, 0x01, 0x62, 0x00, 0x00, 0x01, 0x69, 0xb3, 0xbf, 0xe7, 0x00, 0xb3, 0xbf, 0xe7, 0x00, 0x01, + 0xbb, 0x3c, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x95, 0xae, 0x31, 0x18, + 0x0e, 0x06, 0x10, 0x00, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xdc, 0x8f, 0xf4, 0x38, 0x1a, 0x5b, 0xa4, 0xc7, 0x3a, + 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, 0x01, 0x75, 0xb3, 0xbf, 0xe7, 0x01, 0xb3, 0xbf, 0xe7, 0x01, + 0x01, 0xbb, 0x49, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x95, 0xae, 0x3b, + 0x17, 0x0e, 0x06, 0x10, 0x28, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xb0, 0xc7, 0xe8, 0xb2, 0x49, 0x5b, 0xaf, 0x83, + 0x0c, 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, 0x01, 0x30, 0xb3, 0xbf, 0xe7, 0x02, 0xb3, 0xbf, 0xe7, + 0x02, 0x01, 0xbb, 0x96, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, + 0x00, 0x16, 0x0d, 0x06, 0x10, 0x28, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xdc, 0xc6, 0x26, 0x78, 0xd8, 0x58, 0x7c, + 0x1f, 0x58, 0x00, 0x00, 0x01, 0x62, 0x00, 0x00, 0x01, 0x30, 0xb3, 0xbf, 0xe7, 0x02, 0xb3, 0xbf, + 0xe7, 0x02, 0x01, 0xbb, 0x16, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, + 0x00, 0x00, 0x18, 0x0e, 0x06, 0x10, 0x00, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xdc, 0xc6, 0x26, 0x78, 0xdc, 0x5b, + 0xaf, 0x13, 0x88, 0x00, 0x00, 0x01, 0x62, 0x00, 0x00, 0x01, 0x30, 0xb3, 0xbf, 0xe7, 0x02, 0xb3, + 0xbf, 0xe7, 0x02, 0x01, 0xbb, 0x79, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xdf, 0x00, 0x00, 0x18, 0x0d, 0x06, 0x10, 0x00, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xdc, 0xcd, 0xea, 0xaf, 0x66, + 0x5b, 0xa1, 0xfc, 0x11, 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, 0x01, 0x69, 0xb3, 0xbf, 0xe7, 0x03, + 0xb3, 0xbf, 0xe7, 0x03, 0x01, 0xbb, 0x79, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc2, 0x95, 0xae, 0x31, 0x18, 0x0e, 0x06, 0x10, 0x28, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, + 0x02, 0x60, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0b, 0x20, 0x8a, 0xc7, 0x10, + 0xcc, 0x5b, 0xa6, 0xb0, 0x14, 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, 0x01, 0x69, 0xb3, 0xbf, 0xe7, + 0x04, 0xb3, 0xbf, 0xe4, 0xba, 0x04, 0xaa, 0x22, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc2, 0x95, 0xae, 0x31, 0x18, 0x0e, 0x11, 0x00, 0x28, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, + 0x00, 0x02, 0x60, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0xd8, 0xb9, 0x21, + 0xdc, 0x64, 0x5b, 0xac, 0x7f, 0x22, 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, 0x01, 0x30, 0xb3, 0xbf, + 0xe7, 0x04, 0xb3, 0xbf, 0xe7, 0x04, 0x01, 0xbb, 0x1b, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x16, 0x0d, 0x06, 0x18, 0x28, 0x00, 0x40, 0x00, 0x01, 0x60, + 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xdc, 0xb9, + 0x15, 0x3d, 0x5c, 0x4e, 0xe8, 0x7a, 0x02, 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, 0x01, 0x30, 0xb3, + 0xbf, 0xe7, 0x05, 0xb3, 0xbf, 0xe7, 0x05, 0x88, 0xb3, 0xd0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x16, 0x16, 0x06, 0x10, 0x28, 0x00, 0x40, 0x00, 0x01, + 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, + 0xd4, 0x20, 0xfe, 0x7b, 0x5b, 0xab, 0x61, 0x86, 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, 0x01, 0x31, + 0xb3, 0xbf, 0xe7, 0x06, 0xb3, 0xbf, 0xe7, 0x06, 0xd3, 0xc9, 0xc3, 0x50, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x13, 0x0e, 0x06, 0x10, 0x28, 0x00, 0x40, 0x00, + 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, + 0x90, 0xc6, 0x26, 0x78, 0xc3, 0x25, 0xa5, 0xad, 0xb8, 0x00, 0x00, 0x01, 0x62, 0x00, 0x00, 0x01, + 0x31, 0xb3, 0xbf, 0xe7, 0x08, 0xb3, 0xbf, 0xe7, 0x08, 0x01, 0xbb, 0x58, 0x64, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x18, 0x12, 0x06, 0x10, 0x00, 0x00, 0x40, + 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x05, 0xdc, 0x8f, 0xf4, 0x39, 0x32, 0x4e, 0xe6, 0x08, 0xb1, 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, + 0x01, 0x30, 0xb3, 0xbf, 0xe7, 0x08, 0xb3, 0xbf, 0xe7, 0x08, 0x01, 0xbb, 0xb2, 0x9a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x17, 0x17, 0x06, 0x10, 0x28, 0x00, + 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x05, 0x3c, 0xc6, 0x26, 0x78, 0xb6, 0x25, 0xa4, 0xf7, 0xb2, 0x00, 0x00, 0x01, 0x62, 0x00, + 0x00, 0x01, 0x30, 0xb3, 0xbf, 0xe7, 0x09, 0xb3, 0xbf, 0xe7, 0x09, 0x01, 0xbb, 0xdd, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x18, 0x12, 0x06, 0x10, 0x00, + 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x05, 0x64, 0xcd, 0xb9, 0xd8, 0x12, 0x52, 0x8e, 0x0d, 0x65, 0x00, 0x00, 0x01, 0x61, + 0x00, 0x00, 0x01, 0x30, 0xb3, 0xbf, 0xe7, 0x09, 0xb3, 0xbf, 0xe7, 0x09, 0x00, 0x50, 0x94, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xdf, 0x00, 0x00, 0x18, 0x14, 0x06, 0x10, + 0x28, 0x00, 0x40, 0x00, 0x01, 0x60, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } + buf = bytes.NewBuffer(data[:89]) // truncate: we don't want to test for everything + dec, err = DecodeMessage(buf, templates) + assert.Nil(t, err) + assert.NotNil(t, dec) + decNfv9 = dec.(NFv9Packet) + assert.Equal(t, + NFv9Packet{ + Version: 9, + Count: 21, + SystemUptime: 3015702147, + UnixSeconds: 1636475816, + SequenceNumber: 838987420, + SourceId: 256, + FlowSets: []interface{}{ + DataFlowSet{ + FlowSetHeader: FlowSetHeader{ + Id: 260, + Length: 1372, + }, + Records: []DataRecord{ + // Truncated! + { + Values: []DataField{ + { + PenProvided: false, + Type: 2, + Pen: 0, + Value: []uint8{0x00, 0x00, 0x00, 0x01}, + }, + { + PenProvided: false, + Type: 1, + Pen: 0, + Value: []uint8{0x00, 0x00, 0x05, 0xdc}, + }, + { + PenProvided: false, + Type: 8, + Pen: 0, + Value: []uint8{0xc6, 0x26, 0x78, 0xde}, + }, + { + PenProvided: false, + Type: 12, + Pen: 0, + Value: []uint8{0x58, 0x79, 0xd9, 0xd0}, + }, + { + PenProvided: false, + Type: 10, + Pen: 0, + Value: []uint8{0x00, 0x00, 0x01, 0x62}, + }, + { + PenProvided: false, + Type: 14, + Pen: 0, + Value: []uint8{0x00, 0x00, 0x01, 0x30}, + }, + { + PenProvided: false, + Type: 21, + Pen: 0, + Value: []uint8{0xb3, 0xbf, 0xe6, 0xf9}, + }, + { + PenProvided: false, + Type: 22, + Pen: 0, + Value: []uint8{0xb3, 0xbf, 0xe6, 0xf9}, + }, + { + PenProvided: false, + Type: 7, + Pen: 0, + Value: []uint8{0x01, 0xbb}, + }, + { + PenProvided: false, + Type: 11, + Pen: 0, + Value: []uint8{0x3b, 0x50}, + }, + { + PenProvided: false, + Type: 16, + Pen: 0, + Value: []uint8{0x00, 0x00, 0x00, 0x00}, + }, + { + PenProvided: false, + Type: 17, + Pen: 0, + Value: []uint8{0x00, 0x00, 0x00, 0x00}, + }, + { + PenProvided: false, + Type: 18, + Pen: 0, + Value: []uint8{0xfc, 0xdf, 0x00, 0x00}, + }, + { + PenProvided: false, + Type: 9, + Pen: 0, + Value: []uint8{0x18}, + }, + { + PenProvided: false, + Type: 13, + Pen: 0, + Value: []uint8{0x0e}, + }, + { + PenProvided: false, + Type: 4, + Pen: 0, + Value: []uint8{0x06}, + }, + { + PenProvided: false, + Type: 6, + Pen: 0, + Value: []uint8{0x10}, + }, + { + PenProvided: false, + Type: 5, + Pen: 0, + Value: []uint8{0x00}, + }, + { + PenProvided: false, + Type: 61, + Pen: 0, + Value: []uint8{0x00}, + }, + { + PenProvided: false, + Type: 89, + Pen: 0, + Value: []uint8{0x40}, + }, + { + PenProvided: false, + Type: 48, + Pen: 0, + Value: []uint8{0x00, 0x01}, + }, + { + PenProvided: false, + Type: 234, + Pen: 0, + Value: []uint8{0x60, 0x00, 0x00, 0x02}, + }, + { + PenProvided: false, + Type: 235, + Pen: 0, + Value: []uint8{0x60, 0x00, 0x00, 0x00}, + }, + }, + }, + }, + }, + }, + }, decNfv9) + assert.Equal(t, + `Flow Packet +------------ + Version: 9 + Count: 21 + SystemUptime: 3015702147 + UnixSeconds: 2021-11-09 16:36:56 +0000 UTC + SequenceNumber: 838987420 + SourceId: 256 + FlowSets (1): + - DataFlowSet 0: + Id 260 + Length: 1372 + Records (1 records): + - Record 0: + Values (23): + - 0. IN_PKTS (2): [0 0 0 1] + - 1. IN_BYTES (1): [0 0 5 220] + - 2. IPV4_SRC_ADDR (8): [198 38 120 222] + - 3. IPV4_DST_ADDR (12): [88 121 217 208] + - 4. INPUT_SNMP (10): [0 0 1 98] + - 5. OUTPUT_SNMP (14): [0 0 1 48] + - 6. LAST_SWITCHED (21): [179 191 230 249] + - 7. FIRST_SWITCHED (22): [179 191 230 249] + - 8. L4_SRC_PORT (7): [1 187] + - 9. L4_DST_PORT (11): [59 80] + - 10. SRC_AS (16): [0 0 0 0] + - 11. DST_AS (17): [0 0 0 0] + - 12. BGP_IPV4_NEXT_HOP (18): [252 223 0 0] + - 13. SRC_MASK (9): [24] + - 14. DST_MASK (13): [14] + - 15. PROTOCOL (4): [6] + - 16. TCP_FLAGS (6): [16] + - 17. SRC_TOS (5): [0] + - 18. DIRECTION (61): [0] + - 19. FORWARDING STATUS (89): [64] + - 20. FLOW_SAMPLER_ID (48): [0 1] + - 21. Unassigned (234): [96 0 0 2] + - 22. Unassigned (235): [96 0 0 0] +`, + decNfv9.String()) +} diff --git a/third_party/goflow2/decoders/netflow/nfv9.go b/third_party/goflow2/decoders/netflow/nfv9.go new file mode 100644 index 000000000000..64fe227d8801 --- /dev/null +++ b/third_party/goflow2/decoders/netflow/nfv9.go @@ -0,0 +1,317 @@ +package netflow + +import ( + "fmt" + "time" +) + +const ( + NFV9_FIELD_IN_BYTES = 1 + NFV9_FIELD_IN_PKTS = 2 + NFV9_FIELD_FLOWS = 3 + NFV9_FIELD_PROTOCOL = 4 + NFV9_FIELD_SRC_TOS = 5 + NFV9_FIELD_TCP_FLAGS = 6 + NFV9_FIELD_L4_SRC_PORT = 7 + NFV9_FIELD_IPV4_SRC_ADDR = 8 + NFV9_FIELD_SRC_MASK = 9 + NFV9_FIELD_INPUT_SNMP = 10 + NFV9_FIELD_L4_DST_PORT = 11 + NFV9_FIELD_IPV4_DST_ADDR = 12 + NFV9_FIELD_DST_MASK = 13 + NFV9_FIELD_OUTPUT_SNMP = 14 + NFV9_FIELD_IPV4_NEXT_HOP = 15 + NFV9_FIELD_SRC_AS = 16 + NFV9_FIELD_DST_AS = 17 + NFV9_FIELD_BGP_IPV4_NEXT_HOP = 18 + NFV9_FIELD_MUL_DST_PKTS = 19 + NFV9_FIELD_MUL_DST_BYTES = 20 + NFV9_FIELD_LAST_SWITCHED = 21 + NFV9_FIELD_FIRST_SWITCHED = 22 + NFV9_FIELD_OUT_BYTES = 23 + NFV9_FIELD_OUT_PKTS = 24 + NFV9_FIELD_MIN_PKT_LNGTH = 25 + NFV9_FIELD_MAX_PKT_LNGTH = 26 + NFV9_FIELD_IPV6_SRC_ADDR = 27 + NFV9_FIELD_IPV6_DST_ADDR = 28 + NFV9_FIELD_IPV6_SRC_MASK = 29 + NFV9_FIELD_IPV6_DST_MASK = 30 + NFV9_FIELD_IPV6_FLOW_LABEL = 31 + NFV9_FIELD_ICMP_TYPE = 32 + NFV9_FIELD_MUL_IGMP_TYPE = 33 + NFV9_FIELD_SAMPLING_INTERVAL = 34 + NFV9_FIELD_SAMPLING_ALGORITHM = 35 + NFV9_FIELD_FLOW_ACTIVE_TIMEOUT = 36 + NFV9_FIELD_FLOW_INACTIVE_TIMEOUT = 37 + NFV9_FIELD_ENGINE_TYPE = 38 + NFV9_FIELD_ENGINE_ID = 39 + NFV9_FIELD_TOTAL_BYTES_EXP = 40 + NFV9_FIELD_TOTAL_PKTS_EXP = 41 + NFV9_FIELD_TOTAL_FLOWS_EXP = 42 + NFV9_FIELD_IPV4_SRC_PREFIX = 44 + NFV9_FIELD_IPV4_DST_PREFIX = 45 + NFV9_FIELD_MPLS_TOP_LABEL_TYPE = 46 + NFV9_FIELD_MPLS_TOP_LABEL_IP_ADDR = 47 + NFV9_FIELD_FLOW_SAMPLER_ID = 48 + NFV9_FIELD_FLOW_SAMPLER_MODE = 49 + NFV9_FIELD_FLOW_SAMPLER_RANDOM_INTERVAL = 50 + NFV9_FIELD_MIN_TTL = 52 + NFV9_FIELD_MAX_TTL = 53 + NFV9_FIELD_IPV4_IDENT = 54 + NFV9_FIELD_DST_TOS = 55 + NFV9_FIELD_IN_SRC_MAC = 56 + NFV9_FIELD_OUT_DST_MAC = 57 + NFV9_FIELD_SRC_VLAN = 58 + NFV9_FIELD_DST_VLAN = 59 + NFV9_FIELD_IP_PROTOCOL_VERSION = 60 + NFV9_FIELD_DIRECTION = 61 + NFV9_FIELD_IPV6_NEXT_HOP = 62 + NFV9_FIELD_BGP_IPV6_NEXT_HOP = 63 + NFV9_FIELD_IPV6_OPTION_HEADERS = 64 + NFV9_FIELD_MPLS_LABEL_1 = 70 + NFV9_FIELD_MPLS_LABEL_2 = 71 + NFV9_FIELD_MPLS_LABEL_3 = 72 + NFV9_FIELD_MPLS_LABEL_4 = 73 + NFV9_FIELD_MPLS_LABEL_5 = 74 + NFV9_FIELD_MPLS_LABEL_6 = 75 + NFV9_FIELD_MPLS_LABEL_7 = 76 + NFV9_FIELD_MPLS_LABEL_8 = 77 + NFV9_FIELD_MPLS_LABEL_9 = 78 + NFV9_FIELD_MPLS_LABEL_10 = 79 + NFV9_FIELD_IN_DST_MAC = 80 + NFV9_FIELD_OUT_SRC_MAC = 81 + NFV9_FIELD_IF_NAME = 82 + NFV9_FIELD_IF_DESC = 83 + NFV9_FIELD_SAMPLER_NAME = 84 + NFV9_FIELD_IN_PERMANENT_BYTES = 85 + NFV9_FIELD_IN_PERMANENT_PKTS = 86 + NFV9_FIELD_FRAGMENT_OFFSET = 88 + NFV9_FIELD_FORWARDING_STATUS = 89 + NFV9_FIELD_MPLS_PAL_RD = 90 + NFV9_FIELD_MPLS_PREFIX_LEN = 91 + NFV9_FIELD_SRC_TRAFFIC_INDEX = 92 + NFV9_FIELD_DST_TRAFFIC_INDEX = 93 + NFV9_FIELD_APPLICATION_DESCRIPTION = 94 + NFV9_FIELD_APPLICATION_TAG = 95 + NFV9_FIELD_APPLICATION_NAME = 96 + NFV9_FIELD_postipDiffServCodePoint = 98 + NFV9_FIELD_replication_factor = 99 + NFV9_FIELD_layer2packetSectionOffset = 102 + NFV9_FIELD_layer2packetSectionSize = 103 + NFV9_FIELD_layer2packetSectionData = 104 +) + +type NFv9Packet struct { + Version uint16 + Count uint16 + SystemUptime uint32 + UnixSeconds uint32 + SequenceNumber uint32 + SourceId uint32 + FlowSets []interface{} +} + +type NFv9OptionsTemplateFlowSet struct { + FlowSetHeader + Records []NFv9OptionsTemplateRecord +} + +type NFv9OptionsTemplateRecord struct { + TemplateId uint16 + ScopeLength uint16 + OptionLength uint16 + Scopes []Field + Options []Field +} + +func NFv9TypeToString(typeId uint16) string { + + nameList := map[uint16]string{ + 1: "IN_BYTES", + 2: "IN_PKTS", + 3: "FLOWS", + 4: "PROTOCOL", + 5: "SRC_TOS", + 6: "TCP_FLAGS", + 7: "L4_SRC_PORT", + 8: "IPV4_SRC_ADDR", + 9: "SRC_MASK", + 10: "INPUT_SNMP", + 11: "L4_DST_PORT", + 12: "IPV4_DST_ADDR", + 13: "DST_MASK", + 14: "OUTPUT_SNMP", + 15: "IPV4_NEXT_HOP", + 16: "SRC_AS", + 17: "DST_AS", + 18: "BGP_IPV4_NEXT_HOP", + 19: "MUL_DST_PKTS", + 20: "MUL_DST_BYTES", + 21: "LAST_SWITCHED", + 22: "FIRST_SWITCHED", + 23: "OUT_BYTES", + 24: "OUT_PKTS", + 25: "MIN_PKT_LNGTH", + 26: "MAX_PKT_LNGTH", + 27: "IPV6_SRC_ADDR", + 28: "IPV6_DST_ADDR", + 29: "IPV6_SRC_MASK", + 30: "IPV6_DST_MASK", + 31: "IPV6_FLOW_LABEL", + 32: "ICMP_TYPE", + 33: "MUL_IGMP_TYPE", + 34: "SAMPLING_INTERVAL", + 35: "SAMPLING_ALGORITHM", + 36: "FLOW_ACTIVE_TIMEOUT", + 37: "FLOW_INACTIVE_TIMEOUT", + 38: "ENGINE_TYPE", + 39: "ENGINE_ID", + 40: "TOTAL_BYTES_EXP", + 41: "TOTAL_PKTS_EXP", + 42: "TOTAL_FLOWS_EXP", + 43: "*Vendor Proprietary*", + 44: "IPV4_SRC_PREFIX", + 45: "IPV4_DST_PREFIX", + 46: "MPLS_TOP_LABEL_TYPE", + 47: "MPLS_TOP_LABEL_IP_ADDR", + 48: "FLOW_SAMPLER_ID", + 49: "FLOW_SAMPLER_MODE", + 50: "FLOW_SAMPLER_RANDOM_INTERVAL", + 51: "*Vendor Proprietary*", + 52: "MIN_TTL", + 53: "MAX_TTL", + 54: "IPV4_IDENT", + 55: "DST_TOS", + 56: "IN_SRC_MAC", + 57: "OUT_DST_MAC", + 58: "SRC_VLAN", + 59: "DST_VLAN", + 60: "IP_PROTOCOL_VERSION", + 61: "DIRECTION", + 62: "IPV6_NEXT_HOP", + 63: "BPG_IPV6_NEXT_HOP", + 64: "IPV6_OPTION_HEADERS", + 65: "*Vendor Proprietary*", + 66: "*Vendor Proprietary*", + 67: "*Vendor Proprietary*", + 68: "*Vendor Proprietary*", + 69: "*Vendor Proprietary*", + 70: "MPLS_LABEL_1", + 71: "MPLS_LABEL_2", + 72: "MPLS_LABEL_3", + 73: "MPLS_LABEL_4", + 74: "MPLS_LABEL_5", + 75: "MPLS_LABEL_6", + 76: "MPLS_LABEL_7", + 77: "MPLS_LABEL_8", + 78: "MPLS_LABEL_9", + 79: "MPLS_LABEL_10", + 80: "IN_DST_MAC", + 81: "OUT_SRC_MAC", + 82: "IF_NAME", + 83: "IF_DESC", + 84: "SAMPLER_NAME", + 85: "IN_ PERMANENT _BYTES", + 86: "IN_ PERMANENT _PKTS", + 87: "*Vendor Proprietary*", + 88: "FRAGMENT_OFFSET", + 89: "FORWARDING STATUS", + 90: "MPLS PAL RD", + 91: "MPLS PREFIX LEN", + 92: "SRC TRAFFIC INDEX", + 93: "DST TRAFFIC INDEX", + 94: "APPLICATION DESCRIPTION", + 95: "APPLICATION TAG", + 96: "APPLICATION NAME", + 98: "postipDiffServCodePoint", + 99: "replication factor", + 100: "DEPRECATED", + 102: "layer2packetSectionOffset", + 103: "layer2packetSectionSize", + 104: "layer2packetSectionData", + 234: "ingressVRFID", + 235: "egressVRFID", + } + + if typeId > 104 || typeId == 0 { + return "Unassigned" + } else { + return nameList[typeId] + } +} + +func NFv9ScopeToString(scopeId uint16) string { + nameList := map[uint16]string{ + 1: "System", + 2: "Interface", + 3: "Line Card", + 4: "NetFlow Cache", + 5: "Template", + } + + if scopeId >= 1 && scopeId <= 5 { + return nameList[scopeId] + } else { + return "Unassigned" + } +} + +func (flowSet NFv9OptionsTemplateFlowSet) String(TypeToString func(uint16) string) string { + str := fmt.Sprintf(" Id %v\n", flowSet.Id) + str += fmt.Sprintf(" Length: %v\n", flowSet.Length) + str += fmt.Sprintf(" Records (%v records):\n", len(flowSet.Records)) + + for j, record := range flowSet.Records { + str += fmt.Sprintf(" - Record %v:\n", j) + str += fmt.Sprintf(" TemplateId: %v\n", record.TemplateId) + str += fmt.Sprintf(" ScopeLength: %v\n", record.ScopeLength) + str += fmt.Sprintf(" OptionLength: %v\n", record.OptionLength) + str += fmt.Sprintf(" Scopes (%v):\n", len(record.Scopes)) + + for k, field := range record.Scopes { + str += fmt.Sprintf(" - %v. %v (%v): %v\n", k, NFv9ScopeToString(field.Type), field.Type, field.Length) + } + + str += fmt.Sprintf(" Options (%v):\n", len(record.Options)) + + for k, field := range record.Options { + str += fmt.Sprintf(" - %v. %v (%v): %v\n", k, TypeToString(field.Type), field.Type, field.Length) + } + } + + return str +} + +func (p NFv9Packet) String() string { + str := "Flow Packet\n" + str += "------------\n" + str += fmt.Sprintf(" Version: %v\n", p.Version) + str += fmt.Sprintf(" Count: %v\n", p.Count) + + unixSeconds := time.Unix(int64(p.UnixSeconds), 0) + str += fmt.Sprintf(" SystemUptime: %v\n", p.SystemUptime) + str += fmt.Sprintf(" UnixSeconds: %v\n", unixSeconds.UTC().String()) + str += fmt.Sprintf(" SequenceNumber: %v\n", p.SequenceNumber) + str += fmt.Sprintf(" SourceId: %v\n", p.SourceId) + str += fmt.Sprintf(" FlowSets (%v):\n", len(p.FlowSets)) + + for i, flowSet := range p.FlowSets { + switch flowSet := flowSet.(type) { + case TemplateFlowSet: + str += fmt.Sprintf(" - TemplateFlowSet %v:\n", i) + str += flowSet.String(NFv9TypeToString) + case NFv9OptionsTemplateFlowSet: + str += fmt.Sprintf(" - OptionsTemplateFlowSet %v:\n", i) + str += flowSet.String(NFv9TypeToString) + case DataFlowSet: + str += fmt.Sprintf(" - DataFlowSet %v:\n", i) + str += flowSet.String(NFv9TypeToString) + case OptionsDataFlowSet: + str += fmt.Sprintf(" - OptionsDataFlowSet %v:\n", i) + str += flowSet.String(NFv9TypeToString, NFv9ScopeToString) + default: + str += fmt.Sprintf(" - (unknown type) %v: %v\n", i, flowSet) + } + } + return str +} diff --git a/third_party/goflow2/decoders/netflow/packet.go b/third_party/goflow2/decoders/netflow/packet.go new file mode 100644 index 000000000000..3e3707d641ec --- /dev/null +++ b/third_party/goflow2/decoders/netflow/packet.go @@ -0,0 +1,158 @@ +package netflow + +import ( + "fmt" +) + +// FlowSetHeader contains fields shared by all Flow Sets (DataFlowSet, +// TemplateFlowSet, OptionsTemplateFlowSet). +type FlowSetHeader struct { + // FlowSet ID: + // 0 for TemplateFlowSet + // 1 for OptionsTemplateFlowSet + // 256-65535 for DataFlowSet (used as TemplateId) + Id uint16 + + // The total length of this FlowSet in bytes (including padding). + Length uint16 +} + +// TemplateFlowSet is a collection of templates that describe structure of Data +// Records (actual NetFlow data). +type TemplateFlowSet struct { + FlowSetHeader + + // List of Template Records + Records []TemplateRecord +} + +// DataFlowSet is a collection of Data Records (actual NetFlow data) and Options +// Data Records (meta data). +type DataFlowSet struct { + FlowSetHeader + + Records []DataRecord +} + +type OptionsDataFlowSet struct { + FlowSetHeader + + Records []OptionsDataRecord +} + +// TemplateRecord is a single template that describes structure of a Flow Record +// (actual Netflow data). +type TemplateRecord struct { + // Each of the newly generated Template Records is given a unique + // Template ID. This uniqueness is local to the Observation Domain that + // generated the Template ID. Template IDs of Data FlowSets are numbered + // from 256 to 65535. + TemplateId uint16 + + // Number of fields in this Template Record. Because a Template FlowSet + // usually contains multiple Template Records, this field allows the + // Collector to determine the end of the current Template Record and + // the start of the next. + FieldCount uint16 + + // List of fields in this Template Record. + Fields []Field +} + +type DataRecord struct { + Values []DataField +} + +// OptionsDataRecord is meta data sent alongide actual NetFlow data. Combined +// with OptionsTemplateRecord it can be decoded to a single data row. +type OptionsDataRecord struct { + // List of Scope values stored in raw format as []byte + ScopesValues []DataField + + // List of Optons values stored in raw format as []byte + OptionsValues []DataField +} + +// Field describes type and length of a single value in a Flow Data Record. +// Field does not contain the record value itself it is just a description of +// what record value will look like. +type Field struct { + // A numeric value that represents the type of field. + PenProvided bool + Type uint16 + + // The length (in bytes) of the field. + Length uint16 + + Pen uint32 +} + +type DataField struct { + // A numeric value that represents the type of field. + PenProvided bool + Type uint16 + Pen uint32 + + // The value (in bytes) of the field. + Value interface{} + //Value []byte +} + +func (flowSet OptionsDataFlowSet) String(TypeToString func(uint16) string, ScopeToString func(uint16) string) string { + str := fmt.Sprintf(" Id %v\n", flowSet.Id) + str += fmt.Sprintf(" Length: %v\n", flowSet.Length) + str += fmt.Sprintf(" Records (%v records):\n", len(flowSet.Records)) + + for j, record := range flowSet.Records { + str += fmt.Sprintf(" - Record %v:\n", j) + str += fmt.Sprintf(" Scopes (%v):\n", len(record.ScopesValues)) + + for k, value := range record.ScopesValues { + str += fmt.Sprintf(" - %v. %v (%v): %v\n", k, ScopeToString(value.Type), value.Type, value.Value) + } + + str += fmt.Sprintf(" Options (%v):\n", len(record.OptionsValues)) + + for k, value := range record.OptionsValues { + str += fmt.Sprintf(" - %v. %v (%v): %v\n", k, TypeToString(value.Type), value.Type, value.Value) + } + } + + return str +} + +func (flowSet DataFlowSet) String(TypeToString func(uint16) string) string { + str := fmt.Sprintf(" Id %v\n", flowSet.Id) + str += fmt.Sprintf(" Length: %v\n", flowSet.Length) + str += fmt.Sprintf(" Records (%v records):\n", len(flowSet.Records)) + + for j, record := range flowSet.Records { + str += fmt.Sprintf(" - Record %v:\n", j) + str += fmt.Sprintf(" Values (%v):\n", len(record.Values)) + + for k, value := range record.Values { + str += fmt.Sprintf(" - %v. %v (%v): %v\n", k, TypeToString(value.Type), value.Type, value.Value) + } + } + + return str +} + +func (flowSet TemplateFlowSet) String(TypeToString func(uint16) string) string { + str := fmt.Sprintf(" Id %v\n", flowSet.Id) + str += fmt.Sprintf(" Length: %v\n", flowSet.Length) + str += fmt.Sprintf(" Records (%v records):\n", len(flowSet.Records)) + + for j, record := range flowSet.Records { + str += fmt.Sprintf(" - %v. Record:\n", j) + str += fmt.Sprintf(" TemplateId: %v\n", record.TemplateId) + str += fmt.Sprintf(" FieldCount: %v\n", record.FieldCount) + str += fmt.Sprintf(" Fields (%v):\n", len(record.Fields)) + + for k, field := range record.Fields { + str += fmt.Sprintf(" - %v. %v (%v/%v): %v\n", k, TypeToString(field.Type), field.Type, field.PenProvided, field.Length) + } + } + + return str +} diff --git a/third_party/goflow2/decoders/netflow/templates/file/file.go b/third_party/goflow2/decoders/netflow/templates/file/file.go new file mode 100644 index 000000000000..476babbe4109 --- /dev/null +++ b/third_party/goflow2/decoders/netflow/templates/file/file.go @@ -0,0 +1,204 @@ +package file + +import ( + "context" + "encoding/json" + "flag" + "fmt" + "github.com/netsampler/goflow2/decoders/netflow" + "github.com/netsampler/goflow2/decoders/netflow/templates" + "github.com/netsampler/goflow2/decoders/netflow/templates/memory" + "os" + "sync" +) + +type TemplateFileObject struct { + Key *templates.TemplateKey + Data *TemplateFileData +} + +type TemplateFileData struct { + Type string + Data interface{} +} + +func (d *TemplateFileData) UnmarshalJSON(b []byte) error { + var s struct { + Type string + Data interface{} `json:"-"` + } + if err := json.Unmarshal(b, &s); err != nil { + return err + } + + switch s.Type { + case "NFv9OptionsTemplateRecord": + newS := new(struct { + Type string + Data netflow.NFv9OptionsTemplateRecord + }) + if err := json.Unmarshal(b, newS); err != nil { + return err + } + d.Type = newS.Type + d.Data = newS.Data + case "TemplateRecord": + newS := new(struct { + Type string + Data netflow.TemplateRecord + }) + if err := json.Unmarshal(b, newS); err != nil { + return err + } + d.Type = newS.Type + d.Data = newS.Data + case "IPFIXOptionsTemplateRecord": + newS := new(struct { + Type string + Data netflow.IPFIXOptionsTemplateRecord + }) + if err := json.Unmarshal(b, newS); err != nil { + return err + } + d.Type = newS.Type + d.Data = newS.Data + } + + return nil +} + +type TemplateFile struct { + Templates []*TemplateFileObject `json:"templates"` +} + +func (f *TemplateFile) Add(key *templates.TemplateKey, data interface{}) { + var typeName string + + switch data.(type) { + case netflow.NFv9OptionsTemplateRecord: + typeName = "NFv9OptionsTemplateRecord" + case netflow.TemplateRecord: + typeName = "TemplateRecord" + case netflow.IPFIXOptionsTemplateRecord: + typeName = "IPFIXOptionsTemplateRecord" + default: + return + } + + f.Templates = append(f.Templates, &TemplateFileObject{ + Key: key, + Data: &TemplateFileData{ + Type: typeName, + Data: data, + }, + }) +} + +func NewTemplateFile() *TemplateFile { + return &TemplateFile{ + Templates: make([]*TemplateFileObject, 0), + } +} + +type FileDriver struct { + memDriver *memory.MemoryDriver + path string + lock *sync.Mutex +} + +func (d *FileDriver) Prepare() error { + d.memDriver = memory.Driver + d.lock = &sync.Mutex{} + flag.StringVar(&d.path, "netflow.templates.file.path", "./templates.json", "Path of file to store templates") + return nil +} + +func (d *FileDriver) Init(ctx context.Context) error { + var err error + if err = d.memDriver.Init(ctx); err != nil { + return err + } + + f, err := os.OpenFile(d.path, os.O_RDWR|os.O_CREATE, 0755) + if err != nil { + return err + } + defer f.Close() + dec := json.NewDecoder(f) + tf := NewTemplateFile() + if err = dec.Decode(tf); err != nil { + // log error + } + for _, template := range tf.Templates { + if err := d.memDriver.AddTemplate(ctx, template.Key, template.Data.Data); err != nil { + // log error + continue + } + } + + return nil +} + +func (d *FileDriver) Close(ctx context.Context) error { + if err := d.memDriver.Close(ctx); err != nil { + return err + } + return nil +} + +func (d *FileDriver) ListTemplates(ctx context.Context, ch chan *templates.TemplateKey) error { + return d.memDriver.ListTemplates(ctx, ch) +} + +func (d *FileDriver) AddTemplate(ctx context.Context, key *templates.TemplateKey, template interface{}) error { + d.lock.Lock() + defer d.lock.Unlock() + if err := d.memDriver.AddTemplate(ctx, key, template); err != nil { + return err + } + + tf := NewTemplateFile() + + ch := make(chan *templates.TemplateKey, 5) + go func() { + if err := d.memDriver.ListTemplates(ctx, ch); err != nil { + // log error + close(ch) + } + }() + for key := range ch { + if key == nil { + break + } + if template, err := d.memDriver.GetTemplate(ctx, key); err != nil { + // log error + continue + } else { + tf.Add(key, template) + } + + } + + tmpPath := fmt.Sprintf("%s-tmp", d.path) + f, err := os.OpenFile(tmpPath, os.O_RDWR|os.O_CREATE, 0755) + if err != nil { + return err + } + + enc := json.NewEncoder(f) + if err := enc.Encode(tf); err != nil { + f.Close() + return err + } + + return os.Rename(tmpPath, d.path) +} + +func (d *FileDriver) GetTemplate(ctx context.Context, key *templates.TemplateKey) (interface{}, error) { + return d.memDriver.GetTemplate(ctx, key) +} + +func init() { + d := &FileDriver{} + templates.RegisterTemplateDriver("file", d) +} diff --git a/third_party/goflow2/decoders/netflow/templates/memory/memory.go b/third_party/goflow2/decoders/netflow/templates/memory/memory.go new file mode 100644 index 000000000000..0f16b241e1d4 --- /dev/null +++ b/third_party/goflow2/decoders/netflow/templates/memory/memory.go @@ -0,0 +1,73 @@ +package memory + +import ( + "context" + "github.com/netsampler/goflow2/decoders/netflow/templates" + "sync" +) + +var ( + Driver = &MemoryDriver{} +) + +type templateData struct { + key *templates.TemplateKey + data interface{} +} + +type MemoryDriver struct { + lock *sync.RWMutex + templates map[string]templateData +} + +func (d *MemoryDriver) Prepare() error { + // could have an expiry + return nil +} + +func (d *MemoryDriver) Init(context.Context) error { + d.lock = &sync.RWMutex{} + d.templates = make(map[string]templateData) + return nil +} + +func (d *MemoryDriver) Close(context.Context) error { + return nil +} + +func (d *MemoryDriver) ListTemplates(ctx context.Context, ch chan *templates.TemplateKey) error { + d.lock.RLock() + defer d.lock.RUnlock() + for _, v := range d.templates { + select { + case ch <- v.key: + case <-ctx.Done(): + return ctx.Err() + } + } + select { + case ch <- nil: + } + return nil +} + +func (d *MemoryDriver) AddTemplate(ctx context.Context, key *templates.TemplateKey, template interface{}) error { + d.lock.Lock() + defer d.lock.Unlock() + + d.templates[key.String()] = templateData{ + key: key, + data: template, + } + return nil +} + +func (d *MemoryDriver) GetTemplate(ctx context.Context, key *templates.TemplateKey) (interface{}, error) { + d.lock.RLock() + defer d.lock.RUnlock() + return d.templates[key.String()].data, nil +} + +func init() { + templates.RegisterTemplateDriver("memory", Driver) +} diff --git a/third_party/goflow2/decoders/netflow/templates/templates.go b/third_party/goflow2/decoders/netflow/templates/templates.go new file mode 100644 index 000000000000..525e6b10e1d3 --- /dev/null +++ b/third_party/goflow2/decoders/netflow/templates/templates.go @@ -0,0 +1,139 @@ +package templates + +import ( + "context" + "fmt" + "strconv" + "strings" + "sync" +) + +var ( + templateDrivers = make(map[string]TemplateDriver) // might be better to change into "factory" + lock = &sync.RWMutex{} +) + +type TemplateDriver interface { + TemplateInterface + + Prepare() error // Prepare driver (eg: flag registration) + Init(context.Context) error // Initialize driver (eg: parse keying) + Close(context.Context) error // Close drive (eg: close file) +} + +type TemplateKey struct { + TemplateKey string + Version uint16 + ObsDomainId uint32 + TemplateId uint16 +} + +func NewTemplateKey(templateKey string, version uint16, obsDomainId uint32, templateId uint16) *TemplateKey { + return &TemplateKey{ + TemplateKey: templateKey, + Version: version, + ObsDomainId: obsDomainId, + TemplateId: templateId, + } +} + +func (k *TemplateKey) String() string { + return fmt.Sprintf("%s-%d-%d-%d", k.TemplateKey, k.Version, k.ObsDomainId, k.TemplateId) +} + +func ParseTemplateKey(key string, k *TemplateKey) error { + if k != nil { + return nil + } + var version uint16 + var obsDomainId uint32 + var templateId uint16 + + keySplit := strings.Split(key, "-") + if len(keySplit) != 4 { + return fmt.Errorf("template key format is invalid") + } + templateKey := keySplit[0] + if val, err := strconv.ParseUint(keySplit[1], 10, 64); err != nil { + return fmt.Errorf("template key version is invalid") + } else { + version = uint16(val) + } + if val, err := strconv.ParseUint(keySplit[2], 10, 64); err != nil { + fmt.Errorf("template key observation domain I Dis invalid") + } else { + obsDomainId = uint32(val) + } + if val, err := strconv.ParseUint(keySplit[3], 10, 64); err != nil { + fmt.Errorf("template key template ID is invalid") + } else { + templateId = uint16(val) + } + + k.TemplateKey = templateKey + k.Version = version + k.ObsDomainId = obsDomainId + k.TemplateId = templateId + + return nil +} + +type TemplateInterface interface { + ListTemplates(ctx context.Context, ch chan *TemplateKey) error + GetTemplate(ctx context.Context, key *TemplateKey) (interface{}, error) + AddTemplate(ctx context.Context, key *TemplateKey, template interface{}) error // add expiration +} + +type TemplateSystem struct { + driver TemplateDriver +} + +func (t *TemplateSystem) ListTemplates(ctx context.Context, ch chan *TemplateKey) error { + return t.driver.ListTemplates(ctx, ch) +} + +func (t *TemplateSystem) AddTemplate(ctx context.Context, key *TemplateKey, template interface{}) error { + return t.driver.AddTemplate(ctx, key, template) +} + +func (t *TemplateSystem) GetTemplate(ctx context.Context, key *TemplateKey) (interface{}, error) { + return t.driver.GetTemplate(ctx, key) +} + +func (t *TemplateSystem) Close(ctx context.Context) error { + return t.driver.Close(ctx) +} + +func RegisterTemplateDriver(name string, t TemplateDriver) { + lock.Lock() + templateDrivers[name] = t + lock.Unlock() + + if err := t.Prepare(); err != nil { + panic(err) + } +} + +func FindTemplateSystem(ctx context.Context, name string) (*TemplateSystem, error) { + lock.RLock() + t, ok := templateDrivers[name] + lock.RUnlock() + if !ok { + return nil, fmt.Errorf("Template %s not found", name) + } + + err := t.Init(ctx) + return &TemplateSystem{t}, err +} + +func GetTemplates() []string { + lock.RLock() + defer lock.RUnlock() + t := make([]string, len(templateDrivers)) + var i int + for k, _ := range templateDrivers { + t[i] = k + i++ + } + return t +} diff --git a/third_party/goflow2/decoders/netflowlegacy/netflow.go b/third_party/goflow2/decoders/netflowlegacy/netflow.go new file mode 100644 index 000000000000..c73a54e47cf4 --- /dev/null +++ b/third_party/goflow2/decoders/netflowlegacy/netflow.go @@ -0,0 +1,59 @@ +package netflowlegacy + +import ( + "bytes" + "fmt" + + "github.com/netsampler/goflow2/decoders/utils" +) + +type ErrorVersion struct { + version uint16 +} + +func NewErrorVersion(version uint16) *ErrorVersion { + return &ErrorVersion{ + version: version, + } +} + +func (e *ErrorVersion) Error() string { + return fmt.Sprintf("Unknown NetFlow version %v (only decodes v5)", e.version) +} + +func DecodeMessage(payload *bytes.Buffer) (interface{}, error) { + var version uint16 + err := utils.BinaryDecoder(payload, &version) + if err != nil { + return nil, err + } + packet := PacketNetFlowV5{} + if version == 5 { + packet.Version = version + + utils.BinaryDecoder(payload, + &(packet.Count), + &(packet.SysUptime), + &(packet.UnixSecs), + &(packet.UnixNSecs), + &(packet.FlowSequence), + &(packet.EngineType), + &(packet.EngineId), + &(packet.SamplingInterval), + ) + + packet.Records = make([]RecordsNetFlowV5, int(packet.Count)) + for i := 0; i < int(packet.Count) && payload.Len() >= 48; i++ { + record := RecordsNetFlowV5{} + err := utils.BinaryDecoder(payload, &record) + if err != nil { + return packet, err + } + packet.Records[i] = record + } + + return packet, nil + } else { + return nil, NewErrorVersion(version) + } +} diff --git a/third_party/goflow2/decoders/netflowlegacy/netflow_test.go b/third_party/goflow2/decoders/netflowlegacy/netflow_test.go new file mode 100644 index 000000000000..076db5d074e4 --- /dev/null +++ b/third_party/goflow2/decoders/netflowlegacy/netflow_test.go @@ -0,0 +1,41 @@ +package netflowlegacy + +import ( + "bytes" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestDecodeNetFlowV5(t *testing.T) { + data := []byte{ + 0x00, 0x05, 0x00, 0x06, 0x00, 0x82, 0xc3, 0x48, 0x5b, 0xcd, 0xba, 0x1b, 0x05, 0x97, 0x6d, 0xc7, + 0x00, 0x00, 0x64, 0x3d, 0x08, 0x08, 0x00, 0x00, 0x0a, 0x80, 0x02, 0x79, 0x0a, 0x80, 0x02, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x02, 0x4e, + 0x00, 0x82, 0x9b, 0x8c, 0x00, 0x82, 0x9b, 0x90, 0x1f, 0x90, 0xb9, 0x18, 0x00, 0x1b, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x02, 0x77, 0x0a, 0x81, 0x02, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x94, + 0x00, 0x82, 0x95, 0xa9, 0x00, 0x82, 0x9a, 0xfb, 0x1f, 0x90, 0xc1, 0x2c, 0x00, 0x12, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x81, 0x02, 0x01, 0x0a, 0x80, 0x02, 0x77, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc2, + 0x00, 0x82, 0x95, 0xa9, 0x00, 0x82, 0x9a, 0xfc, 0xc1, 0x2c, 0x1f, 0x90, 0x00, 0x16, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x02, 0x01, 0x0a, 0x80, 0x02, 0x79, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0xf1, + 0x00, 0x82, 0x9b, 0x8c, 0x00, 0x82, 0x9b, 0x8f, 0xb9, 0x18, 0x1f, 0x90, 0x00, 0x1b, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x02, 0x01, 0x0a, 0x80, 0x02, 0x79, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x02, 0x2e, + 0x00, 0x82, 0x9b, 0x90, 0x00, 0x82, 0x9b, 0x9d, 0xb9, 0x1a, 0x1f, 0x90, 0x00, 0x1b, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x02, 0x79, 0x0a, 0x80, 0x02, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0b, 0xac, + 0x00, 0x82, 0x9b, 0x90, 0x00, 0x82, 0x9b, 0x9d, 0x1f, 0x90, 0xb9, 0x1a, 0x00, 0x1b, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } + buf := bytes.NewBuffer(data) + + dec, err := DecodeMessage(buf) + assert.Nil(t, err) + assert.NotNil(t, dec) + decNfv5 := dec.(PacketNetFlowV5) + assert.Equal(t, uint16(5), decNfv5.Version) + assert.Equal(t, uint16(9), decNfv5.Records[0].Input) +} diff --git a/third_party/goflow2/decoders/netflowlegacy/packet.go b/third_party/goflow2/decoders/netflowlegacy/packet.go new file mode 100644 index 000000000000..078bba4dff7e --- /dev/null +++ b/third_party/goflow2/decoders/netflowlegacy/packet.go @@ -0,0 +1,96 @@ +package netflowlegacy + +import ( + "encoding/binary" + "fmt" + "net" + "time" +) + +type PacketNetFlowV5 struct { + Version uint16 + Count uint16 + SysUptime uint32 + UnixSecs uint32 + UnixNSecs uint32 + FlowSequence uint32 + EngineType uint8 + EngineId uint8 + SamplingInterval uint16 + Records []RecordsNetFlowV5 +} + +type RecordsNetFlowV5 struct { + SrcAddr uint32 + DstAddr uint32 + NextHop uint32 + Input uint16 + Output uint16 + DPkts uint32 + DOctets uint32 + First uint32 + Last uint32 + SrcPort uint16 + DstPort uint16 + Pad1 byte + TCPFlags uint8 + Proto uint8 + Tos uint8 + SrcAS uint16 + DstAS uint16 + SrcMask uint8 + DstMask uint8 + Pad2 uint16 +} + +func (p PacketNetFlowV5) String() string { + str := "NetFlow v5 Packet\n" + str += "-----------------\n" + str += fmt.Sprintf(" Version: %v\n", p.Version) + str += fmt.Sprintf(" Count: %v\n", p.Count) + + unixSeconds := time.Unix(int64(p.UnixSecs), int64(p.UnixNSecs)) + str += fmt.Sprintf(" SystemUptime: %v\n", time.Duration(p.SysUptime)*time.Millisecond) + str += fmt.Sprintf(" UnixSeconds: %v\n", unixSeconds.String()) + str += fmt.Sprintf(" FlowSequence: %v\n", p.FlowSequence) + str += fmt.Sprintf(" EngineType: %v\n", p.EngineType) + str += fmt.Sprintf(" EngineId: %v\n", p.EngineId) + str += fmt.Sprintf(" SamplingInterval: %v\n", p.SamplingInterval) + str += fmt.Sprintf(" Records (%v):\n", len(p.Records)) + + for i, record := range p.Records { + str += fmt.Sprintf(" Record %v:\n", i) + str += record.String() + } + return str +} + +func (r RecordsNetFlowV5) String() string { + srcaddr := make(net.IP, 4) + binary.BigEndian.PutUint32(srcaddr, r.SrcAddr) + dstaddr := make(net.IP, 4) + binary.BigEndian.PutUint32(dstaddr, r.DstAddr) + nexthop := make(net.IP, 4) + binary.BigEndian.PutUint32(nexthop, r.NextHop) + + str := fmt.Sprintf(" SrcAddr: %v\n", srcaddr.String()) + str += fmt.Sprintf(" DstAddr: %v\n", dstaddr.String()) + str += fmt.Sprintf(" NextHop: %v\n", nexthop.String()) + str += fmt.Sprintf(" Input: %v\n", r.Input) + str += fmt.Sprintf(" Output: %v\n", r.Output) + str += fmt.Sprintf(" DPkts: %v\n", r.DPkts) + str += fmt.Sprintf(" DOctets: %v\n", r.DOctets) + str += fmt.Sprintf(" First: %v\n", time.Duration(r.First)*time.Millisecond) + str += fmt.Sprintf(" Last: %v\n", time.Duration(r.Last)*time.Millisecond) + str += fmt.Sprintf(" SrcPort: %v\n", r.SrcPort) + str += fmt.Sprintf(" DstPort: %v\n", r.DstPort) + str += fmt.Sprintf(" TCPFlags: %v\n", r.TCPFlags) + str += fmt.Sprintf(" Proto: %v\n", r.Proto) + str += fmt.Sprintf(" Tos: %v\n", r.Tos) + str += fmt.Sprintf(" SrcAS: %v\n", r.SrcAS) + str += fmt.Sprintf(" DstAS: %v\n", r.DstAS) + str += fmt.Sprintf(" SrcMask: %v\n", r.SrcMask) + str += fmt.Sprintf(" DstMask: %v\n", r.DstMask) + + return str +} diff --git a/third_party/goflow2/decoders/sflow/datastructure.go b/third_party/goflow2/decoders/sflow/datastructure.go new file mode 100644 index 000000000000..670652a2cfd5 --- /dev/null +++ b/third_party/goflow2/decoders/sflow/datastructure.go @@ -0,0 +1,103 @@ +package sflow + +type SampledHeader struct { + Protocol uint32 + FrameLength uint32 + Stripped uint32 + OriginalLength uint32 + HeaderData []byte +} + +type SampledEthernet struct { + Length uint32 + SrcMac []byte + DstMac []byte + EthType uint32 +} + +type SampledIP_Base struct { + Length uint32 + Protocol uint32 + SrcIP []byte + DstIP []byte + SrcPort uint32 + DstPort uint32 + TcpFlags uint32 +} + +type SampledIPv4 struct { + Base SampledIP_Base + Tos uint32 +} + +type SampledIPv6 struct { + Base SampledIP_Base + Priority uint32 +} + +type ExtendedSwitch struct { + SrcVlan uint32 + SrcPriority uint32 + DstVlan uint32 + DstPriority uint32 +} + +type ExtendedRouter struct { + NextHopIPVersion uint32 + NextHop []byte + SrcMaskLen uint32 + DstMaskLen uint32 +} + +type ExtendedGateway struct { + NextHopIPVersion uint32 + NextHop []byte + AS uint32 + SrcAS uint32 + SrcPeerAS uint32 + ASDestinations uint32 + ASPathType uint32 + ASPathLength uint32 + ASPath []uint32 + CommunitiesLength uint32 + Communities []uint32 + LocalPref uint32 +} + +type IfCounters struct { + IfIndex uint32 + IfType uint32 + IfSpeed uint64 + IfDirection uint32 + IfStatus uint32 + IfInOctets uint64 + IfInUcastPkts uint32 + IfInMulticastPkts uint32 + IfInBroadcastPkts uint32 + IfInDiscards uint32 + IfInErrors uint32 + IfInUnknownProtos uint32 + IfOutOctets uint64 + IfOutUcastPkts uint32 + IfOutMulticastPkts uint32 + IfOutBroadcastPkts uint32 + IfOutDiscards uint32 + IfOutErrors uint32 + IfPromiscuousMode uint32 +} + +type EthernetCounters struct { + Dot3StatsAlignmentErrors uint32 + Dot3StatsFCSErrors uint32 + Dot3StatsSingleCollisionFrames uint32 + Dot3StatsMultipleCollisionFrames uint32 + Dot3StatsSQETestErrors uint32 + Dot3StatsDeferredTransmissions uint32 + Dot3StatsLateCollisions uint32 + Dot3StatsExcessiveCollisions uint32 + Dot3StatsInternalMacTransmitErrors uint32 + Dot3StatsCarrierSenseErrors uint32 + Dot3StatsFrameTooLongs uint32 + Dot3StatsInternalMacReceiveErrors uint32 + Dot3StatsSymbolErrors uint32 +} diff --git a/third_party/goflow2/decoders/sflow/packet.go b/third_party/goflow2/decoders/sflow/packet.go new file mode 100644 index 000000000000..647f83db39c6 --- /dev/null +++ b/third_party/goflow2/decoders/sflow/packet.go @@ -0,0 +1,73 @@ +package sflow + +type Packet struct { + Version uint32 + IPVersion uint32 + AgentIP []byte + SubAgentId uint32 + SequenceNumber uint32 + Uptime uint32 + SamplesCount uint32 + Samples []interface{} +} + +type SampleHeader struct { + Format uint32 + Length uint32 + + SampleSequenceNumber uint32 + SourceIdType uint32 + SourceIdValue uint32 +} + +type FlowSample struct { + Header SampleHeader + + SamplingRate uint32 + SamplePool uint32 + Drops uint32 + Input uint32 + Output uint32 + FlowRecordsCount uint32 + Records []FlowRecord +} + +type CounterSample struct { + Header SampleHeader + + CounterRecordsCount uint32 + Records []CounterRecord +} + +type ExpandedFlowSample struct { + Header SampleHeader + + SamplingRate uint32 + SamplePool uint32 + Drops uint32 + InputIfFormat uint32 + InputIfValue uint32 + OutputIfFormat uint32 + OutputIfValue uint32 + FlowRecordsCount uint32 + Records []FlowRecord +} + +type RecordHeader struct { + DataFormat uint32 + Length uint32 +} + +type FlowRecord struct { + Header RecordHeader + Data interface{} +} + +type FlowRecordRaw struct { + Data []byte +} + +type CounterRecord struct { + Header RecordHeader + Data interface{} +} diff --git a/third_party/goflow2/decoders/sflow/sflow.go b/third_party/goflow2/decoders/sflow/sflow.go new file mode 100644 index 000000000000..4251443851f6 --- /dev/null +++ b/third_party/goflow2/decoders/sflow/sflow.go @@ -0,0 +1,417 @@ +package sflow + +import ( + "bytes" + "errors" + "fmt" + + "github.com/netsampler/goflow2/decoders/utils" +) + +const ( + FORMAT_EXT_SWITCH = 1001 + FORMAT_EXT_ROUTER = 1002 + FORMAT_EXT_GATEWAY = 1003 + FORMAT_RAW_PKT = 1 + FORMAT_ETH = 2 + FORMAT_IPV4 = 3 + FORMAT_IPV6 = 4 +) + +type ErrorDecodingSFlow struct { + msg string +} + +func NewErrorDecodingSFlow(msg string) *ErrorDecodingSFlow { + return &ErrorDecodingSFlow{ + msg: msg, + } +} + +func (e *ErrorDecodingSFlow) Error() string { + return fmt.Sprintf("Error decoding sFlow: %v", e.msg) +} + +type ErrorDataFormat struct { + dataformat uint32 +} + +func NewErrorDataFormat(dataformat uint32) *ErrorDataFormat { + return &ErrorDataFormat{ + dataformat: dataformat, + } +} + +func (e *ErrorDataFormat) Error() string { + return fmt.Sprintf("Unknown data format %v", e.dataformat) +} + +type ErrorIPVersion struct { + version uint32 +} + +func NewErrorIPVersion(version uint32) *ErrorIPVersion { + return &ErrorIPVersion{ + version: version, + } +} + +func (e *ErrorIPVersion) Error() string { + return fmt.Sprintf("Unknown IP version: %v", e.version) +} + +type ErrorVersion struct { + version uint32 +} + +func NewErrorVersion(version uint32) *ErrorVersion { + return &ErrorVersion{ + version: version, + } +} + +func (e *ErrorVersion) Error() string { + return fmt.Sprintf("Unknown sFlow version %v (supported v5)", e.version) +} + +func DecodeCounterRecord(header *RecordHeader, payload *bytes.Buffer) (CounterRecord, error) { + counterRecord := CounterRecord{ + Header: *header, + } + switch (*header).DataFormat { + case 1: + ifCounters := IfCounters{} + err := utils.BinaryDecoder(payload, &ifCounters) + if err != nil { + return counterRecord, err + } + counterRecord.Data = ifCounters + case 2: + ethernetCounters := EthernetCounters{} + err := utils.BinaryDecoder(payload, ðernetCounters) + if err != nil { + return counterRecord, err + } + counterRecord.Data = ethernetCounters + default: + counterRecord.Data = &FlowRecordRaw{ + Data: payload.Next(int(header.Length)), + } + } + + return counterRecord, nil +} + +func DecodeIP(payload *bytes.Buffer) (uint32, []byte, error) { + var ipVersion uint32 + err := utils.BinaryDecoder(payload, &ipVersion) + if err != nil { + return 0, nil, err + } + var ip []byte + if ipVersion == 1 { + ip = make([]byte, 4) + } else if ipVersion == 2 { + ip = make([]byte, 16) + } else { + return ipVersion, ip, NewErrorIPVersion(ipVersion) + } + if payload.Len() >= len(ip) { + err := utils.BinaryDecoder(payload, &ip) + if err != nil { + return 0, nil, err + } + } else { + return ipVersion, ip, NewErrorDecodingSFlow(fmt.Sprintf("Not enough data: %v, needs %v.", payload.Len(), len(ip))) + } + return ipVersion, ip, nil +} + +func DecodeFlowRecord(header *RecordHeader, payload *bytes.Buffer) (FlowRecord, error) { + flowRecord := FlowRecord{ + Header: *header, + } + switch (*header).DataFormat { + case FORMAT_EXT_SWITCH: + extendedSwitch := ExtendedSwitch{} + err := utils.BinaryDecoder(payload, &extendedSwitch) + if err != nil { + return flowRecord, err + } + flowRecord.Data = extendedSwitch + case FORMAT_RAW_PKT: + sampledHeader := SampledHeader{} + err := utils.BinaryDecoder(payload, &(sampledHeader.Protocol), &(sampledHeader.FrameLength), &(sampledHeader.Stripped), &(sampledHeader.OriginalLength)) + if err != nil { + return flowRecord, err + } + sampledHeader.HeaderData = payload.Bytes() + flowRecord.Data = sampledHeader + case FORMAT_IPV4: + sampledIPBase := SampledIP_Base{ + SrcIP: make([]byte, 4), + DstIP: make([]byte, 4), + } + err := utils.BinaryDecoder(payload, &sampledIPBase) + if err != nil { + return flowRecord, err + } + sampledIPv4 := SampledIPv4{ + Base: sampledIPBase, + } + err = utils.BinaryDecoder(payload, &(sampledIPv4.Tos)) + if err != nil { + return flowRecord, err + } + flowRecord.Data = sampledIPv4 + case FORMAT_IPV6: + sampledIPBase := SampledIP_Base{ + SrcIP: make([]byte, 16), + DstIP: make([]byte, 16), + } + err := utils.BinaryDecoder(payload, &sampledIPBase) + if err != nil { + return flowRecord, err + } + sampledIPv6 := SampledIPv6{ + Base: sampledIPBase, + } + err = utils.BinaryDecoder(payload, &(sampledIPv6.Priority)) + if err != nil { + return flowRecord, err + } + flowRecord.Data = sampledIPv6 + case FORMAT_EXT_ROUTER: + extendedRouter := ExtendedRouter{} + + ipVersion, ip, err := DecodeIP(payload) + if err != nil { + return flowRecord, err + } + extendedRouter.NextHopIPVersion = ipVersion + extendedRouter.NextHop = ip + err = utils.BinaryDecoder(payload, &(extendedRouter.SrcMaskLen), &(extendedRouter.DstMaskLen)) + if err != nil { + return flowRecord, err + } + flowRecord.Data = extendedRouter + case FORMAT_EXT_GATEWAY: + extendedGateway := ExtendedGateway{} + ipVersion, ip, err := DecodeIP(payload) + if err != nil { + return flowRecord, err + } + extendedGateway.NextHopIPVersion = ipVersion + extendedGateway.NextHop = ip + err = utils.BinaryDecoder(payload, &(extendedGateway.AS), &(extendedGateway.SrcAS), &(extendedGateway.SrcPeerAS), + &(extendedGateway.ASDestinations)) + if err != nil { + return flowRecord, err + } + var asPath []uint32 + if extendedGateway.ASDestinations != 0 { + err := utils.BinaryDecoder(payload, &(extendedGateway.ASPathType), &(extendedGateway.ASPathLength)) + if err != nil { + return flowRecord, err + } + if int(extendedGateway.ASPathLength) > payload.Len()-4 { + return flowRecord, errors.New(fmt.Sprintf("Invalid AS path length: %v.", extendedGateway.ASPathLength)) + } + asPath = make([]uint32, extendedGateway.ASPathLength) + if len(asPath) > 0 { + err = utils.BinaryDecoder(payload, asPath) + if err != nil { + return flowRecord, err + } + } + } + extendedGateway.ASPath = asPath + + err = utils.BinaryDecoder(payload, &(extendedGateway.CommunitiesLength)) + if err != nil { + return flowRecord, err + } + if int(extendedGateway.CommunitiesLength) > payload.Len()-4 { + return flowRecord, errors.New(fmt.Sprintf("Invalid Communities length: %v.", extendedGateway.ASPathLength)) + } + communities := make([]uint32, extendedGateway.CommunitiesLength) + if len(communities) > 0 { + err = utils.BinaryDecoder(payload, communities) + if err != nil { + return flowRecord, err + } + } + err = utils.BinaryDecoder(payload, &(extendedGateway.LocalPref)) + if err != nil { + return flowRecord, err + } + extendedGateway.Communities = communities + + flowRecord.Data = extendedGateway + default: + //return flowRecord, errors.New(fmt.Sprintf("Unknown data format %v.", (*header).DataFormat)) + flowRecord.Data = &FlowRecordRaw{ + Data: payload.Next(int(header.Length)), + } + } + return flowRecord, nil +} + +func DecodeSample(header *SampleHeader, payload *bytes.Buffer) (interface{}, error) { + format := (*header).Format + var sample interface{} + + err := utils.BinaryDecoder(payload, &((*header).SampleSequenceNumber)) + if err != nil { + return sample, err + } + if format == FORMAT_RAW_PKT || format == FORMAT_ETH { + var sourceId uint32 + err = utils.BinaryDecoder(payload, &sourceId) + if err != nil { + return sample, err + } + + (*header).SourceIdType = sourceId >> 24 + (*header).SourceIdValue = sourceId & 0x00ffffff + } else if format == FORMAT_IPV4 || format == FORMAT_IPV6 { + err = utils.BinaryDecoder(payload, &((*header).SourceIdType), &((*header).SourceIdValue)) + if err != nil { + return sample, err + } + } else { + return nil, NewErrorDataFormat(format) + } + + var recordsCount uint32 + var flowSample FlowSample + var counterSample CounterSample + var expandedFlowSample ExpandedFlowSample + if format == FORMAT_RAW_PKT { + flowSample = FlowSample{ + Header: *header, + } + err = utils.BinaryDecoder(payload, &(flowSample.SamplingRate), &(flowSample.SamplePool), + &(flowSample.Drops), &(flowSample.Input), &(flowSample.Output), &(flowSample.FlowRecordsCount)) + if err != nil { + return sample, err + } + recordsCount = flowSample.FlowRecordsCount + flowSample.Records = make([]FlowRecord, recordsCount) + sample = flowSample + } else if format == FORMAT_ETH || format == FORMAT_IPV6 { + err = utils.BinaryDecoder(payload, &recordsCount) + if err != nil { + return sample, err + } + counterSample = CounterSample{ + Header: *header, + CounterRecordsCount: recordsCount, + } + counterSample.Records = make([]CounterRecord, recordsCount) + sample = counterSample + } else if format == FORMAT_IPV4 { + expandedFlowSample = ExpandedFlowSample{ + Header: *header, + } + err = utils.BinaryDecoder(payload, &(expandedFlowSample.SamplingRate), &(expandedFlowSample.SamplePool), + &(expandedFlowSample.Drops), &(expandedFlowSample.InputIfFormat), &(expandedFlowSample.InputIfValue), + &(expandedFlowSample.OutputIfFormat), &(expandedFlowSample.OutputIfValue), &(expandedFlowSample.FlowRecordsCount)) + if err != nil { + return sample, err + } + recordsCount = expandedFlowSample.FlowRecordsCount + expandedFlowSample.Records = make([]FlowRecord, recordsCount) + sample = expandedFlowSample + } + for i := 0; i < int(recordsCount) && payload.Len() >= 8; i++ { + recordHeader := RecordHeader{} + err = utils.BinaryDecoder(payload, &(recordHeader.DataFormat), &(recordHeader.Length)) + if err != nil { + return sample, err + } + if int(recordHeader.Length) > payload.Len() { + break + } + recordReader := bytes.NewBuffer(payload.Next(int(recordHeader.Length))) + if format == FORMAT_RAW_PKT || format == FORMAT_IPV4 { + record, err := DecodeFlowRecord(&recordHeader, recordReader) + if err != nil { + continue + } + if format == FORMAT_RAW_PKT { + flowSample.Records[i] = record + } else if format == FORMAT_IPV4 { + expandedFlowSample.Records[i] = record + } + } else if format == FORMAT_ETH || format == FORMAT_IPV6 { + record, err := DecodeCounterRecord(&recordHeader, recordReader) + if err != nil { + continue + } + counterSample.Records[i] = record + } + } + return sample, nil +} + +func DecodeMessage(payload *bytes.Buffer) (interface{}, error) { + var version uint32 + err := utils.BinaryDecoder(payload, &version) + if err != nil { + return nil, err + } + packetV5 := Packet{} + if version == 5 { + packetV5.Version = version + err = utils.BinaryDecoder(payload, &(packetV5.IPVersion)) + if err != nil { + return packetV5, err + } + var ip []byte + if packetV5.IPVersion == 1 { + ip = make([]byte, 4) + err = utils.BinaryDecoder(payload, ip) + if err != nil { + return packetV5, err + } + } else if packetV5.IPVersion == 2 { + ip = make([]byte, 16) + err = utils.BinaryDecoder(payload, ip) + if err != nil { + return packetV5, err + } + } else { + return nil, NewErrorIPVersion(packetV5.IPVersion) + } + + packetV5.AgentIP = ip + err = utils.BinaryDecoder(payload, &(packetV5.SubAgentId), &(packetV5.SequenceNumber), &(packetV5.Uptime), &(packetV5.SamplesCount)) + if err != nil { + return packetV5, err + } + packetV5.Samples = make([]interface{}, int(packetV5.SamplesCount)) + for i := 0; i < int(packetV5.SamplesCount) && payload.Len() >= 8; i++ { + header := SampleHeader{} + err = utils.BinaryDecoder(payload, &(header.Format), &(header.Length)) + if err != nil { + return packetV5, err + } + if int(header.Length) > payload.Len() { + break + } + sampleReader := bytes.NewBuffer(payload.Next(int(header.Length))) + + sample, err := DecodeSample(&header, sampleReader) + if err != nil { + continue + } else { + packetV5.Samples[i] = sample + } + } + + return packetV5, nil + } else { + return nil, NewErrorVersion(version) + } +} diff --git a/third_party/goflow2/decoders/sflow/sflow_test.go b/third_party/goflow2/decoders/sflow/sflow_test.go new file mode 100644 index 000000000000..e9ed52c8771c --- /dev/null +++ b/third_party/goflow2/decoders/sflow/sflow_test.go @@ -0,0 +1,134 @@ +package sflow + +import ( + "bytes" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestSFlowDecode(t *testing.T) { + data := []byte{ + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0xac, 0x10, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x01, 0xaa, 0x67, 0xee, 0xaa, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x04, 0x13, 0x00, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xaa, 0x00, 0x00, 0x04, 0x13, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x4e, 0x00, 0xff, 0x12, 0x34, + 0x35, 0x1b, 0xff, 0xab, 0xcd, 0xef, 0xab, 0x64, 0x81, 0x00, 0x00, 0x20, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x3c, 0x5c, 0x07, 0x00, 0x00, 0x7c, 0x01, 0x48, 0xa0, 0xac, 0x10, 0x20, 0xfe, 0xac, 0x10, + 0x20, 0xf1, 0x08, 0x00, 0x97, 0x61, 0xa9, 0x48, 0x0c, 0xb2, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, + 0x77, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x00, 0x00, + } + buf := bytes.NewBuffer(data) + _, err := DecodeMessage(buf) + assert.Nil(t, err) +} + +func TestExpandedSFlowDecode(t *testing.T) { + data := getExpandedSFlowDecode() + + buf := bytes.NewBuffer(data) + _, err := DecodeMessage(buf) + assert.Nil(t, err) +} + +func getExpandedSFlowDecode() []byte { + return []byte{ + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0xa7, 0x72, 0xc2, 0x0f, 0x76, 0x73, 0x48, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0xdc, 0x20, 0x90, 0x93, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0xa4, + 0x00, 0x00, 0x3f, 0xff, 0x04, 0x38, 0xec, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0f, 0x42, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x52, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xea, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, + 0x08, 0xec, 0xf5, 0x2a, 0x8f, 0xbe, 0x74, 0x83, 0xef, 0x30, 0x65, 0xb7, 0x81, 0x00, 0x00, 0x1e, + 0x08, 0x00, 0x45, 0x00, 0x05, 0xd4, 0x3b, 0xba, 0x40, 0x00, 0x3f, 0x06, 0xbd, 0x99, 0xb9, 0x3b, + 0xdc, 0x93, 0x58, 0xee, 0x4e, 0x13, 0x01, 0xbb, 0xcf, 0xd6, 0x45, 0xb7, 0x1b, 0xc0, 0xd5, 0xb8, + 0xff, 0x24, 0x80, 0x10, 0x00, 0x04, 0x01, 0x55, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0xc8, 0xc8, + 0x56, 0x95, 0x00, 0x34, 0xf6, 0x0f, 0xe8, 0x1d, 0xbd, 0x41, 0x45, 0x92, 0x4c, 0xc2, 0x71, 0xe0, + 0xeb, 0x2e, 0x35, 0x17, 0x7c, 0x2f, 0xb9, 0xa8, 0x05, 0x92, 0x0e, 0x03, 0x1b, 0x50, 0x53, 0x0c, + 0xe5, 0x7d, 0x86, 0x75, 0x32, 0x8a, 0xcc, 0xe2, 0x26, 0xa8, 0x90, 0x21, 0x78, 0xbf, 0xce, 0x7a, + 0xf8, 0xb5, 0x8d, 0x48, 0xe4, 0xaa, 0xfe, 0x26, 0x34, 0xe0, 0xad, 0xb9, 0xec, 0x79, 0x74, 0xd8, + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xdc, 0x20, 0x90, 0x93, 0x27, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0f, 0x42, 0xa4, 0x00, 0x00, 0x3f, 0xff, 0x04, 0x39, 0x2c, 0xd9, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x4b, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x17, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xca, 0x00, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x80, 0xda, 0xb1, 0x22, 0xfb, 0xd9, 0xcf, 0x74, 0x83, 0xef, 0x30, 0x65, 0xb7, + 0x81, 0x00, 0x00, 0x17, 0x08, 0x00, 0x45, 0x00, 0x05, 0xb4, 0xe2, 0x28, 0x40, 0x00, 0x3f, 0x06, + 0x15, 0x0f, 0xc3, 0xb5, 0xaf, 0x26, 0x05, 0x92, 0xc6, 0x9e, 0x00, 0x50, 0x0f, 0xb3, 0x35, 0x8e, + 0x36, 0x02, 0xa1, 0x01, 0xed, 0xb0, 0x80, 0x10, 0x00, 0x3b, 0xf7, 0xd4, 0x00, 0x00, 0x01, 0x01, + 0x08, 0x0a, 0xd2, 0xe8, 0xac, 0xbe, 0x00, 0x36, 0xbc, 0x3c, 0x37, 0x36, 0xc4, 0x80, 0x3f, 0x66, + 0x33, 0xc5, 0x50, 0xa6, 0x63, 0xb2, 0x92, 0xc3, 0x6a, 0x7a, 0x80, 0x65, 0x0b, 0x22, 0x62, 0xfe, + 0x16, 0x9c, 0xab, 0x55, 0x03, 0x47, 0xa6, 0x54, 0x63, 0xa5, 0xbc, 0x17, 0x8e, 0x5a, 0xf6, 0xbc, + 0x24, 0x52, 0xe9, 0xd2, 0x7b, 0x08, 0xe8, 0xc2, 0x6b, 0x05, 0x1c, 0xc0, 0x61, 0xb4, 0xe0, 0x43, + 0x59, 0x62, 0xbf, 0x0a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xdc, 0x04, 0x12, 0xa0, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0xa8, 0x00, 0x00, 0x3f, 0xff, 0xa4, 0x06, 0x9f, 0x9b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0xa8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0f, 0x42, 0xa4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x05, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xf2, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x74, 0x83, 0xef, 0x30, 0x65, 0xb7, 0x28, 0x99, + 0x3a, 0x4e, 0x89, 0x27, 0x81, 0x00, 0x05, 0x39, 0x08, 0x00, 0x45, 0x18, 0x05, 0xdc, 0x8e, 0x5c, + 0x40, 0x00, 0x3a, 0x06, 0x53, 0x77, 0x89, 0x4a, 0xcc, 0xd5, 0x59, 0xbb, 0xa9, 0x55, 0x07, 0x8f, + 0xad, 0xdc, 0xf2, 0x9b, 0x09, 0xb4, 0xce, 0x1d, 0xbc, 0xee, 0x80, 0x10, 0x75, 0x40, 0x58, 0x02, + 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0xb0, 0x18, 0x5b, 0x6f, 0xd7, 0xd6, 0x8b, 0x47, 0xee, 0x6a, + 0x03, 0x0b, 0x9b, 0x52, 0xb1, 0xca, 0x61, 0x4b, 0x84, 0x57, 0x75, 0xc4, 0xb2, 0x18, 0x11, 0x39, + 0xce, 0x5d, 0x2a, 0x38, 0x91, 0x29, 0x76, 0x11, 0x7d, 0xc1, 0xcc, 0x5c, 0x4b, 0x0a, 0xde, 0xbb, + 0xa8, 0xad, 0x9d, 0x88, 0x36, 0x8b, 0xc0, 0x02, 0x87, 0xa7, 0xa5, 0x1c, 0xd9, 0x85, 0x71, 0x85, + 0x68, 0x2b, 0x59, 0xc6, 0x2c, 0x3c, 0x84, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xdc, + 0x20, 0x90, 0x93, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0xa4, 0x00, 0x00, 0x3f, 0xff, + 0x04, 0x39, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0xa4, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x4b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe9, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x05, 0xf2, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0xda, 0xb1, 0x22, 0xfb, + 0xd9, 0xcf, 0x74, 0x83, 0xef, 0x30, 0x65, 0xb7, 0x81, 0x00, 0x00, 0x17, 0x08, 0x00, 0x45, 0x00, + 0x05, 0xdc, 0x7e, 0x42, 0x40, 0x00, 0x3f, 0x06, 0x12, 0x4d, 0xb9, 0x66, 0xdb, 0x43, 0x67, 0xc2, + 0xa9, 0x20, 0x63, 0x75, 0x57, 0xae, 0x6d, 0xbf, 0x59, 0x7c, 0x93, 0x71, 0x09, 0x67, 0x80, 0x10, + 0x00, 0xeb, 0xfc, 0x16, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x40, 0x96, 0x88, 0x38, 0x36, 0xe1, + 0x64, 0xc7, 0x1b, 0x43, 0xbc, 0x0e, 0x1f, 0x81, 0x6d, 0x39, 0xf6, 0x12, 0x0c, 0xea, 0xc0, 0xea, + 0x7b, 0xc1, 0x77, 0xe2, 0x92, 0x6a, 0xbf, 0xbe, 0x84, 0xd9, 0x00, 0x18, 0x57, 0x49, 0x92, 0x72, + 0x8f, 0xa3, 0x78, 0x45, 0x6f, 0xc6, 0x98, 0x8f, 0x71, 0xb0, 0xc5, 0x52, 0x7d, 0x8a, 0x82, 0xef, + 0x52, 0xdb, 0xe9, 0xdc, 0x0a, 0x52, 0xdb, 0x06, 0x51, 0x80, 0x80, 0xa9, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0xdc, 0x20, 0x90, 0x93, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0xa4, + 0x00, 0x00, 0x3f, 0xff, 0x04, 0x39, 0xac, 0xd7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0f, 0x42, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0xa5, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x03, 0xbd, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xf2, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, + 0x90, 0xe2, 0xba, 0x89, 0x21, 0xad, 0x74, 0x83, 0xef, 0x30, 0x65, 0xb7, 0x81, 0x00, 0x03, 0xbd, + 0x08, 0x00, 0x45, 0x00, 0x05, 0xdc, 0x76, 0xa2, 0x40, 0x00, 0x38, 0x06, 0xac, 0x75, 0x33, 0x5b, + 0x74, 0x6c, 0xc3, 0xb5, 0xae, 0x87, 0x1f, 0x40, 0x80, 0x68, 0xab, 0xbb, 0x2f, 0x90, 0x01, 0xee, + 0x3a, 0xaf, 0x80, 0x10, 0x00, 0xeb, 0x8e, 0xf4, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x34, 0xc0, + 0xff, 0x26, 0xac, 0x90, 0xd5, 0xc4, 0xcc, 0xd7, 0xa4, 0xa5, 0x5b, 0xa3, 0x79, 0x33, 0xc1, 0x25, + 0xcd, 0x84, 0xdc, 0xaa, 0x37, 0xc9, 0xe3, 0xab, 0xc6, 0xb4, 0xeb, 0xe3, 0x8d, 0x72, 0x06, 0xd1, + 0x5a, 0x1f, 0x9a, 0x8b, 0xe9, 0x9a, 0xf7, 0x33, 0x35, 0xe5, 0xca, 0x67, 0xba, 0x04, 0xf9, 0x3c, + 0x27, 0xff, 0xa3, 0xca, 0x5e, 0x90, 0xf9, 0xc7, 0xd1, 0xe4, 0xf8, 0xf5, 0x7a, 0x14, 0xdc, 0x1c, + 0xb1, 0xde, 0x63, 0x75, 0xb2, 0x65, 0x27, 0xf0, 0x0d, 0x29, 0xc5, 0x56, 0x60, 0x4a, 0x50, 0x10, + 0x00, 0x77, 0xc0, 0xef, 0x00, 0x00, 0x74, 0xcf, 0x8a, 0x79, 0x87, 0x77, 0x75, 0x64, 0x75, 0xeb, + 0xa4, 0x56, 0xb4, 0xd8, 0x70, 0xca, 0xe6, 0x11, 0xbb, 0x9f, 0xa1, 0x63, 0x95, 0xa1, 0xb4, 0x81, + 0x8d, 0x50, 0xe0, 0xd5, 0xa9, 0x2c, 0xd7, 0x8f, 0xfe, 0x78, 0xce, 0xff, 0x5a, 0xa6, 0xb6, 0xb9, + 0xf1, 0xe9, 0x5f, 0xda, 0xcb, 0xf3, 0x62, 0x61, 0x5f, 0x2b, 0x32, 0x95, 0x5d, 0x96, 0x2e, 0xef, + 0x32, 0x04, 0xff, 0xcc, 0x76, 0xba, 0x49, 0xab, 0x92, 0xa7, 0xf1, 0xcc, 0x52, 0x68, 0xde, 0x94, + 0x90, 0xdb, 0x1b, 0xa0, 0x28, 0x8a, 0xf8, 0x64, 0x55, 0x9c, 0x9b, 0xf6, 0x9c, 0x44, 0xd9, 0x68, + 0xc0, 0xe5, 0x2c, 0xe1, 0x3d, 0x29, 0x19, 0xef, 0x8b, 0x0c, 0x9d, 0x0a, 0x7e, 0xcd, 0xc2, 0xe9, + 0x85, 0x6b, 0x85, 0xb3, 0x97, 0xbe, 0xc6, 0x26, 0xd2, 0xe5, 0x2e, 0x90, 0xa9, 0xac, 0xe3, 0xd8, + 0xef, 0xbd, 0x7b, 0x40, 0xf8, 0xb7, 0xe3, 0xc3, 0x8d, 0xa7, 0x38, 0x0f, 0x87, 0x7a, 0x50, 0x62, + 0xc8, 0xb8, 0xa4, 0x52, 0x6e, 0xdc, 0x92, 0x7f, 0xe6, 0x8d, 0x45, 0x39, 0xfd, 0x06, 0x6e, 0xd9, + 0xb5, 0x65, 0xac, 0xae, 0x2b, 0x8d, 0xea, 0xcf, 0xa2, 0x98, 0x0b, 0xc6, 0x43, 0x2e, 0xa7, 0x71, + 0x99, 0x2b, 0xea, 0xc3, 0x9c, 0x27, 0x74, 0x9e, 0xd5, 0x11, 0x60, 0x7a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7b, 0xd6, 0x2a, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } +} diff --git a/third_party/goflow2/decoders/utils/utils.go b/third_party/goflow2/decoders/utils/utils.go new file mode 100644 index 000000000000..a36e3b2be04d --- /dev/null +++ b/third_party/goflow2/decoders/utils/utils.go @@ -0,0 +1,16 @@ +package utils + +import ( + "encoding/binary" + "io" +) + +func BinaryDecoder(payload io.Reader, dests ...interface{}) error { + for _, dest := range dests { + err := binary.Read(payload, binary.BigEndian, dest) + if err != nil { + return err + } + } + return nil +} diff --git a/third_party/goflow2/docs/agents.md b/third_party/goflow2/docs/agents.md new file mode 100644 index 000000000000..2f254f4a7dd0 --- /dev/null +++ b/third_party/goflow2/docs/agents.md @@ -0,0 +1,51 @@ +# Agents + +There are various agents that can send samples to a flow collector. + +## Hardware + +### Juniper + +In the latest versions, Juniper supports sFlow and IPFIX protocols. + +[Documentation](https://www.juniper.net/documentation/us/en/software/junos/network-mgmt/topics/topic-map/sflow-monitoring-technology.html). + +Sample configuration: +``` +set protocols sflow collector 10.0.0.1 +set protocols sflow collector udp-port 6343 +set protocols sflow interface ge-0/0/0 +set protocols sflow sample-rate 2048 +``` + +## Software + +### hsflowd + +[Documentation](https://sflow.net/host-sflow-linux-config.php). + +Sample packets using pcap, iptables nflog and many more. Uses sFlow. + +Sample configuration: +``` +sflow { + collector { ip = 10.0.0.1 udpport = 6343 } + pcap { dev = eth0 } +} +``` + +Run with +```bash +$ hsflowd -d -f hsflowd.conf +``` + +### nProbe + +[Documentation](https://www.ntop.org/guides/nprobe/) + +Sample packets using pcap, iptables nflog and many more. Uses NetFlow v9 or IPFIX. + +Run with +```bash +$ nprobe -i eth0 -n 10.0.0.1:2055 -V 10 +``` \ No newline at end of file diff --git a/third_party/goflow2/docs/contributors.md b/third_party/goflow2/docs/contributors.md new file mode 100644 index 000000000000..90922e5a10a5 --- /dev/null +++ b/third_party/goflow2/docs/contributors.md @@ -0,0 +1,13 @@ +# Contributors + +A special thank you to all the contributors of GoFlow. +* [debugloop](https://github.com/debugloop) +* [simPod](https://github.com/simPod) +* [mmlb](https://github.com/mmlb) +* [kanocz](https://github.com/kanocz) +* [morrowc](https://github.com/morrowc) +* [SuperQ](https://github.com/SuperQ) +* [shyam334](https://github.com/shyam334) +* [leoluk](https://github.com/leoluk) + +and many more! \ No newline at end of file diff --git a/third_party/goflow2/docs/logs.md b/third_party/goflow2/docs/logs.md new file mode 100644 index 000000000000..ec55956619af --- /dev/null +++ b/third_party/goflow2/docs/logs.md @@ -0,0 +1,2 @@ +# Logs + diff --git a/third_party/goflow2/docs/protobuf.md b/third_party/goflow2/docs/protobuf.md new file mode 100644 index 000000000000..9617f7fd7e30 --- /dev/null +++ b/third_party/goflow2/docs/protobuf.md @@ -0,0 +1,34 @@ +# Protobuf + +The `.proto` files contains a list of fields that are populated by GoFlow2. + +If the fields are changed, the schema needs to be recompiled +in order to use it. + +The compilation is dependent on the language. +Keep in mind the protobuf source code and libraries changes often and this page may be outdated. + +For other languages, refer to the [official guide](https://developers.google.com/protocol-buffers). + +## Compile for Golang + +The following two tools are required: +* [protoc](https://github.com/protocolbuffers/protobuf), a protobuf compiler, written in C +* [protoc-gen-go](https://github.com/protocolbuffers/protobuf-go), a Go plugin for protoc that can compile protobuf for Golang + +The release page in the respective GitHub repositories should provide binaries distributions. Unzip/Untar if necessary. +Make sure that the two binaries are in your ``$PATH``. On Mac OS you can add the files to `/usr/local/bin` for instance. + +From the root of the repository, run the following command: + +```bash +$ protoc --go_opt=paths=source_relative --go_out=. pb/*.proto +``` + +This will compile the main protobuf schema into the `pb` directory. + +You can also run the command which will also compile the protobuf for the sample enricher. + +```bash +$ make proto +``` \ No newline at end of file diff --git a/third_party/goflow2/docs/protocols.md b/third_party/goflow2/docs/protocols.md new file mode 100644 index 000000000000..f27076d50fe9 --- /dev/null +++ b/third_party/goflow2/docs/protocols.md @@ -0,0 +1,111 @@ +# Protocols + +You can find information on the protocols in the links below: +* [sFlow](https://sflow.org/developers/specifications.php) +* [NetFlow v5](https://www.cisco.com/c/en/us/td/docs/net_mgmt/netflow_collection_engine/3-6/user/guide/format.html) +* [NetFlow v9](https://www.cisco.com/en/US/technologies/tk648/tk362/technologies_white_paper09186a00800a3db9.html) +* [IPFIX](https://www.iana.org/assignments/ipfix/ipfix.xhtml) + +The mapping to the protobuf format is listed in the table below. + +| Field | Description | NetFlow v5 | sFlow | NetFlow v9 | IPFIX | +| - | - | - | - | - | - | +|Type|Type of flow message|NETFLOW_V5|SFLOW_5|NETFLOW_V9|IPFIX| +|TimeReceived|Timestamp of when the message was received|Included|Included|Included|Included| +|SequenceNum|Sequence number of the flow packet|Included|Included|Included|Included| +|SamplingRate|Sampling rate of the flow|Included|Included|Included|Included| +|FlowDirection|Direction of the flow| | |DIRECTION (61)|flowDirection (61)| +|SamplerAddress|Address of the device that generated the packet|IP source of packet|Agent IP|IP source of packet|IP source of packet| +|TimeFlowStart|Time the flow started|System uptime and first|=TimeReceived|System uptime and FIRST_SWITCHED (22)|flowStartXXX (150, 152, 154, 156)| +|TimeFlowEnd|Time the flow ended|System uptime and last|=TimeReceived|System uptime and LAST_SWITCHED (23)|flowEndXXX (151, 153, 155, 157)| +|Bytes|Number of bytes in flow|dOctets|Length of sample|IN_BYTES (1) OUT_BYTES (23)|octetDeltaCount (1) postOctetDeltaCount (23)| +|Packets|Number of packets in flow|dPkts|=1|IN_PKTS (2) OUT_PKTS (24)|packetDeltaCount (1) postPacketDeltaCount (24)| +|SrcAddr|Source address (IP)|srcaddr (IPv4 only)|Included|Included|IPV4_SRC_ADDR (8) IPV6_SRC_ADDR (27)|sourceIPv4Address/sourceIPv6Address (8/27)| +|DstAddr|Destination address (IP)|dstaddr (IPv4 only)|Included|Included|IPV4_DST_ADDR (12) IPV6_DST_ADDR (28)|destinationIPv4Address (12)destinationIPv6Address (28)| +|Etype|Ethernet type (0x86dd for IPv6...)|IPv4|Included|Included|Included| +|Proto|Protocol (UDP, TCP, ICMP...)|prot|Included|PROTOCOL (4)|protocolIdentifier (4)| +|SrcPort|Source port (when UDP/TCP/SCTP)|srcport|Included|L4_SRC_PORT (7)|sourceTransportPort (7)| +|DstPort|Destination port (when UDP/TCP/SCTP)|dstport|Included|L4_DST_PORT (11)|destinationTransportPort (11)| +|InIf|Input interface|input|Included|INPUT_SNMP (10)|ingressInterface (10)| +|OutIf|Output interface|output|Included|OUTPUT_SNMP (14)|egressInterface (14)| +|SrcMac|Source mac address| |Included|IN_SRC_MAC (56)|sourceMacAddress (56)| +|DstMac|Destination mac address| |Included|OUT_DST_MAC (57)|postDestinationMacAddress (57)| +|SrcVlan|Source VLAN ID| |From ExtendedSwitch|SRC_VLAN (58)|vlanId (58)| +|DstVlan|Destination VLAN ID| |From ExtendedSwitch|DST_VLAN (59)|postVlanId (59)| +|VlanId|802.11q VLAN ID| |Included|SRC_VLAN (58)|vlanId (58)| +|IngressVrfID|VRF ID| | | |ingressVRFID (234)| +|EgressVrfID|VRF ID| | | |egressVRFID (235)| +|IPTos|IP Type of Service|tos|Included|SRC_TOS (5)|ipClassOfService (5)| +|ForwardingStatus|Forwarding status| | |FORWARDING_STATUS (89)|forwardingStatus (89)| +|IPTTL|IP Time to Live| |Included|IPTTL (52)|minimumTTL (52| +|TCPFlags|TCP flags|tcp_flags|Included|TCP_FLAGS (6)|tcpControlBits (6)| +|IcmpType|ICMP Type| |Included|ICMP_TYPE (32)|icmpTypeXXX (176, 178) icmpTypeCodeXXX (32, 139)| +|IcmpCode|ICMP Code| |Included|ICMP_TYPE (32)|icmpCodeXXX (177, 179) icmpTypeCodeXXX (32, 139)| +|IPv6FlowLabel|IPv6 Flow Label| |Included|IPV6_FLOW_LABEL (31)|flowLabelIPv6 (31)| +|FragmentId|IP Fragment ID| |Included|IPV4_IDENT (54)|fragmentIdentification (54)| +|FragmentOffset|IP Fragment Offset| |Included|FRAGMENT_OFFSET (88)|fragmentOffset (88) and fragmentFlags (197)| +|BiFlowDirection|BiFlow Identification| | | |biflowDirection (239)| +|SrcAS|Source AS number|src_as|From ExtendedGateway|SRC_AS (16)|bgpSourceAsNumber (16)| +|DstAS|Destination AS number|dst_as|From ExtendedGateway|DST_AS (17)|bgpDestinationAsNumber (17)| +|NextHop|Nexthop address|nexthop|From ExtendedRouter|IPV4_NEXT_HOP (15) IPV6_NEXT_HOP (62)|ipNextHopIPv4Address (15) ipNextHopIPv6Address (62)| +|NextHopAS|Nexthop AS number| |From ExtendedGateway| | | +|SrcNet|Source address mask|src_mask|From ExtendedRouter|SRC_MASK (9) IPV6_SRC_MASK (29)|sourceIPv4PrefixLength (9) sourceIPv6PrefixLength (29)| +|DstNet|Destination address mask|dst_mask|From ExtendedRouter|DST_MASK (13) IPV6_DST_MASK (30)|destinationIPv4PrefixLength (13) destinationIPv6PrefixLength (30)| +|BgpNextHop|BGP Nexthop address| |From ExtendedGateway|BGP_IPV4_NEXT_HOP (18) BGP_IPV6_NEXT_HOP (63)|bgpNextHopIPv4Address (18) bgpNextHopIPv6Address (63)| +|BgpCommunities|BGP Communities| |From ExtendedGateway| | | +|ASPath|AS Path| |From ExtendedGateway| | | +|SrcNet|Source address mask|src_mask|From ExtendedRouter|SRC_MASK (9) IPV6_SRC_MASK (29)|sourceIPv4PrefixLength (9) sourceIPv6PrefixLength (29)| +|DstNet|Destination address mask|dst_mask|From ExtendedRouter|DST_MASK (13) IPV6_DST_MASK (30)|destinationIPv4PrefixLength (13) destinationIPv6PrefixLength (30)| +|HasMPLS|Indicates the presence of MPLS header||Included||| +|MPLSCount|Count of MPLS layers||Included||| +|MPLSxTTL|TTL of the MPLS label||Included||| +|MPLSxLabel|MPLS label||Included||| + +## Add new custom fields + +If you are using enterprise fields that you need decoded +or if you are looking for specific bytes inside the packet sample. + +This feature is only available when sending Protobufs (no text output). + +The [`mapping.yaml`](../cmd/goflow2/mapping.yaml) example file +will collect source and destination port again, use it with `-mapping=mapping.yaml` in the CLI. + +Data coming from the flows can be added to the protobuf either as an unsigned/signed integer a slice of bytes. + +The `sflow` section allow to extract data from packet samples inside sFlow and inside IPFIX (dataframe). +The following layers are available: +* 0: no offset +* 3: network layer, offsets to IP/IPv6 header +* 4: transport layer, offsets to TCP/UDP header +* 7: application layer, offsets to the TCP/UDP payload + + +```yaml +ipfix: + mapping: + - field: 7 # NetFlow or IPFIX field ID + destination: CustomInteger1 # Name of the field inside the Protobuf + penprovided: false # Has an enterprise number (optional) + pen: 0 # Enterprise number (optional) +netflowv9: + mapping: [] + # ... similar to above, Enterprise number will not be supported +sflow: + mapping: + - layer: 4 # Layer + offset: 0 # Source port + length: 16 # 2 bytes + destination: CustomInteger1 +``` + +Without editing and recompiling the [protobuf](../pb/flow.proto), you can use up to 5 integers and 5 slices of bytes: + +```protobuf + // Custom allocations + uint64 CustomInteger1 = 1001; + [...] + + bytes CustomBytes1 = 1011; + [...] +``` diff --git a/third_party/goflow2/format/common/hash.go b/third_party/goflow2/format/common/hash.go new file mode 100644 index 000000000000..1d901860350b --- /dev/null +++ b/third_party/goflow2/format/common/hash.go @@ -0,0 +1,56 @@ +package common + +import ( + "flag" + "fmt" + "reflect" + "strings" + "sync" +) + +var ( + fieldsVar string + fields []string // Hashing fields + + hashDeclared bool + hashDeclaredLock = &sync.Mutex{} +) + +func HashFlag() { + hashDeclaredLock.Lock() + defer hashDeclaredLock.Unlock() + + if hashDeclared { + return + } + hashDeclared = true + flag.StringVar(&fieldsVar, "format.hash", "SamplerAddress", "List of fields to do hashing, separated by commas") + +} + +func ManualHashInit() error { + fields = strings.Split(fieldsVar, ",") + return nil +} + +func HashProtoLocal(msg interface{}) string { + return HashProto(fields, msg) +} + +func HashProto(fields []string, msg interface{}) string { + var keyStr string + + if msg != nil { + vfm := reflect.ValueOf(msg) + vfm = reflect.Indirect(vfm) + + for _, kf := range fields { + fieldValue := vfm.FieldByName(kf) + if fieldValue.IsValid() { + keyStr += fmt.Sprintf("%v-", fieldValue) + } + } + } + + return keyStr +} diff --git a/third_party/goflow2/format/common/selector.go b/third_party/goflow2/format/common/selector.go new file mode 100644 index 000000000000..531c716feff3 --- /dev/null +++ b/third_party/goflow2/format/common/selector.go @@ -0,0 +1,36 @@ +package common + +import ( + "flag" + "strings" + "sync" +) + +var ( + selectorVar string + selector []string // Hashing fields + selectorTag string // Hashing fields + + selectorDeclared bool + selectorDeclaredLock = &sync.Mutex{} +) + +func SelectorFlag() { + selectorDeclaredLock.Lock() + defer selectorDeclaredLock.Unlock() + + if selectorDeclared { + return + } + selectorDeclared = true + flag.StringVar(&selectorVar, "format.selector", "", "List of fields to do keep in output") + flag.StringVar(&selectorTag, "format.tag", "", "Use format tag") +} + +func ManualSelectorInit() error { + if selectorVar == "" { + return nil + } + selector = strings.Split(selectorVar, ",") + return nil +} diff --git a/third_party/goflow2/format/common/text.go b/third_party/goflow2/format/common/text.go new file mode 100644 index 000000000000..d97ed68294e8 --- /dev/null +++ b/third_party/goflow2/format/common/text.go @@ -0,0 +1,246 @@ +package common + +import ( + "encoding/binary" + "fmt" + "net" + "reflect" + "strings" +) + +const ( + FORMAT_TYPE_UNKNOWN = iota + FORMAT_TYPE_STRING_FUNC + FORMAT_TYPE_STRING + FORMAT_TYPE_INTEGER + FORMAT_TYPE_IP + FORMAT_TYPE_MAC + FORMAT_TYPE_BYTES +) + +var ( + EtypeName = map[uint32]string{ + 0x806: "ARP", + 0x800: "IPv4", + 0x86dd: "IPv6", + } + ProtoName = map[uint32]string{ + 1: "ICMP", + 6: "TCP", + 17: "UDP", + 58: "ICMPv6", + 132: "SCTP", + } + IcmpTypeName = map[uint32]string{ + 0: "EchoReply", + 3: "DestinationUnreachable", + 8: "Echo", + 9: "RouterAdvertisement", + 10: "RouterSolicitation", + 11: "TimeExceeded", + } + Icmp6TypeName = map[uint32]string{ + 1: "DestinationUnreachable", + 2: "PacketTooBig", + 3: "TimeExceeded", + 128: "EchoRequest", + 129: "EchoReply", + 133: "RouterSolicitation", + 134: "RouterAdvertisement", + } + + TextFields = map[string]int{ + "Type": FORMAT_TYPE_STRING_FUNC, + "SamplerAddress": FORMAT_TYPE_IP, + "SrcAddr": FORMAT_TYPE_IP, + "DstAddr": FORMAT_TYPE_IP, + "SrcMac": FORMAT_TYPE_MAC, + "DstMac": FORMAT_TYPE_MAC, + "NextHop": FORMAT_TYPE_IP, + "MPLSLabelIP": FORMAT_TYPE_IP, + } + + RenderExtras = map[string]RenderExtraFunction{ + "EtypeName": RenderExtraFunctionEtypeName, + "ProtoName": RenderExtraFunctionProtoName, + "IcmpName": RenderExtraFunctionIcmpName, + } +) + +/* +func AddTextField(name string, jtype int) { + TextFields = append(TextFields, name) + TextFieldsTypes = append(TextFieldsTypes, jtype) +}*/ + +type RenderExtraFunction func(interface{}) string + +func RenderExtraFetchNumbers(msg interface{}, fields []string) []uint64 { + vfm := reflect.ValueOf(msg) + vfm = reflect.Indirect(vfm) + + values := make([]uint64, len(fields)) + for i, kf := range fields { + fieldValue := vfm.FieldByName(kf) + if fieldValue.IsValid() { + values[i] = fieldValue.Uint() + } + } + + return values +} + +func RenderExtraFunctionEtypeName(msg interface{}) string { + num := RenderExtraFetchNumbers(msg, []string{"Etype"}) + return EtypeName[uint32(num[0])] +} + +func RenderExtraFunctionProtoName(msg interface{}) string { + num := RenderExtraFetchNumbers(msg, []string{"Proto"}) + return ProtoName[uint32(num[0])] +} +func RenderExtraFunctionIcmpName(msg interface{}) string { + num := RenderExtraFetchNumbers(msg, []string{"Proto", "IcmpCode", "IcmpType"}) + return IcmpCodeType(uint32(num[0]), uint32(num[1]), uint32(num[2])) +} + +func IcmpCodeType(proto, icmpCode, icmpType uint32) string { + if proto == 1 { + return IcmpTypeName[icmpType] + } else if proto == 58 { + return Icmp6TypeName[icmpType] + } + return "" +} + +func RenderIP(addr []byte) string { + if addr == nil || (len(addr) != 4 && len(addr) != 16) { + return "" + } + + return net.IP(addr).String() +} + +func FormatMessageReflectText(msg interface{}, ext string) string { + return FormatMessageReflectCustom(msg, ext, "", " ", "=", false) +} + +func FormatMessageReflectJSON(msg interface{}, ext string) string { + return fmt.Sprintf("{%s}", FormatMessageReflectCustom(msg, ext, "\"", ",", ":", true)) +} + +func ExtractTag(name, original string, tag reflect.StructTag) string { + lookup, ok := tag.Lookup(name) + if !ok { + return original + } + before, _, _ := strings.Cut(lookup, ",") + return before +} + +func FormatMessageReflectCustom(msg interface{}, ext, quotes, sep, sign string, null bool) string { + customSelector := selector + reMap := make(map[string]string) + + vfm := reflect.ValueOf(msg) + vfm = reflect.Indirect(vfm) + vft := vfm.Type() + + if len(customSelector) == 0 || selectorTag != "" { + /* + // we would need proto v2 + msgR := msg.ProtoReflect() + customSelector = make([]string, msgR.Fields().Len()) + for i := 0; i flowpb.FlowMessage.FlowType + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_pb_flow_proto_init() } +func file_pb_flow_proto_init() { + if File_pb_flow_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pb_flow_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FlowMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pb_flow_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pb_flow_proto_goTypes, + DependencyIndexes: file_pb_flow_proto_depIdxs, + EnumInfos: file_pb_flow_proto_enumTypes, + MessageInfos: file_pb_flow_proto_msgTypes, + }.Build() + File_pb_flow_proto = out.File + file_pb_flow_proto_rawDesc = nil + file_pb_flow_proto_goTypes = nil + file_pb_flow_proto_depIdxs = nil +} diff --git a/third_party/goflow2/pb/flow.proto b/third_party/goflow2/pb/flow.proto new file mode 100644 index 000000000000..1cbaae8d52c1 --- /dev/null +++ b/third_party/goflow2/pb/flow.proto @@ -0,0 +1,131 @@ +syntax = "proto3"; +package flowpb; +option go_package = "github.com/netsampler/goflow2/pb;flowpb"; + +message FlowMessage { + + enum FlowType { + FLOWUNKNOWN = 0; + SFLOW_5 = 1; + NETFLOW_V5 = 2; + NETFLOW_V9 = 3; + IPFIX = 4; + } + FlowType type = 1; + + uint64 time_received = 2; + uint32 sequence_num = 4; + uint64 sampling_rate = 3; + + uint32 flow_direction = 42; + + // Sampler information + bytes sampler_address = 11; + + // Found inside packet + uint64 time_flow_start = 38; + uint64 time_flow_end = 5; + uint64 time_flow_start_ms = 63; + uint64 time_flow_end_ms = 64; + + // Size of the sampled packet + uint64 bytes = 9; + uint64 packets = 10; + + // Source/destination addresses + bytes src_addr = 6; + bytes dst_addr = 7; + + // Layer 3 protocol (IPv4/IPv6/ARP/MPLS...) + uint32 etype = 30; + + // Layer 4 protocol + uint32 proto = 20; + + // Ports for UDP and TCP + uint32 src_port = 21; + uint32 dst_port = 22; + + // Interfaces + uint32 in_if = 18; + uint32 out_if = 19; + + // Ethernet information + uint64 src_mac = 27; + uint64 dst_mac = 28; + + // Vlan + uint32 src_vlan = 33; + uint32 dst_vlan = 34; + // 802.1q VLAN in sampled packet + uint32 vlan_id = 29; + + // VRF + uint32 ingress_vrf_id = 39; + uint32 egress_vrf_id = 40; + + // IP and TCP special flags + uint32 ip_tos = 23; + uint32 forwarding_status = 24; + uint32 ip_ttl = 25; + uint32 tcp_flags = 26; + uint32 icmp_type = 31; + uint32 icmp_code = 32; + uint32 ipv6_flow_label = 37; + // Fragments (IPv4/IPv6) + uint32 fragment_id = 35; + uint32 fragment_offset = 36; + uint32 bi_flow_direction = 41; + + // Autonomous system information + uint32 src_as = 14; + uint32 dst_as = 15; + + bytes next_hop = 12; + uint32 next_hop_as = 13; + + // Prefix size + uint32 src_net = 16; + uint32 dst_net = 17; + + // BGP information + bytes bgp_next_hop = 100; + repeated uint32 bgp_communities = 101; + repeated uint32 as_path = 102; + + // MPLS information + bool has_mpls = 53; + uint32 mpls_count = 54; + uint32 mpls_1_ttl = 55; // First TTL + uint32 mpls_1_label = 56; // First Label + uint32 mpls_2_ttl = 57; // Second TTL + uint32 mpls_2_label = 58; // Second Label + uint32 mpls_3_ttl = 59; // Third TTL + uint32 mpls_3_label = 60; // Third Label + uint32 mpls_last_ttl = 61; // Last TTL + uint32 mpls_last_label = 62; // Last Label + bytes mpls_label_ip = 65; // MPLS TOP Label IP + + uint32 observation_domain_id = 70; + uint32 observation_point_id = 71; + + // Custom fields: start after ID 1000: + // uint32 my_custom_field = 1000; + + + // Custom allocations + uint64 custom_integer_1 = 1001; + uint64 custom_integer_2 = 1002; + uint64 custom_integer_3 = 1003; + uint64 custom_integer_4 = 1004; + uint64 custom_integer_5 = 1005; + + bytes custom_bytes_1 = 1011; + bytes custom_bytes_2 = 1012; + bytes custom_bytes_3 = 1013; + bytes custom_bytes_4 = 1014; + bytes custom_bytes_5 = 1015; + + repeated uint32 custom_list_1 = 1021; + +} diff --git a/third_party/goflow2/producer/producer_nf.go b/third_party/goflow2/producer/producer_nf.go new file mode 100644 index 000000000000..07a00f310fee --- /dev/null +++ b/third_party/goflow2/producer/producer_nf.go @@ -0,0 +1,682 @@ +package producer + +import ( + "bytes" + "encoding/binary" + "errors" + "fmt" + "net" + "sync" + "time" + + "github.com/netsampler/goflow2/decoders/netflow" + flowmessage "github.com/netsampler/goflow2/pb" +) + +type SamplingRateSystem interface { + GetSamplingRate(version uint16, obsDomainId uint32) (uint32, error) + AddSamplingRate(version uint16, obsDomainId uint32, samplingRate uint32) +} + +type basicSamplingRateSystem struct { + sampling map[uint16]map[uint32]uint32 + samplinglock *sync.RWMutex +} + +func CreateSamplingSystem() SamplingRateSystem { + ts := &basicSamplingRateSystem{ + sampling: make(map[uint16]map[uint32]uint32), + samplinglock: &sync.RWMutex{}, + } + return ts +} + +func (s *basicSamplingRateSystem) AddSamplingRate(version uint16, obsDomainId uint32, samplingRate uint32) { + s.samplinglock.Lock() + defer s.samplinglock.Unlock() + _, exists := s.sampling[version] + if exists != true { + s.sampling[version] = make(map[uint32]uint32) + } + s.sampling[version][obsDomainId] = samplingRate +} + +func (s *basicSamplingRateSystem) GetSamplingRate(version uint16, obsDomainId uint32) (uint32, error) { + s.samplinglock.RLock() + defer s.samplinglock.RUnlock() + samplingVersion, okver := s.sampling[version] + if okver { + samplingRate, okid := samplingVersion[obsDomainId] + if okid { + return samplingRate, nil + } + return 0, errors.New("") // TBC + } + return 0, errors.New("") // TBC +} + +type SingleSamplingRateSystem struct { + Sampling uint32 +} + +func (s *SingleSamplingRateSystem) AddSamplingRate(version uint16, obsDomainId uint32, samplingRate uint32) { +} + +func (s *SingleSamplingRateSystem) GetSamplingRate(version uint16, obsDomainId uint32) (uint32, error) { + return s.Sampling, nil +} + +func NetFlowLookFor(dataFields []netflow.DataField, typeId uint16) (bool, interface{}) { + for _, dataField := range dataFields { + if dataField.Type == typeId { + return true, dataField.Value + } + } + return false, nil +} + +func NetFlowPopulate(dataFields []netflow.DataField, typeId uint16, addr interface{}) bool { + exists, value := NetFlowLookFor(dataFields, typeId) + if exists && value != nil { + valueBytes, ok := value.([]byte) + valueReader := bytes.NewReader(valueBytes) + if ok { + switch addrt := addr.(type) { + case *(net.IP): + *addrt = valueBytes + case *(time.Time): + t := uint64(0) + binary.Read(valueReader, binary.BigEndian, &t) + t64 := int64(t / 1000) + *addrt = time.Unix(t64, 0) + default: + binary.Read(valueReader, binary.BigEndian, addr) + } + } + } + return exists +} + +func WriteUDecoded(o uint64, out interface{}) error { + switch t := out.(type) { + case *byte: + *t = byte(o) + case *uint16: + *t = uint16(o) + case *uint32: + *t = uint32(o) + case *uint64: + *t = o + default: + return errors.New("The parameter is not a pointer to a byte/uint16/uint32/uint64 structure") + } + return nil +} + +func WriteDecoded(o int64, out interface{}) error { + switch t := out.(type) { + case *int8: + *t = int8(o) + case *int16: + *t = int16(o) + case *int32: + *t = int32(o) + case *int64: + *t = o + default: + return errors.New("The parameter is not a pointer to a int8/int16/int32/int64 structure") + } + return nil +} + +func DecodeUNumber(b []byte, out interface{}) error { + var o uint64 + l := len(b) + switch l { + case 1: + o = uint64(b[0]) + case 2: + o = uint64(binary.BigEndian.Uint16(b)) + case 4: + o = uint64(binary.BigEndian.Uint32(b)) + case 8: + o = binary.BigEndian.Uint64(b) + default: + if l < 8 { + var iter uint + for i := range b { + o |= uint64(b[i]) << uint(8*(uint(l)-iter-1)) + iter++ + } + } else { + return errors.New(fmt.Sprintf("Non-regular number of bytes for a number: %v", l)) + } + } + return WriteUDecoded(o, out) +} + +func DecodeUNumberLE(b []byte, out interface{}) error { + var o uint64 + l := len(b) + switch l { + case 1: + o = uint64(b[0]) + case 2: + o = uint64(binary.LittleEndian.Uint16(b)) + case 4: + o = uint64(binary.LittleEndian.Uint32(b)) + case 8: + o = binary.LittleEndian.Uint64(b) + default: + if l < 8 { + var iter uint + for i := range b { + o |= uint64(b[i]) << uint(8*(iter)) + iter++ + } + } else { + return errors.New(fmt.Sprintf("Non-regular number of bytes for a number: %v", l)) + } + } + return WriteUDecoded(o, out) +} + +func DecodeNumber(b []byte, out interface{}) error { + var o int64 + l := len(b) + switch l { + case 1: + o = int64(int8(b[0])) + case 2: + o = int64(int16(binary.BigEndian.Uint16(b))) + case 4: + o = int64(int32(binary.BigEndian.Uint32(b))) + case 8: + o = int64(binary.BigEndian.Uint64(b)) + default: + if l < 8 { + var iter int + for i := range b { + o |= int64(b[i]) << int(8*(int(l)-iter-1)) + iter++ + } + } else { + return errors.New(fmt.Sprintf("Non-regular number of bytes for a number: %v", l)) + } + } + return WriteDecoded(o, out) +} + +func DecodeNumberLE(b []byte, out interface{}) error { + var o int64 + l := len(b) + switch l { + case 1: + o = int64(int8(b[0])) + case 2: + o = int64(int16(binary.LittleEndian.Uint16(b))) + case 4: + o = int64(int32(binary.LittleEndian.Uint32(b))) + case 8: + o = int64(binary.LittleEndian.Uint64(b)) + default: + if l < 8 { + var iter int + for i := range b { + o |= int64(b[i]) << int(8*(iter)) + iter++ + } + } else { + return errors.New(fmt.Sprintf("Non-regular number of bytes for a number: %v", l)) + } + } + return WriteDecoded(o, out) +} + +func allZeroes(v []byte) bool { + for _, b := range v { + if b != 0 { + return false + } + } + return true +} + +func addrReplaceCheck(dstAddr *[]byte, v []byte, eType *uint32, ipv6 bool) { + if (len(*dstAddr) == 0 && len(v) > 0) || + (len(*dstAddr) != 0 && len(v) > 0 && !allZeroes(v)) { + *dstAddr = v + + if ipv6 { + *eType = 0x86dd + } else { + *eType = 0x800 + } + + } +} + +func ConvertNetFlowDataSet(version uint16, baseTime uint32, uptime uint32, record []netflow.DataField, mapperNetFlow *NetFlowMapper, mapperSFlow *SFlowMapper) *flowmessage.FlowMessage { + flowMessage := &flowmessage.FlowMessage{} + var time uint64 + + if version == 9 { + flowMessage.Type = flowmessage.FlowMessage_NETFLOW_V9 + } else if version == 10 { + flowMessage.Type = flowmessage.FlowMessage_IPFIX + } + + for i := range record { + df := record[i] + + v, ok := df.Value.([]byte) + if !ok { + continue + } + + MapCustomNetFlow(flowMessage, df, mapperNetFlow) + + if df.PenProvided { + continue + } + + switch df.Type { + + case netflow.IPFIX_FIELD_observationPointId: + DecodeUNumber(v, &(flowMessage.ObservationPointId)) + + // Statistics + case netflow.NFV9_FIELD_IN_BYTES: + DecodeUNumber(v, &(flowMessage.Bytes)) + case netflow.NFV9_FIELD_IN_PKTS: + DecodeUNumber(v, &(flowMessage.Packets)) + case netflow.NFV9_FIELD_OUT_BYTES: + DecodeUNumber(v, &(flowMessage.Bytes)) + case netflow.NFV9_FIELD_OUT_PKTS: + DecodeUNumber(v, &(flowMessage.Packets)) + + // L4 + case netflow.NFV9_FIELD_L4_SRC_PORT: + DecodeUNumber(v, &(flowMessage.SrcPort)) + case netflow.NFV9_FIELD_L4_DST_PORT: + DecodeUNumber(v, &(flowMessage.DstPort)) + case netflow.NFV9_FIELD_PROTOCOL: + DecodeUNumber(v, &(flowMessage.Proto)) + + // Network + case netflow.NFV9_FIELD_SRC_AS: + DecodeUNumber(v, &(flowMessage.SrcAs)) + case netflow.NFV9_FIELD_DST_AS: + DecodeUNumber(v, &(flowMessage.DstAs)) + + // Interfaces + case netflow.NFV9_FIELD_INPUT_SNMP: + DecodeUNumber(v, &(flowMessage.InIf)) + case netflow.NFV9_FIELD_OUTPUT_SNMP: + DecodeUNumber(v, &(flowMessage.OutIf)) + + case netflow.NFV9_FIELD_FORWARDING_STATUS: + DecodeUNumber(v, &(flowMessage.ForwardingStatus)) + case netflow.NFV9_FIELD_SRC_TOS: + DecodeUNumber(v, &(flowMessage.IpTos)) + case netflow.NFV9_FIELD_TCP_FLAGS: + DecodeUNumber(v, &(flowMessage.TcpFlags)) + case netflow.NFV9_FIELD_MIN_TTL: + DecodeUNumber(v, &(flowMessage.IpTtl)) + + // IP + case netflow.NFV9_FIELD_IP_PROTOCOL_VERSION: + if len(v) > 0 { + if v[0] == 4 { + flowMessage.Etype = 0x800 + } else if v[0] == 6 { + flowMessage.Etype = 0x86dd + } + } + + case netflow.NFV9_FIELD_IPV4_SRC_ADDR: + addrReplaceCheck(&(flowMessage.SrcAddr), v, &(flowMessage.Etype), false) + + case netflow.NFV9_FIELD_IPV4_DST_ADDR: + addrReplaceCheck(&(flowMessage.DstAddr), v, &(flowMessage.Etype), false) + + case netflow.NFV9_FIELD_SRC_MASK: + DecodeUNumber(v, &(flowMessage.SrcNet)) + case netflow.NFV9_FIELD_DST_MASK: + DecodeUNumber(v, &(flowMessage.DstNet)) + + case netflow.NFV9_FIELD_IPV6_SRC_ADDR: + addrReplaceCheck(&(flowMessage.SrcAddr), v, &(flowMessage.Etype), true) + + case netflow.NFV9_FIELD_IPV6_DST_ADDR: + addrReplaceCheck(&(flowMessage.DstAddr), v, &(flowMessage.Etype), true) + + case netflow.NFV9_FIELD_IPV6_SRC_MASK: + DecodeUNumber(v, &(flowMessage.SrcNet)) + case netflow.NFV9_FIELD_IPV6_DST_MASK: + DecodeUNumber(v, &(flowMessage.DstNet)) + + case netflow.NFV9_FIELD_IPV4_NEXT_HOP: + flowMessage.NextHop = v + case netflow.NFV9_FIELD_BGP_IPV4_NEXT_HOP: + flowMessage.BgpNextHop = v + + case netflow.NFV9_FIELD_IPV6_NEXT_HOP: + flowMessage.NextHop = v + case netflow.NFV9_FIELD_BGP_IPV6_NEXT_HOP: + flowMessage.BgpNextHop = v + + // ICMP + case netflow.NFV9_FIELD_ICMP_TYPE: + var icmpTypeCode uint16 + DecodeUNumber(v, &icmpTypeCode) + flowMessage.IcmpType = uint32(icmpTypeCode >> 8) + flowMessage.IcmpCode = uint32(icmpTypeCode & 0xff) + case netflow.IPFIX_FIELD_icmpTypeCodeIPv6: + var icmpTypeCode uint16 + DecodeUNumber(v, &icmpTypeCode) + flowMessage.IcmpType = uint32(icmpTypeCode >> 8) + flowMessage.IcmpCode = uint32(icmpTypeCode & 0xff) + case netflow.IPFIX_FIELD_icmpTypeIPv4: + DecodeUNumber(v, &(flowMessage.IcmpType)) + case netflow.IPFIX_FIELD_icmpTypeIPv6: + DecodeUNumber(v, &(flowMessage.IcmpType)) + case netflow.IPFIX_FIELD_icmpCodeIPv4: + DecodeUNumber(v, &(flowMessage.IcmpCode)) + case netflow.IPFIX_FIELD_icmpCodeIPv6: + DecodeUNumber(v, &(flowMessage.IcmpCode)) + + // Mac + case netflow.NFV9_FIELD_IN_SRC_MAC: + DecodeUNumber(v, &(flowMessage.SrcMac)) + case netflow.NFV9_FIELD_IN_DST_MAC: + DecodeUNumber(v, &(flowMessage.DstMac)) + case netflow.NFV9_FIELD_OUT_SRC_MAC: + DecodeUNumber(v, &(flowMessage.SrcMac)) + case netflow.NFV9_FIELD_OUT_DST_MAC: + DecodeUNumber(v, &(flowMessage.DstMac)) + + case netflow.NFV9_FIELD_SRC_VLAN: + DecodeUNumber(v, &(flowMessage.VlanId)) + DecodeUNumber(v, &(flowMessage.SrcVlan)) + case netflow.NFV9_FIELD_DST_VLAN: + DecodeUNumber(v, &(flowMessage.DstVlan)) + + case netflow.IPFIX_FIELD_ingressVRFID: + DecodeUNumber(v, &(flowMessage.IngressVrfId)) + case netflow.IPFIX_FIELD_egressVRFID: + DecodeUNumber(v, &(flowMessage.EgressVrfId)) + + case netflow.NFV9_FIELD_IPV4_IDENT: + DecodeUNumber(v, &(flowMessage.FragmentId)) + case netflow.NFV9_FIELD_FRAGMENT_OFFSET: + var fragOffset uint32 + DecodeUNumber(v, &fragOffset) + flowMessage.FragmentOffset |= fragOffset + case netflow.IPFIX_FIELD_fragmentFlags: + var ipFlags uint32 + DecodeUNumber(v, &ipFlags) + flowMessage.FragmentOffset |= ipFlags + case netflow.NFV9_FIELD_IPV6_FLOW_LABEL: + DecodeUNumber(v, &(flowMessage.Ipv6FlowLabel)) + + case netflow.IPFIX_FIELD_biflowDirection: + DecodeUNumber(v, &(flowMessage.BiFlowDirection)) + + case netflow.NFV9_FIELD_DIRECTION: + DecodeUNumber(v, &(flowMessage.FlowDirection)) + + // MPLS + case netflow.IPFIX_FIELD_mplsTopLabelStackSection: + var mplsLabel uint32 + DecodeUNumber(v, &mplsLabel) + flowMessage.Mpls_1Label = uint32(mplsLabel >> 4) + flowMessage.HasMpls = true + case netflow.IPFIX_FIELD_mplsLabelStackSection2: + var mplsLabel uint32 + DecodeUNumber(v, &mplsLabel) + flowMessage.Mpls_2Label = uint32(mplsLabel >> 4) + case netflow.IPFIX_FIELD_mplsLabelStackSection3: + var mplsLabel uint32 + DecodeUNumber(v, &mplsLabel) + flowMessage.Mpls_3Label = uint32(mplsLabel >> 4) + case netflow.IPFIX_FIELD_mplsTopLabelIPv4Address: + flowMessage.MplsLabelIp = v + case netflow.IPFIX_FIELD_mplsTopLabelIPv6Address: + flowMessage.MplsLabelIp = v + + default: + if version == 9 { + // NetFlow v9 time works with a differential based on router's uptime + switch df.Type { + case netflow.NFV9_FIELD_FIRST_SWITCHED: + var timeFirstSwitched uint32 + DecodeUNumber(v, &timeFirstSwitched) + timeDiff := (uptime - timeFirstSwitched) + flowMessage.TimeFlowStart = uint64(baseTime - timeDiff/1000) + flowMessage.TimeFlowStartMs = uint64(baseTime)*1000 - uint64(timeDiff) + case netflow.NFV9_FIELD_LAST_SWITCHED: + var timeLastSwitched uint32 + DecodeUNumber(v, &timeLastSwitched) + timeDiff := (uptime - timeLastSwitched) + flowMessage.TimeFlowEnd = uint64(baseTime - timeDiff/1000) + flowMessage.TimeFlowEndMs = uint64(baseTime)*1000 - uint64(timeDiff) + } + } else if version == 10 { + switch df.Type { + case netflow.IPFIX_FIELD_flowStartSeconds: + DecodeUNumber(v, &time) + flowMessage.TimeFlowStart = time + flowMessage.TimeFlowStartMs = time * 1000 + case netflow.IPFIX_FIELD_flowStartMilliseconds: + DecodeUNumber(v, &time) + flowMessage.TimeFlowStart = time / 1000 + flowMessage.TimeFlowStartMs = time + case netflow.IPFIX_FIELD_flowStartMicroseconds: + DecodeUNumber(v, &time) + flowMessage.TimeFlowStart = time / 1000000 + flowMessage.TimeFlowStartMs = time / 1000 + case netflow.IPFIX_FIELD_flowStartNanoseconds: + DecodeUNumber(v, &time) + flowMessage.TimeFlowStart = time / 1000000000 + flowMessage.TimeFlowStartMs = time / 1000000 + case netflow.IPFIX_FIELD_flowEndSeconds: + DecodeUNumber(v, &time) + flowMessage.TimeFlowEnd = time + flowMessage.TimeFlowEndMs = time * 1000 + case netflow.IPFIX_FIELD_flowEndMilliseconds: + DecodeUNumber(v, &time) + flowMessage.TimeFlowEnd = time / 1000 + flowMessage.TimeFlowEndMs = time + case netflow.IPFIX_FIELD_flowEndMicroseconds: + DecodeUNumber(v, &time) + flowMessage.TimeFlowEnd = time / 1000000 + flowMessage.TimeFlowEndMs = time / 1000 + case netflow.IPFIX_FIELD_flowEndNanoseconds: + DecodeUNumber(v, &time) + flowMessage.TimeFlowEnd = time / 1000000000 + flowMessage.TimeFlowEndMs = time / 1000000 + case netflow.IPFIX_FIELD_flowStartDeltaMicroseconds: + DecodeUNumber(v, &time) + flowMessage.TimeFlowStart = uint64(baseTime) - time/1000000 + flowMessage.TimeFlowStartMs = uint64(baseTime)*1000 - time/1000 + case netflow.IPFIX_FIELD_flowEndDeltaMicroseconds: + DecodeUNumber(v, &time) + flowMessage.TimeFlowEnd = uint64(baseTime) - time/1000000 + flowMessage.TimeFlowEndMs = uint64(baseTime)*1000 - time/1000 + // RFC7133 + case netflow.IPFIX_FIELD_dataLinkFrameSize: + DecodeUNumber(v, &(flowMessage.Bytes)) + flowMessage.Packets = 1 + case netflow.IPFIX_FIELD_dataLinkFrameSection: + ParseEthernetHeader(flowMessage, v, mapperSFlow) + flowMessage.Packets = 1 + if flowMessage.Bytes == 0 { + flowMessage.Bytes = uint64(len(v)) + } + } + } + } + + } + + return flowMessage +} + +func SearchNetFlowDataSetsRecords(version uint16, baseTime uint32, uptime uint32, dataRecords []netflow.DataRecord, mapperNetFlow *NetFlowMapper, mapperSFlow *SFlowMapper) []*flowmessage.FlowMessage { + var flowMessageSet []*flowmessage.FlowMessage + for _, record := range dataRecords { + fmsg := ConvertNetFlowDataSet(version, baseTime, uptime, record.Values, mapperNetFlow, mapperSFlow) + if fmsg != nil { + flowMessageSet = append(flowMessageSet, fmsg) + } + } + return flowMessageSet +} + +func SearchNetFlowDataSets(version uint16, baseTime uint32, uptime uint32, dataFlowSet []netflow.DataFlowSet, mapperNetFlow *NetFlowMapper, mapperSFlow *SFlowMapper) []*flowmessage.FlowMessage { + var flowMessageSet []*flowmessage.FlowMessage + for _, dataFlowSetItem := range dataFlowSet { + fmsg := SearchNetFlowDataSetsRecords(version, baseTime, uptime, dataFlowSetItem.Records, mapperNetFlow, mapperSFlow) + if fmsg != nil { + flowMessageSet = append(flowMessageSet, fmsg...) + } + } + return flowMessageSet +} + +func SearchNetFlowOptionDataSets(dataFlowSet []netflow.OptionsDataFlowSet) (uint32, bool) { + var samplingRate uint32 + var found bool + for _, dataFlowSetItem := range dataFlowSet { + for _, record := range dataFlowSetItem.Records { + b := NetFlowPopulate(record.OptionsValues, 305, &samplingRate) + if b { + return samplingRate, b + } + b = NetFlowPopulate(record.OptionsValues, 50, &samplingRate) + if b { + return samplingRate, b + } + b = NetFlowPopulate(record.OptionsValues, 34, &samplingRate) + if b { + return samplingRate, b + } + } + } + return samplingRate, found +} + +func SplitNetFlowSets(packetNFv9 netflow.NFv9Packet) ([]netflow.DataFlowSet, []netflow.TemplateFlowSet, []netflow.NFv9OptionsTemplateFlowSet, []netflow.OptionsDataFlowSet) { + var dataFlowSet []netflow.DataFlowSet + var templatesFlowSet []netflow.TemplateFlowSet + var optionsTemplatesFlowSet []netflow.NFv9OptionsTemplateFlowSet + var optionsDataFlowSet []netflow.OptionsDataFlowSet + for _, flowSet := range packetNFv9.FlowSets { + switch tFlowSet := flowSet.(type) { + case netflow.TemplateFlowSet: + templatesFlowSet = append(templatesFlowSet, tFlowSet) + case netflow.NFv9OptionsTemplateFlowSet: + optionsTemplatesFlowSet = append(optionsTemplatesFlowSet, tFlowSet) + case netflow.DataFlowSet: + dataFlowSet = append(dataFlowSet, tFlowSet) + case netflow.OptionsDataFlowSet: + optionsDataFlowSet = append(optionsDataFlowSet, tFlowSet) + } + } + return dataFlowSet, templatesFlowSet, optionsTemplatesFlowSet, optionsDataFlowSet +} + +func SplitIPFIXSets(packetIPFIX netflow.IPFIXPacket) ([]netflow.DataFlowSet, []netflow.TemplateFlowSet, []netflow.IPFIXOptionsTemplateFlowSet, []netflow.OptionsDataFlowSet) { + var dataFlowSet []netflow.DataFlowSet + var templatesFlowSet []netflow.TemplateFlowSet + var optionsTemplatesFlowSet []netflow.IPFIXOptionsTemplateFlowSet + var optionsDataFlowSet []netflow.OptionsDataFlowSet + for _, flowSet := range packetIPFIX.FlowSets { + switch tFlowSet := flowSet.(type) { + case netflow.TemplateFlowSet: + templatesFlowSet = append(templatesFlowSet, tFlowSet) + case netflow.IPFIXOptionsTemplateFlowSet: + optionsTemplatesFlowSet = append(optionsTemplatesFlowSet, tFlowSet) + case netflow.DataFlowSet: + dataFlowSet = append(dataFlowSet, tFlowSet) + case netflow.OptionsDataFlowSet: + optionsDataFlowSet = append(optionsDataFlowSet, tFlowSet) + } + } + return dataFlowSet, templatesFlowSet, optionsTemplatesFlowSet, optionsDataFlowSet +} + +func ProcessMessageNetFlow(msgDec interface{}, samplingRateSys SamplingRateSystem) ([]*flowmessage.FlowMessage, error) { + return ProcessMessageNetFlowConfig(msgDec, samplingRateSys, nil) +} + +// Convert a NetFlow datastructure to a FlowMessage protobuf +// Does not put sampling rate +func ProcessMessageNetFlowConfig(msgDec interface{}, samplingRateSys SamplingRateSystem, config *ProducerConfigMapped) ([]*flowmessage.FlowMessage, error) { + seqnum := uint32(0) + var baseTime uint32 + var uptime uint32 + + var flowMessageSet []*flowmessage.FlowMessage + + switch msgDecConv := msgDec.(type) { + case netflow.NFv9Packet: + dataFlowSet, _, _, optionDataFlowSet := SplitNetFlowSets(msgDecConv) + + seqnum = msgDecConv.SequenceNumber + baseTime = msgDecConv.UnixSeconds + uptime = msgDecConv.SystemUptime + obsDomainId := msgDecConv.SourceId + + var cfg *NetFlowMapper + if config != nil { + cfg = config.NetFlowV9 + } + flowMessageSet = SearchNetFlowDataSets(9, baseTime, uptime, dataFlowSet, cfg, nil) + samplingRate, found := SearchNetFlowOptionDataSets(optionDataFlowSet) + if samplingRateSys != nil { + if found { + samplingRateSys.AddSamplingRate(9, obsDomainId, samplingRate) + } else { + samplingRate, _ = samplingRateSys.GetSamplingRate(9, obsDomainId) + } + } + for _, fmsg := range flowMessageSet { + fmsg.SequenceNum = seqnum + fmsg.SamplingRate = uint64(samplingRate) + } + case netflow.IPFIXPacket: + dataFlowSet, _, _, optionDataFlowSet := SplitIPFIXSets(msgDecConv) + + seqnum = msgDecConv.SequenceNumber + baseTime = msgDecConv.ExportTime + obsDomainId := msgDecConv.ObservationDomainId + + var cfgIpfix *NetFlowMapper + var cfgSflow *SFlowMapper + if config != nil { + cfgIpfix = config.IPFIX + cfgSflow = config.SFlow + } + flowMessageSet = SearchNetFlowDataSets(10, baseTime, uptime, dataFlowSet, cfgIpfix, cfgSflow) + + samplingRate, found := SearchNetFlowOptionDataSets(optionDataFlowSet) + if samplingRateSys != nil { + if found { + samplingRateSys.AddSamplingRate(10, obsDomainId, samplingRate) + } else { + samplingRate, _ = samplingRateSys.GetSamplingRate(10, obsDomainId) + } + } + for _, fmsg := range flowMessageSet { + fmsg.SequenceNum = seqnum + fmsg.SamplingRate = uint64(samplingRate) + fmsg.ObservationDomainId = obsDomainId + } + default: + return flowMessageSet, errors.New("Bad NetFlow/IPFIX version") + } + + return flowMessageSet, nil +} diff --git a/third_party/goflow2/producer/producer_nflegacy.go b/third_party/goflow2/producer/producer_nflegacy.go new file mode 100644 index 000000000000..8acb3eeaa5ce --- /dev/null +++ b/third_party/goflow2/producer/producer_nflegacy.go @@ -0,0 +1,81 @@ +package producer + +import ( + "encoding/binary" + "errors" + "net" + + "github.com/netsampler/goflow2/decoders/netflowlegacy" + flowmessage "github.com/netsampler/goflow2/pb" +) + +func ConvertNetFlowLegacyRecord(baseTime uint32, uptime uint32, record netflowlegacy.RecordsNetFlowV5) *flowmessage.FlowMessage { + flowMessage := &flowmessage.FlowMessage{} + + flowMessage.Type = flowmessage.FlowMessage_NETFLOW_V5 + + timeDiffFirst := (uptime - record.First) + timeDiffLast := (uptime - record.Last) + flowMessage.TimeFlowStart = uint64(baseTime - timeDiffFirst/1000) + flowMessage.TimeFlowStartMs = uint64(baseTime)*1000 - uint64(timeDiffFirst) + flowMessage.TimeFlowEnd = uint64(baseTime - timeDiffLast/1000) + flowMessage.TimeFlowEndMs = uint64(baseTime)*1000 - uint64(timeDiffLast) + + v := make(net.IP, 4) + binary.BigEndian.PutUint32(v, record.NextHop) + flowMessage.NextHop = v + v = make(net.IP, 4) + binary.BigEndian.PutUint32(v, record.SrcAddr) + flowMessage.SrcAddr = v + v = make(net.IP, 4) + binary.BigEndian.PutUint32(v, record.DstAddr) + flowMessage.DstAddr = v + + flowMessage.Etype = 0x800 + flowMessage.SrcAs = uint32(record.SrcAS) + flowMessage.DstAs = uint32(record.DstAS) + flowMessage.SrcNet = uint32(record.SrcMask) + flowMessage.DstNet = uint32(record.DstMask) + flowMessage.Proto = uint32(record.Proto) + flowMessage.TcpFlags = uint32(record.TCPFlags) + flowMessage.IpTos = uint32(record.Tos) + flowMessage.InIf = uint32(record.Input) + flowMessage.OutIf = uint32(record.Output) + flowMessage.SrcPort = uint32(record.SrcPort) + flowMessage.DstPort = uint32(record.DstPort) + flowMessage.Packets = uint64(record.DPkts) + flowMessage.Bytes = uint64(record.DOctets) + + return flowMessage +} + +func SearchNetFlowLegacyRecords(baseTime uint32, uptime uint32, dataRecords []netflowlegacy.RecordsNetFlowV5) []*flowmessage.FlowMessage { + var flowMessageSet []*flowmessage.FlowMessage + for _, record := range dataRecords { + fmsg := ConvertNetFlowLegacyRecord(baseTime, uptime, record) + if fmsg != nil { + flowMessageSet = append(flowMessageSet, fmsg) + } + } + return flowMessageSet +} + +func ProcessMessageNetFlowLegacy(msgDec interface{}) ([]*flowmessage.FlowMessage, error) { + switch packet := msgDec.(type) { + case netflowlegacy.PacketNetFlowV5: + seqnum := packet.FlowSequence + samplingRate := packet.SamplingInterval + baseTime := packet.UnixSecs + uptime := packet.SysUptime + + flowMessageSet := SearchNetFlowLegacyRecords(baseTime, uptime, packet.Records) + for _, fmsg := range flowMessageSet { + fmsg.SequenceNum = seqnum + fmsg.SamplingRate = uint64(samplingRate) + } + + return flowMessageSet, nil + default: + return []*flowmessage.FlowMessage{}, errors.New("Bad NetFlow v5 version") + } +} diff --git a/third_party/goflow2/producer/producer_sf.go b/third_party/goflow2/producer/producer_sf.go new file mode 100644 index 000000000000..5ff5a871dec0 --- /dev/null +++ b/third_party/goflow2/producer/producer_sf.go @@ -0,0 +1,349 @@ +package producer + +import ( + "encoding/binary" + "errors" + "net" + + "github.com/netsampler/goflow2/decoders/sflow" + flowmessage "github.com/netsampler/goflow2/pb" +) + +func GetSFlowFlowSamples(packet *sflow.Packet) []interface{} { + var flowSamples []interface{} + for _, sample := range packet.Samples { + switch sample.(type) { + case sflow.FlowSample: + flowSamples = append(flowSamples, sample) + case sflow.ExpandedFlowSample: + flowSamples = append(flowSamples, sample) + } + } + return flowSamples +} + +func ParseSampledHeader(flowMessage *flowmessage.FlowMessage, sampledHeader *sflow.SampledHeader) error { + return ParseSampledHeaderConfig(flowMessage, sampledHeader, nil) +} + +func ParseEthernetHeader(flowMessage *flowmessage.FlowMessage, data []byte, config *SFlowMapper) { + var hasMpls bool + var countMpls uint32 + var firstLabelMpls uint32 + var firstTtlMpls uint8 + var secondLabelMpls uint32 + var secondTtlMpls uint8 + var thirdLabelMpls uint32 + var thirdTtlMpls uint8 + var lastLabelMpls uint32 + var lastTtlMpls uint8 + + var nextHeader byte + var tcpflags byte + srcIP := net.IP{} + dstIP := net.IP{} + offset := 14 + + var srcMac uint64 + var dstMac uint64 + + var tos byte + var ttl byte + var identification uint16 + var fragOffset uint16 + var flowLabel uint32 + + var srcPort uint16 + var dstPort uint16 + + for _, configLayer := range GetSFlowConfigLayer(config, 0) { + extracted := GetBytes(data, configLayer.Offset, configLayer.Length) + MapCustom(flowMessage, extracted, configLayer.Destination, configLayer.Endian) + } + + etherType := data[12:14] + + dstMac = binary.BigEndian.Uint64(append([]byte{0, 0}, data[0:6]...)) + srcMac = binary.BigEndian.Uint64(append([]byte{0, 0}, data[6:12]...)) + (*flowMessage).SrcMac = srcMac + (*flowMessage).DstMac = dstMac + + encap := true + iterations := 0 + for encap && iterations <= 1 { + encap = false + + if etherType[0] == 0x81 && etherType[1] == 0x0 { // VLAN 802.1Q + (*flowMessage).VlanId = uint32(binary.BigEndian.Uint16(data[14:16])) + offset += 4 + etherType = data[16:18] + } + + if etherType[0] == 0x88 && etherType[1] == 0x47 { // MPLS + iterateMpls := true + hasMpls = true + for iterateMpls { + if len(data) < offset+5 { + iterateMpls = false + break + } + label := binary.BigEndian.Uint32(append([]byte{0}, data[offset:offset+3]...)) >> 4 + //exp := data[offset+2] > 1 + bottom := data[offset+2] & 1 + mplsTtl := data[offset+3] + offset += 4 + + if bottom == 1 || label <= 15 || offset > len(data) { + if data[offset]&0xf0>>4 == 4 { + etherType = []byte{0x8, 0x0} + } else if data[offset]&0xf0>>4 == 6 { + etherType = []byte{0x86, 0xdd} + } + iterateMpls = false + } + + if countMpls == 0 { + firstLabelMpls = label + firstTtlMpls = mplsTtl + } else if countMpls == 1 { + secondLabelMpls = label + secondTtlMpls = mplsTtl + } else if countMpls == 2 { + thirdLabelMpls = label + thirdTtlMpls = mplsTtl + } else { + lastLabelMpls = label + lastTtlMpls = mplsTtl + } + countMpls++ + } + } + + for _, configLayer := range GetSFlowConfigLayer(config, 3) { + extracted := GetBytes(data, offset*8+configLayer.Offset, configLayer.Length) + MapCustom(flowMessage, extracted, configLayer.Destination, configLayer.Endian) + } + + if etherType[0] == 0x8 && etherType[1] == 0x0 { // IPv4 + if len(data) >= offset+20 { + nextHeader = data[offset+9] + srcIP = data[offset+12 : offset+16] + dstIP = data[offset+16 : offset+20] + tos = data[offset+1] + ttl = data[offset+8] + + identification = binary.BigEndian.Uint16(data[offset+4 : offset+6]) + fragOffset = binary.BigEndian.Uint16(data[offset+6 : offset+8]) + + offset += 20 + } + } else if etherType[0] == 0x86 && etherType[1] == 0xdd { // IPv6 + if len(data) >= offset+40 { + nextHeader = data[offset+6] + srcIP = data[offset+8 : offset+24] + dstIP = data[offset+24 : offset+40] + + tostmp := uint32(binary.BigEndian.Uint16(data[offset : offset+2])) + tos = uint8(tostmp & 0x0ff0 >> 4) + ttl = data[offset+7] + + flowLabel = binary.BigEndian.Uint32(data[offset : offset+4]) + + offset += 40 + + } + } else if etherType[0] == 0x8 && etherType[1] == 0x6 { // ARP + } /*else { + return errors.New(fmt.Sprintf("Unknown EtherType: %v\n", etherType)) + } */ + + for _, configLayer := range GetSFlowConfigLayer(config, 4) { + extracted := GetBytes(data, offset*8+configLayer.Offset, configLayer.Length) + MapCustom(flowMessage, extracted, configLayer.Destination, configLayer.Endian) + } + + appOffset := 0 + if len(data) >= offset+4 && (nextHeader == 17 || nextHeader == 6) { + srcPort = binary.BigEndian.Uint16(data[offset+0 : offset+2]) + dstPort = binary.BigEndian.Uint16(data[offset+2 : offset+4]) + } + + if nextHeader == 17 { + appOffset = 8 + } + + if len(data) > offset+13 && nextHeader == 6 { + tcpflags = data[offset+13] + + appOffset = int(data[13]>>4) * 4 + } + + // ICMP and ICMPv6 + if len(data) >= offset+2 && (nextHeader == 1 || nextHeader == 58) { + (*flowMessage).IcmpType = uint32(data[offset+0]) + (*flowMessage).IcmpCode = uint32(data[offset+1]) + } + + if appOffset > 0 { + for _, configLayer := range GetSFlowConfigLayer(config, 7) { + extracted := GetBytes(data, (offset+appOffset)*8+configLayer.Offset, configLayer.Length) + MapCustom(flowMessage, extracted, configLayer.Destination, configLayer.Endian) + } + } + + iterations++ + } + + (*flowMessage).HasMpls = hasMpls + (*flowMessage).MplsCount = countMpls + (*flowMessage).Mpls_1Label = firstLabelMpls + (*flowMessage).Mpls_1Ttl = uint32(firstTtlMpls) + (*flowMessage).Mpls_2Label = secondLabelMpls + (*flowMessage).Mpls_2Ttl = uint32(secondTtlMpls) + (*flowMessage).Mpls_3Label = thirdLabelMpls + (*flowMessage).Mpls_3Ttl = uint32(thirdTtlMpls) + (*flowMessage).MplsLastLabel = lastLabelMpls + (*flowMessage).MplsLastTtl = uint32(lastTtlMpls) + + (*flowMessage).Etype = uint32(binary.BigEndian.Uint16(etherType[0:2])) + (*flowMessage).Ipv6FlowLabel = flowLabel & 0xFFFFF + + (*flowMessage).SrcPort = uint32(srcPort) + (*flowMessage).DstPort = uint32(dstPort) + + (*flowMessage).SrcAddr = srcIP + (*flowMessage).DstAddr = dstIP + (*flowMessage).Proto = uint32(nextHeader) + (*flowMessage).IpTos = uint32(tos) + (*flowMessage).IpTtl = uint32(ttl) + (*flowMessage).TcpFlags = uint32(tcpflags) + + (*flowMessage).FragmentId = uint32(identification) + (*flowMessage).FragmentOffset = uint32(fragOffset) +} + +func ParseSampledHeaderConfig(flowMessage *flowmessage.FlowMessage, sampledHeader *sflow.SampledHeader, config *SFlowMapper) error { + data := (*sampledHeader).HeaderData + switch (*sampledHeader).Protocol { + case 1: // Ethernet + ParseEthernetHeader(flowMessage, data, config) + } + return nil +} + +func SearchSFlowSamples(samples []interface{}) []*flowmessage.FlowMessage { + return SearchSFlowSamples(samples) +} + +func SearchSFlowSamplesConfig(samples []interface{}, config *SFlowMapper) []*flowmessage.FlowMessage { + var flowMessageSet []*flowmessage.FlowMessage + + for _, flowSample := range samples { + var records []sflow.FlowRecord + + flowMessage := &flowmessage.FlowMessage{} + flowMessage.Type = flowmessage.FlowMessage_SFLOW_5 + + switch flowSample := flowSample.(type) { + case sflow.FlowSample: + records = flowSample.Records + flowMessage.SamplingRate = uint64(flowSample.SamplingRate) + flowMessage.InIf = flowSample.Input + flowMessage.OutIf = flowSample.Output + case sflow.ExpandedFlowSample: + records = flowSample.Records + flowMessage.SamplingRate = uint64(flowSample.SamplingRate) + flowMessage.InIf = flowSample.InputIfValue + flowMessage.OutIf = flowSample.OutputIfValue + } + + ipNh := net.IP{} + ipSrc := net.IP{} + ipDst := net.IP{} + flowMessage.Packets = 1 + for _, record := range records { + switch recordData := record.Data.(type) { + case sflow.SampledHeader: + flowMessage.Bytes = uint64(recordData.FrameLength) + ParseSampledHeaderConfig(flowMessage, &recordData, config) + case sflow.SampledIPv4: + ipSrc = recordData.Base.SrcIP + ipDst = recordData.Base.DstIP + flowMessage.SrcAddr = ipSrc + flowMessage.DstAddr = ipDst + flowMessage.Bytes = uint64(recordData.Base.Length) + flowMessage.Proto = recordData.Base.Protocol + flowMessage.SrcPort = recordData.Base.SrcPort + flowMessage.DstPort = recordData.Base.DstPort + flowMessage.IpTos = recordData.Tos + flowMessage.Etype = 0x800 + case sflow.SampledIPv6: + ipSrc = recordData.Base.SrcIP + ipDst = recordData.Base.DstIP + flowMessage.SrcAddr = ipSrc + flowMessage.DstAddr = ipDst + flowMessage.Bytes = uint64(recordData.Base.Length) + flowMessage.Proto = recordData.Base.Protocol + flowMessage.SrcPort = recordData.Base.SrcPort + flowMessage.DstPort = recordData.Base.DstPort + flowMessage.IpTos = recordData.Priority + flowMessage.Etype = 0x86dd + case sflow.ExtendedRouter: + ipNh = recordData.NextHop + flowMessage.NextHop = ipNh + flowMessage.SrcNet = recordData.SrcMaskLen + flowMessage.DstNet = recordData.DstMaskLen + case sflow.ExtendedGateway: + ipNh = recordData.NextHop + flowMessage.BgpNextHop = ipNh + flowMessage.BgpCommunities = recordData.Communities + flowMessage.AsPath = recordData.ASPath + if len(recordData.ASPath) > 0 { + flowMessage.DstAs = recordData.ASPath[len(recordData.ASPath)-1] + flowMessage.NextHopAs = recordData.ASPath[0] + } else { + flowMessage.DstAs = recordData.AS + } + if recordData.SrcAS > 0 { + flowMessage.SrcAs = recordData.SrcAS + } else { + flowMessage.SrcAs = recordData.AS + } + case sflow.ExtendedSwitch: + flowMessage.SrcVlan = recordData.SrcVlan + flowMessage.DstVlan = recordData.DstVlan + } + } + flowMessageSet = append(flowMessageSet, flowMessage) + } + return flowMessageSet +} + +func ProcessMessageSFlow(msgDec interface{}) ([]*flowmessage.FlowMessage, error) { + return ProcessMessageSFlowConfig(msgDec, nil) +} + +func ProcessMessageSFlowConfig(msgDec interface{}, config *ProducerConfigMapped) ([]*flowmessage.FlowMessage, error) { + switch packet := msgDec.(type) { + case sflow.Packet: + seqnum := packet.SequenceNumber + var agent net.IP + agent = packet.AgentIP + + var cfg *SFlowMapper + if config != nil { + cfg = config.SFlow + } + + flowSamples := GetSFlowFlowSamples(&packet) + flowMessageSet := SearchSFlowSamplesConfig(flowSamples, cfg) + for _, fmsg := range flowMessageSet { + fmsg.SamplerAddress = agent + fmsg.SequenceNum = seqnum + } + + return flowMessageSet, nil + default: + return []*flowmessage.FlowMessage{}, errors.New("Bad sFlow version") + } +} diff --git a/third_party/goflow2/producer/producer_test.go b/third_party/goflow2/producer/producer_test.go new file mode 100644 index 000000000000..f3e622f164eb --- /dev/null +++ b/third_party/goflow2/producer/producer_test.go @@ -0,0 +1,191 @@ +package producer + +import ( + "testing" + + "github.com/netsampler/goflow2/decoders/netflow" + "github.com/netsampler/goflow2/decoders/sflow" + "github.com/stretchr/testify/assert" +) + +func TestProcessMessageNetFlow(t *testing.T) { + records := []netflow.DataRecord{ + netflow.DataRecord{ + Values: []netflow.DataField{ + netflow.DataField{ + Type: netflow.NFV9_FIELD_IPV4_SRC_ADDR, + Value: []byte{10, 0, 0, 1}, + }, + }, + }, + } + dfs := []interface{}{ + netflow.DataFlowSet{ + Records: records, + }, + } + + pktnf9 := netflow.NFv9Packet{ + FlowSets: dfs, + } + testsr := &SingleSamplingRateSystem{1} + _, err := ProcessMessageNetFlow(pktnf9, testsr) + assert.Nil(t, err) + + pktipfix := netflow.IPFIXPacket{ + FlowSets: dfs, + } + _, err = ProcessMessageNetFlow(pktipfix, testsr) + assert.Nil(t, err) +} + +func TestProcessMessageSFlow(t *testing.T) { + sh := sflow.SampledHeader{ + FrameLength: 10, + Protocol: 1, + HeaderData: []byte{ + 0xff, 0xab, 0xcd, 0xef, 0xab, 0xcd, 0xff, 0xab, 0xcd, 0xef, 0xab, 0xbc, 0x86, 0xdd, 0x60, 0x2e, + 0xc4, 0xec, 0x01, 0xcc, 0x06, 0x40, 0xfd, 0x01, 0x00, 0x00, 0xff, 0x01, 0x82, 0x10, 0xcd, 0xff, + 0xff, 0x1c, 0x00, 0x00, 0x01, 0x50, 0xfd, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x01, 0x02, 0xff, + 0xff, 0x93, 0x00, 0x00, 0x02, 0x46, 0xcf, 0xca, 0x00, 0x50, 0x05, 0x15, 0x21, 0x6f, 0xa4, 0x9c, + 0xf4, 0x59, 0x80, 0x18, 0x08, 0x09, 0x8c, 0x86, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x2a, 0x85, + 0xee, 0x9e, 0x64, 0x5c, 0x27, 0x28, + }, + } + pkt := sflow.Packet{ + Version: 5, + Samples: []interface{}{ + sflow.FlowSample{ + SamplingRate: 1, + Records: []sflow.FlowRecord{ + sflow.FlowRecord{ + Data: sh, + }, + }, + }, + sflow.ExpandedFlowSample{ + SamplingRate: 1, + Records: []sflow.FlowRecord{ + sflow.FlowRecord{ + Data: sh, + }, + }, + }, + }, + } + _, err := ProcessMessageSFlow(pkt) + assert.Nil(t, err) +} + +func TestExpandedSFlowDecode(t *testing.T) { + flowMessages, err := ProcessMessageSFlow(getSflowPacket()) + flowMessage := flowMessages[0] + + assert.Nil(t, err) + + assert.Equal(t, []byte{0x05, 0x05, 0x05, 0x05}, flowMessage.BgpNextHop) + assert.Equal(t, []uint32{3936619448, 3936619708, 3936623548}, flowMessage.BgpCommunities) + assert.Equal(t, []uint32{456}, flowMessage.AsPath) + assert.Equal(t, []byte{0x09, 0x09, 0x09, 0x09}, flowMessage.NextHop) +} + +func getSflowPacket() sflow.Packet { + return sflow.Packet{ + Version: 5, + IPVersion: 1, + AgentIP: []uint8{1, 2, 3, 4}, + SubAgentId: 0, + SequenceNumber: 3178205882, + Uptime: 3011091704, + SamplesCount: 1, + Samples: []interface{}{ + sflow.FlowSample{ + Header: sflow.SampleHeader{ + Format: 1, + Length: 662, + SampleSequenceNumber: 2757962272, + SourceIdType: 0, + SourceIdValue: 1000100, + }, + SamplingRate: 16383, + SamplePool: 639948256, + Drops: 0, + Input: 1000100, + Output: 1000005, + FlowRecordsCount: 4, + Records: []sflow.FlowRecord{ + sflow.FlowRecord{ + Header: sflow.RecordHeader{ + DataFormat: 1001, + Length: 16, + }, + Data: sflow.ExtendedSwitch{ + SrcVlan: 952, + SrcPriority: 0, + DstVlan: 952, + DstPriority: 0, + }, + }, + sflow.FlowRecord{ + Header: sflow.RecordHeader{ + DataFormat: 1, + Length: 144, + }, + Data: sflow.SampledHeader{ + Protocol: 1, + FrameLength: 1522, + Stripped: 4, + OriginalLength: 128, + HeaderData: []byte{ + 0x74, 0x83, 0xef, 0x2e, 0xc3, 0xc5, 0xac, 0x1f, 0x6b, 0x2c, 0x43, 0x36, 0x81, 0x00, 0x03, 0xb8, + 0x08, 0x00, 0x45, 0x00, 0x05, 0xdc, 0x59, 0xa5, 0x40, 0x00, 0x40, 0x06, 0x0a, 0xb8, 0xb9, 0x3b, + 0xdf, 0xb6, 0x32, 0x44, 0x05, 0x89, 0x23, 0x78, 0xc9, 0x06, 0x24, 0x6c, 0x0b, 0xf4, 0xd9, 0xce, + 0x9c, 0x66, 0x50, 0x10, 0x00, 0x1e, 0x29, 0x8a, 0x00, 0x00, 0xb4, 0x7e, 0xb7, 0xfd, 0x16, 0x3e, + 0x19, 0x97, 0xa8, 0xb4, 0x2a, 0xf7, 0x49, 0x96, 0xf4, 0x0e, 0xef, 0xa7, 0x55, 0x93, 0x27, 0x6f, + 0x1e, 0x20, 0xe1, 0x04, 0x2f, 0x36, 0x18, 0xfe, 0x7b, 0x88, 0x1f, 0xc9, 0x57, 0xbc, 0x71, 0x43, + 0x3d, 0x1c, 0x6c, 0xb0, 0x3d, 0xf7, 0x51, 0x48, 0x68, 0x94, 0x47, 0x00, 0xd3, 0x1a, 0x9d, 0xdb, + 0x2f, 0x1e, 0x39, 0xcf, 0xfd, 0x96, 0x79, 0xdf, 0xb0, 0x2d, 0x02, 0x6e, 0x72, 0xf5, 0x29, 0x73, + }, + }, + }, + sflow.FlowRecord{ + Header: sflow.RecordHeader{ + DataFormat: 1003, + Length: 56, + }, + Data: sflow.ExtendedGateway{ + NextHopIPVersion: 1, + NextHop: []uint8{5, 5, 5, 5}, + AS: 123, + SrcAS: 0, + SrcPeerAS: 0, + ASDestinations: 1, + ASPathType: 2, + ASPathLength: 1, + ASPath: []uint32{456}, + CommunitiesLength: 3, + Communities: []uint32{ + 3936619448, + 3936619708, + 3936623548, + }, + LocalPref: 170, + }, + }, + sflow.FlowRecord{ + Header: sflow.RecordHeader{ + DataFormat: 1002, + Length: 16, + }, + Data: sflow.ExtendedRouter{ + NextHopIPVersion: 1, + NextHop: []uint8{9, 9, 9, 9}, + SrcMaskLen: 26, + DstMaskLen: 22, + }, + }, + }, + }, + }, + } +} diff --git a/third_party/goflow2/producer/reflect.go b/third_party/goflow2/producer/reflect.go new file mode 100644 index 000000000000..91a2a415cc79 --- /dev/null +++ b/third_party/goflow2/producer/reflect.go @@ -0,0 +1,233 @@ +package producer + +import ( + "fmt" + "reflect" + + "github.com/netsampler/goflow2/decoders/netflow" + flowmessage "github.com/netsampler/goflow2/pb" +) + +type EndianType string + +var ( + BigEndian EndianType = "big" + LittleEndian EndianType = "little" +) + +func GetBytes(d []byte, offset int, length int) []byte { + if length == 0 { + return nil + } + leftBytes := offset / 8 + rightBytes := (offset + length) / 8 + if (offset+length)%8 != 0 { + rightBytes += 1 + } + if leftBytes >= len(d) { + return nil + } + if rightBytes > len(d) { + rightBytes = len(d) + } + chunk := make([]byte, rightBytes-leftBytes) + + offsetMod8 := (offset % 8) + shiftAnd := byte(0xff >> (8 - offsetMod8)) + + var shifted byte + for i := range chunk { + j := len(chunk) - 1 - i + cur := d[j+leftBytes] + chunk[j] = (cur << offsetMod8) | shifted + shifted = shiftAnd & cur + } + last := len(chunk) - 1 + shiftAndLast := byte(0xff << ((8 - ((offset + length) % 8)) % 8)) + chunk[last] = chunk[last] & shiftAndLast + return chunk +} + +func IsUInt(k reflect.Kind) bool { + return k == reflect.Uint8 || k == reflect.Uint16 || k == reflect.Uint32 || k == reflect.Uint64 +} + +func IsInt(k reflect.Kind) bool { + return k == reflect.Int8 || k == reflect.Int16 || k == reflect.Int32 || k == reflect.Int64 +} + +func MapCustomNetFlow(flowMessage *flowmessage.FlowMessage, df netflow.DataField, mapper *NetFlowMapper) { + if mapper == nil { + return + } + mapped, ok := mapper.Map(df) + if ok { + v := df.Value.([]byte) + MapCustom(flowMessage, v, mapped.Destination, mapped.Endian) + } +} + +func MapCustom(flowMessage *flowmessage.FlowMessage, v []byte, destination string, endianness EndianType) { + vfm := reflect.ValueOf(flowMessage) + vfm = reflect.Indirect(vfm) + + fieldValue := vfm.FieldByName(destination) + + if fieldValue.IsValid() { + typeDest := fieldValue.Type() + fieldValueAddr := fieldValue.Addr() + + if typeDest.Kind() == reflect.Slice { + + if typeDest.Elem().Kind() == reflect.Uint8 { + fieldValue.SetBytes(v) + } else { + item := reflect.New(typeDest.Elem()) + + if IsUInt(typeDest.Elem().Kind()) { + if endianness == LittleEndian { + DecodeUNumberLE(v, item.Interface()) + } else { + DecodeUNumber(v, item.Interface()) + } + } else if IsUInt(typeDest.Elem().Kind()) { + if endianness == LittleEndian { + DecodeUNumberLE(v, item.Interface()) + } else { + DecodeUNumber(v, item.Interface()) + } + } + + itemi := reflect.Indirect(item) + tmpFieldValue := reflect.Append(fieldValue, itemi) + fieldValue.Set(tmpFieldValue) + } + + } else if fieldValueAddr.IsValid() && IsUInt(typeDest.Kind()) { + if endianness == LittleEndian { + DecodeUNumberLE(v, fieldValueAddr.Interface()) + } else { + DecodeUNumber(v, fieldValueAddr.Interface()) + } + } else if fieldValueAddr.IsValid() && IsInt(typeDest.Kind()) { + if endianness == LittleEndian { + DecodeUNumberLE(v, fieldValueAddr.Interface()) + } else { + DecodeUNumber(v, fieldValueAddr.Interface()) + } + } + } +} + +type NetFlowMapField struct { + PenProvided bool `json:"penprovided" yaml:"penprovided"` + Type uint16 `json:"field" yaml:"field"` + Pen uint32 `json:"pen" yaml:"pen"` + + Destination string `json:"destination" yaml:"destination"` + Endian EndianType `json:"endianness" yaml:"endianness"` + //DestinationLength uint8 `json:"dlen"` // could be used if populating a slice of uint16 that aren't in protobuf +} + +type IPFIXProducerConfig struct { + Mapping []NetFlowMapField `json:"mapping"` + //PacketMapping []SFlowMapField `json:"packet-mapping"` // for embedded frames: use sFlow configuration +} + +type NetFlowV9ProducerConfig struct { + Mapping []NetFlowMapField `json:"mapping"` +} + +type SFlowMapField struct { + Layer int `json:"layer"` + Offset int `json:"offset"` // offset in bits + Length int `json:"length"` // length in bits + + Destination string `json:"destination" yaml:"destination"` + Endian EndianType `json:"endianness" yaml:"endianness"` + //DestinationLength uint8 `json:"dlen"` +} + +type SFlowProducerConfig struct { + Mapping []SFlowMapField `json:"mapping"` +} + +type ProducerConfig struct { + IPFIX IPFIXProducerConfig `json:"ipfix"` + NetFlowV9 NetFlowV9ProducerConfig `json:"netflowv9"` + SFlow SFlowProducerConfig `json:"sflow"` // also used for IPFIX data frames + + // should do a rename map list for when printing +} + +type DataMap struct { + Destination string + Endian EndianType +} + +type NetFlowMapper struct { + data map[string]DataMap // maps field to destination +} + +func (m *NetFlowMapper) Map(field netflow.DataField) (DataMap, bool) { + mapped, found := m.data[fmt.Sprintf("%v-%d-%d", field.PenProvided, field.Pen, field.Type)] + return mapped, found +} + +func MapFieldsNetFlow(fields []NetFlowMapField) *NetFlowMapper { + ret := make(map[string]DataMap) + for _, field := range fields { + ret[fmt.Sprintf("%v-%d-%d", field.PenProvided, field.Pen, field.Type)] = DataMap{Destination: field.Destination, Endian: field.Endian} + } + return &NetFlowMapper{ret} +} + +type DataMapLayer struct { + Offset int + Length int + Destination string + Endian EndianType +} + +type SFlowMapper struct { + data map[int][]DataMapLayer // map layer to list of offsets +} + +func GetSFlowConfigLayer(m *SFlowMapper, layer int) []DataMapLayer { + if m == nil { + return nil + } + return m.data[layer] +} + +func MapFieldsSFlow(fields []SFlowMapField) *SFlowMapper { + ret := make(map[int][]DataMapLayer) + for _, field := range fields { + retLayerEntry := DataMapLayer{ + Offset: field.Offset, + Length: field.Length, + Destination: field.Destination, + Endian: field.Endian, + } + retLayer := ret[field.Layer] + retLayer = append(retLayer, retLayerEntry) + ret[field.Layer] = retLayer + } + return &SFlowMapper{ret} +} + +type ProducerConfigMapped struct { + IPFIX *NetFlowMapper `json:"ipfix"` + NetFlowV9 *NetFlowMapper `json:"netflowv9"` + SFlow *SFlowMapper `json:"sflow"` +} + +func NewProducerConfigMapped(config *ProducerConfig) *ProducerConfigMapped { + newCfg := &ProducerConfigMapped{} + if config != nil { + newCfg.IPFIX = MapFieldsNetFlow(config.IPFIX.Mapping) + newCfg.NetFlowV9 = MapFieldsNetFlow(config.NetFlowV9.Mapping) + newCfg.SFlow = MapFieldsSFlow(config.SFlow.Mapping) + } + return newCfg +} diff --git a/third_party/goflow2/transport/file/transport.go b/third_party/goflow2/transport/file/transport.go new file mode 100644 index 000000000000..5143c8b0b636 --- /dev/null +++ b/third_party/goflow2/transport/file/transport.go @@ -0,0 +1,101 @@ +package file + +import ( + "context" + "flag" + "fmt" + "github.com/netsampler/goflow2/transport" + "io" + "os" + "os/signal" + "sync" + "syscall" +) + +type FileDriver struct { + fileDestination string + lineSeparator string + w io.Writer + file *os.File + lock *sync.RWMutex + q chan bool +} + +func (d *FileDriver) Prepare() error { + flag.StringVar(&d.fileDestination, "transport.file", "", "File/console output (empty for stdout)") + flag.StringVar(&d.lineSeparator, "transport.file.sep", "\n", "Line separator") + // idea: add terminal coloring based on key partitioning (if any) + return nil +} + +func (d *FileDriver) openFile() error { + file, err := os.OpenFile(d.fileDestination, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + if err != nil { + return err + } + d.file = file + d.w = d.file + return err +} + +func (d *FileDriver) Init(context.Context) error { + d.q = make(chan bool, 1) + + if d.fileDestination == "" { + d.w = os.Stdout + } else { + var err error + + d.lock.Lock() + err = d.openFile() + d.lock.Unlock() + if err != nil { + return err + } + + c := make(chan os.Signal, 1) + signal.Notify(c, syscall.SIGHUP) + go func() { + for { + select { + case <-c: + d.lock.Lock() + d.file.Close() + d.openFile() + d.lock.Unlock() + // if there is an error, keeps using the old file + case <-d.q: + return + } + } + }() + + } + return nil +} + +func (d *FileDriver) Send(key, data []byte) error { + d.lock.RLock() + w := d.w + d.lock.RUnlock() + _, err := fmt.Fprint(w, string(data)+d.lineSeparator) + return err +} + +func (d *FileDriver) Close(context.Context) error { + if d.fileDestination != "" { + d.lock.Lock() + d.file.Close() + d.lock.Unlock() + signal.Ignore(syscall.SIGHUP) + } + close(d.q) + return nil +} + +func init() { + d := &FileDriver{ + lock: &sync.RWMutex{}, + } + transport.RegisterTransportDriver("file", d) +} diff --git a/third_party/goflow2/transport/kafka/kafka.go b/third_party/goflow2/transport/kafka/kafka.go new file mode 100644 index 000000000000..702ea5c60b8b --- /dev/null +++ b/third_party/goflow2/transport/kafka/kafka.go @@ -0,0 +1,226 @@ +package kafka + +import ( + "context" + "crypto/tls" + "crypto/x509" + "errors" + "flag" + "fmt" + "os" + "strings" + "time" + + sarama "github.com/Shopify/sarama" + "github.com/netsampler/goflow2/transport" + "github.com/netsampler/goflow2/utils" + + log "github.com/sirupsen/logrus" +) + +type KafkaDriver struct { + kafkaTLS bool + kafkaSASL string + kafkaSCRAM string + kafkaTopic string + kafkaSrv string + kafkaBrk string + kafkaMaxMsgBytes int + kafkaFlushBytes int + kafkaFlushFrequency time.Duration + + kafkaLogErrors bool + + kafkaHashing bool + kafkaVersion string + kafkaCompressionCodec string + + producer sarama.AsyncProducer + + q chan bool +} + +type KafkaSASLAlgorithm string + +const ( + KAFKA_SASL_NONE KafkaSASLAlgorithm = "none" + KAFKA_SASL_PLAIN KafkaSASLAlgorithm = "plain" + KAFKA_SASL_SCRAM_SHA256 KafkaSASLAlgorithm = "scram-sha256" + KAFKA_SASL_SCRAM_SHA512 KafkaSASLAlgorithm = "scram-sha512" +) + +var ( + compressionCodecs = map[string]sarama.CompressionCodec{ + strings.ToLower(sarama.CompressionNone.String()): sarama.CompressionNone, + strings.ToLower(sarama.CompressionGZIP.String()): sarama.CompressionGZIP, + strings.ToLower(sarama.CompressionSnappy.String()): sarama.CompressionSnappy, + strings.ToLower(sarama.CompressionLZ4.String()): sarama.CompressionLZ4, + strings.ToLower(sarama.CompressionZSTD.String()): sarama.CompressionZSTD, + } + + saslAlgorithms = map[KafkaSASLAlgorithm]bool{ + KAFKA_SASL_PLAIN: true, + KAFKA_SASL_SCRAM_SHA256: true, + KAFKA_SASL_SCRAM_SHA512: true, + } + saslAlgorithmsList = []string{ + string(KAFKA_SASL_NONE), + string(KAFKA_SASL_PLAIN), + string(KAFKA_SASL_SCRAM_SHA256), + string(KAFKA_SASL_SCRAM_SHA512), + } +) + +func (d *KafkaDriver) Prepare() error { + flag.BoolVar(&d.kafkaTLS, "transport.kafka.tls", false, "Use TLS to connect to Kafka") + flag.StringVar(&d.kafkaSASL, "transport.kafka.sasl", "none", + fmt.Sprintf( + "Use SASL to connect to Kafka, available settings: %s (TLS is recommended and the environment variables KAFKA_SASL_USER and KAFKA_SASL_PASS need to be set)", + strings.Join(saslAlgorithmsList, ", "))) + + flag.StringVar(&d.kafkaTopic, "transport.kafka.topic", "flow-messages", "Kafka topic to produce to") + flag.StringVar(&d.kafkaSrv, "transport.kafka.srv", "", "SRV record containing a list of Kafka brokers (or use brokers)") + flag.StringVar(&d.kafkaBrk, "transport.kafka.brokers", "127.0.0.1:9092,[::1]:9092", "Kafka brokers list separated by commas") + flag.IntVar(&d.kafkaMaxMsgBytes, "transport.kafka.maxmsgbytes", 1000000, "Kafka max message bytes") + flag.IntVar(&d.kafkaFlushBytes, "transport.kafka.flushbytes", int(sarama.MaxRequestSize), "Kafka flush bytes") + flag.DurationVar(&d.kafkaFlushFrequency, "transport.kafka.flushfreq", time.Second*5, "Kafka flush frequency") + + flag.BoolVar(&d.kafkaLogErrors, "transport.kafka.log.err", false, "Log Kafka errors") + flag.BoolVar(&d.kafkaHashing, "transport.kafka.hashing", false, "Enable partition hashing") + + //flag.StringVar(&d.kafkaKeying, "transport.kafka.key", "SamplerAddress,DstAS", "Kafka list of fields to do hashing on (partition) separated by commas") + flag.StringVar(&d.kafkaVersion, "transport.kafka.version", "2.8.0", "Kafka version") + flag.StringVar(&d.kafkaCompressionCodec, "transport.kafka.compression", "", "Kafka default compression") + + return nil +} + +func (d *KafkaDriver) Init(context.Context) error { + kafkaConfigVersion, err := sarama.ParseKafkaVersion(d.kafkaVersion) + if err != nil { + return err + } + + kafkaConfig := sarama.NewConfig() + kafkaConfig.Version = kafkaConfigVersion + kafkaConfig.Producer.Return.Successes = false + kafkaConfig.Producer.Return.Errors = d.kafkaLogErrors + kafkaConfig.Producer.MaxMessageBytes = d.kafkaMaxMsgBytes + kafkaConfig.Producer.Flush.Bytes = d.kafkaFlushBytes + kafkaConfig.Producer.Flush.Frequency = d.kafkaFlushFrequency + + if d.kafkaCompressionCodec != "" { + /* + // when upgrading sarama, replace with: + // note: if the library adds more codecs, they will be supported natively + var cc *sarama.CompressionCodec + + if err := cc.UnmarshalText([]byte(d.kafkaCompressionCodec)); err != nil { + return err + } + kafkaConfig.Producer.Compression = *cc + */ + + if cc, ok := compressionCodecs[strings.ToLower(d.kafkaCompressionCodec)]; !ok { + return errors.New("compression codec does not exist") + } else { + kafkaConfig.Producer.Compression = cc + } + } + + if d.kafkaTLS { + rootCAs, err := x509.SystemCertPool() + if err != nil { + return errors.New(fmt.Sprintf("Error initializing TLS: %v", err)) + } + kafkaConfig.Net.TLS.Enable = true + kafkaConfig.Net.TLS.Config = &tls.Config{RootCAs: rootCAs} + } + + if d.kafkaHashing { + kafkaConfig.Producer.Partitioner = sarama.NewHashPartitioner + } + + kafkaSASL := KafkaSASLAlgorithm(d.kafkaSASL) + if d.kafkaSASL != "" && kafkaSASL != KAFKA_SASL_NONE { + _, ok := saslAlgorithms[KafkaSASLAlgorithm(strings.ToLower(d.kafkaSASL))] + if !ok { + return errors.New("SASL algorithm does not exist") + } + + kafkaConfig.Net.SASL.Enable = true + kafkaConfig.Net.SASL.User = os.Getenv("KAFKA_SASL_USER") + kafkaConfig.Net.SASL.Password = os.Getenv("KAFKA_SASL_PASS") + if kafkaConfig.Net.SASL.User == "" && kafkaConfig.Net.SASL.Password == "" { + return errors.New("Kafka SASL config from environment was unsuccessful. KAFKA_SASL_USER and KAFKA_SASL_PASS need to be set.") + } + + if kafkaSASL == KAFKA_SASL_SCRAM_SHA256 || kafkaSASL == KAFKA_SASL_SCRAM_SHA512 { + kafkaConfig.Net.SASL.Handshake = true + + if kafkaSASL == KAFKA_SASL_SCRAM_SHA512 { + kafkaConfig.Net.SASL.SCRAMClientGeneratorFunc = func() sarama.SCRAMClient { + return &XDGSCRAMClient{HashGeneratorFcn: SHA512} + } + kafkaConfig.Net.SASL.Mechanism = sarama.SASLTypeSCRAMSHA512 + } else if kafkaSASL == KAFKA_SASL_SCRAM_SHA256 { + kafkaConfig.Net.SASL.SCRAMClientGeneratorFunc = func() sarama.SCRAMClient { + return &XDGSCRAMClient{HashGeneratorFcn: SHA256} + } + kafkaConfig.Net.SASL.Mechanism = sarama.SASLTypeSCRAMSHA256 + } + } + } + + var addrs []string + if d.kafkaSrv != "" { + addrs, _ = utils.GetServiceAddresses(d.kafkaSrv) + } else { + addrs = strings.Split(d.kafkaBrk, ",") + } + + kafkaProducer, err := sarama.NewAsyncProducer(addrs, kafkaConfig) + if err != nil { + return err + } + d.producer = kafkaProducer + + d.q = make(chan bool) + + if d.kafkaLogErrors { + go func() { + for { + select { + case msg := <-kafkaProducer.Errors(): + //if log != nil { + log.Error(msg) + //} + case <-d.q: + return + } + } + }() + } + + return err +} + +func (d *KafkaDriver) Send(key, data []byte) error { + d.producer.Input() <- &sarama.ProducerMessage{ + Topic: d.kafkaTopic, + Key: sarama.ByteEncoder(key), + Value: sarama.ByteEncoder(data), + } + return nil +} + +func (d *KafkaDriver) Close(context.Context) error { + d.producer.Close() + close(d.q) + return nil +} + +func init() { + d := &KafkaDriver{} + transport.RegisterTransportDriver("kafka", d) +} diff --git a/third_party/goflow2/transport/kafka/scram_client.go b/third_party/goflow2/transport/kafka/scram_client.go new file mode 100644 index 000000000000..1490f6a26e94 --- /dev/null +++ b/third_party/goflow2/transport/kafka/scram_client.go @@ -0,0 +1,39 @@ +package kafka + +// From https://github.com/Shopify/sarama/blob/main/examples/sasl_scram_client/scram_client.go + +import ( + "crypto/sha256" + "crypto/sha512" + + "github.com/xdg-go/scram" +) + +var ( + SHA256 scram.HashGeneratorFcn = sha256.New + SHA512 scram.HashGeneratorFcn = sha512.New +) + +type XDGSCRAMClient struct { + *scram.Client + *scram.ClientConversation + scram.HashGeneratorFcn +} + +func (x *XDGSCRAMClient) Begin(userName, password, authzID string) (err error) { + x.Client, err = x.HashGeneratorFcn.NewClient(userName, password, authzID) + if err != nil { + return err + } + x.ClientConversation = x.Client.NewConversation() + return nil +} + +func (x *XDGSCRAMClient) Step(challenge string) (response string, err error) { + response, err = x.ClientConversation.Step(challenge) + return +} + +func (x *XDGSCRAMClient) Done() bool { + return x.ClientConversation.Done() +} diff --git a/third_party/goflow2/transport/transport.go b/third_party/goflow2/transport/transport.go new file mode 100644 index 000000000000..11e9c6786316 --- /dev/null +++ b/third_party/goflow2/transport/transport.go @@ -0,0 +1,68 @@ +package transport + +import ( + "context" + "fmt" + "sync" +) + +var ( + transportDrivers = make(map[string]TransportDriver) + lock = &sync.RWMutex{} +) + +type TransportDriver interface { + Prepare() error // Prepare driver (eg: flag registration) + Init(context.Context) error // Initialize driver (eg: start connections, open files...) + Close(context.Context) error // Close driver (eg: close connections and files...) + Send(key, data []byte) error // Send a formatted message +} + +type TransportInterface interface { + Send(key, data []byte) error +} + +type Transport struct { + driver TransportDriver +} + +func (t *Transport) Close(ctx context.Context) { + t.driver.Close(ctx) +} +func (t *Transport) Send(key, data []byte) error { + return t.driver.Send(key, data) +} + +func RegisterTransportDriver(name string, t TransportDriver) { + lock.Lock() + transportDrivers[name] = t + lock.Unlock() + + if err := t.Prepare(); err != nil { + panic(err) + } +} + +func FindTransport(ctx context.Context, name string) (*Transport, error) { + lock.RLock() + t, ok := transportDrivers[name] + lock.RUnlock() + if !ok { + return nil, fmt.Errorf("Transport %s not found", name) + } + + err := t.Init(ctx) + return &Transport{t}, err +} + +func GetTransports() []string { + lock.RLock() + defer lock.RUnlock() + t := make([]string, len(transportDrivers)) + var i int + for k, _ := range transportDrivers { + t[i] = k + i++ + } + return t +} diff --git a/third_party/goflow2/utils/metrics.go b/third_party/goflow2/utils/metrics.go new file mode 100644 index 000000000000..eb3f23158054 --- /dev/null +++ b/third_party/goflow2/utils/metrics.go @@ -0,0 +1,171 @@ +package utils + +import ( + "strconv" + "time" + + "github.com/prometheus/client_golang/prometheus" +) + +var ( + MetricTrafficBytes = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_traffic_bytes", + Help: "Bytes received by the application.", + }, + []string{"remote_ip", "local_ip", "local_port", "type"}, + ) + MetricTrafficPackets = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_traffic_packets", + Help: "Packets received by the application.", + }, + []string{"remote_ip", "local_ip", "local_port", "type"}, + ) + MetricPacketSizeSum = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Name: "flow_traffic_summary_size_bytes", + Help: "Summary of packet size.", + Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, + }, + []string{"remote_ip", "local_ip", "local_port", "type"}, + ) + DecoderStats = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_decoder_count", + Help: "Decoder processed count.", + }, + []string{"worker", "name"}, + ) + DecoderErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_decoder_error_count", + Help: "Decoder processed error count.", + }, + []string{"worker", "name"}, + ) + DecoderTime = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Name: "flow_summary_decoding_time_us", + Help: "Decoding time summary.", + Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, + }, + []string{"name"}, + ) + DecoderProcessTime = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Name: "flow_summary_processing_time_us", + Help: "Processing time summary.", + Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, + }, + []string{"name"}, + ) + NetFlowStats = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_process_nf_count", + Help: "NetFlows processed.", + }, + []string{"router", "version"}, + ) + NetFlowErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_process_nf_errors_count", + Help: "NetFlows processed errors.", + }, + []string{"router", "error"}, + ) + NetFlowSetRecordsStatsSum = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_process_nf_flowset_records_sum", + Help: "NetFlows FlowSets sum of records.", + }, + []string{"router", "version", "type"}, // data-template, data, opts... + ) + NetFlowSetStatsSum = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_process_nf_flowset_sum", + Help: "NetFlows FlowSets sum.", + }, + []string{"router", "version", "type"}, // data-template, data, opts... + ) + NetFlowTimeStatsSum = prometheus.NewSummaryVec( + prometheus.SummaryOpts{ + Name: "flow_process_nf_delay_summary_seconds", + Help: "NetFlows time difference between time of flow and processing.", + Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, + }, + []string{"router", "version"}, + ) + NetFlowTemplatesStats = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_process_nf_templates_count", + Help: "NetFlows Template count.", + }, + []string{"router", "version", "obs_domain_id", "template_id", "type"}, // options/template + ) + SFlowStats = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_process_sf_count", + Help: "sFlows processed.", + }, + []string{"router", "agent", "version"}, + ) + SFlowErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_process_sf_errors_count", + Help: "sFlows processed errors.", + }, + []string{"router", "error"}, + ) + SFlowSampleStatsSum = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_process_sf_samples_sum", + Help: "SFlows samples sum.", + }, + []string{"router", "agent", "version", "type"}, // counter, flow, expanded... + ) + SFlowSampleRecordsStatsSum = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "flow_process_sf_samples_records_sum", + Help: "SFlows samples sum of records.", + }, + []string{"router", "agent", "version", "type"}, // data-template, data, opts... + ) +) + +func init() { + prometheus.MustRegister(MetricTrafficBytes) + prometheus.MustRegister(MetricTrafficPackets) + prometheus.MustRegister(MetricPacketSizeSum) + + prometheus.MustRegister(DecoderStats) + prometheus.MustRegister(DecoderErrors) + prometheus.MustRegister(DecoderTime) + prometheus.MustRegister(DecoderProcessTime) + + prometheus.MustRegister(NetFlowStats) + prometheus.MustRegister(NetFlowErrors) + prometheus.MustRegister(NetFlowSetRecordsStatsSum) + prometheus.MustRegister(NetFlowSetStatsSum) + prometheus.MustRegister(NetFlowTimeStatsSum) + prometheus.MustRegister(NetFlowTemplatesStats) + + prometheus.MustRegister(SFlowStats) + prometheus.MustRegister(SFlowErrors) + prometheus.MustRegister(SFlowSampleStatsSum) + prometheus.MustRegister(SFlowSampleRecordsStatsSum) +} + +func DefaultAccountCallback(name string, id int, start, end time.Time) { + DecoderProcessTime.With( + prometheus.Labels{ + "name": name, + }). + Observe(float64((end.Sub(start)).Nanoseconds()) / 1000) + DecoderStats.With( + prometheus.Labels{ + "worker": strconv.Itoa(id), + "name": name, + }). + Inc() +} diff --git a/third_party/goflow2/utils/netflow.go b/third_party/goflow2/utils/netflow.go new file mode 100644 index 000000000000..0923ee3b7955 --- /dev/null +++ b/third_party/goflow2/utils/netflow.go @@ -0,0 +1,377 @@ +package utils + +import ( + "bytes" + "context" + "sync" + "time" + + "github.com/netsampler/goflow2/decoders/netflow" + "github.com/netsampler/goflow2/decoders/netflow/templates" + "github.com/netsampler/goflow2/format" + flowmessage "github.com/netsampler/goflow2/pb" + "github.com/netsampler/goflow2/producer" + "github.com/netsampler/goflow2/transport" + "github.com/prometheus/client_golang/prometheus" +) + +/* +type TemplateSystem struct { + key string + templates *netflow.BasicTemplateSystem +} + +func (s *TemplateSystem) AddTemplate(version uint16, obsDomainId uint32, template interface{}) { + s.templates.AddTemplate(version, obsDomainId, template) + + typeStr := "options_template" + var templateId uint16 + switch templateIdConv := template.(type) { + case netflow.IPFIXOptionsTemplateRecord: + templateId = templateIdConv.TemplateId + case netflow.NFv9OptionsTemplateRecord: + templateId = templateIdConv.TemplateId + case netflow.TemplateRecord: + templateId = templateIdConv.TemplateId + typeStr = "template" + } + NetFlowTemplatesStats.With( + prometheus.Labels{ + "router": s.key, + "version": strconv.Itoa(int(version)), + "obs_domain_id": strconv.Itoa(int(obsDomainId)), + "template_id": strconv.Itoa(int(templateId)), + "type": typeStr, + }). + Inc() +} + +func (s *TemplateSystem) GetTemplate(version uint16, obsDomainId uint32, templateId uint16) (interface{}, error) { + return s.templates.GetTemplate(version, obsDomainId, templateId) +} +*/ + +type StateNetFlow struct { + stopper + + Format format.FormatInterface + Transport transport.TransportInterface + Logger Logger + /*templateslock *sync.RWMutex + templates map[string]*TemplateSystem*/ + + samplinglock *sync.RWMutex + sampling map[string]producer.SamplingRateSystem + + Config *producer.ProducerConfig + configMapped *producer.ProducerConfigMapped + + TemplateSystem templates.TemplateInterface + + ctx context.Context +} + +func NewStateNetFlow() *StateNetFlow { + return &StateNetFlow{ + ctx: context.Background(), + samplinglock: &sync.RWMutex{}, + sampling: make(map[string]producer.SamplingRateSystem), + } +} + +func (s *StateNetFlow) DecodeFlow(msg interface{}) error { + pkt := msg.(BaseMessage) + buf := bytes.NewBuffer(pkt.Payload) + + key := pkt.Src.String() + samplerAddress := pkt.Src + if samplerAddress.To4() != nil { + samplerAddress = samplerAddress.To4() + } + + s.samplinglock.RLock() + sampling, ok := s.sampling[key] + s.samplinglock.RUnlock() + if !ok { + sampling = producer.CreateSamplingSystem() + s.samplinglock.Lock() + s.sampling[key] = sampling + s.samplinglock.Unlock() + } + + ts := uint64(time.Now().UTC().Unix()) + if pkt.SetTime { + ts = uint64(pkt.RecvTime.UTC().Unix()) + } + + timeTrackStart := time.Now() + msgDec, err := netflow.DecodeMessageContext(s.ctx, buf, key, netflow.TemplateWrapper{s.ctx, key, s.TemplateSystem}) + if err != nil { + switch err.(type) { + case *netflow.ErrorTemplateNotFound: + NetFlowErrors.With( + prometheus.Labels{ + "router": key, + "error": "template_not_found", + }). + Inc() + default: + NetFlowErrors.With( + prometheus.Labels{ + "router": key, + "error": "error_decoding", + }). + Inc() + } + return err + } + + var flowMessageSet []*flowmessage.FlowMessage + + switch msgDecConv := msgDec.(type) { + case netflow.NFv9Packet: + NetFlowStats.With( + prometheus.Labels{ + "router": key, + "version": "9", + }). + Inc() + + for _, fs := range msgDecConv.FlowSets { + switch fsConv := fs.(type) { + case netflow.TemplateFlowSet: + NetFlowSetStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "9", + "type": "TemplateFlowSet", + }). + Inc() + + NetFlowSetRecordsStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "9", + "type": "TemplateFlowSet", + }). + Add(float64(len(fsConv.Records))) + + case netflow.NFv9OptionsTemplateFlowSet: + NetFlowSetStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "9", + "type": "OptionsTemplateFlowSet", + }). + Inc() + + NetFlowSetRecordsStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "9", + "type": "OptionsTemplateFlowSet", + }). + Add(float64(len(fsConv.Records))) + + case netflow.OptionsDataFlowSet: + NetFlowSetStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "9", + "type": "OptionsDataFlowSet", + }). + Inc() + + NetFlowSetRecordsStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "9", + "type": "OptionsDataFlowSet", + }). + Add(float64(len(fsConv.Records))) + case netflow.DataFlowSet: + NetFlowSetStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "9", + "type": "DataFlowSet", + }). + Inc() + + NetFlowSetRecordsStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "9", + "type": "DataFlowSet", + }). + Add(float64(len(fsConv.Records))) + } + } + flowMessageSet, err = producer.ProcessMessageNetFlowConfig(msgDecConv, sampling, s.configMapped) + + for _, fmsg := range flowMessageSet { + fmsg.TimeReceived = ts + fmsg.SamplerAddress = samplerAddress + timeDiff := fmsg.TimeReceived - fmsg.TimeFlowEnd + NetFlowTimeStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "9", + }). + Observe(float64(timeDiff)) + } + case netflow.IPFIXPacket: + NetFlowStats.With( + prometheus.Labels{ + "router": key, + "version": "10", + }). + Inc() + + for _, fs := range msgDecConv.FlowSets { + switch fsConv := fs.(type) { + case netflow.TemplateFlowSet: + NetFlowSetStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "10", + "type": "TemplateFlowSet", + }). + Inc() + + NetFlowSetRecordsStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "10", + "type": "TemplateFlowSet", + }). + Add(float64(len(fsConv.Records))) + + case netflow.IPFIXOptionsTemplateFlowSet: + NetFlowSetStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "10", + "type": "OptionsTemplateFlowSet", + }). + Inc() + + NetFlowSetRecordsStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "10", + "type": "OptionsTemplateFlowSet", + }). + Add(float64(len(fsConv.Records))) + + case netflow.OptionsDataFlowSet: + + NetFlowSetStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "10", + "type": "OptionsDataFlowSet", + }). + Inc() + + NetFlowSetRecordsStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "10", + "type": "OptionsDataFlowSet", + }). + Add(float64(len(fsConv.Records))) + + case netflow.DataFlowSet: + NetFlowSetStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "10", + "type": "DataFlowSet", + }). + Inc() + + NetFlowSetRecordsStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "10", + "type": "DataFlowSet", + }). + Add(float64(len(fsConv.Records))) + } + } + flowMessageSet, err = producer.ProcessMessageNetFlowConfig(msgDecConv, sampling, s.configMapped) + + for _, fmsg := range flowMessageSet { + fmsg.TimeReceived = ts + fmsg.SamplerAddress = samplerAddress + timeDiff := fmsg.TimeReceived - fmsg.TimeFlowEnd + NetFlowTimeStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "10", + }). + Observe(float64(timeDiff)) + } + } + + timeTrackStop := time.Now() + DecoderTime.With( + prometheus.Labels{ + "name": "NetFlow", + }). + Observe(float64((timeTrackStop.Sub(timeTrackStart)).Nanoseconds()) / 1000) + + for _, fmsg := range flowMessageSet { + if s.Format != nil { + key, data, err := s.Format.Format(fmsg) + + if err != nil && s.Logger != nil { + s.Logger.Error(err) + } + if err == nil && s.Transport != nil { + err = s.Transport.Send(key, data) + if err != nil { + s.Logger.Error(err) + } + } + } + } + + return nil +} + +/* +func (s *StateNetFlow) ServeHTTPTemplates(w http.ResponseWriter, r *http.Request) { + tmp := make(map[string]map[uint16]map[uint32]map[uint16]interface{}) + s.templateslock.RLock() + for key, templatesrouterstr := range s.templates { + templatesrouter := templatesrouterstr.templates.GetTemplates() + tmp[key] = templatesrouter + } + s.templateslock.RUnlock() + enc := json.NewEncoder(w) + enc.Encode(tmp) +} + +func (s *StateNetFlow) InitTemplates() { + s.templates = make(map[string]*TemplateSystem) + s.templateslock = &sync.RWMutex{} + s.sampling = make(map[string]producer.SamplingRateSystem) + s.samplinglock = &sync.RWMutex{} +}*/ + +func (s *StateNetFlow) initConfig() { + s.configMapped = producer.NewProducerConfigMapped(s.Config) +} + +func (s *StateNetFlow) FlowRoutine(workers int, addr string, port int, reuseport bool) error { + if err := s.start(); err != nil { + return err + } + //s.InitTemplates() + s.initConfig() + return UDPStoppableRoutine(s.stopCh, "NetFlow", s.DecodeFlow, workers, addr, port, reuseport, s.Logger) +} + +// FlowRoutineCtx? diff --git a/third_party/goflow2/utils/nflegacy.go b/third_party/goflow2/utils/nflegacy.go new file mode 100644 index 000000000000..dcfc36dbeecf --- /dev/null +++ b/third_party/goflow2/utils/nflegacy.go @@ -0,0 +1,111 @@ +package utils + +import ( + "bytes" + "time" + + "github.com/netsampler/goflow2/decoders/netflowlegacy" + "github.com/netsampler/goflow2/format" + flowmessage "github.com/netsampler/goflow2/pb" + "github.com/netsampler/goflow2/producer" + "github.com/netsampler/goflow2/transport" + "github.com/prometheus/client_golang/prometheus" +) + +type StateNFLegacy struct { + stopper + + Format format.FormatInterface + Transport transport.TransportInterface + Logger Logger +} + +func NewStateNFLegacy() *StateNFLegacy { + return &StateNFLegacy{} +} + +func (s *StateNFLegacy) DecodeFlow(msg interface{}) error { + pkt := msg.(BaseMessage) + buf := bytes.NewBuffer(pkt.Payload) + key := pkt.Src.String() + samplerAddress := pkt.Src + if samplerAddress.To4() != nil { + samplerAddress = samplerAddress.To4() + } + + ts := uint64(time.Now().UTC().Unix()) + if pkt.SetTime { + ts = uint64(pkt.RecvTime.UTC().Unix()) + } + + timeTrackStart := time.Now() + msgDec, err := netflowlegacy.DecodeMessage(buf) + + if err != nil { + switch err.(type) { + case *netflowlegacy.ErrorVersion: + NetFlowErrors.With( + prometheus.Labels{ + "router": key, + "error": "error_version", + }). + Inc() + } + return err + } + + switch msgDecConv := msgDec.(type) { + case netflowlegacy.PacketNetFlowV5: + NetFlowStats.With( + prometheus.Labels{ + "router": key, + "version": "5", + }). + Inc() + NetFlowSetStatsSum.With( + prometheus.Labels{ + "router": key, + "version": "5", + "type": "DataFlowSet", + }). + Add(float64(msgDecConv.Count)) + } + + var flowMessageSet []*flowmessage.FlowMessage + flowMessageSet, err = producer.ProcessMessageNetFlowLegacy(msgDec) + + timeTrackStop := time.Now() + DecoderTime.With( + prometheus.Labels{ + "name": "NetFlowV5", + }). + Observe(float64((timeTrackStop.Sub(timeTrackStart)).Nanoseconds()) / 1000) + + for _, fmsg := range flowMessageSet { + fmsg.TimeReceived = ts + fmsg.SamplerAddress = samplerAddress + + if s.Format != nil { + key, data, err := s.Format.Format(fmsg) + + if err != nil && s.Logger != nil { + s.Logger.Error(err) + } + if err == nil && s.Transport != nil { + err = s.Transport.Send(key, data) + if err != nil { + s.Logger.Error(err) + } + } + } + } + + return nil +} + +func (s *StateNFLegacy) FlowRoutine(workers int, addr string, port int, reuseport bool) error { + if err := s.start(); err != nil { + return err + } + return UDPStoppableRoutine(s.stopCh, "NetFlowV5", s.DecodeFlow, workers, addr, port, reuseport, s.Logger) +} diff --git a/third_party/goflow2/utils/sflow.go b/third_party/goflow2/utils/sflow.go new file mode 100644 index 000000000000..27223bcc096a --- /dev/null +++ b/third_party/goflow2/utils/sflow.go @@ -0,0 +1,170 @@ +package utils + +import ( + "bytes" + "net" + "time" + + "github.com/netsampler/goflow2/decoders/sflow" + "github.com/netsampler/goflow2/format" + flowmessage "github.com/netsampler/goflow2/pb" + "github.com/netsampler/goflow2/producer" + "github.com/netsampler/goflow2/transport" + "github.com/prometheus/client_golang/prometheus" +) + +type StateSFlow struct { + stopper + + Format format.FormatInterface + Transport transport.TransportInterface + Logger Logger + + Config *producer.ProducerConfig + configMapped *producer.ProducerConfigMapped +} + +func NewStateSFlow() *StateSFlow { + return &StateSFlow{} +} + +func (s *StateSFlow) DecodeFlow(msg interface{}) error { + pkt := msg.(BaseMessage) + buf := bytes.NewBuffer(pkt.Payload) + key := pkt.Src.String() + + ts := uint64(time.Now().UTC().Unix()) + if pkt.SetTime { + ts = uint64(pkt.RecvTime.UTC().Unix()) + } + + timeTrackStart := time.Now() + msgDec, err := sflow.DecodeMessage(buf) + + if err != nil { + switch err.(type) { + case *sflow.ErrorVersion: + SFlowErrors.With( + prometheus.Labels{ + "router": key, + "error": "error_version", + }). + Inc() + case *sflow.ErrorIPVersion: + SFlowErrors.With( + prometheus.Labels{ + "router": key, + "error": "error_ip_version", + }). + Inc() + case *sflow.ErrorDataFormat: + SFlowErrors.With( + prometheus.Labels{ + "router": key, + "error": "error_data_format", + }). + Inc() + default: + SFlowErrors.With( + prometheus.Labels{ + "router": key, + "error": "error_decoding", + }). + Inc() + } + return err + } + + switch msgDecConv := msgDec.(type) { + case sflow.Packet: + agentStr := net.IP(msgDecConv.AgentIP).String() + SFlowStats.With( + prometheus.Labels{ + "router": key, + "agent": agentStr, + "version": "5", + }). + Inc() + + for _, samples := range msgDecConv.Samples { + typeStr := "unknown" + countRec := 0 + switch samplesConv := samples.(type) { + case sflow.FlowSample: + typeStr = "FlowSample" + countRec = len(samplesConv.Records) + case sflow.CounterSample: + typeStr = "CounterSample" + if samplesConv.Header.Format == 4 { + typeStr = "Expanded" + typeStr + } + countRec = len(samplesConv.Records) + case sflow.ExpandedFlowSample: + typeStr = "ExpandedFlowSample" + countRec = len(samplesConv.Records) + } + SFlowSampleStatsSum.With( + prometheus.Labels{ + "router": key, + "agent": agentStr, + "version": "5", + "type": typeStr, + }). + Inc() + + SFlowSampleRecordsStatsSum.With( + prometheus.Labels{ + "router": key, + "agent": agentStr, + "version": "5", + "type": typeStr, + }). + Add(float64(countRec)) + } + + } + + var flowMessageSet []*flowmessage.FlowMessage + flowMessageSet, err = producer.ProcessMessageSFlowConfig(msgDec, s.configMapped) + + timeTrackStop := time.Now() + DecoderTime.With( + prometheus.Labels{ + "name": "sFlow", + }). + Observe(float64((timeTrackStop.Sub(timeTrackStart)).Nanoseconds()) / 1000) + + for _, fmsg := range flowMessageSet { + fmsg.TimeReceived = ts + fmsg.TimeFlowStart = ts + fmsg.TimeFlowEnd = ts + + if s.Format != nil { + key, data, err := s.Format.Format(fmsg) + + if err != nil && s.Logger != nil { + s.Logger.Error(err) + } + if err == nil && s.Transport != nil { + err = s.Transport.Send(key, data) + if err != nil { + s.Logger.Error(err) + } + } + } + } + + return nil +} + +func (s *StateSFlow) initConfig() { + s.configMapped = producer.NewProducerConfigMapped(s.Config) +} + +func (s *StateSFlow) FlowRoutine(workers int, addr string, port int, reuseport bool) error { + if err := s.start(); err != nil { + return err + } + s.initConfig() + return UDPStoppableRoutine(s.stopCh, "sFlow", s.DecodeFlow, workers, addr, port, reuseport, s.Logger) +} diff --git a/third_party/goflow2/utils/sflow_test.go b/third_party/goflow2/utils/sflow_test.go new file mode 100644 index 000000000000..76f3316253a8 --- /dev/null +++ b/third_party/goflow2/utils/sflow_test.go @@ -0,0 +1,92 @@ +package utils + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestDecodeFlowExpandedSFlow(t *testing.T) { + msg := BaseMessage{ + Src: []byte{}, + Port: 1, + Payload: getExpandedSFlowDecode(), + } + + s := &StateSFlow{} + + assert.Nil(t, s.DecodeFlow(msg)) +} + +func getExpandedSFlowDecode() []byte { + return []byte{ + 0, 0, 0, 5, 0, 0, 0, 1, 1, 2, 3, 4, 0, 0, 0, 0, 5, 167, 139, 219, 5, 118, + 138, 184, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 220, 2, 144, 194, 214, 0, 0, 0, 0, + 0, 5, 6, 164, 0, 0, 3, 255, 6, 6, 189, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 6, 164, 0, 0, 0, 0, 0, 5, 6, 171, 0, 0, 0, 2, 0, 0, 3, 233, 0, 0, 0, 6, + 0, 0, 5, 7, 0, 0, 0, 0, 0, 0, 5, 7, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 0, 144, 0, 0, 0, 1, 0, 0, 5, 234, 0, 0, 0, 4, 0, 0, 0, 128, 8, 6, 168, 250, + 146, 253, 116, 131, 239, 8, 101, 183, 129, 0, 5, 7, 8, 0, 9, 0, 5, 212, 0, 2, 4, 0, + 3, 6, 252, 8, 9, 187, 169, 1, 4, 7, 186, 201, 1, 187, 249, 6, 160, 7, 5, 240, 6, 4, + 4, 0, 0, 6, 0, 123, 119, 210, 0, 0, 165, 105, 7, 171, 145, 234, 102, 0, 252, 187, 162, 227, + 104, 188, 126, 232, 156, 164, 2, 115, 6, 100, 0, 185, 6, 4, 119, 5, 213, 1, 215, 208, 8, 4, + 118, 183, 241, 225, 130, 186, 2, 250, 220, 153, 189, 3, 4, 4, 1, 8, 210, 119, 172, 9, 164, 233, + 1, 8, 171, 226, 196, 195, 3, 152, 9, 5, 6, 181, 4, 7, 0, 0, 0, 3, 0, 0, 0, 220, + 9, 107, 215, 156, 0, 0, 0, 0, 0, 5, 6, 165, 0, 0, 3, 255, 226, 123, 0, 100, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, 6, 165, 0, 0, 0, 0, 0, 5, 6, 164, 0, 0, 0, 2, + 0, 0, 3, 233, 0, 0, 0, 6, 0, 0, 3, 184, 0, 0, 0, 0, 0, 0, 3, 184, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 144, 0, 0, 0, 1, 0, 0, 5, 190, 0, 0, 0, 4, + 0, 0, 0, 128, 116, 131, 239, 8, 101, 183, 144, 226, 186, 134, 8, 1, 129, 0, 3, 184, 8, 0, + 9, 0, 5, 168, 7, 127, 4, 0, 4, 6, 163, 211, 185, 9, 220, 7, 0, 254, 3, 8, 0, 9, + 130, 136, 179, 1, 2, 2, 7, 5, 250, 4, 128, 6, 0, 1, 7, 1, 0, 0, 1, 1, 8, 0, + 6, 9, 250, 9, 4, 113, 121, 4, 160, 125, 0, 4, 9, 209, 241, 194, 190, 148, 161, 186, 6, 192, + 246, 190, 170, 2, 238, 190, 128, 221, 223, 1, 218, 225, 3, 9, 7, 226, 220, 231, 127, 3, 3, 252, + 7, 9, 161, 247, 218, 8, 8, 174, 133, 4, 213, 245, 149, 218, 5, 4, 200, 128, 139, 5, 0, 115, + 0, 0, 0, 3, 0, 0, 0, 220, 2, 144, 194, 215, 0, 0, 0, 0, 0, 5, 6, 164, 0, 0, + 3, 255, 6, 6, 253, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 164, 0, 0, 0, 0, + 0, 5, 6, 171, 0, 0, 0, 2, 0, 0, 3, 233, 0, 0, 0, 6, 0, 0, 0, 104, 0, 0, + 0, 0, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 144, 0, 0, 0, 1, + 0, 0, 5, 242, 0, 0, 0, 4, 0, 0, 0, 128, 116, 131, 239, 7, 9, 1, 116, 131, 239, 8, + 101, 183, 129, 0, 0, 104, 8, 0, 9, 0, 5, 220, 152, 143, 4, 0, 1, 6, 5, 179, 9, 187, + 191, 101, 190, 2, 144, 182, 0, 0, 130, 4, 252, 4, 160, 192, 138, 8, 219, 124, 128, 6, 0, 235, + 180, 213, 0, 0, 1, 1, 8, 0, 9, 124, 6, 1, 9, 1, 252, 3, 194, 8, 195, 209, 115, 1, + 5, 152, 204, 2, 6, 4, 1, 119, 254, 9, 1, 170, 0, 192, 2, 7, 190, 9, 149, 5, 101, 2, + 128, 122, 0, 190, 1, 109, 188, 175, 4, 8, 152, 1, 142, 108, 2, 100, 2, 124, 125, 195, 5, 8, + 233, 126, 7, 4, 243, 4, 3, 153, 0, 0, 0, 3, 0, 0, 0, 220, 5, 1, 150, 6, 0, 0, + 0, 0, 0, 5, 6, 167, 0, 0, 3, 255, 6, 5, 105, 220, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 6, 167, 0, 0, 0, 0, 0, 5, 6, 164, 0, 0, 0, 2, 0, 0, 3, 233, 0, 0, + 0, 6, 0, 0, 5, 7, 0, 0, 0, 0, 0, 0, 5, 7, 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 144, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 4, 0, 0, 0, 128, 116, 131, + 239, 8, 101, 183, 152, 3, 130, 1, 196, 153, 129, 0, 5, 7, 8, 0, 9, 0, 2, 0, 0, 0, + 4, 0, 126, 7, 119, 188, 185, 9, 221, 8, 2, 116, 144, 0, 9, 139, 3, 112, 2, 0, 8, 124, + 255, 251, 0, 0, 131, 2, 0, 0, 0, 246, 3, 3, 107, 5, 0, 0, 0, 0, 9, 173, 2, 217, + 6, 248, 0, 0, 9, 173, 2, 217, 8, 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 6, 9, 153, + 215, 157, 0, 255, 0, 8, 1, 0, 9, 8, 9, 6, 164, 103, 9, 5, 0, 0, 0, 3, 0, 0, + 0, 152, 5, 201, 2, 175, 0, 0, 0, 0, 0, 5, 6, 5, 0, 0, 3, 255, 1, 8, 9, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 5, 0, 0, 0, 0, 0, 5, 6, 164, 0, 0, + 0, 2, 0, 0, 3, 233, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, + 0, 4, 0, 0, 0, 0, 116, 131, 239, 8, 101, 183, 218, 177, 4, 251, 217, 207, 8, 0, 9, 0, + 0, 8, 0, 0, 0, 0, 9, 7, 8, 161, 106, 3, 109, 6, 185, 9, 220, 215, 0, 123, 9, 184, + 0, 8, 116, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 3, 130, 6, + 0, 0, 0, 3, 0, 0, 0, 220, 2, 144, 194, 216, 0, 0, 0, 0, 0, 5, 6, 164, 0, 0, + 3, 255, 6, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 164, 0, 0, 0, 0, + 0, 5, 6, 165, 0, 0, 0, 2, 0, 0, 3, 233, 0, 0, 0, 6, 0, 0, 3, 202, 0, 0, + 0, 0, 0, 0, 3, 202, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 144, 0, 0, 0, 1, + 0, 0, 5, 242, 0, 0, 0, 4, 0, 0, 0, 128, 144, 226, 186, 135, 4, 241, 116, 131, 239, 8, + 101, 183, 129, 0, 3, 202, 8, 0, 9, 0, 5, 220, 147, 0, 4, 0, 7, 6, 225, 131, 1, 159, + 7, 185, 195, 181, 170, 8, 9, 117, 7, 175, 8, 3, 191, 135, 190, 150, 196, 102, 0, 6, 0, 119, + 116, 113, 0, 0, 201, 244, 240, 206, 2, 117, 4, 139, 8, 4, 240, 223, 247, 123, 6, 0, 239, 0, + 9, 116, 152, 153, 191, 0, 124, 2, 7, 8, 3, 178, 166, 150, 3, 218, 163, 175, 121, 8, 4, 210, + 4, 5, 166, 5, 178, 1, 6, 222, 172, 186, 6, 241, 232, 8, 188, 192, 2, 220, 128, 1, 8, 7, + 194, 130, 220, 5, 2, 0, 158, 195, 0, 4, 3, 2, 160, 158, 157, 2, 102, 3, 7, 3, 0, 0, + 1, 3, 3, 4, 1, 1, 4, 2, 187, 255, 188, 3, 4, 138, 9, 180, 104, 233, 212, 239, 123, 237, + 112, 8, 133, 129, 152, 138, 7, 195, 8, 171, 237, 3, 4, 223, 116, 214, 151, 9, 151, 102, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + } +} diff --git a/third_party/goflow2/utils/stopper.go b/third_party/goflow2/utils/stopper.go new file mode 100644 index 000000000000..153b1bd174e1 --- /dev/null +++ b/third_party/goflow2/utils/stopper.go @@ -0,0 +1,33 @@ +package utils + +import ( + "errors" +) + +// ErrAlreadyStarted error happens when you try to start twice a flow routine +var ErrAlreadyStarted = errors.New("the routine is already started") + +// stopper mechanism, common for all the flow routines +type stopper struct { + stopCh chan struct{} +} + +func (s *stopper) start() error { + if s.stopCh != nil { + return ErrAlreadyStarted + } + s.stopCh = make(chan struct{}) + return nil +} + +func (s *stopper) Shutdown() { + if s.stopCh != nil { + select { + case <-s.stopCh: + default: + close(s.stopCh) + } + + s.stopCh = nil + } +} diff --git a/third_party/goflow2/utils/stopper_test.go b/third_party/goflow2/utils/stopper_test.go new file mode 100644 index 000000000000..f76e7bfe8ab9 --- /dev/null +++ b/third_party/goflow2/utils/stopper_test.go @@ -0,0 +1,51 @@ +package utils + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestStopper(t *testing.T) { + r := routine{} + require.False(t, r.Running) + require.NoError(t, r.StartRoutine()) + assert.True(t, r.Running) + r.Shutdown() + assert.Eventually(t, func() bool { + return r.Running == false + }, time.Second, time.Millisecond) + + // after shutdown, we can start it again + require.NoError(t, r.StartRoutine()) + assert.True(t, r.Running) +} + +func TestStopper_CannotStartTwice(t *testing.T) { + r := routine{} + require.False(t, r.Running) + require.NoError(t, r.StartRoutine()) + assert.ErrorIs(t, r.StartRoutine(), ErrAlreadyStarted) +} + +type routine struct { + stopper + Running bool +} + +func (p *routine) StartRoutine() error { + if err := p.start(); err != nil { + return err + } + p.Running = true + waitForGoRoutine := make(chan struct{}) + go func() { + close(waitForGoRoutine) + <-p.stopCh + p.Running = false + }() + <-waitForGoRoutine + return nil +} diff --git a/third_party/goflow2/utils/utils.go b/third_party/goflow2/utils/utils.go new file mode 100644 index 000000000000..bddd4460815b --- /dev/null +++ b/third_party/goflow2/utils/utils.go @@ -0,0 +1,234 @@ +package utils + +import ( + "errors" + "fmt" + "io" + "net" + "strconv" + "sync" + "time" + + reuseport "github.com/libp2p/go-reuseport" + decoder "github.com/netsampler/goflow2/decoders" + "github.com/netsampler/goflow2/decoders/netflow" + flowmessage "github.com/netsampler/goflow2/pb" + "github.com/netsampler/goflow2/producer" + "github.com/prometheus/client_golang/prometheus" + "go.yaml.in/yaml/v2" +) + +type ProducerConfig *producer.ProducerConfig + +func LoadMapping(f io.Reader) (ProducerConfig, error) { + config := &producer.ProducerConfig{} + dec := yaml.NewDecoder(f) + err := dec.Decode(config) + return config, err +} + +func GetServiceAddresses(srv string) (addrs []string, err error) { + _, srvs, err := net.LookupSRV("", "", srv) + if err != nil { + return nil, errors.New(fmt.Sprintf("Service discovery: %v\n", err)) + } + for _, srv := range srvs { + addrs = append(addrs, net.JoinHostPort(srv.Target, strconv.Itoa(int(srv.Port)))) + } + return addrs, nil +} + +type Logger interface { + Printf(string, ...interface{}) + Errorf(string, ...interface{}) + Warnf(string, ...interface{}) + Warn(...interface{}) + Error(...interface{}) + Debug(...interface{}) + Debugf(string, ...interface{}) + Infof(string, ...interface{}) + Fatalf(string, ...interface{}) +} + +type BaseMessage struct { + Src net.IP + Port int + Payload []byte + + SetTime bool + RecvTime time.Time +} + +type Transport interface { + Send([]*flowmessage.FlowMessage) +} + +type Formatter interface { + Format([]*flowmessage.FlowMessage) +} + +/* +type DefaultLogTransport struct { +} + + func (s *DefaultLogTransport) Publish(msgs []*flowmessage.FlowMessage) { + for _, msg := range msgs { + fmt.Printf("%v\n", FlowMessageToString(msg)) + } + } + +type DefaultJSONTransport struct { +} + + func (s *DefaultJSONTransport) Publish(msgs []*flowmessage.FlowMessage) { + for _, msg := range msgs { + fmt.Printf("%v\n", FlowMessageToJSON(msg)) + } + } +*/ +type DefaultErrorCallback struct { + Logger Logger +} + +func (cb *DefaultErrorCallback) Callback(name string, id int, start, end time.Time, err error) { + if _, ok := err.(*netflow.ErrorTemplateNotFound); ok { + return + } + if cb.Logger != nil { + cb.Logger.Errorf("Error from: %v (%v) duration: %v. %v", name, id, end.Sub(start), err) + } +} + +func UDPRoutine(name string, decodeFunc decoder.DecoderFunc, workers int, addr string, port int, sockReuse bool, logger Logger) error { + return UDPStoppableRoutine(make(chan struct{}), name, decodeFunc, workers, addr, port, sockReuse, logger) +} + +// UDPStoppableRoutine runs a UDPRoutine that can be stopped by closing the stopCh passed as argument +func UDPStoppableRoutine(stopCh <-chan struct{}, name string, decodeFunc decoder.DecoderFunc, workers int, addr string, port int, sockReuse bool, logger Logger) error { + ecb := DefaultErrorCallback{ + Logger: logger, + } + + decoderParams := decoder.DecoderParams{ + DecoderFunc: decodeFunc, + DoneCallback: DefaultAccountCallback, + ErrorCallback: ecb.Callback, + } + + processor := decoder.CreateProcessor(workers, decoderParams, name) + processor.Start() + + addrUDP := net.UDPAddr{ + IP: net.ParseIP(addr), + Port: port, + } + + var udpconn *net.UDPConn + var err error + + if sockReuse { + pconn, err := reuseport.ListenPacket("udp", addrUDP.String()) + if err != nil { + return err + } + defer pconn.Close() + var ok bool + udpconn, ok = pconn.(*net.UDPConn) + if !ok { + return err + } + } else { + udpconn, err = net.ListenUDP("udp", &addrUDP) + if err != nil { + return err + } + defer udpconn.Close() + } + + payload := make([]byte, 9000) + + localIP := addrUDP.IP.String() + if addrUDP.IP == nil { + localIP = "" + } + + type udpData struct { + size int + pktAddr *net.UDPAddr + payload []byte + } + + udpDataCh := make(chan udpData) + defer close(udpDataCh) + + wg := &sync.WaitGroup{} + wg.Add(1) + go func() { + defer wg.Done() + for { + u := udpData{} + u.size, u.pktAddr, _ = udpconn.ReadFromUDP(payload) + if u.size == 0 { // Ignore 0 byte packets. + continue + } + u.payload = make([]byte, u.size) + copy(u.payload, payload[0:u.size]) + select { + case <-stopCh: + return + default: + udpDataCh <- u + } + } + }() + func() { + for { + select { + case u := <-udpDataCh: + process(u.size, u.payload, u.pktAddr, processor, localIP, addrUDP, name) + case <-stopCh: + return + } + } + }() + + for _ = range udpDataCh { + // drain + } + wg.Wait() + return nil +} + +func process(size int, payload []byte, pktAddr *net.UDPAddr, processor decoder.Processor, localIP string, addrUDP net.UDPAddr, name string) { + baseMessage := BaseMessage{ + Src: pktAddr.IP, + Port: pktAddr.Port, + Payload: payload, + } + processor.ProcessMessage(baseMessage) + + MetricTrafficBytes.With( + prometheus.Labels{ + "remote_ip": pktAddr.IP.String(), + "local_ip": localIP, + "local_port": strconv.Itoa(addrUDP.Port), + "type": name, + }). + Add(float64(size)) + MetricTrafficPackets.With( + prometheus.Labels{ + "remote_ip": pktAddr.IP.String(), + "local_ip": localIP, + "local_port": strconv.Itoa(addrUDP.Port), + "type": name, + }). + Inc() + MetricPacketSizeSum.With( + prometheus.Labels{ + "remote_ip": pktAddr.IP.String(), + "local_ip": localIP, + "local_port": strconv.Itoa(addrUDP.Port), + "type": name, + }). + Observe(float64(size)) +} diff --git a/third_party/goflow2/utils/utils_test.go b/third_party/goflow2/utils/utils_test.go new file mode 100644 index 000000000000..1f7a880f2cd1 --- /dev/null +++ b/third_party/goflow2/utils/utils_test.go @@ -0,0 +1,93 @@ +package utils + +import ( + "fmt" + "net" + "testing" + "time" + + "github.com/sirupsen/logrus" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestCancelUDPRoutine(t *testing.T) { + testTimeout := time.After(10 * time.Second) + port, err := getFreeUDPPort() + require.NoError(t, err) + dp := dummyFlowProcessor{} + go func() { + require.NoError(t, dp.FlowRoutine("127.0.0.1", port)) + }() + + // wait slightly so we give time to the server to accept requests + time.Sleep(100 * time.Millisecond) + + sendMessage := func(msg string) error { + conn, err := net.Dial("udp", fmt.Sprintf("127.0.0.1:%d", port)) + if err != nil { + return err + } + defer conn.Close() + _, err = conn.Write([]byte(msg)) + return err + } + require.NoError(t, sendMessage("message 1")) + require.NoError(t, sendMessage("message 2")) + require.NoError(t, sendMessage("message 3")) + + readMessage := func() string { + select { + case msg := <-dp.receivedMessages: + return string(msg.(BaseMessage).Payload) + case <-testTimeout: + require.Fail(t, "test timed out while waiting for message") + return "" + } + } + + // in UDP, messages might arrive out of order or duplicate, so whe just verify they arrive + // to avoid flaky tests + require.Contains(t, []string{"message 1", "message 2", "message 3"}, readMessage()) + require.Contains(t, []string{"message 1", "message 2", "message 3"}, readMessage()) + require.Contains(t, []string{"message 1", "message 2", "message 3"}, readMessage()) + + dp.Shutdown() + time.Sleep(100 * time.Millisecond) + + _ = sendMessage("no more messages should be processed") + + select { + case msg := <-dp.receivedMessages: + assert.Fail(t, fmt.Sprint(msg)) + default: + // everything is correct + } +} + +type dummyFlowProcessor struct { + stopper + receivedMessages chan interface{} +} + +func (d *dummyFlowProcessor) FlowRoutine(host string, port int) error { + _ = d.start() + d.receivedMessages = make(chan interface{}) + return UDPStoppableRoutine(d.stopCh, "test_udp", func(msg interface{}) error { + d.receivedMessages <- msg + return nil + }, 3, host, port, false, logrus.StandardLogger()) +} + +func getFreeUDPPort() (int, error) { + a, err := net.ResolveUDPAddr("udp", "127.0.0.1:0") + if err != nil { + return 0, err + } + l, err := net.ListenUDP("udp", a) + if err != nil { + return 0, err + } + defer l.Close() + return l.LocalAddr().(*net.UDPAddr).Port, nil +} diff --git a/third_party/opa/.gitignore b/third_party/opa/.gitignore new file mode 100644 index 000000000000..ab9c6a2d379f --- /dev/null +++ b/third_party/opa/.gitignore @@ -0,0 +1,43 @@ +# development environment +.DS_Store +.vscode +.idea +*~ +*.swp + +# build artifacts +coverage.txt +opa_* +.Dockerfile_* +_release +wasm/_obj +_test +!*_test.go +site.tar.gz +policy.wasm +.npm +.gitbook +.go +release-notes.md +bundle.tar.gz + +# ci artifacts +fuzzit +ast-fuzzer +ast-fuzzer.a + +# runtime artifacts +policies + +# Local Netlify folder +.netlify + +# man pages +man + +# generated when running local website build +docs/website/.hugo_build.lock +docs/website/data/versions + +# generated when building windows binary to add icon and product version +resource.syso \ No newline at end of file diff --git a/third_party/opa/.go-version b/third_party/opa/.go-version new file mode 100644 index 000000000000..2f4320f67fe0 --- /dev/null +++ b/third_party/opa/.go-version @@ -0,0 +1 @@ +1.24.4 diff --git a/third_party/opa/.golangci.yaml b/third_party/opa/.golangci.yaml new file mode 100644 index 000000000000..56bac582543d --- /dev/null +++ b/third_party/opa/.golangci.yaml @@ -0,0 +1,215 @@ +run: + timeout: 5m + +issues: + max-same-issues: 0 # don't hide issues in CI runs because they are the same type + exclude-dirs: + - internal/gojsonschema + - internal/jwx + exclude-rules: + - path: ast/ + linters: + - staticcheck + text: "SA1019" + - path: bundle/ + linters: + - staticcheck + text: "SA1019" + - path: capabilities/ + linters: + - staticcheck + text: "SA1019" + - path: compile/ + linters: + - staticcheck + text: "SA1019" + - path: config/ + linters: + - staticcheck + text: "SA1019" + - path: cover/ + linters: + - staticcheck + text: "SA1019" + - path: debug/ + linters: + - staticcheck + text: "SA1019" + - path: dependencies/ + linters: + - staticcheck + text: "SA1019" + - path: download/ + linters: + - staticcheck + text: "SA1019" + - path: format/ + linters: + - staticcheck + text: "SA1019" + - path: hooks/ + linters: + - staticcheck + text: "SA1019" + - path: ir/ + linters: + - staticcheck + text: "SA1019" + - path: keys/ + linters: + - staticcheck + text: "SA1019" + - path: loader/ + linters: + - staticcheck + text: "SA1019" + - path: logging/ + linters: + - staticcheck + text: "SA1019" + - path: metrics/ + linters: + - staticcheck + text: "SA1019" + - path: plugins/ + linters: + - staticcheck + text: "SA1019" + - path: profiler/ + linters: + - staticcheck + text: "SA1019" + - path: refactor/ + linters: + - staticcheck + text: "SA1019" + - path: repl/ + linters: + - staticcheck + text: "SA1019" + - path: rego/ + linters: + - staticcheck + text: "SA1019" + - path: resolver/ + linters: + - staticcheck + text: "SA1019" + - path: runtime/ + linters: + - staticcheck + text: "SA1019" + - path: schemas/ + linters: + - staticcheck + text: "SA1019" + - path: sdk/ + linters: + - staticcheck + text: "SA1019" + - path: server/ + linters: + - staticcheck + text: "SA1019" + - path: storage/ + linters: + - staticcheck + text: "SA1019" + - path: tester/ + linters: + - staticcheck + text: "SA1019" + - path: topdown/ + linters: + - staticcheck + text: "SA1019" + - path: tracing/ + linters: + - staticcheck + text: "SA1019" + - path: types/ + linters: + - staticcheck + text: "SA1019" + - path: util/ + linters: + - staticcheck + text: "SA1019" + - path: version/ + linters: + - staticcheck + text: "SA1019" + +linters-settings: + lll: + line-length: 200 + gocritic: + disabled-checks: + - appendAssign + # NOTE(ae): this one should be enabled, but there were too + # many violations to fix in one go... revisit later + - singleCaseSwitch + # Reasonable rule, but not sure what to replace with in + # many locations, so disabling for now + - exitAfterDefer + # The following 3 rules are disabled from the perfomance tag + # enabled further down. The first two are reasonable, but not + # super important. appendCombine is really nice though! And + # should be enabled. Just many places to fix.. + - hugeParam + - preferFprint + - appendCombine + enabled-checks: + # NOTE that these are rules enabled in addition to the default set + - filepathJoin + - dupImport + - redundantSprint + - stringConcatSimplify + enabled-tags: + - performance + settings: + ifElseChain: + # ridiculous value set for now, but this should be + # lowered to something more reasonable, as the rule + # is reasonable (replace long if-else chains with + # switch)... just too many violations right now + minThreshold: 10 + govet: + enable: + - deepequalerrors + - nilness + perfsprint: + # only rule disabled by default, but it's a good one + err-error: true + revive: + rules: + # this mainly complains about us using min/max for variable names, + # which seems like an unlikely source of actual issues + - name: redefines-builtin-id + disabled: true + - name: unused-receiver + disabled: false + +linters: + disable-all: true + enable: + - mirror + - errcheck + - govet + - ineffassign + - intrange + - revive # replacement for golint + - gofmt + - goimports + - unused + - misspell + - usetesting + - typecheck + - staticcheck + - gosimple + - prealloc + - unconvert + - copyloopvar + - perfsprint + - gocritic + # - gosec # too many false positives diff --git a/third_party/opa/.regal/config.yaml b/third_party/opa/.regal/config.yaml new file mode 100644 index 000000000000..45da0a40842a --- /dev/null +++ b/third_party/opa/.regal/config.yaml @@ -0,0 +1,24 @@ +ignore: + files: + - "docs/*" + - "**/test/*" + - "**/testdata/*" + - "**/testfiles/*" + +rules: + idiomatic: + directory-package-mismatch: + exclude-test-suffix: true + ignore: + files: + - "docs" + - "internal/wasm/sdk/examples/*" + style: + line-length: + ignore: + files: + - "docs" + +project: + roots: + - build/policy diff --git a/third_party/opa/.trivyignore b/third_party/opa/.trivyignore new file mode 100644 index 000000000000..74dc0da0a35c --- /dev/null +++ b/third_party/opa/.trivyignore @@ -0,0 +1,35 @@ +# We're not directly using nor running these dependencies, and hence they're not applicable +# +# * github.com/satori/go.uuid - used by a dependency that imports containerd... the containerd import +# used here is not vulnerable though. +CVE-2021-3538 + +# * go.etcd.io/etcd - we don't run etcd as part of the OPA deployment +CVE-2018-1098 +CVE-2018-1099 + +# * k8s.io/kubernetes - we don't run kubernetes as part of the OPA deployment +CVE-2019-1002101 +CVE-2019-11250 +CVE-2019-11253 +CVE-2019-11254 +CVE-2020-8552 +CVE-2020-8554 +CVE-2020-8555 +CVE-2020-8557 +CVE-2020-8558 +CVE-2020-8559 +CVE-2020-8561 +CVE-2020-8562 +CVE-2020-8563 +CVE-2020-8564 +CVE-2020-8565 +CVE-2021-25735 +CVE-2021-25740 +CVE-2021-25741 + +# * github.com/emicklei/go-restful - we don't use its code in our handlers +CVE-2022-1996 + +# github.com/dgrijalva/jwt-go -- vulnerable version used by docker/distribution above +CVE-2020-26160 diff --git a/third_party/opa/.yamllint.yaml b/third_party/opa/.yamllint.yaml new file mode 100644 index 000000000000..7fd66d2e0798 --- /dev/null +++ b/third_party/opa/.yamllint.yaml @@ -0,0 +1,12 @@ +extends: default + +rules: + # Some of our testcases end up going past the default 80 character limit. + line-length: false + braces: + max-spaces-inside: 1 + comments: + min-spaces-from-content: 1 + indentation: + ignore: + - test-time-* diff --git a/third_party/opa/ADOPTERS.md b/third_party/opa/ADOPTERS.md new file mode 100644 index 000000000000..b495100b3ec9 --- /dev/null +++ b/third_party/opa/ADOPTERS.md @@ -0,0 +1,311 @@ +# Adopters + + + + +This is a list of organizations that have spoken publicly about their adoption or +production users that have added themselves (in alphabetical order): + +* [2U, Inc](https://2u.com) has incorporated OPA into their SDLC for both Terraform and Kubernetes deployments. + Shift left! + +* [APIwiz](https://www.apiwiz.io) has implemented OPA as a centralized service to enforce consistent + and secure authorization decisions across all internal APIs. By delegating authorization logic to OPA, + APIwiz streamlines access control, ensuring robust security throughout the platform. Furthermore, OPA + has been seamlessly integrated into APIwiz's API Builder, enabling users to embed policy-driven workflows. + This integration provides precise control over workflows, enhancing both the security and efficiency of + the platform's operations. + +* [Appsflyer](https://www.appsflyer.com/) uses OPA to make consistent + authorization decisions by hundreds of microservices for UI and API data + access. All authorization decisions are delegated to OPA that is deployed as a + central service. The decisions are driven by flexible policy rules that take + into consideration data privacy regulations and policies, data consents and + application level access permissions. For more information, see the [Appsflyer + Engineering Blog post](https://medium.com/appsflyer/authorization-solution-for-microservices-architecture-a2ac0c3c510b). + +* [Atlassian](https://www.atlassian.com/) uses OPA in a heterogeneous cloud + environment for microservice API authorization. OPA is deployed per-host and + inside of their Slauth (AAA) system. Policies are tagged and categorized + (e.g., platform, service, etc.) and distributed via S3. Custom log infrastructure + consumes decision logs. For more information see this talk from [OPA Summit 2019](https://www.youtube.com/watch?v=nvRTO8xjmrg). + +* [Bisnode](https://www.dnb.com/en-gb/about-us/we-are-now-dun-bradstreet.html) + (Dun & Bradstreet) uses OPA for a wide range of use cases, + including microservice authorization, fine grained kubernetes authorization, + validating and mutating admission control and CI/CD pipeline testing. Built + and maintains some OPA related tools and libraries, primarily to help + integrate OPA in the Java/JVM ecosystem, [see `github.com/Bisnode`](https://github.com/Bisnode). + +* [bol.com](https://www.bol.com/) uses OPA for a mix of + validating and mutating admission control use cases in their + Kubernetes clusters. Use cases include patching image pull secrets, + load balancer properties, and tolerations based on contextual + information stored on namespaces. OPA is deployed on multiple + clusters with ~100 nodes and ~300 namespaces total. + +* [BNY Mellon](https://www.bnymellon.com/) uses OPA as a sidecar to enforce access + control over applications based on external context coming from AD and other + internal services. For more information see this talk from [QCon 2019](https://www.infoq.com/presentations/opa-spring-boot-hocon/). + +* [Capital One](https://www.capitalone.com/) uses OPA to enforce a variety of + admission control policies across their Kubernetes clusters including image + registry allowlisting, label requirements, resource requirements, container + privileges, etc. For more information see this talk from [KubeCon US 2018](https://www.youtube.com/watch?v=CDDsjMOtJ-c&t=6m35s) + and this talk from [OPA Summit 2019](https://www.youtube.com/watch?v=vkvWZuqSk5M). + +* [Chef](https://www.chef.io/) integrates OPA to implement IAM-style + access control and enumerate user->resource permissions in Chef + Automate V2. The integration utilizes OPA's Partial Evaluation + feature to reduce evaluation time (in exchange for higher update + latency.) A high-level description can be found [in this blog + post](https://blog.chef.io/2019/01/24/introducing-the-chef-automate-identity-access-management-version-two-iam-v2-beta/), + and the code is Open Source, [see + `github.com/chef/automate`](https://github.com/chef/automate/tree/master/components/authz-service). + +* [cluetec.de](https://cluetec.de) primarily uses OPA to enforce fine-grained authorization + and data-filtering policies in its Spring-based microservices and multi-tenant SaaS. Policies + are mapped to tenant-specific domains and used to enrich the database queries without any code + modifications. OPA is also used to enforce admission control policies and RBAC in multi-tenant + Kubernetes clusters. + +* [Cloudflare](https://www.cloudflare.com/) uses OPA as a validating + admission controller to prevent conflicting Ingresses in their + Kubernetes clusters that host a mix of production and test + workloads. + +* [Cloudsmith](https://www.cloudsmith.com/) uses OPA to allow organizations to define, enforce, + and monitor policies across the artifact lifecycle. Cloudsmith users can leverage EPSS-based logic + in their Rego policies for more granular, data-informed decisions around vulnerability management. + For more information on how Cloudsmith uses Exploit Prediction Scoring System (EPSS) in OPA policies, + check out the [Cloudsmith Blog](https://cloudsmith.com/blog/cloudsmith-introduces-epss-scoring-in-enterprise-policy-management-epm). + +* [ControlPlane](https://control-plane.io) uses OPA to enforce enterprise-friendly + policy for safe adoption of Kubernetes, Istio, and cloud services. OPA policies + are validated and tested individually and en masse with unit tests and conftest. + This enables developers to validate local changes against production policies, + minimise engineering feedback loops, and reduce CI cycle time. Policies are + tested as "SDLC guardrails", then re-validated at deployment time by a range of + OPA-based admission controllers, covering single-tenant environments and hard + multi-tenancy configurations. + +* [Elastic](https://www.elastic.co/) uses OPA in its Cloud Security offering to enable CSPM and KSPM solutions, helping customers adhere to best practices + defined in CIS benchmarks by tracking misconfigurations on AWS, GCP and Azure. the code is Open Source, see [Security Policies](https://github.com/elastic/cloudbeat/tree/main/security-policies). + +* [Facets.cloud](https://www.facets.cloud/) is a DevOps platform designed to streamline software development and deployment processes. + The integration of Open Policy Agent (OPA) has been a key factor in developing our [Guardrails Policy](https://readme.facets.cloud/docs/guardrail-policy) feature. + Managed using OPA, this feature enables our customers to set rules that align their software blueprints(detailed architectural designs of their software) - with established standards. + The Guardrails Policy feature has optimized resource management, minimized redundancy in policy definitions, and ensured comprehensive adherence to organizations’ best practices. + +* [Fugue](https://fugue.co) was a cloud security SaaS that uses OPA to + classify compliance violations and security risks in AWS and Azure + accounts and generate compliance reports and notifications. Now part of + [Snyk](https://snyk.com). + +* [Goldman Sachs](https://www.goldmansachs.com/) uses OPA to enforce admission control + policies in their multi-tenant Kubernetes clusters as well as for _provisioning_ + RBAC, PV, and Quota resources that are central to the security and operation of + these clusters. For more information see this talk from [KubeCon US 2019](https://www.youtube.com/watch?v=lYHr_UaHsYQ). + +* [Google Cloud](https://cloud.google.com/) uses OPA to validate Google Cloud + product's configurations in several products and tools, including + [Anthos Config Management](https://cloud.google.com/anthos/config-management), + [GKE Policy Automation](https://github.com/google/gke-policy-automation) or + [Config Validator](https://github.com/GoogleCloudPlatform/policy-library). See + [Creating policy-compliant Google Cloud resources article](https://cloud.google.com/architecture/policy-compliant-resources) + for example use cases. + +* [Infracost](https://www.infracost.io/) shows cloud cost estimates for Terraform. + It uses OPA to enable users to create cost policies, and setup guardrails such + as "this change puts the monthly costs above $10K, which is the budget for this + product. Consider asking the team lead to review it". See [the docs](https://www.infracost.io/docs/features/cost_policies/) for details. + +* [Intuit](https://www.intuit.com/company/) uses OPA as a validating + and mutating admission controller to implement various security, + multi-tenancy, and risk management policies across approximately 50 + clusters and 1,000 namespaces. For more information on how Intuit + uses OPA see [this talk from KubeCon Seattle 2018](https://youtu.be/CDDsjMOtJ-c?t=980). + +* [Jetstack](https://www.jetstack.io) uses OPA on customer projects to validate + resources deployed to Kubernetes environments are conformant with + organization rules. This has involved both validating and mutating resources + as well as the following related projects: conftest, konstraint, and + Gatekeeper. Jetstack also uses OPA via the Golang API in _Jetstack Secure_ to + automate the checking of resources against our best practice recommendations. + +* [Marsh McLennan](https://www.marshmclennan.com) uses OPA Gatekeeper in their + Kubernetes clusters, and OPA as an authorization decision point by many + applications for ingress traffic. Some applications also use OPA as a rules + engine. + +* [Medallia](https://www.medallia.com/) uses OPA to audit AWS + resources for compliance violations. The policies search across + state from Terraform and AWS APIs to identify security violations + and identify high-risk configurations. The policies ingest 1,000s of + AWS resources to generate the final report. + +* [Mercari](https://www.mercari.com/) uses OPA to enforce admission control + policies in their multi-tenant Kubernetes clusters. It helps maintain + the governance of the cluster, checking that developers are following + the best practices in the admission controller. They also use [confest](https://github.com/open-policy-agent/conftest) to + enforce policies in their CI/CD pipeline. + +* [Mia-Platform](https://mia-platform.eu/) uses OPA to run RBAC authorization policies + distributed within the application microservices. They built [Rönd](https://github.com/rond-authz/rond) + sidecar to intercept API invocation in the kubernetes ecosystem and created an extensible + RBAC solution that protects the application with little-to-none changes to the existing codebase. + +* [Netflix](https://www.netflix.com) uses OPA as a method of enforcing + access control in microservices across a variety of languages and + frameworks for thousands of instances in their cloud + infrastructure. Netflix takes advantage of OPA's ability to bring in + contextual information and data from remote resources in order to + evaluate policies in a flexible and consistent manner. For a + description of how Netflix has architected access control with OPA + check out [this talk from KubeCon Austin 2017](https://www.youtube.com/watch?v=R6tUNpRpdnY). + +* [Pinterest](https://www.pinterest.com/) uses OPA to solve multiple policy-related use cases + including access control in Kafka, Envoy, and Jenkins! At peak, their Kafka-OPA + integration handles ~400K QPS without caching. With caching the system + handles ~8.5M QPS. For more information see this talk from [OPA Summit 2019](https://www.youtube.com/watch?v=LhgxFICWsA8). + +* [Pix4D](https://www.pix4d.com/) uses OPA to run and define RBAC authorization policies for + the users of its cloud platform. Defining the policies in OPA ensures a single source of + controls and a consistent policy enforcement for any microservices. It operates as a + sidecar to a Django application exposing access roles of users over resources. + +* [Plex Systems](https://www.plex.com) uses OPA to enforce policy throughout + their entire release process; from local development to continuous production + audits. The CI/CD pipelines at Plex leverage [conftest](https://github.com/instrumenta/conftest), + a policy enforcement tool that relies on OPA, to automatically reject changes that do not adhere + to defined policies. Plex also uses + [Gatekeeper](https://github.com/open-policy-agent/gatekeeper), a Kubernetes policy controller, as + a means to enforce policies within their Kubernetes clusters. The general-purpose nature of OPA + has enabled Plex to have a consistent means of policy enforcement, + no matter the environment. + +* [Splash](https://splashthat.com) uses OPA to handle fine-grained authorization + across its entire platform, implemented as both a sidecar in Kubernetes and a separate + container on bare instances. Policies and datasets are recompiled and updated based + on changes to users' roles and permissions. + +* [SAP/InfraBox](https://github.com/SAP/Infrabox) integrates OPA to + implement authorization over HTTP API resources. OPA policies + evaluate user and permission data replicated from Postgres to make + access control decisions over projects, collaborators, jobs, + etc. SAP/Infrabox is used in production within SAP and has several + external users. + +* [Terminus Software](https://terminus.com/) uses OPA for microservice authorization. + +* [T-Mobile](https://www.t-mobile.com) uses OPA as a core component for their + [MagTape](https://github.com/tmobile/magtape/) project that enforces best + practices and secure configurations across their fleet of Kubernetes + clusters (more info in [this blog post](https://opensource.t-mobile.com/blog/posts/rolling-out-the-magenta-tape/)). + T-Mobile also leverages OPA to enforce authorization workflows within their + Corporate Delivery Platform (CI/CD). + +* [Tremolo Security](https://www.tremolosecurity.com/) uses OPA at a + London-based financial services company to inject annotations and + volume mount parameters into Kubernetes Pods so that workloads can + connect to off-cluster CIFS drives and SQL Server + instances. Policies are based on external context sourced from + OpenUnison. Ability to validate policies offline is a huge win + because the clusters are air-gapped. For more information on how + Tremolo Security uses OPA see [this blog post](https://www.tremolosecurity.com/beyond-rbac-in-openshift-open-policy-agent/). + +* [Tripadvisor](http://tripadvisor.com/) uses OPA to enforce + admission control policies in Kubernetes. In the process of rolling out OPA, + they created an integration testing framework that verifies clusters are accepting + and rejecting the right objects when OPA is deployed. For more information see + this talk from [OPA Summit 2019](https://www.youtube.com/watch?v=X09c1eXvCFM). + +* [Very Good Security (VGS)](https://www.vgs.io/) integrates OPA to + implement a fine-grained permission system and enumerate + user->resource permissions in their product. The backend is + architected as a collection of (polyglot) microservices running on + Kubernetes that offload policy decisions to OPA sidecars. VGS has + implemented a synchronization protocol on top of the Bundle and + Status APIs so that the system can determine when permission updates + have propagated. For more details on the VGS use case see this + [blog post](https://www.verygoodsecurity.com/blog/posts/building-a-fine-grained-permission-system-in-a-distributed-environment). + +* [VNG Cloud](https://www.vngcloud.vn/en/home) [Identity and Access Management (IAM)](https://iam.vngcloud.vn/) + use OPA as a policy-based decision engine for authorization. IAM provides administrators with fine-grained + access control to VNG Cloud resources and help centralize and manage permissions to access resources. + Specifically, OPA is integrated to evaluate policies to make the decision about denying or allowing incoming requests. + +* [Wiz](https://www.wiz.io/) helps every organization rapidly remove the most critical + risks in their cloud estate. It simply connects in minutes, requires zero agents, and + automatically correlates the entire security stack to uncover the most pressing issues. + Wiz policies leverage Open Policy Agent (OPA) for a unified framework across the + cloud-native stack. Whether for configurations, compliance, IaC, and more, OPA enables + teams to move faster in the cloud. For more information on how Wiz uses OPA, [contact Wiz](https://www.wiz.io/contact/). + +* [Xenit AB](https://www.xenit.se/) uses OPA to implement fine-grained control + over resource formulation in its managed Kubernetes service as well as several + customer-specific implementations. For more information, see the Kubernetes Terraform library + [OPA Gatekeeper module](https://github.com/XenitAB/terraform-modules/tree/main/modules/kubernetes/gatekeeper) and + [OPA Gatekeeper policy library](https://github.com/XenitAB/gatekeeper-library). + +* [Yelp](https://www.yelp.com/) use OPA and Envoy to enforce authorization policies + across a fleet of microservices that evolved out of a monolithic architecture. + For more information see this talk from [KubeCon US 2019](https://www.youtube.com/watch?v=Z6aN3Smt-9M). + +In addition, there are several production adopters that prefer to +remain anonymous. + +* **A Fortune 100 company** uses OPA to implement validating admission + control and fine-grained authorization policies on ~10 Kubernetes + clusters with ~1,000 nodes. They also integrate OPA into their PKI + as part of a Certificate RA that serves these clusters. + +This is a list of adopters in early stages of production or +pre-production (in alphabetical order): + +* [Aserto](https://www.aserto.com/) is a venture-backed developer API company + that helps developers easily build permissions and roles into their SaaS + applications. Aserto uses OPA as its core engine, and has contributed projects + such as [Open Policy Containers](https://openpolicycontainers.com/) and + [OPA Runtime](https://github.com/aserto-dev/runtime) that make it easier for + developers to incorporate OPA policies and the OPA engine into their applications. + +* [Cyral](https://www.cyral.com/) is a venture-funded data security + company. Still in stealth mode but using OPA to manage and enforce + fine-grained authorization policies. + +* [Permit.io](https://permit.io) Uses a combination of OPA and OPAL + to power fine-grained authorization policies at the core of the Permit.io platform. + Permit.io leverages the power of OPA's Rego language, + generating new Rego code on the fly from its UI policy editor. + The team behind Permit.io contributes to the OPA ecosystem - creating opens-source projects like + [OPAL- making OPA event-driven)](https://github.com/permitio/opal) + and [OPToggles - sync Frontend with open-policy](https://github.com/permitio/OPToggles). + +* [Scalr](https://scalr.com/) is a remote operations backend for Terraform + that helps users scale their Terraform usage through automation and collaboration. + [Scalr uses OPA](https://docs.scalr.com/en/latest/opa.html) to validate Terraform + code against organization standards and allows for approvals prior to a Terraform apply. + +* [Spacelift](https://spacelift.io) is a specialized CI/CD platform + for infrastructure-as-code. Spacelift is [using OPA](https://docs.spacelift.io/concepts/policy) to provide flexible, + fine-grained controls at various application decision points, including + automated code review, defining access levels or blocking execution of + unwanted code. + +* [Magda](https://github.com/magda-io/magda) is a federated, Kubernetes-based, open-source data catalog system. Working as Magda's central authorisation policy engine, OPA helps not only the API endpoint authorisation. Magda also uses its partial evaluation feature to translate datasets authorisation decisions to other database-specific DSLs (e.g. SQL or Elasticsearch DSL) and use them for dataset authorisation enforcement in different databases. + +* [VodafoneZiggo](https://www.vodafoneziggo.nl/) Is a Dutch telecommunications company that uses OPA to power authorisation decisions in our internal developer platform based on Backstage, it is also used as a way to enforce and validate component metadata that is onboarded as software components into the Backstage software catalog. + +Other adopters that have gone into production or various stages of +testing include: + +* [Cisco](https://www.cisco.com/) +* [Nefeli Networks](https://nefeli.io) +* [SolarWinds](https://www.solarwinds.com/) via [Lee Calcote](https://github.com/leecalcote) +* [State Street Corporation](http://www.statestreet.com/) +* [PITS Global Data Recovery Services](https://www.pitsdatarecovery.net/) + +If you have adopted OPA and would like to be included in this list, +feel free to submit a PR updating this file or +[open an issue](https://github.com/open-policy-agent/opa/issues/new?assignees=&labels=adopt-opa&template=adopt-opa.yaml&title=organization_name+has+adopted+OPA). diff --git a/third_party/opa/CHANGELOG.md b/third_party/opa/CHANGELOG.md new file mode 100644 index 000000000000..59ae566ecace --- /dev/null +++ b/third_party/opa/CHANGELOG.md @@ -0,0 +1,7533 @@ +# Change Log + +All notable changes to this project will be documented in this file. This +project adheres to [Semantic Versioning](http://semver.org/). + +## 1.7.1 + +This is a bug fix release addressing two issues for users that include OPA's CLI in their own application's CLI: + - A missing symbol in the `cmd` package (`cmd.RootCommand`) + - A possible panic in the `opa parse` command + +## 1.7.0 + +This release contains a mix of new features, performance improvements, and bugfixes. Notably: + +- Improved OPA SDK/API for better extensibility + +### SDK Improvements + +The OPA SDK/API has been improved to provide better extensibility an more points of integration for developers. + +- ast: Add `DefaultModuleLoader` ([#7794](https://github.com/open-policy-agent/opa/pull/7794)) authored by @srenatus +- ast: Add feature registration from the outside ([#7782](https://github.com/open-policy-agent/opa/pull/7782)) authored by @srenatus +- bundle: Add support for bundle store and activation plugins ([#7771](https://github.com/open-policy-agent/opa/pull/7771)) authored by @philipaconrad +- cmd: Allow branding ([#7797](https://github.com/open-policy-agent/opa/pull/7797)) authored by @srenatus +- decisionlogs: Add custom fields grab bag ([#7793](https://github.com/open-policy-agent/opa/pull/7793)) authored by @srenatus +- plugins: allow registering handlerfuncs with name+path ([#7769](https://github.com/open-policy-agent/opa/pull/7769)) authored by @srenatus +- rego: Expose `QueryTracers`, `tracing.Options` and `Cancel` from `QueryContext` ([#7767](https://github.com/open-policy-agent/opa/pull/7767)) authored by @philipaconrad +- rego: Pass along `TracingOpts` into `EvalContext` ([#7778](https://github.com/open-policy-agent/opa/pull/7778)) authored by @srenatus +- runtime: add `ExtraDiscoveryOpts` to `runtime.Params` ([#7766](https://github.com/open-policy-agent/opa/pull/7766)) authored by @srenatus +- sdk: Allow for setting default options for all instances ([#7760](https://github.com/open-policy-agent/opa/pull/7760)) authored by @srenatus +- server: Add hooks wiring + new hooks for inter-query caches ([#7775](https://github.com/open-policy-agent/opa/pull/7775)) authored by @srenatus +- server: Ensure that wrapped middlewares all support `http.Flusher` ([#7772](https://github.com/open-policy-agent/opa/pull/7772)) authored by @srenatus +- server/authorizer: Allow adding paths to validator ([#7792](https://github.com/open-policy-agent/opa/pull/7792)) authored by @philipaconrad +- server+plugins: Allow plugins to inject http handler middlewares ([#7789](https://github.com/open-policy-agent/opa/pull/7789)) authored by @srenatus reported by @deeglaze +- store+runtime: Extension points for custom stores ([#7779](https://github.com/open-policy-agent/opa/pull/7779)) authored by @srenatus +- test+eval: Add helper to smuggle compiler through context ([#7790](https://github.com/open-policy-agent/opa/pull/7790)) authored by @srenatus +- tester: Support `uint64` and `float64` metrics in `runBenchmark` ([#7761](https://github.com/open-policy-agent/opa/pull/7761)) authored by @srenatus + +### Runtime, Tooling + +- build: Show a warning when .manifest is ignored ([#7807](https://github.com/open-policy-agent/opa/pull/7807)) authored by @charlieegan3 +- cli: Avoid os.Exit() in Run() funcs ([#7788](https://github.com/open-policy-agent/opa/pull/7788)) authored by @srenatus +- config: Keep unknown env replacements ([#7786](https://github.com/open-policy-agent/opa/pull/7786)) authored by @srenatus +- format: Not bracketing keywords in imports ([#7742](https://github.com/open-policy-agent/opa/issues/7742)) authored by @johanfylling +- loader: Add bundle lazy loading mode across the runtime. ([#7768](https://github.com/open-policy-agent/opa/pull/7768)) authored by @philipaconrad +- loader: Pass bundle name in `AsBundle()` ([#7798](https://github.com/open-policy-agent/opa/pull/7798)) authored by @srenatus +- opa exec: stop plugins before exit ([#7760](https://github.com/open-policy-agent/opa/pull/7760)) authored by @srenatus +- plugins/discovery: Make `Factories()` merge the factories ([#7777](https://github.com/open-policy-agent/opa/pull/7777)) authored by @srenatus +- plugins/discovery: Replace environment variables after evaluation ([#7787](https://github.com/open-policy-agent/opa/pull/7787)) authored by @philipaconrad +- plugins/logs: Add experimental intermediate results field ([#7796](https://github.com/open-policy-agent/opa/pull/7796)) authored by @philipaconrad +- report: Fetching latest OPA release version from GitHub ([#7756](https://github.com/open-policy-agent/opa/pull/7756)) authored by @johanfylling + OPA will no longer send telemetry data when fetching the latest release version. +- runtime: Allow enabling NDBCache by default ([#7780](https://github.com/open-policy-agent/opa/pull/7780)) authored by @srenatus +- server+logging: Add `BatchDecisionID` field to Decision Logs ([#7791](https://github.com/open-policy-agent/opa/pull/7791)) authored by @philipaconrad +- store: Improve conflicting root error message ([#7806](https://github.com/open-policy-agent/opa/issues/7806)) authored by @charlieegan3 + +### Compiler, Topdown and Rego + +- perf: AST compiler optimizations ([#7740](https://github.com/open-policy-agent/opa/pull/7740)) authored by @anderseknert + +### Docs, Website + +**Note:** While we have been working on the new website we have been showing +the edge documentation contents (as contents and framework changes often must +go hand in hand). Now that the website development pace has slowed and the +functionality is more stable, we will be returning to showing the documentation +content from the latest release instead. Please use the +[edge documentation site](https://edge--opa-docs.netlify.app/) +to review new changes. PR previews are also based on the latest branch commit. +This change will be made to show the v1.7.0 release shortly after publishing. + +- docs: Add examples for crypto.sha256 and base64.encode built-in functions ([#7762](https://github.com/open-policy-agent/opa/pull/7762)) authored by @ToluGIT +- docs: Break out the built-in categories in policy ref ([#7722](https://github.com/open-policy-agent/opa/pull/7722)) authored by @sky3n3t +- docs: Correctly spell NetBSD ([#7738](https://github.com/open-policy-agent/opa/pull/7738)) authored by @iamleot +- docs: Fix a number of minor docs typos ([#7799](https://github.com/open-policy-agent/opa/pull/7799)) authored by @charlieegan3 +- docs: Fix `/docs/envoy-authorization/` `404` ([#7755](https://github.com/open-policy-agent/opa/issues/7755) authored by @charlieegan3 +- docs: Remove link to OPA playground share ([#7750](https://github.com/open-policy-agent/opa/pull/7750)) authored by @charlieegan3 +- docs: Revise docs index page wording ([#7805](https://github.com/open-policy-agent/opa/pull/7805)) authored by @charlieegan3 +- docs: Update warning note in GraphQL API docs ([#7737](https://github.com/open-policy-agent/opa/pull/7737)) authored by @charlieegan3 +- website: Add wildcard CORS for data/versions.json ([#7784](https://github.com/open-policy-agent/opa/pull/7784)) authored by @charlieegan3 +- website: Ensure no hscroll on built-in tables ([#7773](https://github.com/open-policy-agent/opa/pull/7773)) authored by @charlieegan3 +- website: Render versions under `/data/versions.json` ([#7783](https://github.com/open-policy-agent/opa/pull/7783)) authored by @charlieegan3 +- website: Set mobile and desktop tab sizes ([#7774](https://github.com/open-policy-agent/opa/pull/7774)) authored by @charlieegan3 +- website: Show link to the edge release of the docs ([#7776](https://github.com/open-policy-agent/opa/pull/7776)) authored by @charlieegan3 + +### Miscellaneous + +- Benchmark fixes ([#7765](https://github.com/open-policy-agent/opa/pull/7765)) authored by @anderseknert +- Use Regal for linting Rego ([#7752](https://github.com/open-policy-agent/opa/pull/7752)) authored by @anderseknert +- Use shorthand form for types ([#7757](https://github.com/open-policy-agent/opa/pull/7757)) authored by @anderseknert +- .github: Use types for issues ([#7751](https://github.com/open-policy-agent/opa/pull/7751)) authored by @charlieegan3 +- build: Add top-level token permissions for workflows ([#7795](https://github.com/open-policy-agent/opa/pull/7795)) authored by @timothyklee + +- docs/build: Link checker fixes ([#7743](https://github.com/open-policy-agent/opa/pull/7743)) authored by @charlieegan3 +- Dependency updates; notably: + - build(deps): bump github.com/containerd/containerd/v2 from 2.1.1 to 2.1.3 + - build(deps): bump google.golang.org/grpc from 1.73.0 to 1.74.2 + - build(deps): bump go.opentelemetry.io deps from 1.36.0/0.61.0 to 1.37.0/0.62.0 + +## 1.6.0 + +This release contains a mix of new features, performance improvements, and bugfixes. Notably: + +- Improvements to the OPA website and documentation +- Allowing keywords in Rego references +- Parallel test execution +- Faster built-in function execution + +### Modernized OPA Website ([#7037](https://github.com/open-policy-agent/opa/issues/7037)) + +We're continuing to modernize the OPA website with a new design and improved user experience. + +Some highlights: + +- [Builtins](https://www.openpolicyagent.org/docs/policy-reference#built-in-functions): You can now search them on the docs page! +- Sidebar redesign: Making it easier to find what you're looking for in our docs +- Feedback forms: Closing the feedback loop between docs authors and readers -- Please let us know if you dislike, or like, a docs page. +- [Downloads page](https://www.openpolicyagent.org/docs#1-download-opa): Find your OS' installation instructions on a less cluttered page! +- And much more + +Authored by @sky3n3t and @charlieegan3 + +### Allowing keywords in Rego references ([#7709](https://github.com/open-policy-agent/opa/pull/7709)) + +Previously, Rego references could not contain terms that conflict with Rego keywords such as `package`, `if`, `else`, `not`, etc. +in certain constructs: + +```rego +package example + +allow if { + input.package.source # not allowed (before v1.6.0) + input["package"].destination # allowed +} +``` + +The constraints for valid Rego references have been relaxed to allow keywords. +The above example is now valid and will no longer cause a compilation error. + +Authored by @johanfylling + +### Parallel Test Execution ([#7442](https://github.com/open-policy-agent/opa/issues/7442)) + +By default, OPA will now run tests in parallel (defaulting to one parallel execution thread per available CPU core), significantly speeding up test execution time for large test suites. +The performance boost is closely tied to the number of tests in your project and your selected parallelism level. For larger projects and default settings, 2-3x performance gains have been measured on a MacBook Pro. + +Parallelism can be disabled to run tests sequentially by setting the `--parallel` flag to `1`. E.g. `opa test . --parallel=1`. + +Authored by @sspaink reported by @anderseknert + +### Faster Builtin Function Evaluation + +The builtin context, an internal construct of OPA's evaluation engine, was previously provided to every builtin function. +As it turns out, only very few of them actually need it, for caching, cancellation, or lookups. +Those builtins are still provided with a builtin context, but for calls to all other builtins, we save the memory required by it. +The impact is tremendous: Even though the size of a single builtin context is only about 270 bytes, in an example application (Regal), this change brings about 360 MB of reduced memory usage! + +Authored by @anderseknert + +### Runtime, Tooling, SDK + +- cmd/check: `opa check --bundle` report virtual/base doc conflicts ([#7701](https://github.com/open-policy-agent/opa/pull/7701)) authored by @anderseknert + When `opa check` is used with the `--bundle` flag, an error will be reported if the provided json/yaml data has a conflicting overlap with the virtual documents generated by Rego rules. Such conflicts are ambiguous and can lead to unexpected evaluation results, and should be resolved. +- cmd/inspect: Fixing missing annotations location in `opa inspect` with JSON format ([#7459](https://github.com/open-policy-agent/opa/issues/7459)) authored by @johanfylling reported by @mostealth +- cmd/parse: Expose `--v0-compatible` flag ([#7668](https://github.com/open-policy-agent/opa/pull/7668)) authored by @tsandall +- cmd/refactor: Fix src:dst parsing to deal with colons ([#7648](https://github.com/open-policy-agent/opa/pull/7648)) authored by @tsandall +- metrics: Fix restartable timer bug. ([#7669](https://github.com/open-policy-agent/opa/pull/7669)) authored by @philipaconrad +- metrics: Prealloc maps + add benchmark ([#7664](https://github.com/open-policy-agent/opa/pull/7664)) authored by @philipaconrad +- oracle: Add support for some and every ([#7716](https://github.com/open-policy-agent/opa/pull/7716)) authored by @charlieegan3 +- oracle: Support object refs in FindDefinition ([#7711](https://github.com/open-policy-agent/opa/pull/7711)) authored by @charlieegan3 +- plugin/decision: Check if event is too large after compression ([#7526](https://github.com/open-policy-agent/opa/issues/7526)) authored by @sspaink +- runtime,server: Replace gorilla/mux dependency with http.ServeMux ([#7676](https://github.com/open-policy-agent/opa/pull/7676)) authored by @anderseknert + **Note**: This is a potentially breaking change for go API users directly interfacing with the OPA server's routing. +- server: Fix deferred metrics timers. ([#7671](https://github.com/open-policy-agent/opa/pull/7671)) authored by @philipaconrad +- server: Fix query url when opa is served not from root path ([#7644](https://github.com/open-policy-agent/opa/pull/7644)) authored by @olegKoshmeliuk + **Note**: This is only applicable for the web UI hosted by OPA on its root path (`/`) and OPA is served at some other path than root. + +### Compiler, Topdown and Rego + +- ast: Ensure surplus leading zeros always error ([#7726](https://github.com/open-policy-agent/opa/pull/7726)) authored by @charlieegan3 + **Note**: Primitive Rego number values with leading zeros (e.g. `0123`) are now considered invalid at time of parsing and will generate an error. If you're impacted by this change, please update your policies to not have numbers with leading zeros. E.g. `0123` should be changed to `123`. +- ast: Fixing type-checker schema cache race condition for inlined schemas ([#7679](https://github.com/open-policy-agent/opa/issues/7679), [7571](https://github.com/open-policy-agent/opa/issues/7571)) authored by @johanfylling reported by @daniel-petrov-gig +- perf: Improve performance when referencing "global" in loop ([#7654](https://github.com/open-policy-agent/opa/issues/7654)) authored by @anderseknert +- topdown: Fix issue where path in `walk` would get mutated ([#7656](https://github.com/open-policy-agent/opa/issues/7656)) authored by @anderseknert reported by @robmyersrobmyers +- topdown/http: Lenient application/json Content-Type header ([#6684](https://github.com/open-policy-agent/opa/issues/6684)) authored by @sspaink reported by @mrvanes + +### Docs, Website, Ecosystem + +- adopters: add Pix4D as adopters for its RBAC service ([#7645](https://github.com/open-policy-agent/opa/pull/7645)) authored by @marcaurele +- api: Expand docs for RegisterBuiltin — no thread-safety ([#7667](https://github.com/open-policy-agent/opa/issues/7667)) authored by @anderseknert reported by @parth-mehta-989 +- docs: Added a search function for the builtins section of policy-reference ([#7704](https://github.com/open-policy-agent/opa/pull/7704)) authored by @sky3n3t +- docs: Add another OR note in AND section ([#7706](https://github.com/open-policy-agent/opa/pull/7706)) authored by @charlieegan3 +- docs: Add basic docs covering CI/CD use case ([#7703](https://github.com/open-policy-agent/opa/pull/7703)) authored by @charlieegan3 +- docs: Add current ecosystem contribution docs ([#7678](https://github.com/open-policy-agent/opa/pull/7678)) authored by @charlieegan3 +- docs: Add EvergreenCodeBlock for code with version ([#7706](github.com/open-policy-agent/opa/pull/7706)) authored by @charlieegan3 +- docs: Add feedback form for user reported issues ([#7662](https://github.com/open-policy-agent/opa/pull/7662)) authored by @charlieegan3 +- docs: Address broken links ([#7661](https://github.com/open-policy-agent/opa/pull/7661)) authored by @charlieegan3 +- docs: Archive explain that only latest patch is shown ([#7682](https://github.com/open-policy-agent/opa/pull/7682)) authored by @charlieegan3 +- docs: Fix bug where the search match respects case ([#7713](https://github.com/open-policy-agent/opa/pull/7713)) authored by @sky3n3t +- docs: Hide feedback pop-up forever if dismissed ([#7674](https://github.com/open-policy-agent/opa/pull/7674)) authored by @charlieegan3 +- docs: Improve bundle structure documentation ([#7683](https://github.com/open-policy-agent/opa/pull/7683)) authored by @charlieegan3 +- docs: Improve explanations for initial examples ([#7677](https://github.com/open-policy-agent/opa/pull/7677)) authored by @charlieegan3 +- docs: Install/Download Instruction Update ([#7687](https://github.com/open-policy-agent/opa/pull/7687)) authored by @charlieegan3 +- docs: Move code example data inside the PlaygroundComponent ([#7724](https://github.com/open-policy-agent/opa/pull/7724)) authored by @sky3n3t +- docs: policy-reference, update sig algs formatting ([#7685](https://github.com/open-policy-agent/opa/pull/7685)) authored by @charlieegan3 +- docs: Redirect old admission control link ([#7730](https://github.com/open-policy-agent/opa/pull/7730)) authored by @charlieegan3 +- docs: Refactored Networking Reference docs ([#7686](https://github.com/open-policy-agent/opa/pull/7686)) authored by @sky3n3t +- docs: Revise sidebar order and layout ([#7731](https://github.com/open-policy-agent/opa/pull/7731)) authored by @charlieegan3 +- docs: Reworked existing policy examples to use PlaygroundExample ([#7690](https://github.com/open-policy-agent/opa/pull/7690)) authored by @sky3n3t +- docs: Show a feedback popup on the docs site ([#7663](https://github.com/open-policy-agent/opa/pull/7663)) authored by @charlieegan3 +- docs: Show edge rather than latest release ([#7717](https://github.com/open-policy-agent/opa/pull/7717)) authored by @charlieegan3 +- docs: Show TOC on CLI page ([#7712](https://github.com/open-policy-agent/opa/pull/7712)) authored by @charlieegan3 +- docs: Update colors for feedback form in dark mode ([#7691](https://github.com/open-policy-agent/opa/pull/7691)) authored by @charlieegan3 +- docs: Update policy-ref allowing anchor linking ([#7675](https://github.com/open-policy-agent/opa/pull/7675)) authored by @charlieegan3 +- docs: Update rego in deployment examples ([#7707](https://github.com/open-policy-agent/opa/pull/7707)) authored by @charlieegan3 +- docs: Update sidebar ([#7723](https://github.com/open-policy-agent/opa/pull/7723)) authored by @charlieegan3 +- website: Disable cancel script ([#7719](https://github.com/open-policy-agent/opa/pull/7719)) authored by @charlieegan3 +- website: Explain automation in RELEASE.md ([#7721](https://github.com/open-policy-agent/opa/pull/7721)) authored by @charlieegan3 +- website: Fix badge endpoints ([#7653](https://github.com/open-policy-agent/opa/pull/7653)) authored by @charlieegan3 +- website: Refactor site components with CSS modules ([#7666](https://github.com/open-policy-agent/opa/pull/7666)) authored by @charlieegan3 +- website: Update docusaurus components to 3.8.1 ([#7718](https://github.com/open-policy-agent/opa/pull/7718)) authored by @charlieegan3 + +### Miscellaneous + +- build: Better detection of go changes ([#7696](https://github.com/open-policy-agent/opa/pull/7696)) authored by @charlieegan3 +- build: Bump golang 1.24.3 -> 1.24.4 ([#7672](https://github.com/open-policy-agent/opa/pull/7672)) authored by @srenatus +- Adding Clarification to merge instructions when cutting a patch release ([#7660](https://github.com/open-policy-agent/opa/pull/7660)) authored by @johanfylling +- build: Make summary failure source clearer ([#7697](https://github.com/open-policy-agent/opa/pull/7697)) authored by @charlieegan3 +- build: Skip jobs for non docs changes ([#7688](https://github.com/open-policy-agent/opa/pull/7688)) authored by @charlieegan3 +- deps: Use `google.golang.org/protobuf` ([#7655](https://github.com/open-policy-agent/opa/pull/7655)) authored by @sspaink +- perf: Simplify interning ([#7714](https://github.com/open-policy-agent/opa/pull/7714)) authored by @anderseknert +- perf: Only pass built-in context to calls depending on it ([#7728](https://github.com/open-policy-agent/opa/pull/7728)) authored by @anderseknert +- perf: Improve built-in `concat` performance ([#7702](https://github.com/open-policy-agent/opa/pull/7702)) authored by @anderseknert +- perf: More efficient data/v1 POST handler ([#7673](https://github.com/open-policy-agent/opa/pull/7673)) authored by @anderseknert +- test: Fix flaky TestRaisingHTTPClientQueryError ([#7698](https://github.com/open-policy-agent/opa/pull/7698)) authored by @sspaink +- test: Fix flaky topdown query cache tests ([#7590](https://github.com/open-policy-agent/opa/issues/7590)) authored by @sspaink +- Dependency updates; notably: + - build(deps): Bump gqlparser from v2.5.27 to v2.5.28 ([#7699](https://github.com/open-policy-agent/opa/issues/7699)) authored by @robmyersrobmyers + - build(deps): bump github.com/go-logr/logr from 1.4.2 to 1.4.3 + - build(deps): bump github.com/vektah/gqlparser/v2 from 2.5.26 to 2.5.27 + - build(deps): bump golang.org/x/net from 0.39.0 to 0.40.0 + - build(deps): bump google.golang.org/grpc from 1.72.0 to 1.72.2 + - build(deps): bump oras.land/oras-go/v2 from 2.5.0 to 2.6.0 + - build(deps): bump go.opentelemetry.io deps to 1.36.0/0.61.0 + +## 1.5.1 + +This is a bug fix release addressing a regression to the [walk](https://www.openpolicyagent.org/docs/policy-reference#builtin-graph-walk) built-in function, introduced in v1.5.0. See [#7656](https://github.com/open-policy-agent/opa/issues/7656) (authored by @anderseknert reported by @robmyersrobmyers) + +## 1.5.0 + +This release contains a mix of new features, performance improvements, and bugfixes. Among others: + +- Support for AWS SSO credentials provider +- Support for signing client assertions with Azure Keyvault +- Faster `object.get`, `walk` and builtin-function evaluation +- Improved guardrails in the parser +- Improvements to decision logging + +### Modernized OPA Website ([#7037](https://github.com/open-policy-agent/opa/issues/7037)) + +The [OPA website](https://www.openpolicyagent.org/) has been modernized with a new design and improved user experience. + +The new site is based on Docusaurus and React which makes it easier to build live functionality and add non-documentation resources. +This lays the groundwork for even more improvements in the future! + +Documentation for older OPA versions are still available in the [version archive](https://www.openpolicyagent.org/docs/archive). + +Authored by @charlieegan3 + +### Runtime, Tooling, SDK + +- ast: Only use JSON-escaped literal when needed in ref to string convertion ([#7550](https://github.com/open-policy-agent/opa/issues/7550)) reported and authored by @xubinzheng +- ast: Parser recursion depth guard ([#7568](https://github.com/open-policy-agent/opa/pull/7568)) authored by @thevilledev +- ast: Retaining `SomeDecl` `Location` field when compiler resolves refs ([#7543](https://github.com/open-policy-agent/opa/issues/7543)) authored by @johanfylling +- bundle: Setting default rego-version in bundle API ([#7588](https://github.com/open-policy-agent/opa/issues/7588)) authored by @johanfylling reported by @xubinzheng +- perf: Improved "baseline" metrics of opa bench for trivial queries ([#7580](https://github.com/open-policy-agent/opa/pull/7580)) authored by @anderseknert +- plugins/decision: Don't drop adaptive uncompressed size limit on upload ([#7562](https://github.com/open-policy-agent/opa/issues/7562)) authored by @sspaink +- plugins/decision: Set config boundaries to upload_size_limit_bytes (#7563) (authored by @sspaink) +- plugins/rest: Add support for AWS SSO credentials provider ([#7527](https://github.com/open-policy-agent/opa/pull/7527)) authored by @efiShtain +- plugins/rest: Support signing of client assertions with Azure Keyvault ([#7462](https://github.com/open-policy-agent/opa/issues/7462)) reported and authored by @Od1nB +- plugins/status: Support graceful shutdown timeout ([#7576](https://github.com/open-policy-agent/opa/issues/6676)) authored by @sspaink +- rego: Don't generate JSON values for wildcard/generated keys in result set ([#7567](https://github.com/open-policy-agent/opa/pull/7567)) authored by @anderseknert +- runtime: Don't override user set version `commit` and `timestamp` ([#7471](https://github.com/open-policy-agent/opa/issues/7471)) reported by @kastl-ars authored by @sspaink + +### Planner, Topdown and Rego + +- planner: Deal with var-for-function replacement in indirect calls ([#5311](https://github.com/open-policy-agent/opa/issues/5311)) authored by @srenatus +- topdown: Faster `object.get` built-in function ([#7593](https://github.com/open-policy-agent/opa/pull/7593)) authored by @anderseknert +- topdown: Faster `walk` built-in function ([#7612](https://github.com/open-policy-agent/opa/pull/7612)) authored by @anderseknert +- topdown: Improved default rule value inlining ( ([#1418](https://github.com/open-policy-agent/opa/issues/1418)) authored by @johanfylling +- topdown: Improved GraphQL error handling ([#7622](https://github.com/open-policy-agent/opa/issues/7622)) reported and authored by @robmyersrobmyers + +### Docs, Website, Ecosystem + +- docs: Fix helm-kubernetes-quickstart bundle ([#7606](https://github.com/open-policy-agent/opa/pull/7606)) reported and authored by @nejec +- docs: Add Swift-OPA to the Ecosystem Page ([#7610](https://github.com/open-policy-agent/opa/pull/7610)) authored by @charlieegan3 +- docs: Add Tutorial Redirects ([#7603]https://github.com/open-policy-agent/opa/issues/7603) reported by @nataraj24 authored by @charlieegan3 +- Fix links in README ([#7633](https://github.com/open-policy-agent/opa/pull/7633)) authored by @ffjlabo + +### Miscellaneous + +- github_actions: Adding monthly check for broken hyperlinks ([#7537](https://github.com/open-policy-agent/opa/pull/7537)) authored by @sspaink +- perf: Extended interning ([#7636](https://github.com/open-policy-agent/opa/pull/7636)) authored by @anderseknert +- perf: `Ref.String()` shortcut on single var term ref ([#7595](https://github.com/open-policy-agent/opa/pull/7595)) authored by @anderseknert +- refactor: Don't return error from `opaTest` ([#7560](https://github.com/open-policy-agent/opa/pull/7560)) authored by @sspaink +- refactor: Remove internal/gqlparser and use upstream dependency instead. ([#7520](https://github.com/open-policy-agent/opa/issues/7520)) authored by @robmyersrobmyers +- test: Fix flaky TestContextErrorHandling ([#7587](https://github.com/open-policy-agent/opa/pull/7587)) authored by @sspaink +- Apply modernize linter fixes ([#7599](https://github.com/open-policy-agent/opa/pull/7599)) authored by @anderseknert +- Use `any` in place of `interface{}` ([#7566](https://github.com/open-policy-agent/opa/pull/7566)) authored by @anderseknert +- Dependency updates; notably: + - build: bump go from 1.24.0 to 1.24.3 + - build(deps): bump containerd to v2.1.1 ([#7627](https://github.com/open-policy-agent/opa/issues/7627)) authored by @johanfylling reported by @robmyersrobmyers + - build(deps): bump github.com/fsnotify/fsnotify from 1.8.0 to 1.9.0 + - build(deps): bump github.com/prometheus/client_golang from 1.21.1 to 1.22.0 + - build(deps): bump github.com/prometheus/client_model from 0.6.1 to 0.6.2 + - build(deps): bump golang.org/x/net from 0.38.0 to 0.39.0 + - build(deps): bump google.golang.org/grpc from 1.71.1 to 1.72.0 + +## 1.4.2 + +This is a bug fix release addressing the missing `capabilities/v1.4.1.json` in the v1.4.1 release. + +## 1.4.1 + +This is a security fix release for the fixes published in Go [1.24.1](https://groups.google.com/g/golang-announce/c/4t3lzH3I0eI) and [1.24.2](https://groups.google.com/g/golang-announce/c/Y2uBTVKjBQk) + +- build: bump go to 1.24.2 (#7544) (authored by @sspaink) + Addressing `CVE-2025-22870` and `CVE-2025-22871` vulnerabilities in the Go runtime. + +## 1.4.0 + +This release contains a security fix addressing CVE-2025-46569. +It also includes a mix of new features, bugfixes, and dependency updates. + +#### Security Fix: CVE-2025-46569 - OPA server Data API HTTP path injection of Rego ([GHSA-6m8w-jc87-6cr7](https://github.com/open-policy-agent/opa/security/advisories/GHSA-6m8w-jc87-6cr7)) + +A vulnerability in the OPA server's [Data API](https://www.openpolicyagent.org/docs/latest/rest-api/#data-api) allows an attacker to craft the HTTP path in a way that injects Rego code into the query that is evaluated. +The evaluation result cannot be made to return any other data than what is generated by the requested path, but this path can be misdirected, and the injected Rego code can be crafted to make the query succeed or fail; opening up for oracle attacks or, given the right circumstances, erroneous policy decision results. +Furthermore, the injected code can be crafted to be computationally expensive, resulting in a Denial Of Service (DoS) attack. + +**Users are only impacted if all of the following apply:** + +* OPA is deployed as a standalone server (rather than being used as a Go library) +* The OPA server is exposed outside of the local host in an untrusted environment. +* The configured [authorization policy](https://www.openpolicyagent.org/docs/latest/security/#authentication-and-authorization) does not do exact matching of the input.path attribute when deciding if the request should be allowed. + +**or, if all of the following apply:** + +* OPA is deployed as a standalone server. +* The service connecting to OPA allows 3rd parties to insert unsanitised text into the path of the HTTP request to OPA’s Data API. + +Note: With **no** [Authorization Policy](https://www.openpolicyagent.org/docs/latest/security/#authentication-and-authorization) configured for restricting API access (the default configuration), the RESTful [Data API](https://www.openpolicyagent.org/docs/latest/rest-api/#data-api) provides access for managing Rego policies; and the RESTful [Query API](https://www.openpolicyagent.org/docs/latest/rest-api/#query-api) facilitates advanced queries. +Full access to these APIs provides both simpler, and broader access than what the security issue describes here can facilitate. +As such, OPA servers exposed to a network are **not** considered affected by the attack described here if they are knowingly not restricting access through an Authorization Policy. + +This issue affects all versions of OPA prior to 1.4.0. + +See the [Security Advisory](https://github.com/open-policy-agent/opa/security/advisories/GHSA-6m8w-jc87-6cr7) for more details. + +Reported by @GamrayW, @HyouKash, @AdrienIT, authored by @johanfylling + +### Runtime, Tooling, SDK + +- ast: Adding `rego_v1` feature to `--v0-compatible` capabilities ([#7474](https://github.com/open-policy-agent/opa/pull/7474)) authored by @johanfylling +- executable: Add version and icon to OPA windows executable ([#3171](https://github.com/open-policy-agent/opa/issues/3171)) authored by @sspaink reported by @christophwille +- format: Don't panic on format due to unexpected comments ([#6330](https://github.com/open-policy-agent/opa/issues/6330)) authored by @sspaink reported by @sirpi +- format: Avoid modifying strings when formatting ([#6220](https://github.com/open-policy-agent/opa/issues/6220)) authored by @sspaink reported by @zregvart +- plugins/status: FIFO buffer channel for status events to prevent slow status API blocking ([#7522](https://github.com/open-policy-agent/opa/pull/7522)) authored by @sspaink + +### Topdown and Rego + +- gqlparser: Add JSON annotation in `internal/gqlparser/ast` to Position fields ([#7509](https://github.com/open-policy-agent/opa/pull/7509)) authored by @robmyersrobmyers +- graphql: Cache GraphQL schema parse results ([#7457](https://github.com/open-policy-agent/opa/pull/7457)) authored by @robmyersrobmyers +- topdown: Handling default functions in Partial Eval ([#7220](https://github.com/open-policy-agent/opa/issues/7220)) authored by @johanfylling +- topdown: Fix wall clock time init for `PartialRun()` ([#7490](https://github.com/open-policy-agent/opa/issues/7490)) authored by @srenatus +- topdown: Zero alloc lower/upper unless changed ([#7472](https://github.com/open-policy-agent/opa/pull/7472)) authored by @anderseknert + +### Docs, Website, Ecosystem + +- adopters: Cloudsmith adds support for OPA ([#7498](https://github.com/open-policy-agent/opa/pull/7498)) authored by @ndouglas-cloudsmith +- docs: Fixed broken docs link ([#7452](https://github.com/open-policy-agent/opa/issues/7452)) reported and authored by @fvarg00 +- docs: Update built-in function examples for OPA v1 ([#7514](https://github.com/open-policy-agent/opa/issues/7514)) reported and authored by @robmyersrobmyers +- docs: Add link to inline schema annotations ([#7496](https://github.com/open-policy-agent/opa/pull/7496)) authored by @kmadan +- docs: Add manual trigger to integration docs ([#7473](https://github.com/open-policy-agent/opa/pull/7473)) authored by @charlieegan3 +- docs: Point path versioned requests to new sites ([#7531](https://github.com/open-policy-agent/opa/pull/7531)) authored by @charlieegan3 +- docs: Update community slack inviter link ([#7488](https://github.com/open-policy-agent/opa/pull/7488), [#7493](https://github.com/open-policy-agent/opa/pull/7493)) authored by @charlieegan3 +- docs: Set versioned docs links to point to archive ([#7528](https://github.com/open-policy-agent/opa/pull/7528)) authored by @charlieegan3 +- docs: Update helm-kubernetes-quickstart bundle ([#7469](https://github.com/open-policy-agent/opa/pull/7469)) authored by @johanfylling +- docs: Update opa-docker-authz example to use ghcr and v0.10 release tag ([#7513](https://github.com/open-policy-agent/opa/pull/7513)) authored by @larhauga +- docs: Fix post merge badge ([#7532](https://github.com/open-policy-agent/opa/pull/7532)) authored by @sspaink +- docs: Improve request headers documentation in REST APIs ([#7524](https://github.com/open-policy-agent/opa/pull/7524)) authored by @ali-jalaal +- docs: Update edge links to use `/docs/edge/` path ([#7529](https://github.com/open-policy-agent/opa/pull/7529)) authored by @charlieegan3 +- ecosystem: Add NACP integration ([#7503](https://github.com/open-policy-agent/opa/pull/7503)) authored by @charlieegan3 +- ecosystem: Update traefik integration docs ([#7506](https://github.com/open-policy-agent/opa/pull/7506)) authored by @charlieegan3 +- ecosystem: Add Principled Evolution integration ([#7495](https://github.com/open-policy-agent/opa/pull/7495)) authored by @kmadan +- ecosystem: Add tavo to ecosystem integration ([#7511](https://github.com/open-policy-agent/opa/pull/7511)) authored by @percyding-tavo + +### Miscellaneous + +- Dependency updates; notably: + - build(deps): bump github.com/hypermodeinc/badger from v4.6.0 to v4.7.0 + - build(deps): bump github.com/spf13/viper from 1.18.2 to 1.20.1 + - build(deps): bump golang.org/x/net from 0.37.0 to 0.38.0 + - build(deps): bump google.golang.org/grpc from 1.71.0 to 1.71.1 + - build(deps): bump oras.land/oras-go/v2 from 2.3.1 to 2.5.0 + +## 1.3.0 + +This release contains a mix of features, bugfixes, and dependency updates. + +### New Buffer Option for Decision Logs ([#5724](https://github.com/open-policy-agent/opa/issues/5724)) + +A new, optional, buffering mechanism has been added to decision logging. +The default buffer is designed around making precise memory footprint guarantees, which can produce lock contention at high loads, negatively impacting query performance. +The new event-based buffer is designed to reduce lock contention and improve performance at high loads, but sacrifices the memory footprint guarantees of the default buffer. + +The new event-based buffer is enabled by setting the `decision_logs.reporting.buffer_type` [configuration option](https://www.openpolicyagent.org/docs/latest/configuration/#decision-logs) to `event`. + +For more details, see the decision log plugin [README](https://github.com/open-policy-agent/opa/blob/main/v1/plugins/logs/README.md). + +Reported by @mjungsbluth, authored by @sspaink + +### OpenTelemetry: HTTP Support and Expanded Batch Span Configuration ([#7412](https://github.com/open-policy-agent/opa/issues/7412)) + +Distributed tracing through OpenTelemetry has been extended to support HTTP collectors (enabled by setting the `distributed_tracing.type` configuration option to `http`). +Additionally, configuration has been expanded with fine-grained batch span processor [options](https://www.openpolicyagent.org/docs/latest/configuration/#distributed-tracing). + +Authored and reported by @sqyang94 + +### Runtime, Tooling, SDK + +- compile: Require multi-term entrypoint paths for optimized bundle building ([#7321](https://github.com/open-policy-agent/opa/issues/7321)) authored by @johanfylling reported by @nikpivkin +- fmt: Allow one liner rule grouping ([#6760](https://github.com/open-policy-agent/opa/issues/6760)) authored by @anderseknert +- fmt: Fix v0-compatible fmt with stdin ([#7409](https://github.com/open-policy-agent/opa/issues/7409)) authored and reported by @charlieegan3 +- ir: Fix nil pointer deref in Unmarshal() when handling IsSetStmt ([#7415](https://github.com/open-policy-agent/opa/issues/7415)) authored and reported by @KrisKennawayDD +- planner: Fix Wasm vs non-Wasm evaluation difference bug related to the overeager optimization of ref head rules ([#7439](https://github.com/open-policy-agent/opa/pull/7439)) authored by @srenatus +- sdk: Removing repeat args from sub-func call ([#7443](https://github.com/open-policy-agent/opa/pull/7443)) authored by @alingse +- tester: Including parameterized test cases in test report counter ([#7407](https://github.com/open-policy-agent/opa/issues/7407)) authored by @johanfylling +- tester: Only including failed sub-test cases in report summary when non-verbose ([#7426](https://github.com/open-policy-agent/opa/pull/7426)) authored by @johanfylling + +### Docs, Website, Ecosystem + +- docs: Add some notes about AI assisted patches ([#7436](https://github.com/open-policy-agent/opa/pull/7436)) authored by @charlieegan3 +- docs: Add query_parameters_to_set ([#7405](https://github.com/open-policy-agent/opa/pull/7405)) authored by @sedovmik +- docs: Delete reference to license key in Envoy tutorial ([#7466](https://github.com/open-policy-agent/opa/pull/7466)) authored by @joostholslag +- docs: Fix typo in Envoy tutorial ([#7464](https://github.com/open-policy-agent/opa/pull/7464)) authored by @joostholslag +- docs: Update slack inviter link ([#7450](https://github.com/open-policy-agent/opa/pull/7450)) authored by @charlieegan3 +- docs: Update terraform examples ([#7429](https://github.com/open-policy-agent/opa/pull/7429)) authored by @charlieegan3 +- docs: Simplify `kind` usage instruction in Envoy tutorial ([#7465](https://github.com/open-policy-agent/opa/pull/7465)) authored by @joostholslag + +### Miscellaneous + +- Enable unused-receiver linter (revive) ([#7448](https://github.com/open-policy-agent/opa/pull/7448)) authored by @anderseknert +- Dependency updates; notably: + - build(deps): bump github.com/containerd/containerd from 1.7.26 to 1.7.27 + - build(deps): bump github.com/dgraph-io/badger/v4 from 4.5.1 to 4.6.0 + - build(deps): bump github.com/opencontainers/image-spec from 1.1.0 to 1.1.1 + - build(deps): bump github.com/prometheus/client_golang 1.21.0 to 1.21.1 + - build(deps): bump golang.org/x/net from 0.35.0 to 0.37.0 + - build(deps): bump golang.org/x/time from 0.10.0 to 0.11.0 + - build(deps): bump google.golang.org/grpc from 1.70.0 to 1.71.0 + - build(deps): bump go.opentelemetry.io deps to 1.35.0/0.60.0 + +## 1.2.0 + +This release contains a mix of features, performance improvements, and bugfixes. + +### Parameterized Rego Tests ([#2176](https://github.com/open-policy-agent/opa/issues/2176)) + +Rego tests now support parameterization, allowing a single test rule to include multiple, hierarchical, named test cases. +This feature is useful for data-driven testing, where a single test rule can be used for multiple test cases with different inputs and expected outputs. + +```rego +package example_test + +test_concat[note] if { + some note, tc in { + "empty + empty": { + "a": [], + "b": [], + "exp": [], + }, + "empty + filled": { + "a": [], + "b": [1, 2], + "exp": [1, 2], + }, + "filled + filled": { + "a": [1, 2], + "b": [3, 4], + "exp": [1, 2, 3], # Faulty expectation, this test case will fail + }, + } + + act := array.concat(tc.a, tc.b) + act == tc.exp +} +``` + +```cmd +$ opa test example_test.rego +example_test.rego: +data.example_test.test_concat: FAIL (263.375µs) + empty + empty: PASS + empty + filled: PASS + filled + filled: FAIL +-------------------------------------------------------------------------------- +FAIL: 1/1 +``` + +See the [documentation](https://www.openpolicyagent.org/docs/latest/policy-testing/#parameterized-tests-and-data-driven-testing) for more information. + +Authored by @johanfylling, reported by @anderseknert + +### Performance Improvements + +- perf: Add ref.CopyNonGround ([#7350](https://github.com/open-policy-agent/opa/pull/7350)) authored by @anderseknert +- perf: `opa fmt` 3x faster formatting ([#7341](https://github.com/open-policy-agent/opa/pull/7341)) authored by @anderseknert +- perf: Cost of indexing greatly reduced ([#7370](https://github.com/open-policy-agent/opa/pull/7370)) authored by @anderseknert +- perf: Eval optimizations ([#7367](https://github.com/open-policy-agent/opa/pull/7367)) authored by @anderseknert +- perf: Intern annotation terms ([#7365](https://github.com/open-policy-agent/opa/pull/7365)) authored by @anderseknert +- perf: Slightly more efficient policy scanning ([#7368](https://github.com/open-policy-agent/opa/pull/7368)) authored by @anderseknert +- perf: Switch to a faster xxhash package ([7362](https://github.com/open-policy-agent/opa/pull/7362)) authored by @Juneezee +- perf: Use GetByValue to avoid boxing to interface{} ([#7372](https://github.com/open-policy-agent/opa/pull/7372)) authored by @anderseknert +- perf: Various small improvements ([#7357](https://github.com/open-policy-agent/opa/pull/7357)) authored by @anderseknert +- perf: Improve storage lookup performance ([#7336](https://github.com/open-policy-agent/opa/pull/7336)) authored by @anderseknert +- perf: optimize iteration ([#7327](https://github.com/open-policy-agent/opa/pull/7327)) authored by @anderseknert + +### Topdown and Rego + +- rego+topdown: Allow providing custom base cache ([#7329](https://github.com/open-policy-agent/opa/pull/7329)) authored by @anderseknert + +### Runtime, Tooling, SDK + +- ast: Add missing `BuildAnnotationSet` to `ast` v0 ([#7347](https://github.com/open-policy-agent/opa/issues/7347)) authored by @anderseknert +- ast: Eliminate allocation in Value.Find, and other improvements ([#7319](https://github.com/open-policy-agent/opa/pull/7319)) authored by @anderseknert +- ast: Use byte for RuleKind and DocKind ([#7332](https://github.com/open-policy-agent/opa/pull/7332)) authored by @anderseknert +- ast.InterfaceToValue: add test case for `[]byte` ([#7379](https://github.com/open-policy-agent/opa/pull/7379)) authored by @dennygursky +- ast: support []string and ast.Value in ast.InterfaceToValue ([#7306](https://github.com/open-policy-agent/opa/pull/7306)) authored by @regeda +- bundle: Fixing issue where `--v0-compatible` isn't respected for custom bundles ([#7338](https://github.com/open-policy-agent/opa/pull/7338)) authored by @johanfylling +- cmd: Handle failing tests in `opa test --bench` ([#7205](https://github.com/open-policy-agent/opa/issues/7205)) authored by @anderseknert +- cmd: Add decision ID to `opa exec` output ([#7373](https://github.com/open-policy-agent/opa/pull/7373)) authored by @anderseknert +- oracle: Make oracle public under v1/ast/oracle ([#7265](https://github.com/open-policy-agent/opa/issues/7265)) authored by @anderseknert +- oracle: Allow passing own compiler to oracle ([#7354](https://github.com/open-policy-agent/opa/pull/7354)) authored by @anderseknert +- plugins/discovery: Enable tracing for discovery plugin ([#7299](https://github.com/open-policy-agent/opa/pull/7299)) authored by @mjungsbluth +- plugins/rest: Do not attach authorization header in bearerAuthPlugin if response is a redirect ([#7308](https://github.com/open-policy-agent/opa/pull/7308)) authored by @carabasdaniel +- server+distributedtracing: Add Additional Resource Attributes for OpenTelemetry ([#7322](https://github.com/open-policy-agent/opa/issues/7322)) authored by @briankahoot reported by @briankahoot +- util: Add util.HasherMap ([#7363](https://github.com/open-policy-agent/opa/pull/7363)) authored by @anderseknert + +### Docs, Website, Ecosystem + +- docs: Add support link to README ([#7359](https://github.com/open-policy-agent/opa/pull/7359)) (authored by @anderseknert) +- docs: Update example bundle to be v1 compatible ([#7342](https://github.com/open-policy-agent/opa/pull/7342)) authored by @ashutosh-narkar +- docs: Add note about v1.0 addr behaviour ([#7360](https://github.com/open-policy-agent/opa/issues/7360)) authored by @charlieegan3 reported by @ali-jalaal +- docs: Update homepage examples to drop `v1 import` ([#7391](https://github.com/open-policy-agent/opa/pull/7391)) authored by @charlieegan3 +- docs: Updating `--v1-compatible` mentions outside the v1 upgrade guide and v0 compatibility docs ([#7337](https://github.com/open-policy-agent/opa/pull/7337)) authored by @johanfylling +- docs: Fixed invalid links to examples ([#7326](https://github.com/open-policy-agent/opa/pull/7326)) authored by @JonathanDeLaCruzEncora +- MAINTAINERS: Add Anders and Charlie as maintainers ([#7318](https://github.com/open-policy-agent/opa/pull/7318)) authored by @charlieegan3 + +### Miscellaneous + +- build+test: Add `make test-short` task (#7364) (authored by @anderseknert) +- build: Add gocritic linter ([#7377](https://github.com/open-policy-agent/opa/pull/7377)) authored by @anderseknert +- build: Add nilness linter from govet ([#7335](https://github.com/open-policy-agent/opa/pull/7335)) authored by @anderseknert +- build: Add perfsprint linter ([#7334](https://github.com/open-policy-agent/opa/pull/7334)) authored by @anderseknert +- ci: Tagging release binaries with build version ([#7395](https://github.com/open-policy-agent/opa/pull/7395), [#7397](https://github.com/open-policy-agent/opa/pull/7397), [#7400](https://github.com/open-policy-agent/opa/pull/7400)) authored by @johanfylling +- test: fix race in `TestIntraQueryCache_ClientError` and `TestInterQueryCache_ClientError` ([#7280](https://github.com/open-policy-agent/opa/pull/7280)) authored by @Juneezee +- misc: Use Go 1.22+ int ranges ([#7328](https://github.com/open-policy-agent/opa/pull/7328)) authored by @anderseknert +- Dependency updates; notably: + - build: bump go from 1.23.5 to 1.24.0 + - build(deps): bump github.com/agnivade/levenshtein from 1.2.0 to 1.2.1 + - build(deps): bump github.com/containerd/containerd from 1.7.25 to 1.7.26 + - build(deps): bump github.com/google/go-cmp from 0.6.0 to 0.7.0 + - build(deps): bump github.com/prometheus/client_golang + - build(deps): bump github.com/spf13/cobra from 1.8.1 to 1.9.1 + - build(deps): bump github.com/spf13/pflag from 1.0.5 to 1.0.6 + - build(deps): bump golang.org/x/net from 0.34.0 to 0.35.0 + - build(deps): bump golang.org/x/time from 0.9.0 to 0.10.0 + - build(deps): bump ossf/scorecard-action from 2.4.0 to 2.4.1 + - Bump golangci-lint from v1.60.1 to 1.64.5 + +## 1.1.0 + +This release contains a mix of features, performance improvements, and bugfixes. + +### Performance Improvements + +- ast: Remove jsonOptions from AST nodes and terms ([#7281](https://github.com/open-policy-agent/opa/pull/7281)) authored by @anderseknert +- ast+plugins: Optimize activation of bundles with no inter-bundle path overlap ([#7144](https://github.com/open-policy-agent/opa/issues/7144)) authored and reported by @sqyang94 +- bundle: Optimizing rego-version management in bundle activation ([#7296](https://github.com/open-policy-agent/opa/pull/7296)) authored by @johanfylling +- cmd: Don't generate JSON from result in `opa bench` ([#7291](https://github.com/open-policy-agent/opa/issues/7291)) authored by @anderseknert +- topdown: Adding configurable token cache to `io.jwt` token verification built-ins ([#7274](https://github.com/open-policy-agent/opa/pull/7274)) authored by @johanfylling +- topdown: Reduce allocations in hot path ([#7288](https://github.com/open-policy-agent/opa/pull/7288)) authored by @anderseknert +- perf: Improvements to terms and built-in functions ([#7284](https://github.com/open-policy-agent/opa/pull/7284)) authored by @anderseknert +- perf: add Regorus ACI benchmark tests ([#7298](https://github.com/open-policy-agent/opa/pull/7298)) authored by @anderseknert +- plugins: Don't use reflect.DeepEqual for errors ([#7238](https://github.com/open-policy-agent/opa/issues/7238)) authored by @anderseknert +- testing: replace reflect.DeepEqual where possible ([#7286](https://github.com/open-policy-agent/opa/pull/7286)) authored by @anderseknert + +### Topdown and Rego + +- topdown: Fix out of range error in `numbers.range` built-in ([#7269](https://github.com/open-policy-agent/opa/issues/7269)) authored by @anderseknert +- topdown+rego+server: Allow opt-in for evaluating non-det builtins in PE ([#6496](https://github.com/open-policy-agent/opa/issues/6496)) authored by @srenatus + +### Runtime, Tooling, SDK + +- bundle: Add info about the correct rego version to parse modules on the store ([#7278](https://github.com/open-policy-agent/opa/pull/7278)) co-authored by @ashutosh-narkar and @johanfylling +- bundle+plugins: Fixing issue where bundle plugin could panic on reconfiguration (SDK use) ([#7297](https://github.com/open-policy-agent/opa/issues/7297)) authored by @johanfylling reported by @carabasdaniel +- cmd: Fix printed representation of ref head rules in `opa repl` ([#7301](https://github.com/open-policy-agent/opa/issues/7301)) authored by @anderseknert reported by @tsandall +- cmd: Respect `--v0-compatible` for `opa eval` partial eval support modules ([#7251](https://github.com/open-policy-agent/opa/pull/7251)) authored by @johanfylling +- golangci: fix invalid `linter-settings` configuration name ([#7244](https://github.com/open-policy-agent/opa/pull/7244)) authored by @Juneezee +- plugins/logs: Add support for masking with array keys ([#6883](https://github.com/open-policy-agent/opa/issues/6883)) authored by @charlieegan3 +- tester: code nitpicks ([#7252](https://github.com/open-policy-agent/opa/pull/7252)) authored by @srenatus +- util: Add util.Keys and util.KeysSorted ([#7285](https://github.com/open-policy-agent/opa/pull/7285)) authored by @anderseknert + +### Docs, Website, Ecosystem + +- docs: Update docker compose file in HTTP API tutorial and use addr for binding ([#7264](https://github.com/open-policy-agent/opa/issues/7264)) authored and reported by @zanliffick +- docs: Make 'ancient' warnings closable ([#7253](https://github.com/open-policy-agent/opa/issues/7253)) authored by @srenatus reported by @konradzagozda +- docs: Redirect opa-1 to v0-upgrade ([#7259](https://github.com/open-policy-agent/opa/pull/7259)) authored by @charlieegan3 +- docs: Use preformatted strings in fmt help ([#7263](https://github.com/open-policy-agent/opa/pull/7263)) authored by @charlieegan3 +- docs: Fix typo in k8s primer ([#7242](https://github.com/open-policy-agent/opa/pull/7242)) authored by @vicentinileonardo +- docs: Formatting and wording fixes ([#7268](https://github.com/open-policy-agent/opa/pull/7268)) authored by @kamilturek +- docs: Update output document of Envoy plugin. ([#7241](https://github.com/open-policy-agent/opa/pull/7241)) authored by @regeda + +### Miscellaneous + +- ci(nightly): Remove vendor w/o modproxy check ([#7292](https://github.com/open-policy-agent/opa/pull/7292)) authored by @srenatus +- Dependency updates; notably: + - build(go): bump to 1.23.5 ([7279](https://github.com/open-policy-agent/opa/pull/7279)) authored by @srenatus + - build(deps): upgrade github.com/dgraph-io/badger to v4 (4.5.1) ([#7239](https://github.com/open-policy-agent/opa/pull/7239)) authored by @Juneezee + - build(deps): bump github.com/containerd/containerd from 1.7.24 to 1.7.25 + - build(deps): bump github.com/tchap/go-patricia/v2 from 2.3.1 to 2.3.2 + - build(deps): bump golang.org/x/net from 0.33.0 to 0.34.0 + - build(deps): bump golang.org/x/time from 0.8.0 to 0.9.0 + - build(deps): bump google.golang.org/grpc from 1.69.2 to 1.70.0 + - build(deps): bump go.opentelemetry.io deps to 1.34.0/0.59.0 + +## 1.0.1 + +This is a bug fix release addressing the following issues: + +- build(go): bump to 1.23.5 (authored by @srenatus). + Addressing `CVE-2024-45341` and `CVE-2024-45336` vulnerabilities in the Go runtime. +- bundle: Add info about the correct rego version to parse modules on the store, co-authored by @ashutosh-narkar and @johanfylling in [#7278](https://github.com/open-policy-agent/opa/pull/7278). + Fixing an issue where the rego-version for individual modules was lost during bundle deactivation (bundle lifecycle) if this version diverged from the active runtime rego-version. + This could cause reloading of v0 bundles to fail when OPA was not running with the `--v0-compatible` flag. + +## 1.0.0 + +> **_NOTES:_** +> +> * The minimum version of Go required to build the OPA module is **1.22** + +We are excited to announce **OPA 1.0**, a milestone release consolidating an improved developer experience for the future of Policy as Code. +The release makes new functionality designed to simplify policy writing and improve the language's consistency the default. + +### Changes to Rego in OPA 1.0 + +Below we highlight some key changes to the defaults in OPA 1.0: + +- Using `if` for all rule definitions and `contains` for multi-value rules is now mandatory, not just when using the `rego.v1` import. +- Other new keywords (`every`, `in`) are available without any imports. +- Previously requirements that were only run in "strict mode" (like `opa check --strict`) are now the default. Duplicate imports and imports which shadow each other are no longer allowed. +- OPA 1.0 comes with a range of backwards compatibility features to aid your migrations, please see the [v0 compatibility guide](https://www.openpolicyagent.org/docs/latest/v0-compatibility/) +if you must continue to support v0 Rego. + +Read more about the OPA 1.0 announcement on the [OPA blog](https://blog.openpolicyagent.org/). + +Following are other changes that are included in OPA 1.0. + +### Improvements to memory allocations + +PRs [#7172](https://github.com/open-policy-agent/opa/pull/7172), [#7190](https://github.com/open-policy-agent/opa/pull/7190), +[#7193](https://github.com/open-policy-agent/opa/pull/7193), [#7165](https://github.com/open-policy-agent/opa/pull/7165), +[#7168](https://github.com/open-policy-agent/opa/pull/7168), [#7191](https://github.com/open-policy-agent/opa/pull/7191) & +[#7222](https://github.com/open-policy-agent/opa/pull/7222) together improve the memory performance of OPA. Key strategies +include reusing pointers and optimizing array and object operations, minimizing intermediate object creation, and using `sync.Pool` +to manage memory-heavy operations. These changes cumulatively greatly reduced the number of allocations and improved +evaluation speed by 10-20%. Additional benchmarks highlighted significant memory and speed improvements in custom +function evaluation. + +Authored by @anderseknert. + +### Wrap http.RoundTripper for SDK users + +PR [#7180](https://github.com/open-policy-agent/opa/pull/7180) adds an `EvalHTTPRoundTrip` EvalOption and query-level `WithHTTPRoundTrip` option. +Both use a new function type which converts an `http.Transport` configured by topdown to an `http.RoundTripper`. +This supports use cases requiring the customization of the `http.send` built in behavior. + +Authored by @evankanderson. + +### Improvements to scientific notation parsing in `units.parse` + +PR [#7147](https://github.com/open-policy-agent/opa/pull/7147) extends the behaviour of `extractNumAndUnit` to support +scientific notation values. This means values such as `1e3KB` can now be handled by this function. + +Authored by @berdanA. + +### Support customized buckets `bundle_loading_duration_ns` metric + +PR [#7156](https://github.com/open-policy-agent/opa/pull/7156) extends OPA’s Prometheus configuration to allow the +setting of user defined buckets for metrics. This aids when debugging the loading of slow bundles. + +Authored by @jwu730-1. + +### Test suite performance improvements + +PR [#7126](https://github.com/open-policy-agent/opa/pull/7126) updates tests to improve performance. Topdown and `storage/disk/` +tests now run around 50% and 75% faster respectively. + +Authored by @philipaconrad. + +### OPA 1.0 Preparation + +- Update v1 capabilities by @johanfylling in [#7216](https://github.com/open-policy-agent/opa/pull/7216) +- v1 API by @johanfylling in [#7215](https://github.com/open-policy-agent/opa/pull/7215) +- Updating formatter to not drop `rego.v1` and `future.keywords` imports for v1 by @johanfylling in [#7224](https://github.com/open-policy-agent/opa/pull/7224) +- Update docs and server binding address per OPA 1.0 specs by @ashutosh-narkar & @charlieegan3 in [#7140](https://github.com/open-policy-agent/opa/pull/7140) +- Renaming `--rego-v1` cmd flag to `--v0-v1` by @johanfylling in [#7225](https://github.com/open-policy-agent/opa/pull/7225) + + +### Topdown and Rego + +- Provide a more useful error message when there are conflicting default rules by @tjons in [#7164](https://github.com/open-policy-agent/opa/pull/7164) +- Fix test flakes in `topdown/cache` by @evankanderson in [#7188](https://github.com/open-policy-agent/opa/pull/7188) +- Add description to all built-in function args and return values by @anderseknert in [#7153](https://github.com/open-policy-agent/opa/pull/7153) +- Built-in function `to_number` now rejects "Inf", "Infinity" and "NaN" values by @sikehish in [#7203](https://github.com/open-policy-agent/opa/pull/7203) +- Update eval_cancel_error logic to separate context canceled, timeout errors by @mchitten in [#7202](https://github.com/open-policy-agent/opa/pull/7202) + +### Runtime, Tooling, SDK + +- Respect runtime rego-version in RESTful policy API by @johanfylling in [#7183](https://github.com/open-policy-agent/opa/pull/7183) +- Debugger: allow YAML to be used as input by @anderseknert in [#7178](https://github.com/open-policy-agent/opa/pull/7178) +- `opa build`: provide an option to preserve print statements for the "wasm" target (#7194) by @me-viper in [#7195](https://github.com/open-policy-agent/opa/pull/7195) +- Fix improper formatter behavior when comprehension contains comment by @tjons in [#7169](https://github.com/open-policy-agent/opa/pull/7169) +- runtime: send version report less often when OPA long-running by @srenatus in [#7211](https://github.com/open-policy-agent/opa/pull/7211) +- `opa eval`: Return error if illegal arguments passed with `--unknowns` flag by @kd-labs in [#7149](https://github.com/open-policy-agent/opa/pull/7149) +- Enable direct error handling for bundle plugin trigger method by @torwunder in [#7143](https://github.com/open-policy-agent/opa/pull/7143) + +### Docs, Website, Ecosystem + +- Add VodafoneZiggo as adopters by @Parsifal-M in [#7154](https://github.com/open-policy-agent/opa/pull/7154) +- Add opa-java-wasm to docs by @andreaTP in [#7199](https://github.com/open-policy-agent/opa/pull/7199) + +### Dependency Updates + +- (build) golangci-lint: v1.59.1 -> v1.60.1 by @srenatus in [#7175](https://github.com/open-policy-agent/opa/pull/7175) +- github.com/containerd/containerd: v1.7.23 -> v1.7.24 +- github.com/fsnotify/fsnotify: v1.7.0 -> v1.8.0 +- golang.org/x/net: v0.30.0 -> v0.33.0 +- golang.org/x/time: v0.7.0 -> v0.8.0 +- google.golang.org/grpc: v1.67.1 -> v1.69.2 +- go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp: v0.53.0 -> v0.58.0 +- go.opentelemetry.io/otel: v1.28.0 -> v1.33.0 +- go.opentelemetry.io/otel/exporters/otlp/otlptrace: v1.28.0 -> v1.33.0 +- go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc: v1.28.0 -> v1.33.0 +- go.opentelemetry.io/otel/sdk: v1.28.0 -> v1.33.0 +- go.opentelemetry.io/otel/trace: v1.28.0 -> v1.33.0 + + +## 0.70.0 + +This release contains a mix of features, performance improvements, and bugfixes. + +### Optimized read mode for OPA's in-memory store ([#7125](https://github.com/open-policy-agent/opa/pull/7125)) + +A new optimized read mode has been added to the default in-memory store, where data written to the store is eagerly converted +to AST values (the data format used during evaluation). This removes the time spent converting raw data values to AST +during policy evaluation, thereby improving performance. + +The memory footprint of the store will increase, as processed AST values generally take up more space in memory than the +corresponding raw data values, but overall memory usage of OPA might remain more stable over time, as pre-converted data +is shared across evaluations and isn't recomputed for each evaluation, which can cause spikes in memory usage. + +This mode can be enabled for `opa run`, `opa eval`, and `opa bench` by setting the `--optimize-store-for-read-speed` flag. + +More information about this feature can be found [here](https://www.openpolicyagent.org/docs/v0.70.0/policy-performance/#storage-optimization). + +Co-authored by @johanfylling and @ashutosh-narkar. + +### Topdown and Rego +- topdown: Use new Inter-Query Value Cache for `json.match_schema` built-in function ([#7011](https://github.com/open-policy-agent/opa/issues/7011)) authored by @anderseknert reported by @lcarva +- ast: Fix location text attribute for multi-value rules with generated body ([#7128](https://github.com/open-policy-agent/opa/issues/7128)) authored by @anderseknert +- ast: Fix regression in `opa check` where a file that referenced non-provided schemas failed validation ([#7124](https://github.com/open-policy-agent/opa/pull/7124)) authored by @tjons +- test/cases/testdata: Fix bug in test by replacing unification by explicit equality check ([#7093](https://github.com/open-policy-agent/opa/pull/7093)) authored by @matajoh +- ast: Replace use of yaml.v2 library with yaml.v3. The earlier version would parse `yes`/`no` values as boolean. The usage of yaml.v2 in the parser was unintentional and now has been updated to yaml.v3 ([#7090](https://github.com/open-policy-agent/opa/issues/7090)) authored by @anderseknert + +### Runtime, Tooling, SDK +- cmd: Make `opa check` respect `--ignore` when `--bundle` flag is set ([#7136](https://github.com/open-policy-agent/opa/issues/7136)) authored by @anderseknert +- server/writer: Properly handle result encoding errors which earlier on failure would emit logs such as `superfluous call to WriteHeader()` while still returning `200` HTTP status code. Now, errors encoding the payload properly lead to `500` HTTP status code, without extra logs. Also use Header().Set() not Header().Add() to avoid duplicate content-type headers ([#7114](https://github.com/open-policy-agent/opa/pull/7114)) authored by @srenatus +- cmd: Support `file://` format for TLS key material file flags in `opa run` ([#7094](https://github.com/open-policy-agent/opa/pull/7094)) authored by @alexrohozneanu +- plugins/rest/azure: Support managed identity for App Service / Container Apps ([#7085](https://github.com/open-policy-agent/opa/issues/7085)) reported and authored by @apc-kamezaki +- debug: Fix step-over behaviour when exiting partial rules ([#7096](https://github.com/open-policy-agent/opa/pull/7096)) authored by @johanfylling +- util+plugins: Fix potential memory leaks with explicit timer cancellation ([#7089](https://github.com/open-policy-agent/opa/pull/7089)) authored by @philipaconrad + +### Docs, Website, Ecosystem +- docs: Fix OCI example with updated flag used by the ORAS CLI ([#7130](https://github.com/open-policy-agent/opa/pull/7130)) authored by @b3n3d17 +- docs: Delete Atom editor from supported editor integrations ([#7111](https://github.com/open-policy-agent/opa/pull/7111)) authored by @KaranbirSingh7 +- docs/website: Add Styra OPA ASP.NET Core SDK integration ([#7073](https://github.com/open-policy-agent/opa/pull/7073)) authored by @philipaconrad +- docs/website: Update compatibility information on the rego-cpp integration ([#7078](https://github.com/open-policy-agent/opa/pull/7078)) authored by @matajoh + +### Miscellaneous +- Dependency updates; notably: + - build(deps): bump github.com/containerd/containerd from 1.7.22 to 1.7.23 + - build(deps): bump github.com/prometheus/client_golang from 1.20.4 to 1.20.5 + - build(deps): bump golang.org/x/net from 0.29.0 to 0.30.0 + - build(deps): bump golang.org/x/time from 0.6.0 to 0.7.0 + - build(deps): bump google.golang.org/grpc from 1.67.0 to 1.67.1 + +## 0.69.0 + +This release contains a mix of features, bugfixes and necessary tooling and test changes required to support the upcoming OPA `1.0` release. + + +### Inter-Query Value Cache ([#6908](https://github.com/open-policy-agent/opa/issues/6908)) + +OPA now has a new inter-query value cache added to the SDK. It is intended to be used for values that are expensive to +compute and can be reused across multiple queries. The cache can be leveraged by built-in functions to store values +that otherwise aren't appropriate for the existing inter-query cache; for instance when the entry size isn't an +appropriate or primary limiting factor for cache eviction. + +The default size of the inter-query value cache is unbounded, but can be configured via the +`caching.inter_query_builtin_value_cache.max_num_entries` configuration field. OPA will drop random items from the cache +if this limit is exceeded. + +The cache is used by the `regex` and `glob` built-in functions, which previously had individual, non-configurable +caches with a max entry size of `100` each. + +Currently, the cache is only exercised when running OPA in server mode (ie. `opa run -s`). Also this feature is unsupported +for WASM. + +Authored by @ashutosh-narkar, reported by @amirsalarsafaei + +### Topdown and Rego + +- Future-proofing tests in the `ast`, `topdown`, `rego` etc. packages to be `1.0` compatible (authored by @johanfylling) +- ast: Attach annotation to static part of rule ref ([#7050](https://github.com/open-policy-agent/opa/issues/7050)) authored by @anderseknert +- ast: Make `Module.String()` include `if`/`contains` for v1 modules ([#6973](https://github.com/open-policy-agent/opa/issues/6973)) authored by @johanfylling reported by @nikpivkin +- topdown/http: Stop `http.send` latency timer when an error is encountered ([#7007](https://github.com/open-policy-agent/opa/pull/7007)) authored by @lukyer +- ast/compile: Refactor local variable replacement and replace declared variables in `with`'s target ([#6979](https://github.com/open-policy-agent/opa/issues/6979)) authored by @srenatus reported by @bluebrown +- ast: Update type checker to cache schema types ([#6970](https://github.com/open-policy-agent/opa/pull/6970)) authored by @nikpivkin +- test: Fix indentation in a YAML test case ([#7039](https://github.com/open-policy-agent/opa/pull/7039)) authored by @matajoh +- format: Bracketing keyword ref elements in formatter output ([#7010](https://github.com/open-policy-agent/opa/pull/7010)) authored by @johanfylling + +### Runtime, Tooling, SDK + +- Future-proofing tests in the `sdk`, `downlaod`, `server` , `cmd` etc. packages to be `1.0` compatible (authored by @johanfylling) +- cmd: Add `--v0-compatible` flag to make OPA behave as `v0.x` post `v1.0` release ([#7065](https://github.com/open-policy-agent/opa/pull/7065)) authored by @johanfylling +- util: Strip UTF-8 BOM from input JSON when found ([#6988](https://github.com/open-policy-agent/opa/issues/6988)) authored by @anderseknert reported by @adhilto +- plugins/rest: Support reading AWS token from the filesystem for the AWS container credential provider ([#6997](https://github.com/open-policy-agent/opa/pull/6997)) authored by @cmaddalozzo +- debug: Add `RegoOption` launch option to debugger for setting custom Rego options ([#7045](https://github.com/open-policy-agent/opa/issues/7045)) authored by @johanfylling +- debug: Always include `Input` and `Data` variable scopes to ease discoverability of the scopes ([#7074](https://github.com/open-policy-agent/opa/pull/7074)) authored by @johanfylling +- wasm: Fix arithmetic comparison for large numbers, caused by an integer overflow ([#6991](https://github.com/open-policy-agent/opa/issues/6991)) authored by @Ptroger + +### Docs, Website, Ecosystem + +- Add Marsh McLennan to adopters ([#7060](https://github.com/open-policy-agent/opa/issues/7060)) authored by @anderseknert reported by @pratimsc +- Add APIwiz to adopters ([#7067](https://github.com/open-policy-agent/opa/pull/7067)) authored by @anderseknert +- docs: Fix misnomer in OPA-Istio tutorial to document Istio's AuthorizationPolicy API ([#6984](https://github.com/open-policy-agent/opa/pull/6984)) authored by @tjons +- docs: Readme updates to highlight more up-to-date information about OPA ([#7066](https://github.com/open-policy-agent/opa/pull/7066)) authored by @charlieegan3 +- docs: Update documentation to show Debug API uses ([#7036](https://github.com/open-policy-agent/opa/pull/7036)) authored by @charlieegan3 +- docs: Simplify the OPA-Istio tutorial example policy ([#7059](https://github.com/open-policy-agent/opa/pull/7059)) authored by @anderseknert +- website: Update policy examples on the OPA home page to be `1.0` compatible ([#7033](https://github.com/open-policy-agent/opa/pull/7033)) authored by @charlieegan3 + +### Miscellaneous + +- build: Bump github.com/golang/glob, remove replace directive ([#7024](https://github.com/open-policy-agent/opa/issues/7024)) authored by @srenatus reported by @mmannerm +- Dependency updates; notably: + - build(deps): bump github.com/containerd/containerd from 1.7.21 to 1.7.22 + - build(deps): bump github.com/prometheus/client_golang from 1.20.2 to 1.20.4 + - build(deps): bump go.uber.org/automaxprocs from 1.5.3 to 1.6.0 + - build(deps): bump golang.org/x/net from 0.28.0 to 0.29.0 + - build(deps): bump google.golang.org/grpc from 1.66.0 to 1.67.0 + - build(go): bump 1.22.5 to 1.23.1 ([#7006](https://github.com/open-policy-agent/opa/pull/7006)) authored by @srenatus + +## 0.68.0 + +This release contains a mix of features and bugfixes. + +### Breaking Changes + +#### `entrypoint` annotation implies `document` scope ([#6798](https://github.com/open-policy-agent/opa/issues/6798)) + +The [entrypoint annotation's](https://www.openpolicyagent.org/docs/latest/policy-language/#entrypoint) scope requirement +has changed from `rule` to `document` ([https://github.com/open-policy-agent/opa/issues/6798](#6798)). +Furthermore, if no `scope` annotation is declared for a METADATA block preceding a rule, the presence of an `entrypoint` +annotation with a `true` value will assign the block a `document` scope, where the `rule` scope is otherwise the default. + +In practice, a rule entrypoint always point to the entire document and not a particular rule definition. The previous behavior was a bug, and one we've now addressed. + +Authored by @anderseknert + +### Topdown and Rego + +- ast: Fixing nil-pointer dereference in compiler for partial rule edge case ([#6930](https://github.com/open-policy-agent/opa/issues/6930)) authored by @johanfylling +- ast+parser: Add hint to future-proof imports ([6968](https://github.com/open-policy-agent/opa/pull/6968)) authored by @srenatus +- topdown: Adding unification scope to virtual-cache key. Fixing issue where false positive cache hits can occur when unification "restricts" the scope of ref-head rule evaluation ([#6926](https://github.com/open-policy-agent/opa/issues/6926)) authored by @johanfylling reported by @anderseknert +- topdown: Marshal JWT encode sign inputs as JSON ([#6934](https://github.com/open-policy-agent/opa/pull/6934)) authored by @charlieegan3 + +### Runtime, Tooling, SDK + +- ast: Make type checker `copy` method copy all values ([#6949](https://github.com/open-policy-agent/opa/pull/6949)) authored by @anderseknert +- ast: Include term locations in rule heads when requested ([#6860](https://github.com/open-policy-agent/opa/issues/6860)) authored by @anderseknert +- debug: Adding experimental debugger SDK ([#6876](https://github.com/open-policy-agent/opa/issues/6876)) authored by @johanfylling +- distributedtracing: allow OpenTelemetry resource attributes to be configured under distributed_tracing config ([#6942](https://github.com/open-policy-agent/opa/issues/6942)) authored and reported by @brettmc +- download: Fixing issue when saving OCI bundles on disk ([#6939](https://github.com/open-policy-agent/opa/issues/6939)) authored and reported by @Sergey-Kizimov +- logging: Always include HTTP request context in incoming req context ([#6951](https://github.com/open-policy-agent/opa/issues/6951)) authored by @ashutosh-narkar reported by @alvarogomez93 +- plugins/bundle: Avoid race-condition during bundle reconfiguration and activation ([#6849](https://github.com/open-policy-agent/opa/issues/6849)) authored by @ashutosh-narkar reported by @Pushpalanka +- plugins/bundle: Escape reserved chars used in persisted bundle directory name ([#6915](https://github.com/open-policy-agent/opa/issues/6915)) authored by @ashutosh-narkar reported by @alvarogomez93 +- plugins/rest: Support AWS_CONTAINER_CREDENTIALS_FULL_URI metadata endpoint ([#6893](https://github.com/open-policy-agent/opa/issues/6893)) authored and reported by @mbamber +- util+server: Fix bug around chunked request handling. ([#6904](https://github.com/open-policy-agent/opa/issues/6904)) authored by @philipaconrad reported by @David-Wobrock +- `opa exec`: This command never supported "pretty" formatting (`--format=pretty` or `-f pretty`), only `json`. Passing `pretty` is now invalid. ([#6923](https://github.com/open-policy-agent/opa/pull/6923)) authored by @srenatus + Note that the flag is now unnecessary, but it's kept so existing calls like `opa exec -fjson ...` remain valid. + +#### Security Fix: CVE-2024-8260 ([#6933](https://github.com/open-policy-agent/opa/pull/6933)) + +This release includes a fix where OPA would accept UNC locations on Windows. Reading those could leak NTLM hashes. +The attack vector would include an adversary tricking the user in passing an UNC path to OPA, e.g. `opa eval -d $FILE`. +UNC paths are now forbidden. If this is an issue for you, please reach out on Slack or GitHub issues. + +Reported by Shelly Raban +Authored by @ashutosh-narkar + +### Docs, Website, Ecosystem + +- docs: Suggest using `opa-config.yaml` as name for config file (#6966) ([#6959](https://github.com/open-policy-agent/opa/issues/6959)) authored by @anderseknert +- docs: Add documentation for OPA Spring Boot integration ([#6898](https://github.com/open-policy-agent/opa/pull/6898)) authored by @charlieegan3 +- docs: Update Istio tutorial ([#6896](https://github.com/open-policy-agent/opa/pull/6896)) authored by @Pindar +- docs: Update contrib docs ([#6974](https://github.com/open-policy-agent/opa/pull/6974)) authored by @charlieegan3 +- docs: Add Lula to the OPA ecosystem ([#6902](https://github.com/open-policy-agent/opa/pull/6902)) authored by @brandtkeller +- docs: Add github action policy testing automation ([#6954](https://github.com/open-policy-agent/opa/pull/6954)) authored by @oycyc +- docs: Mention `http.send` in inter-query cache config docs ([#6953](https://github.com/open-policy-agent/opa/pull/6953)) authored by @anderseknert +- docs+topdown: Fixing typos in built-in descriptions ([#6940](https://github.com/open-policy-agent/opa/pull/6940)) authored by @msorens + +### Miscellaneous + +- build: Make it possible to build only wasm testcases ([#6920](https://github.com/open-policy-agent/opa/pull/6920)) authored by @andreaTP +- Dependency updates; notably: + - build(deps): bump github.com/containerd/containerd from 1.7.20 to 1.7.21 + - build(deps): bump github.com/prometheus/client_golang from 1.19.1 to 1.20.2 + - build(deps): bump golang.org/x/net from 0.27.0 to 0.28.0 + - build(deps): bump golang.org/x/time from 0.5.0 to 0.6.0 + - build(deps): bump google.golang.org/grpc from 1.65.0 to 1.66.0 + +## 0.67.1 + +This is a bug fix release addressing the following issue: + +- util+server: Fix bug around chunked request handling ([#6906](https://github.com/open-policy-agent/opa/pull/6906)) authored by @philipaconrad, reported by @David-Wobrock. A request handling bug was introduced in ([#6868](https://github.com/open-policy-agent/opa/pull/6868)), which caused OPA to treat all incoming chunked requests as if they had zero-length request bodies. + +## 0.67.0 + +This release contains a mix of features, a new builtin function (`strings.count`), performance improvements, and bugfixes. + +### Breaking Change + +#### Request Body Size Limits + +OPA now automatically rejects very large requests ([#6868](https://github.com/open-policy-agent/opa/pull/6868)) authored by @philipaconrad. +Requests with a `Content-Length` larger than 128 MB uncompressed, and gzipped requests with payloads that decompress to +larger than 256 MB will be rejected, as part of hardening OPA against denial-of-service attacks. Previously, a large +enough request could cause an OPA instance to run out of memory in low-memory sidecar deployment scenarios, just from +attempting to read the request body into memory. + +These changes allow improvements in memory usage for the OPA HTTP server, and help OPA deployments avoid some accidental out-of-memory situations. + +For most users, no changes will be needed to continue using OPA. However, to control this behavior, two new configuration +keys are available: `server.decoding.max_length` and `server.decoding.gzip.max_length`. These control the max size in +bytes to allow for an incoming request payload, and the maximum size in bytes to allow for a decompressed gzip request payload, respectively. + +Here's an example OPA configuration using the new keys: + +```yaml +# Set max request size to 64 MB and max gzip size (decompressed) to be 128 MB. +server: + decoding: + max_length: 67108864 + gzip: + max_length: 134217728 +``` + +### Topdown and Rego + +- topdown: New `strings.count` builtin which returns the number of non-overlapping instances of a substring in a string ([#6827](https://github.com/open-policy-agent/opa/issues/6827)) authored by @Manish-Giri +- format: Produce error when `--rego-v1` formatted module has rule name conflicting with keyword ([#6833](https://github.com/open-policy-agent/opa/issues/6833)) authored by @johanfylling +- topdown: Add cap to caches for regex and glob built-in functions ([#6828](https://github.com/open-policy-agent/opa/issues/6828)) authored by @johanfylling. This fixes possible memory leaks where caches grow uncontrollably when large amounts of regexes or globs are generated or originate from the input document. + +### Runtime, Tooling, SDK +- repl: Add support for correctly loading bundle modules ([#6872](https://github.com/open-policy-agent/opa/issues/6872)) authored by @ashutosh-narkar +- plugins/discovery: Allow un-registration of discovery listener ([#6851](https://github.com/open-policy-agent/opa/pull/6851)) authored by @mjungsbluth. The discovery plugin allows OPA to register a bundle download status listener but previously did not offer a method to unregister that listener +- plugins/logs: Reduce amount of work performed inside global lock in decision log plugin ([#6859](https://github.com/open-policy-agent/opa/pull/6859)) authored by @johanfylling +- plugins/rest: Add a new client credential attribute to support Azure Workload Identity. This would allow workloads deployed on an Azure Kubernetes Services (AKS) cluster to authenticate and access Azure cloud resources ([#6802](https://github.com/open-policy-agent/opa/pull/6802)) authored by @ledbutter +- cmd/inspect: Add ability for opa inspect to inspect a single file outside of any bundle ([#6873](https://github.com/open-policy-agent/opa/pull/6873)) authored by @tjons +- cmd+bundle: Add `--follow-symlinks` flag to the `opa build` command to allow users to build directories with symlinked files, and have the contents of those symlinked files included in the built bundle ([#6800](https://github.com/open-policy-agent/opa/pull/6800)) authored by @tjons +- server: Add missing handling in the server for the `explain=fails` query value ([#6886](https://github.com/open-policy-agent/opa/pull/6886)) authored by @acamatcisco + +### Docs, Website, Ecosystem +- docs: Update bundle section with an example of a manifest with `rego_version` and `file_rego_versions` attributes ([#6885](https://github.com/open-policy-agent/opa/pull/6885)) authored by @ashutosh-narkar +- docs: Better link language SDKs to make them more discoverable ([#6866](https://github.com/open-policy-agent/opa/pull/6866)) authored by @charlieegan3 + +### Miscellaneous + +- ci: Add the OpenSSF Scorecard Github Action to help evaluate the OPA project's security posture ([#6848](https://github.com/open-policy-agent/opa/pull/6848)) authored by @harshitasao +- Dependency updates; notably: + - build(go): bump golang from 1.22.4 to 1.22.5 + - build(deps): bump github.com/containerd/containerd from 1.7.18 to 1.7.20 + - build(deps): bump golang.org/x/net from 0.26.0 to 0.27.0 + - build(deps): bump google.golang.org/grpc from 1.64.0 to 1.65.0 + - build(deps): bump go.opentelemetry.io modules ([#6847](https://github.com/open-policy-agent/opa/pull/6847)) + +## 0.66.0 + +This release contains a mix of features, performance improvements, and bugfixes. + +### Improved Test Reports ([2546](https://github.com/open-policy-agent/opa/issues/2546)) + +The `opa test` command now includes a new `--var-values` flag that enriches reporting of failed tests with the values and locations for variables in the failing expression. +E.g.: + +``` +FAILURES +-------------------------------------------------------------------------------- +data.test.test_my_policy: FAIL (0ms) + + test.rego:8: + x == y + z + | | | + | | 3 + | y + z: 5 + | y: 2 + 1 + +SUMMARY +-------------------------------------------------------------------------------- +test.rego: +data.test.test_foo: FAIL (0ms) +-------------------------------------------------------------------------------- +FAIL: 1/1 +``` + +Authored by @johanfylling, reported by @grosser. + +### Reading stdin in `opa exec` ([#6538](https://github.com/open-policy-agent/opa/issues/6538)) + +The `opa exec` command now supports reading `input` documents from stdin with the `--stdin-input` (`-I`) flag. +E.g.: + +```shell +$ echo '{"user": "alice"}' | opa exec --stdin-input --bundle my_bundle +``` + +Authored by @colinjlacy, reported by @humbertoc-silva. + +### Topdown and Rego + +- ast: Fix blanket "unexpected assign token" error message / usability issue ([#6563](https://github.com/open-policy-agent/opa/issues/6563)) authored by @anderseknert +- ast: Fix wrong location on metadata parse errors on first line ([#6587](https://github.com/open-policy-agent/opa/issues/6587)) authored by @anderseknert +- ast: Fix/inspect unknowns in with stmt ([#6812](https://github.com/open-policy-agent/opa/issues/6812)) authored by @johanfylling reported by @surajupadhyay01 +- ast: Include original text in annotation location text attribute ([#6779](https://github.com/open-policy-agent/opa/issues/6779)) authored by @anderseknert +- ast: Expanding nested expressions in `every` domain ([#6790](https://github.com/open-policy-agent/opa/issues/6790)) authored by @johanfylling reported by @anakrish +- topdown: Add http.send request attribute to ignore headers for caching key ([#6642](https://github.com/open-policy-agent/opa/issues/6642)) authored and reported by @rudrakhp + +### Runtime, Tooling, SDK + +- build: Use chainguard images from dockerhub ([#6830](https://github.com/open-policy-agent/opa/pull/6830)) authored by @srenatus +- bundle: Preallocate buffers for file contents. ([#6818](https://github.com/open-policy-agent/opa/pull/6818)) authored by @philipaconrad +- plugins: Reduce locks during decision logging ([#6797](https://github.com/open-policy-agent/opa/pull/6797)) authored by @mjungsbluth +- plugins/rest: Do local map modification in OAuth2 client credentials flow ([#6769](https://github.com/open-policy-agent/opa/issues/6769)) authored and reported by @eubaranov +- loader: Use a better error message when trying to merge non-objects ([#6803](https://github.com/open-policy-agent/opa/issues/6803)) authored by @anderseknert +- server/authorizer: Fix gzip payload handling ([#6804](https://github.com/open-policy-agent/opa/issues/6804)) authored by @philipaconrad reported by @nevumx + +### Docs, Website, Ecosystem + +- docs: Remove missing prometheus metric `go_memstats_gc_cpu_fraction` ([#6783](https://github.com/open-policy-agent/opa/issues/6783)) authored by @philipaconrad +- docs: Mention that default functions may not evaluate ([#6265](https://github.com/open-policy-agent/opa/issues/6265)) authored by @anderseknert +- docs: Fix spelling and grammar of `an HTTP` ([#6786](https://github.com/open-policy-agent/opa/pull/6786)) authored by @jdbaldry +- docs/website: Add vs code and zed to ecosystem page ([#6788](https://github.com/open-policy-agent/opa/pull/6788)) authored by @charlieegan3 +- docs/website: Add Flipt to the OPA ecosystem ([#6781](https://github.com/open-policy-agent/opa/pull/6781)) authored by @markphelps +- docs/website: Add Flipt blog to their ecosystem page ([#6789](https://github.com/open-policy-agent/opa/pull/6789)) authored by @charlieegan3 +- docs/website: Revise language SDK content ([#6811](https://github.com/open-policy-agent/opa/pull/6811)) authored by @charlieegan3 + +### Miscellaneous + +- Dependency updates; notably: + - build(go): bump golang from 1.22.3 to 1.22.4 + - build(deps): bump github.com/containerd/containerd from 1.7.17 to 1.7.18 + - build(deps): bump golang.org/x/net from 0.25.0 to 0.26.0 + +## 0.65.0 + +This release contains a mix of features and bugfixes. + +### Runtime, Tooling, SDK + +- ast: Include annotations in rule AST, to help external tooling analyzing the AST ([#6771](https://github.com/open-policy-agent/opa/pull/6771)) authored by @ashutosh-narkar +- aws: Always read HTTP response body, to re-use persistent connections for non-200 responses ([#6734](https://github.com/open-policy-agent/opa/pull/6734)) authored by @johanneslarsson +- plugins/discovery: Update comparison logic for overrides ([#6723](https://github.com/open-policy-agent/opa/pull/6723)) authored by @ashutosh-narkar +- plugins/logs: Include http request context in decision logs ([#6693](https://github.com/open-policy-agent/opa/issues/6693)) authored by @ashutosh-narkar reported by @stiidk +- plugins/rest: Disable the Authorization header for ECR redirects ([6728](https://github.com/open-policy-agent/opa/pull/6728)) authored by @gdlg reported by @vazquezf2000 +- runtime: Fix OpenTelemetry graceful shutdown ([#6651](https://github.com/open-policy-agent/opa/issues/6651)) authored by @nicolaschotard and @David-Wobrock reported by @nicolaschotard + +### Topdown and Rego + +- topdown: Asserting the `every` domain is a collection type before evaluation ([#6762](https://github.com/open-policy-agent/opa/issues/6762)) authored by @johanfylling reported by @anderseknert + +### Miscellaneous + +- docs: Add arrays to composite values section ([#6727](https://github.com/open-policy-agent/opa/issues/6727)) authored by @anderseknert reported by @SpecLad +- docs: Add remainder operator to grammar ([#6767](https://github.com/open-policy-agent/opa/pull/6767)) authored by @anderseknert +- docs: Fix dynamic metadata object in docs ([#6709](https://github.com/open-policy-agent/opa/pull/6709)) authored by @antonioberben +- docs: Use best practice package name in test examples ([#6731](https://github.com/open-policy-agent/opa/pull/6731)) authored by @asleire +- docs: Update query API doc with details about overriding the def decision path ([#6745](https://github.com/open-policy-agent/opa/pull/6745)) authored by @ashutosh-narkar +- ci: pin GitHub Actions macos runner version and build for darwin/amd64 ([#6720](https://github.com/open-policy-agent/opa/issues/6720)) reported and authored by @suzuki-shunsuke +- Dependency updates; notably: + - build(go): bump golang from 1.22.2 to 1.22.3 + - build(deps): bump github.com/containerd/containerd from 1.7.15 to 1.7.17 + - build(deps): bump github.com/prometheus/client_golang + - build(deps): bump golang.org/x/net from 0.24.0 to 0.25.0 + - build(deps): bump google.golang.org/grpc from 1.63.2 to 1.64.0 + +### Breaking changes + +A new [IsSetStmt](https://www.openpolicyagent.org/docs/latest/ir/#issetstmt) statement has been added to the intermediate representation (IR). +This is a breaking change for custom IR evaluators, which must interpret this statement in IR plans generated by this OPA version and later. +No actions are required for Wasm users, as long as Wasm modules are built by this OPA version or later. + +## 0.64.1 + +This is a bug fix release addressing the following issues: + +- ci: Pin GitHub Actions macos runner version. The architecture of the GitHub Actions Runner `macos-latest` was changed from `amd64` to `arm64` and as a result `darwin/amd64` binary wasn't released ([#6720](https://github.com/open-policy-agent/opa/issues/6720)) authored by @suzuki-shunsuke +- plugins/discovery: Update comparison logic used in the discovery plugin for handling overrides. This fixes a panic that resulted from the comparison of uncomparable types ([#6723](https://github.com/open-policy-agent/opa/pull/6723)) authored by @ashutosh-narkar + +## 0.64.0 + +> **_NOTES:_** +> +> * The minimum version of Go required to build the OPA module is **1.21** + +This release contains a mix of features, a new builtin function (`json.marshal_with_options()`), performance improvements, and bugfixes. + +### Breaking Change + +#### Bootstrap configuration overrides Discovered configuration + +Previously if Discovery was enabled, other features like bundle downloading and status reporting could not be configured manually. +The reason for this was to prevent OPAs being deployed that could not be controlled through discovery. It's possible that +the system serving the discovered config is unaware of all options locally available in OPA. Hence, we relax the configuration +check when discovery is enabled so that the bootstrap configuration can contain plugin configurations. In case of conflicts, +the bootstrap configuration for plugins wins. These local configuration overrides from the bootstrap configuration are included +in the Status API messages so that management systems can get visibility into the local overrides. + +**In general, the bootstrap configuration overrides the discovered configuration.** Previously this was not the case for all +configuration fields. For example, if the discovered configuration changes the `labels` section, only labels that are +additional compared to the bootstrap configuration are used, all other changes are ignored. This implies labels in the +bootstrap configuration override those in the discovered configuration. But for fields such as `default_decision`, `default_authorization_decision`, +`nd_builtin_cache`, the discovered configuration would override the bootstrap configuration. Now the behavior is more consistent +for the entire configuration and helps to avoid accidental configuration errors. ([#5722](https://github.com/open-policy-agent/opa/issues/5722)) authored by @ashutosh-narkar + +### Add `rego_version` attribute to the bundle manifest + +A new global `rego_version` attribute is added to the bundle manifest, to inform the OPA runtime about what Rego version (`v0`/`v1`) to +use while parsing/compiling contained Rego files. There is also a new `file_rego_versions` attribute which allows individual +files to override the global Rego version specified by `rego_version`. + +When the version of the contained Rego is advertised by the bundle through this attribute, it is not required to run OPA with the +`--v1-compatible` (or future `--v0-compatible`) flag in order to correctly parse, compile and evaluate the bundle's modules. + +A bundle's `rego_version` attribute takes precedence over any applied `--v1-compatible`/`--v0-compatible` flag. ([#6578](https://github.com/open-policy-agent/opa/issues/6578)) authored by @johanfylling + +### Runtime, Tooling, SDK +- compile: Fix panic from CLI + metadata entrypoint overlaps. The panic occurs when `opa build` was provided an entrypoint from both a CLI flag, and via entrypoint metadata annotation. ([#6661](https://github.com/open-policy-agent/opa/issues/6661)) authored by @philipaconrad +- cmd/deps: Improve memory footprint and execution time of `deps` command for policies with high dependency connectivity ([#6685](https://github.com/open-policy-agent/opa/issues/6685)) authored by @johanfylling +- server: Keep default decision path in-sync with manager's config ([#6697](https://github.com/open-policy-agent/opa/issues/6697)) authored by @ashutosh-narkar +- server: Remove unnecessary AST-to-JSON conversions ([#6665](https://github.com/open-policy-agent/opa/pull/6665)) and ([#6669](https://github.com/open-policy-agent/opa/pull/6669)) authored by @koponen-styra +- sdk: Allow customizations of the plugin manager via SDK ([#6662](https://github.com/open-policy-agent/opa/issues/6662)) authored by @xico42 +- sdk: Fix issue where active parser options aren't propagated to module reload during bundle activation resulting in errors while activating bundles with `v1` syntax ([#6689](https://github.com/open-policy-agent/opa/pull/6689)) authored by @xico42 +- plugins/rest: Close response body in OAuth2 client credentials flow ([#6708](https://github.com/open-policy-agent/opa/pull/6708)) authored by @johanneslarsson + +### Topdown and Rego +- ast: Import `rego.v1` in `v0` support modules when applicable ([#6450](https://github.com/open-policy-agent/opa/issues/6450)) authored by @johanfylling +- rego: Set query Rego version from configured imports ([#6701](https://github.com/open-policy-agent/opa/issues/6701)) authored by @johanfylling +- topdown: New `json.marshal_with_options()` builtin for indented/"pretty-printed" and/or line-prefixed JSON ([#6630](https://github.com/open-policy-agent/opa/issues/6630)) authored by @sean-r-williams + +### Docs, Website, Ecosystem +- Add Raygun to ecosystem projects ([#6712](https://github.com/open-policy-agent/opa/pull/6712)) authored by @johndbro1 +- Add env0 to ecosystem projects ([#6658](https://github.com/open-policy-agent/opa/pull/6658)) authored by @yarivg +- Add Rego Language Comparisons to ecosystem projects ([#6663](https://github.com/open-policy-agent/opa/pull/6663)) authored by @charlieegan3 +- docs/configuration: Tidy up headers in Services section ([#6695](https://github.com/open-policy-agent/opa/pull/6695)) authored by @tsandall +- docs: Use cuboid rather than cube to explain concepts of sets and composite values in policy-language section of documentation ([#6691](https://github.com/open-policy-agent/opa/pull/6691)) authored by @kd-labs + +### Miscellaneous +- go.{mod,sum}: Update the `go` stanza of OPA's `go.mod` to `go 1.21`. OPA, used as Go dependency, requires at least `go 1.21`, and thus works with all officially supported Go versions (`1.21.x` and `1.22.x`) ([#6678](https://github.com/open-policy-agent/opa/pull/6678)) authored by @srenatus +- ci: Update Github Actions for Node 20. This change updates the `upload-artifact` and `download-artifact` Github actions to the latest version (v4) ([#6670](https://github.com/open-policy-agent/opa/pull/6670)) authored by @philipaconrad +- build: Update WASM Rego test generation docker command to address CVE-2022-24765 in Git ([#6703](https://github.com/open-policy-agent/opa/issues/6703)) authored by @ashutosh-narkar +- Dependency updates; notably: + - build(go): bump 1.22.1 -> 1.22.2 ([#6672](https://github.com/open-policy-agent/opa/pull/6672)) authored by @srenatus + - build(deps): bump aquasecurity/trivy-action from 0.18.0 to 0.19.0 + - build(deps): bump github.com/containerd/containerd from 1.7.14 to 1.7.15 + - build(deps): bump github.com/prometheus/client_model from 0.5.0 to 0.6.1 + - build(deps): bump golang.org/x/net from 0.22.0 to 0.24.0 + - build(deps): bump google.golang.org/grpc from 1.62.1 to 1.63.2 + + +## 0.63.0 + +This release contains a mix of features, performance improvements, and bugfixes. + +### Runtime, Tooling, SDK + +- cmd/exec: Add `--timeout` flag to `opa exec` to prevent infinite hangs. ([#6613](https://github.com/open-policy-agent/opa/issues/6613)) authored by @philipaconrad +- download: Surface bundle download errors via debug logging ([#6609](https://github.com/open-policy-agent/opa/issues/6609)) authored by @ashutosh-narkar reported by @nevumx +- topdown: Fixing overactive Early Exit suppression ([#6566](https://github.com/open-policy-agent/opa/issues/6566)) authored by @johanfylling reported by @ashwinhb +- plugins/rest: Add support to get temp creds via AssumeRole ([#6634](https://github.com/open-policy-agent/opa/pull/6634)) authored by @ashutosh-narkar + +### Topdown and Rego + +- topdown: Adding a new `crypto.x509.parse_and_verify_certificates_with_options` built-in function. ([#5882](https://github.com/open-policy-agent/opa/issues/5882)) authored by @yogisinha reported by @IxDay +- format: Preserve brackets around set union operation ([#6588](https://github.com/open-policy-agent/opa/issues/6588)) authored by @ashutosh-narkar reported by @HarshPathakhp +- aws: Support for Unsigned Payload or provided content sha256 in AWS signing ([#6581](https://github.com/open-policy-agent/opa/pull/6611)) authored by @prasanthj + +### Docs + Website + Ecosystem + +- ADOPTERS.md: Add Facets.cloud to the list ([#6640](https://github.com/open-policy-agent/opa/issues/6640)) authored by @ashutosh-narkar reported by @samarthya-gupta1 +- docs: Mention homebrew install option ([#6622](https://github.com/open-policy-agent/opa/issues/6622)) authored by @anderseknert +- docs: Add Rego v1 keywords to list of reserved names ([#6649](https://github.com/open-policy-agent/opa/pull/6649)) authored by @anderseknert +- docs: Add Tunnelmole as an open source tunneling option in the Cloudformation hooks documentation ([#6626](https://github.com/open-policy-agent/opa/pull/6626)) authored by @robbie-cahill +- docs: Add docs on using env vars in place of CLI flags ([#6631](https://github.com/open-policy-agent/opa/pull/6631)) authored by @anderseknert +- docs: Adding integration for Backstage ([#6629](https://github.com/open-policy-agent/opa/pull/6629)) authored by @Parsifal-M +- docs: Clear up some uses of future keywords ([#6653](https://github.com/open-policy-agent/opa/pull/6653)) authored by @charlieegan3 +- docs: Update delta bundle patch doc for remove op ([#6645](https://github.com/open-policy-agent/opa/pull/6645)) authored by @0marq +- docs: Fix typo in `Debugging OPA` ([#6637](https://github.com/open-policy-agent/opa/pull/6637)) authored by @setchy + +### Miscellaneous + +- chore: Remove repetitive words ([#6644](https://github.com/open-policy-agent/opa/pull/6644)) authored by @occupyhabit +- Dependency updates; notably: + - build(deps): bump github.com/containerd/containerd from 1.7.13 to 1.7.14 + - build(deps): bump github.com/golang/protobuf from 1.5.3 to 1.5.4 + - build(deps): bump google.golang.org/grpc from 1.62.0 to 1.62.1 + +## 0.62.1 + +This is a security fix release for the fixes published in [Golang 1.22.1](https://groups.google.com/g/golang-announce/c/5pwGVUPoMbg). + +OPA servers using `--authentication=tls` would be affected: crafted malicious client +certificates could cause a panic in the server. + +Also, crafted server certificates could panic OPA's HTTP clients, in bundle plugin, +status and decision logs; and `http.send` calls that verify TLS. + +This affects all crypto/tls clients, and servers that set Config.ClientAuth to +VerifyClientCertIfGiven or RequireAndVerifyClientCert. The default behavior is +for TLS servers to not verify client certificates. + +This is CVE-2024-24783 (https://pkg.go.dev/vuln/GO-2024-2598). + +Note that there are other security fixes in this Golang release, but whether or not +OPA is affected is harder to tell. An update is advised. + + +### Miscellaneous + +- Add Trino to OPA ecosystem (authored by @mosabua) +- update: ADOPTERS.md (#6608) (authored by @fredmaggiowski) + + +## 0.62.0 + +> **_NOTES:_** +> +> * The minimum version of Go required to build the OPA module is **1.20** + +This release contains a mix of improvements and bugfixes. + +### Runtime, Tooling, SDK + +- cmd: Add environment variable backups for command-line flags ([#6508](https://github.com/open-policy-agent/opa/pull/6508)) authored by @colinjlacy +- download/oci: Add missing `WithBundleParserOpts` method to OCI downloader ([#6571](https://github.com/open-policy-agent/opa/pull/6571)) authored by @slonka +- logging: avoid `%!F(MISSING)` in logs by skipping calls to the `{Debug,Info,Warn,Error}f` functions when there are no arguments ([#6555](https://github.com/open-policy-agent/opa/pull/6555)) authored by @srenatus + +### Topdown and Rego + +- ast+cmd: Allow bundle to contain calls to unknown Rego functions when inspected ([#6591](https://github.com/open-policy-agent/opa/issues/6591)) authored by @johanfylling +- topdown/http: Respect `raise_error` flag during input validation ([#6553](https://github.com/open-policy-agent/opa/pull/6553)) authored by @ashutosh-narkar + +### Docs + Website + Ecosystem + +- Add OpaDotNet to ecosystem projects ([#6554](https://github.com/open-policy-agent/opa/pull/6554)) authored by @me-viper +- Add updated logos for Permit.io and OPAL ([#6562](https://github.com/open-policy-agent/opa/pull/6562)) authored by @danielbass37 +- docs: Update description of the url path usage when accessing values inside object and array documents for v1/data GET and POST ([#6567](https://github.com/open-policy-agent/opa/pull/6567)) authored by @ashutosh-narkar +- docs: Use `application/yaml` instead of `application/x-yaml` as the former is now a recognized content type ([#6565](https://github.com/open-policy-agent/opa/pull/6565)) authored by @anderseknert + +### Miscellaneous +- Add Elastic to ADOPTERS.md ([#6568](https://github.com/open-policy-agent/opa/pull/6568)) authored by @orouz +- Dependency updates; notably: + - bump golang 1.21.5 -> 1.22 ([#6595](https://github.com/open-policy-agent/opa/pull/6595)) authored by @srenatus + - bump google.golang.org/grpc from 1.61.0 to 1.62.0 + - bump golang.org/x/net from 0.19.0 to 0.21.0 + - bump github.com/containerd/containerd from 1.7.12 to 1.7.13 + - bump aquasecurity/trivy-action from 0.16.1 to 0.17.0 + - bump github.com/prometheus/client_golang from 1.18.0 to 1.19.0 + - bump github.com/opencontainers/image-spec from 1.1.0-rc5 to 1.1.0-rc6 + + +## 0.61.0 + +This release contains a mix of new features and bugfixes. + +### Runtime, SDK + +- Adding `--v1-compatible` flag to all previously unsupported command line commands ([#6520](https://github.com/open-policy-agent/opa/issues/6520)) authored by @johanfylling +- Don't load files in tarball exceeding `size_limit_bytes` ([#6514](https://github.com/open-policy-agent/opa/issues/6514)) authored by @anderseknert reported by @dolevf +- Allow TLS cipher suites to be set for the OPA server ([#6537](https://github.com/open-policy-agent/opa/pull/6537)) authored by @ashutosh-narkar +- Removing deprecated fields and functions related to rego-v1 compatibility ([#6542](https://github.com/open-policy-agent/opa/pull/6542)) authored by @johanfylling +- bundle: Make func newDescriptor and withCloser public ([#6517](https://github.com/open-policy-agent/opa/pull/6517)) authored by @antgubarev +- runtime/logging: Do not panic when rctx is missing ([#6506](https://github.com/open-policy-agent/opa/pull/6506)) authored by @srenatus + +### Topdown + +- topdown: Clean expired `http.send` cache entries periodically ([#5320](https://github.com/open-policy-agent/opa/issues/5320)) authored by @rudrakhp reported by @lukyer + +### Docs + +- docs: Add documentation for new cache config parameters ([#6518](https://github.com/open-policy-agent/opa/pull/6518)) authored by @rudrakhp +- docs: Update docker-authorization.md to use new plugin version ([#6539](https://github.com/open-policy-agent/opa/pull/6539)) authored by @denis-accesa +- docs: Fix a typo in _index.md ([#6491](https://github.com/open-policy-agent/opa/pull/6491)) authored by @trungnguyen +- docs: Add a new debugging page ([#6513](https://github.com/open-policy-agent/opa/pull/6513)) authored by @charlieegan3 +- docs: Update log masking policy examples to be Rego v1 compatible ([#6545](https://github.com/open-policy-agent/opa/pull/6545)) authored by @ashutosh-narkar +- docs: Update version for non docs pages ([#6526](https://github.com/open-policy-agent/opa/pull/6526)) authored by @charlieegan3 +- Integrations, Ecosystem: + - docs: Add dependency-management-data logo ([#6543](https://github.com/open-policy-agent/opa/pull/6543)) authored by @jamietanna + - docs: Updated Rond links ([#6524](https://github.com/open-policy-agent/opa/pull/6524)) authored by @ugho16 + - docs: Correctly size integration logos ([#6544](https://github.com/open-policy-agent/opa/pull/6544)) authored by @charlieegan3 + - docs: Validate ecosystem keys ([#6522](https://github.com/open-policy-agent/opa/pull/6522)) authored by @charlieegan3 + +### Miscellaneous + +- linters+testdata: Reformat all yaml testcases for linting. ([#6511](https://github.com/open-policy-agent/opa/pull/6511)) authored by @philipaconrad +- Dependency updates, notably: + - bump github.com/containerd/containerd from 1.7.11 to 1.7.12 + - bump github.com/go-logr/logr from 1.3.0 to 1.4.1 + - bump github.com/google/uuid from 1.5.0 to 1.6.0 + - bump github.com/prometheus/client_golang from v1.16.0 to v1.18.0 + - bump google.golang.org/grpc from 1.60.1 to 1.61.0 + +## 0.60.0 + +### Runtime, Tooling, SDK +- OPA can be run in 1.0 compatibility mode by using the new `--v1-compatible` flag. When this mode is enabled, the current release of OPA will behave as OPA `v1.0` will eventually behave by default. This flag is currently supported on the `build`, `check`, `fmt`, `eval` and `test` commands ([#6478](https://github.com/open-policy-agent/opa/pull/6478)) authored by @johanfylling +- Extend the telemetry report to include the minimum compatible version of policies loaded into OPA ([#6361](https://github.com/open-policy-agent/opa/issues/6361)) co-authored by @srenatus and @ashutosh-narkar +- server: Support fsnotify based reloading of certificate, key and CA cert pool when they change on disk ([#5788](https://github.com/open-policy-agent/opa/issues/5788)) authored by @charlieegan3 +- Add option on the unit test runner to surface builtin errors. This should help with debugging errors generated while running unit tests ([#6489](https://github.com/open-policy-agent/opa/issues/6489)) authored by @jalseth +- Fix issue in `opa fmt` where the assignment operator and term in the rule head of chain rules are removed from the re-written rule head ([#6467](https://github.com/open-policy-agent/opa/issues/6467)) authored by @anderseknert +- cmd/fmt: Replace dependency on `diff` tool with an external golang library function ([#6284](https://github.com/open-policy-agent/opa/issues/6284)) authored by @colinjlacy + +### Topdown and Rego +- topdown/providers: Preserve user provided http headers in the `providers.aws.sign_req` builtin command ([#6456](https://github.com/open-policy-agent/opa/pull/6456)) authored by @c2zwdjnlcg +- rego: Allow custom builtin function registration to provide a description for the builtin ([#6449](https://github.com/open-policy-agent/opa/issues/6449)) authored by @lcarva +- ast+cmd: Allow bundle to contain calls to unknown functions when inspected ([#6457](https://github.com/open-policy-agent/opa/issues/6457)) authored by @johanfylling + +### Docs +- Add section on the changes proposed for a future OPA v1.0 and update Rego examples to be OPA v1.0 compliant([#6453](https://github.com/open-policy-agent/opa/issues/6453)) authored by @johanfylling +- Clarify behavior of the `sprintf` builtin command when used with the `%T` marker ([#6487](https://github.com/open-policy-agent/opa/issues/6487)) authored by @lcarva + +### Website + Ecosystem +- Ecosystem: Digger ([#6464](https://github.com/open-policy-agent/opa/pull/6464)) authored by @anderseknert + +### Miscellaneous +- Update `Makefile` to allow custom `GOFLAGS` to be provided to the golang executable ([#6458](https://github.com/open-policy-agent/opa/issues/6458)) authored by @cova-fe +- Dependency updates; notably: + - bump golang 1.21.4 -> 1.21.5 ([#6460](https://github.com/open-policy-agent/opa/pull/6460)) authored by @srenatus + - bump aquasecurity/trivy-action from 0.14.0 to 0.16.0 + - bump github.com/containerd/containerd from 1.7.9 to 1.7.11 + - bump google.golang.org/grpc from 1.59.0 to 1.60.1 + - bump github.com/google/uuid from 1.4.0 to 1.5.0 + +## 0.59.0 + +This release adds tooling to help prepare existing policies for the upcoming OPA 1.0 release. +It also contains a mix of improvements, bugfixes and security fixes for third-party libraries. + +> **_NOTES:_** +> +> * All published OPA images now run with a non-root uid/gid. The `uid:gid` is set to `1000:1000` for all images. As a result + there is no longer a need for the `-rootless` image variant and hence it will not be published as part of future releases. + This change is in line with container security best practices. OPA can still be run with root privileges by explicitly setting the user, + either with the `--user` argument for `docker run`, or by specifying the `securityContext` in the Kubernetes Pod specification. + +### Rego v1 + +The upcoming release of OPA 1.0, which will be released at a future date, will introduce breaking changes to the Rego language. Most notably: + +* the keywords that currently must be imported through `import future.keywords` into a module before use will be part of the Rego language by default, without the need to first import them. +* the `if` keyword will be required before the body of a rule. +* the `contains` keyword will be required when declaring a multi-value rule (partial set rule). +* deprecated built-in functions will be removed. + +This current release (`0.59.0`) introduces a new `--rego-v1` flag to the `opa fmt` and `opa check` commands to facilitate the transition of existing policies to be compatible with the 1.0 syntax. + +When used with `opa fmt`, the `--rego-v1` flag will format the module(s) according to the new Rego syntax in OPA 1.0. +Formatted modules are compatible with both the current version of OPA and 1.0. +Modules using deprecated built-ins will terminate formatting with an error. Future versions of OPA will support rewriting applicable function calls with equivalent Rego compatible with 1.0. + +When used with `opa check`, the `--rego-v1` flag will check that the modules are compatible with both the current version of OPA and 1.0. + +#### Relevant Changes + +- cmd: Adding `--rego-v1` flag to `check` cmd ([#6429](https://github.com/open-policy-agent/opa/issues/6429)) authored by @johanfylling +- cmd & format: Adding rego-v1 mode to `opa fmt` ([#6297](https://github.com/open-policy-agent/opa/issues/6297)) authored by @johanfylling +- ast: Adding capability feature for the `rego.v1` import (#6375) (authored by @johanfylling) +- ast: Skip if keyword requirement for default rule (`rego.v1`) ([#6356](https://github.com/open-policy-agent/opa/pull/6356)) authored by @ashutosh-narkar +- rego.v1: Fixing erroneous missing value assignment error ([#6364](https://github.com/open-policy-agent/opa/issues/6364)) authored by @johanfylling +- rego.v1: Improving support for rules with chained bodies ([#6370](https://github.com/open-policy-agent/opa/issues/6370)) authored by @johanfylling +- ast: Add `rego.v1` import ([#6247](https://github.com/open-policy-agent/opa/issues/6247)) introduced in OPA 0.58.0, authored by @johanfylling + +### Runtime, Tooling, SDK + +- ast: Adding `rule_head_refs` capabilities feature flag ([#6334](https://github.com/open-policy-agent/opa/issues/6334)) authored by @johanfylling +- build: Remove rootless image variant ([#4295](https://github.com/open-policy-agent/opa/issues/4295)) authored by @ashutosh-narkar +- discovery: Make status updates non blocking (#6345) ([#6343](https://github.com/open-policy-agent/opa/issues/6343)) authored by @charlieegan3 +- plugins/rest: Masks X-AMZ-SECURITY-TOKEN header in decision logs ([#5848](https://github.com/open-policy-agent/opa/issues/5848)) authored by @colinjlacy reported by @jwineinger +- wasm: Fix re2 bug ([#6376](https://github.com/open-policy-agent/opa/issues/6376)) authored by @srenatus reported by @sandhose +- ast: Add ExcludeLocationFile JSON marshalling option ([#6398](https://github.com/open-policy-agent/opa/pull/6398)) (authored by @anderseknert) +- cmd: Add options to the filter to only load rego files ([#6317](https://github.com/open-policy-agent/opa/issues/6317)) authored by @tjons +- ast: Add minimum compatible version computation to compiler ([#6348](https://github.com/open-policy-agent/opa/pull/6348)) authored by @tsandall +- internal/planner: Insert general ref head objects starting from the leaves, not root. ([#6401](https://github.com/open-policy-agent/opa/pull/6401)) authored by @srenatus +- internal/planner: Don't plan superfluous Equal/NotEqualStmts ([#6386](https://github.com/open-policy-agent/opa/pull/6386)) authored by @srenatus + +### Topdown and Rego + +- ast: Allowing packages to be declared within the dynamic extent of a rule ([#6387](https://github.com/open-policy-agent/opa/issues/6387)) authored by @johanfylling +- ast: Disallow root document shadowing in leading term of rule refs ([#6291](https://github.com/open-policy-agent/opa/issues/6291)) authored by @johanfylling +- topdown: Add a new builtin function `strings.render_template` to render templated strings ([#6371](https://github.com/open-policy-agent/opa/issues/6371)) authored by @RDVasavada +- topdown/crypto: Add URIStrings field to JSON certs ([#6416](https://github.com/open-policy-agent/opa/issues/6416)) authored by @charlieegan3 reported by @kenjenkins +- ast: change ident token string ([#6435](https://github.com/open-policy-agent/opa/pull/6435)) authored by @tsandall + +### Miscellaneous + +- chore: Fix IDE warnings and remove usage of several deprecated fields. ([#6397](https://github.com/open-policy-agent/opa/pull/6397)) authored by @willbeason +- chore: Disable verbose output in wasm-sdk-e2e-test ([#6434](https://github.com/open-policy-agent/opa/pull/6434)) authored by @tsandall +- deps: group otel deps ([#6407](https://github.com/open-policy-agent/opa/pull/6407/files)) authored by @srenatus +- test: add environment variable tests ([#6420](https://github.com/open-policy-agent/opa/pull/6420)) authored by @robhafner +- Docs & Website: + - docs: Add dependency-management-data to the Ecosystem ([#6436](https://github.com/open-policy-agent/opa/pull/6436)) authored by @jamietanna + - docs: Add docs for dynamic_metadata feature in opa-envoy-plugin ([#6389](https://github.com/open-policy-agent/opa/pull/6389)) authored by @tjons + - docs: Fixed XACML Policy in documentation (Comparing to Other Systems) to be XACML 3.0 compliant ([#6438](https://github.com/open-policy-agent/opa/pull/6438)) authored by @cdanger + - docs: Update docs on rego.v1 / OPA 1.0 ([#6365](https://github.com/open-policy-agent/opa/pull/6365)) authored by @anderseknert + - docs: Update spinnaker integration ([#6414](https://github.com/open-policy-agent/opa/pull/6414)) authored by @charlieegan3 + - docs: Add legitify to ecosystem ([#6369](https://github.com/open-policy-agent/opa/pull/6369)) authored by @charlieegan3 + - docs: add cheat sheet link ([#6362](https://github.com/open-policy-agent/opa/pull/6362)) authored by @charlieegan3 + - docs: add newstack blog to regal ([#6372](https://github.com/open-policy-agent/opa/pull/6372)) authored by @charlieegan3 + - docs: Disk storage broken link ([#6425](https://github.com/open-policy-agent/opa/pull/6425)) authored by @francoisauclair911 + - docs: Update istio envoy tutorial to use AuthorizationPolicy ([#6426](https://github.com/open-policy-agent/opa/pull/6426)) authored by @tjons +- Dependency updates; notably: + - golang from 1.21.3 to 1.21.4 + - OpenTelemetry (contrib) 1.21.0/0.46.1 + +## 0.58.0 + +> **_NOTES:_** +> +> * All published OPA images now run with a non-root uid/gid. The `uid:gid` is set to `1000:1000` for all images. As a result + there is no longer a need for the `-rootless` image variant and hence it will not be published as part of future releases. + This change is in line with container security best practices. OPA can still be run with root privileges by explicitly setting the user, + either with the `--user` argument for `docker run`, or by specifying the `securityContext` in the Kubernetes Pod specification. + +This release contains a mix of performance improvements, bugfixes and security fixes for third-party libraries. + +### Runtime, Tooling, SDK +- cmd/test: Display lines not covered if code coverage threshold not met in verbose reporting mode ([#2562](https://github.com/open-policy-agent/opa/issues/2562)) authored by @johanfylling +- cmd/test: Don't round up test coverage calculation as it could lead to inaccurate code coverage results ([#6307](https://github.com/open-policy-agent/opa/issues/6307)) authored by @anderseknert +- cmd/fmt: Don't format functions without a value to include `= true` as it is implied ([#6323](https://github.com/open-policy-agent/opa/pull/6323)) authored by @anderseknert +- server: Remove deprecated partial query parameter from REST API. This option has been deprecated since `v0.23.0` ([#2266](https://github.com/open-policy-agent/opa/issues/2266)) authored by @ashutosh-narkar +- Add support for configurable prometheus buckets for the `http_request_duration_seconds` metric ([#6238](https://github.com/open-policy-agent/opa/issues/6238)) authored by @AdrianArnautu +- plugins/bundle: Update bundle plugin state on a reconfigure operation when existing bundle is not modified ([#6311](https://github.com/open-policy-agent/opa/pull/6311)) authored by @asadk12 +- internal/pathwatcher: Fix how paths to watch by a fsnotify watcher are determined to avoid monitoring unintended directories and files ([#6277](https://github.com/open-policy-agent/opa/pull/6277)) authored by @ashutosh-narkar + +### Topdown and Rego +- topdown: Fix issue with build optimization producing support modules with forbidden characters in first var of rule ref ([#6338](https://github.com/open-policy-agent/opa/issues/6338)) authored by @johanfylling +- topdown: Fix panic in build optimization when policy contains rules with a general ref in the head ([#6339](https://github.com/open-policy-agent/opa/issues/6339)) authored by @johanfylling +- topdown: Avoid unnecessary conversion of small numbers by caching them and thereby helping to speed up some arithmetic operations ([#6021](https://github.com/open-policy-agent/opa/issues/6021)) authored by @ashutosh-narkar +- ast+rego: Disable compiler stages for IR-based eval paths ([#6335](https://github.com/open-policy-agent/opa/pull/6335)) authored by @srenatus +- built-in/walk: Skip path creation if path is assigned a wildcard to achieve faster `walk`-ing ([#6267](https://github.com/open-policy-agent/opa/pull/6267)) authored by @anderseknert +- ast: Add regression test for edge case where partial rule hides recursion cycle ([#6318](https://github.com/open-policy-agent/opa/pull/6318)) authored by @johanfylling + +### Docs +- Drop EXPERIMENTAL status of reported prom metrics ([#6298](https://github.com/open-policy-agent/opa/issues/6298)) authored by @ashutosh-narkar +- Update documentation on GCS bundles for case where the resource (the object in the GCS bucket) contains slashes (`/`) or other special characters ([#6264](https://github.com/open-policy-agent/opa/pull/6264)) authored by @dennisg +- Provide a more clear description of negation in the policy language section ([#6275](https://github.com/open-policy-agent/opa/pull/6275)) authored by @gusega + +### Website + Ecosystem +- Fix un-versioned built-in docs issue so that only the built-ins for a given doc version are displayed ([#6269](https://github.com/open-policy-agent/opa/issues/6269)) authored by @charlieegan3 + +### Miscellaneous +- ci: Remove `hub` tool in GitHub workflows in favor of [GitHub CLI](https://cli.github.com/) tool ([#6326](https://github.com/open-policy-agent/opa/issues/6326)) authored by @ashutosh-narkar +- Dependency updates; notably: + - bump go.opentelemetry.io modules ([#6292](https://github.com/open-policy-agent/opa/issues/6292)) authored by @cksidharthan + - aquasecurity/trivy-action from 0.12.0 to 0.13.0 + - github.com/containerd/containerd from 1.7.6 to 1.7.7 + - github.com/fsnotify/fsnotify from 1.6.0 to 1.7.0 + - golang.org/x/net from 0.15.0 to 0.17.0 + - google.golang.org/grpc from 1.58.2 to 1.59.0 (addresses vulnerability [GHSA-m425-mq94-257g](https://github.com/advisories/GHSA-m425-mq94-257g)) + - oras.land/oras-go/v2 from 2.3.0 to 2.3.1 + - sigs.k8s.io/yaml from 1.3.0 to 1.4.0 + +## 0.57.1 + +This is a bug fix release addressing the following security issues: + +### Golang security fix GO-2023-2102 + +> A malicious HTTP/2 client which rapidly creates requests and immediately resets them can cause excessive server resource consumption. + +### OpenTelemetry-Go Contrib security fix CVE-2023-45142 + +> Denial of service in otelhttp due to unbound cardinality metrics. + +## 0.57.0 + +This release contains an updated Rego syntax to allow general references in rule heads, and a mix of new features and bugfixes. + +### Support for General References in Rule Heads + +In OPA `0.56.0`, we introduced support for general references in rule heads as an experimental feature. +It has now graduated to a fully supported feature, and is no longer experimental. + +A general reference is a reference with variables at arbitrary locations. +In Rego, [partial rules](https://www.openpolicyagent.org/docs/latest/#partial-rules) are used for generating sets and objects. +In previous versions of OPA, variables were only allowed in the very last position in the rule's reference. +Now, Rego has been expanded to allow rules to be declared with general references in their head, with variables at arbitrary locations. +This allows for generating nested dynamic object structures: + +```rego +package example + +import future.keywords + +# Converting a flat list of users to a mapping by "role" and then "id". +users_by_role[role][id] := user if { + some user in data.users + id := user.id + role := user.role +} + +# Explicit "admin" key override to the above mapping. +users_by_role.admin[id] := user if { + some user in data.admins + id := user.id +} + +# Leaf entries can be multi-value. +users_by_country[country] contains user.id if { + some user in data.users + country := user.country +} +``` + +See the [documentation](https://www.openpolicyagent.org/docs/latest/policy-language/#variables-in-rule-head-references) for more information. + +Authored by @johanfylling. + +### Runtime, Tooling, SDK + +- ast/runtime: Extend type checking for authz policies ([#6213](https://github.com/open-policy-agent/opa/issues/6213)) authored by @ashutosh-narkar +- server: Add test case for bundle update - query API handler scenario ([#4792](https://github.com/open-policy-agent/opa/issues/4792)) authored by @ashutosh-narkar + +### Topdown and Rego + +- ast: Accept short-form else bodies ([#6157](https://github.com/open-policy-agent/opa/issues/6157)) authored by @Ronnie-personal +- plugins: Surface AWS authentication error details ([#6232](https://github.com/open-policy-agent/opa/issues/6232)) authored by @ashutosh-narkar +- topdown: Builtin function to parse uuid with google/uuid library ([#6173](https://github.com/open-policy-agent/opa/issues/6173)) authored by @Od1nB + +### Miscellaneous + +- ast: Add location to single entry rule head ref ([#6199](https://github.com/open-policy-agent/opa/issues/6199)) authored by @Ronnie-personal +- ast: Add option to marshal location text ([#6213](https://github.com/open-policy-agent/opa/issues/6213)) authored by @charlieegan3 +- types: New algorithm for (Any).Union + new benchmarks ([#6228](https://github.com/open-policy-agent/opa/pull/6228)) authored by @philipaconrad +- Updates to documentation and website authored by @charlieegan3 + - docs: Link to expressing or post (#6236) (authored by @charlieegan3) + - docs: Use links on support page (#6249) (authored by @charlieegan3) +- Dependency updates; notably: + - golang from 1.21 to 1.21.1 + - golang.org/x/net from 0.14.0 to 0.15.0 + - google.golang.org/grpc from 1.57.0 to 1.58.2 + - github.com/containerd/containerd from 1.7.4 to 1.7.6 + +## 0.56.0 + +This release contains a mix of new features, bugfixes and a new builtin function. + +### Support for General References in Rule Heads (Experimental) + +A new experimental feature in OPA is support for general refs in rule heads. Where a general ref is a reference with variables at arbitrary locations. + +```rego +package example + +import future.keywords + +# Converting a flat list of users to a mapping by "role" and then "id". +users_by_role[role][id] := user if { + some user in data.users + id := user.id + role := user.role +} + +# Explicit "admin" key override to the above mapping. +users_by_role.admin[id] := user if { + some user in data.admins + id := user.id +} + +# Leaf entries can be multi-value. +users_by_country[country] contains user.id if { + some user in data.users + country := user.country +} +``` + +General refs are currently not supported by the OPA planner, making this feature unsupported for Wasm and IR. + +Note: this feature is disabled by default, and needs to be enabled by setting the `EXPERIMENTAL_GENERAL_RULE_REFS` environment variable (once the feature is complete - supports Wasm and IR - this requirement will be dropped). + +Authored by @johanfylling. + +### New Built-In Function: `numbers.range_step` + +Similar to the `numbers.range` built-in function, `numbers.range_step` returns an array of numbers in a given range. The new built-in function also allows you to control the _step between each entry_. + +See [the documentation on the new built-in](https://www.openpolicyagent.org/docs/v0.56.0/policy-reference/#builtin-numbers-numbersrange_step) +for all the details. + +Authored by @sspaink. + +### New Ecosystem page on The Website + +The OPA Ecosystem of related integrations has been refreshed and moved to a more prominent location on [the website](https://www.openpolicyagent.org/ecosystem/). + +If you're interested to add any new integrations you've been working on, please see the [docs here](https://github.com/open-policy-agent/opa/tree/main/docs#opa-ecosystem) (updates to existing integrations are very welcome too!). + +### Runtime, Tooling, SDK + +- ast: Update strict error check message for unused args ([#6125](https://github.com/open-policy-agent/opa/pull/6125)) authored by @ashutosh-narkar +- ast: Remove unnecessary nil check ([#6155](https://github.com/open-policy-agent/opa/pull/6155)) authored by @Juneezee +- cmd: Make `opa test -z` fail with failing tests ([#6126](https://github.com/open-policy-agent/opa/issues/6126)) authored by @fdaguin +- cmd: Fix `opa test` `--ignore` when used together with `--bundle` ([#6185](https://github.com/open-policy-agent/opa/pull/6185)) authored by @joaobrandt +- cmd: Adding `--fail-non-empty` flag to `opa exec` ([#6153](https://github.com/open-policy-agent/opa/pull/6153)) authored by @Ronnie-personal +- download: Add `opa_no_oci` flag to build without containerd ([#6159](https://github.com/open-policy-agent/opa/pull/6159)) authored by @slonka +- download: Remove not required basedir for oci bundles & add test to verify signature verification ([#6145](https://github.com/open-policy-agent/opa/pull/6145)) authored by @gitu +- fmt: Trim trailing whitespace in comments ([#6161](https://github.com/open-policy-agent/opa/issues/6161)) authored by @anderseknert +- fmt: Remove dedup comment function in opa fmt ([#6165](https://github.com/open-policy-agent/opa/pull/6165)) authored by @anderseknert +- runtime: Always read .tar.gz file provided in argument as a bundle ([#5879](https://github.com/open-policy-agent/opa/issues/5879)) authored by @yogisinha +- server/authorizer: Inline readBody ([#6156](https://github.com/open-policy-agent/opa/pull/6156)) authored by @srenatus +- test: Bind test server to localhost interface ([#6162](https://github.com/open-policy-agent/opa/issues/6162)) authored by @anderseknert + +### Topdown and Rego + +- ast: Including "child" rules when fetching rules by ref ([#6182](https://github.com/open-policy-agent/opa/issues/6182)) authored by @johanfylling +- ast: Making partial object key rules contribute to dynamic portion of object type ([#6138](https://github.com/open-policy-agent/opa/issues/6138)) authored by @johanfylling +- rego: Expose PrepareOption, add BuiltinFuncs ([#6188](https://github.com/open-policy-agent/opa/pull/6188)) authored by @srenatus +- topdown: Support force cache even when server doesn't set the Date header ([#6175](https://github.com/open-policy-agent/opa/pull/6175)) authored by @c2zwdjnlcg +- topdown: Partial-eval for partial object/set ref head rules ([#6094](https://github.com/open-policy-agent/opa/issues/6094)) authored by @johanfylling + +### Miscellaneous + +- Updates to Documentation and Website (authored by: @anderseknert, @ashutosh-narkar, @atkrad, @charlieegan3, @hmoazzem, @johndbro1, @Pushkarm029, @srenatus and @testwill) +- Dependency updates; notably: + - golang: from 1.20.6 to 1.21 (authored by @ashutosh-narkar amd @srenatus) + - golang.org/x/net from 0.12.0 to 0.14.0 + - google.golang.org/grpc from 1.56.2 to 1.57.0 + - oras.land/oras-go/v2 from 2.2.1 to 2.3.0 + - Replace ghodss/yaml with sigs.k8s.io/yaml ([#6195](https://github.com/open-policy-agent/opa/pull/6195)) authored by @mrueg + +### Breaking changes + +Since its introduction in 0.34.0, the `--exit-zero-on-skipped` option always made the `opa test` command return an exit code 0. When used, it now returns the exit code 0 only if no failed tests were found. + +Test runs on existing projects using `--exit-zero-on-skipped` will fail if any failed tests were inhibited by this behavior. + +## 0.55.0 + +> **_NOTES:_** +> +> * All published OPA images now run with a non-root uid/gid. The `uid:gid` is set to `1000:1000` for all images. As a result +> there is no longer a need for the `-rootless` image variant and hence it will be not be published as part of future releases. +> This change is in line with container security best practices. OPA can still be run with root privileges by explicitly setting the user, +> either with the `--user` argument for `docker run`, or by specifying the `securityContext` in the Kubernetes Pod specification. +> +> * The minimum version of Go required to build the OPA module is **1.19** + +This release contains a mix of new features, bugfixes and a new builtin function. + +### Honor `default` keyword on functions + +Previously if a function was defined with a `default` value, OPA would ignore it. Now the `default` function is honored +if all functions with the same name are undefined. For example, + +```rego +package example + +default clamp_positive(x) := 0 + +clamp_positive(x) = x { + x > 0 +} +``` + +``` +$ opa eval -d example.rego 'data.example.clamp_positive(1)' -f pretty +1 +``` + +``` +$ opa eval -d example.rego 'data.example.clamp_positive(-1)' -f pretty +0 +``` + +The value of a `default` function follows the same conditions as that of a `default` rule. In addition, a `default` +function satisfies the following properties: + +- same arity as other functions with the same name +- arguments should only be plain variables ie. no composite values +- argument names should not be repeated + +> **_NOTE:_** +> +> `default` functions used to be previously ignored. If existing policies contain `default` functions, ensure that they conform +> to the properties mentioned above. Otherwise, those policies will fail to evaluate. + +Authored by @ashutosh-narkar. + +### New Built-In Function: crypto.parse_private_keys + +`crypto.parse_private_keys` returns zero or more private keys from the given encoded string containing DER certificate data. +If the input contains a list of one or more concatenated PEM blocks, then the built-in will output the parsed private keys +represented as objects. + +See [the documentation on the new built-in](https://www.openpolicyagent.org/docs/v0.55.0/policy-reference/#builtin-crypto-cryptoparse_private_keys) +for all the details. + +Authored by @volck. + +### Runtime, Tooling, SDK + +- plugins/rest: Add AWS KMS support for OAuth2 Client Credentials JWT authentication ([#5942](https://github.com/open-policy-agent/opa/pull/5942)) authored by @prasanthu +- sdk: Update input object to conform to the format expected by decision log masking ([#6090](https://github.com/open-policy-agent/opa/pull/6090)) authored by @epaulson10 +- sdk: Add option for specifying decision ID to SDK. Users can use this to control the ID that gets included in the decision logs ([#6101](https://github.com/open-policy-agent/opa/pull/6101)) authored by @brianchhun-chime +- cmd: Add `discard` output format to `opa eval` which discards the result while still showing the output of eval flags like `--profile` ([#6103](https://github.com/open-policy-agent/opa/pull/6103)) authored by @26tanishabanik +- Make rootless deprecation messages more explicit as all published OPA images now run with non-root uid/gid ([#6091](https://github.com/open-policy-agent/opa/pull/6091)) authored by @charlieegan3 +- download/oci: Add support for Docker Registry v2 authentication scheme ([#6045](https://github.com/open-policy-agent/opa/pull/6045)) authored by @gitu and @DerGut +- plugins/discovery: Ensure discovery plugin doesn't erase its own config on the plugin manager ([#6070](https://github.com/open-policy-agent/opa/pull/6070)) authored by @blacksails + +### Topdown and Rego + +- ast: Add `WithRoots` compiler option that allows callers to set the roots to include in the output bundle manifest ([#6088](https://github.com/open-policy-agent/opa/pull/6088)) authored by @kubaj +- rego: Parse store modules iff modules set on the Rego object. This change assumes that while using the Rego package, the compiler and store are kept in-sync, and thereby attempts to avoid a race during the compilation process ([#6081](https://github.com/open-policy-agent/opa/pull/6081)) authored by @ashutosh-narkar + +### Docs + +- docs/envoy: Update the standalone Envoy tutorial to use [kind](https://kind.sigs.k8s.io/), updated Envoy version etc. ([#6105](https://github.com/open-policy-agent/opa/pull/6105)) authored by @charlieegan3 + +### Website + Ecosystem + +- Ecosystem: + - Carbonetes BrainIAC ([#6073](https://github.com/open-policy-agent/opa/pull/6073)) authored by @jaysonsantos05 + +- Website: + - Reorganize relevant doc sections and OPA Ecosystem projects to have a closer integration between them ([#6064](https://github.com/open-policy-agent/opa/issues/6064)) authored by @charlieegan3 + +### Miscellaneous +- chore: Update comments on some exported functions and clean up instances where the same package was imported multiple times (authored by @testwill) +- Fix issue in the OPA release patch scripts related to `CRLF` line terminations in the patch output ([#6069](https://github.com/open-policy-agent/opa/pull/6069)) authored by @johanfylling +- Dependency bumps, notably: + - golang from 1.20.5 to 1.20.6 + - oras.land/oras-go/v2 from 2.2.0 to 2.2.1 + - google.golang.org/grpc from 1.56.1 to 1.56.2 + - github.com/containerd/containerd from 1.6.19 to 1.7.2 + - golang.org/x/net from 0.11.0 to 0.12.0 + - go.uber.org/automaxprocs from 1.5.2 to 1.5.3 + - go.opentelemetry.io/otel from v1.14.0 to v1.16.0 ([#6062](https://github.com/open-policy-agent/opa/pull/6062)) authored by @srenatus with feedback from @ghaskins and @zregvart + +## 0.54.0 + +This release focuses on bug fixes, but also includes some improvements to the SDK and commandline. + +Note: This will be the last OPA release to support building with Golang 1.18. (Golang 1.21 is expected to be released in August. Keeping the support for 1.18 is blocking OPA from upgrading OpenTelemetry.) + +### Topdown and Rego + +- Add unwrap functionality to topdown.Error ([#5890](https://github.com/open-policy-agent/opa/issues/5890)) authored by @ajith-sub reported by @ajith-sub +- Lazy obj performance ([#6009](https://github.com/open-policy-agent/opa/issues/6009)) authored by @johanfylling reported by @kubaj +- ast: Only realizing `lazyObj` when compared against other object type ([6060](https://github.com/open-policy-agent/opa/pull/6060)) (authored by @johanfylling) +- ast: Fixing issue in type-checker where partial objects couldn't have key overrides of divergent type ([#5972](https://github.com/open-policy-agent/opa/issues/5972)) authored by @johanfylling +- planner: CallDynamic regression fix ([#5964](https://github.com/open-policy-agent/opa/issues/5964)) authored by @srenatus +- fmt: Fix `fmt` panic in comprehension with comments ([#5798](https://github.com/open-policy-agent/opa/issues/5798)) authored by @Trolloldem reported by @Djoust +- topdown: Format integer numbers without exponent ([#6013](https://github.com/open-policy-agent/opa/issues/6013)) authored by @kenjenkins reported by @kenjenkins +- topdown: Fix panic in partial eval with ref head rule ([#6027](https://github.com/open-policy-agent/opa/issues/6027)) authored by @srenatus +- Fixed a bug in `object.union_n` where nested objects were mutated ([#5975](https://github.com/open-policy-agent/opa/issues/5975)) authored by @qshu-splunk +- Fixed the issue of the `object.subset` method failing to correctly compare array relationships ([5968](https://github.com/open-policy-agent/opa/issues/5968)) authored by @DCRUNNN +- topdown: Fixed caching race condition issue in `http.send` ([#5997](https://github.com/open-policy-agent/opa/pull/5997)) authored by @ashutosh-narkar +- Allow time formatting constants in rego `time.format` and `time.parse_ns` ([#5945](https://github.com/open-policy-agent/opa/issues/5945)) authored by @tjons + +### Runtime, Tooling, SDK + +- Add `--schema` flag to `opa test` ([#5923](https://github.com/open-policy-agent/opa/issues/5923)) authored by @renatosc +- Add ability to specify namespace for optimized files ([#5933](https://github.com/open-policy-agent/opa/issues/5933)) authored by @ashutosh-narkar reported by @deezkay +- Fix for the issue when OPA throws misleading error (storage_not_found_error) message while loading the delta bundle when persist property in config is true. ([#5959](https://github.com/open-policy-agent/opa/issues/5959)) authored by @yogisinha reported by @jnethery +- cmd: Update storage when a file remove op is detected ([#5986](https://github.com/open-policy-agent/opa/issues/5986)) authored by @boranx +- cmd: Add support for watch mode in opa test ([#1719](https://github.com/open-policy-agent/opa/issues/1719)) authored by @ashutosh-narkar reported by @Fox32 +- download: Pass request to docker.Authorizer ([#5902](https://github.com/open-policy-agent/opa/issues/5902)) authored by @DerGut reported by @carabasdaniel +- plugins/discovery: Fix discovery erasing `persistence_directory` config ([#6042](https://github.com/open-policy-agent/opa/pull/6042)) authored by @blacksails +- plugins/discovery: Fix persistence of discovery bundle ([#6048](https://github.com/open-policy-agent/opa/pull/6048)) (authored by @bdjgs) +- Add tracing to bundle/discovery download ([#5967](https://github.com/open-policy-agent/opa/issues/5967)) authored by @mjungsbluth +- Fallback on embedded timezone database if `tzdata` is not found on filesystem ([6038](https://github.com/open-policy-agent/opa/pull/6038)) authored by @charlieegan3 +- extensibility: Adding hooks (plugins, discovery, sdk) ([#6053](https://github.com/open-policy-agent/opa/pull/6053)) authored by @srenatus +- sdk: allow passing in a separate `Store` implementation in SDK ([5962](https://github.com/open-policy-agent/opa/pull/5962)) authored by @srenatus +- config: Show "extra", unknown fields in `/v1/config` API result ([6056](https://github.com/open-policy-agent/opa/pull/6056)) authored by @srenatus + +### Miscellaneous +- Disable provenance attestations in buildx ([#5877](https://github.com/open-policy-agent/opa/issues/5877)) authored by @ashutosh-narkar reported by @JasonMan34 +- build: configure SELinux labels for Docker volumes ([#6054](https://github.com/open-policy-agent/opa/issues/6054)) authored by @zregvart reported by @zregvart +- Dependency bumps, notably: + - golang from 1.20.4 to 1.20.5 + - github.com/prometheus/client_golang from from 1.15.1 to v1.16.0 + +## 0.53.1 + +This is a bug fix release addressing the following issues: + +### Runtime, Tooling, SDK +- plugins/logs: Previously while passing the decision log plugins's status to the Status API, the plugin held the mutex while a status upload was in process. This had the potential to block new decisions from being written to the plugin's buffer. To avoid this situation, a local copy of plugin's status is created ([#5966](https://github.com/open-policy-agent/opa/pull/5966)) authored by @ashutosh-narkar +- download: Public docker repositories require an authorization handshake where the client needs to respond to challenges marked by the `WWW-Authenticate` header of a `401 Unauthorized` response. Errors were returned when downloading a public image as it was assumed that authorization is not necessary for public repositories. This fix addresses this issue by challenging any `401 Unauthorized` responses by passing it to the docker.Authorizer ([#5902](https://github.com/open-policy-agent/opa/issues/5902)) authored by @DerGut +- `opa fmt`: Fix panic encountered while processing policies with comprehensions written on multiple lines with comments in these lines ([#5798](https://github.com/open-policy-agent/opa/issues/5798)) authored by @Trolloldem + +### Topdown and Rego +- built-in function `object.subset`: Fix an issue in `object.subset` related to incorrect results being generated when arrays are provided as an input ([#5968](https://github.com/open-policy-agent/opa/issues/5968)) authored by @DCRUNNN +- planner: Fix the optimization check for overlapping ref rules ([#5964](https://github.com/open-policy-agent/opa/issues/5964)) authored by @srenatus + +## 0.53.0 + +This release contains some enhancements, bugfixes, and a new builtin function. + +### Runtime, Tooling, SDK + +- status: Ensure Status plugin is correctly reconfigured to register or unregister Prometheus Collectors based on the state provided in OPA's active config ([#5918](https://github.com/open-policy-agent/opa/issues/5918)) authored by @johanfylling +- `opa eval`: Update OPA eval's `--profile-sort` flag description to highlight the valid options to sort the profile results ([#5924](https://github.com/open-policy-agent/opa/issues/5924)) authored by @ecbenezra +- `opa fmt`: Fix cases in which invalid code was generated due to parentheses being improperly handled ([#5537](https://github.com/open-policy-agent/opa/issues/5537)) authored by @Trolloldem +- rest: Allow users to configure the AWS STS domain when using Web Identity Credentials ([#5915](https://github.com/open-policy-agent/opa/issues/5915)) authored by @johanfylling +- status: Add an OPA environment information Gauge to Prometheus metrics to capture information like OPA version ([#5852](https://github.com/open-policy-agent/opa/issues/5852)) authored by @jmoghisi +- server: Add ability to configure Unix socket permissions if OPA is listening on a Unix socket ([#5888](https://github.com/open-policy-agent/opa/pull/5888)) authored by @ashutosh-narkar +- loader: Allow extensions to the `loader` package that provide ability to register handlers for certain file extensions. This feature is currently **EXPERIMENTAL** ([#5940](https://github.com/open-policy-agent/opa/pull/5940)) authored by @srenatus + +### Topdown and Rego + +- New built-in function `crypto.x509.parse_keypair`: Returns a key pair from a pair of PEM or base64 encoded strings of data. See [the documentation on the new built-in](https://www.openpolicyagent.org/docs/v0.53.0/policy-reference/#builtin-crypto-cryptox509parse_keypair) for all the details. ([#5853](https://github.com/open-policy-agent/opa/issues/5853)) authored by @volck. +- ast: Abort query evaluation if the compiler has errors. These errors will be exposed via the Status API if enabled ([#5947](https://github.com/open-policy-agent/opa/issues/5947)) authored by @johanfylling +- `io.jwt.decode_verify`: Fix issue where token verification succeeded in case where `iss` constraint was required but JWT did not contain it ([#5850](https://github.com/open-policy-agent/opa/issues/5850)) authored by @AleksanderBrzozowski +- wasm: Fix memory leaks in WASM when incrementally adding or removing data ([#5785](https://github.com/open-policy-agent/opa/issues/5785)) and ([#5901](https://github.com/open-policy-agent/opa/issues/5901)) authored by @ctelfer-sophos +- `http.send`: Add a new option to the `http.send` input object which allows policy authors to specify a retry count for executing a HTTP request. Retries are performed with an exponential backoff delay ([#5891](https://github.com/open-policy-agent/opa/pull/5891)) authored by @ashutosh-narkar +- ast: Fix issue with `_` matching only scalars in rule indexing for arrays ([#5916](https://github.com/open-policy-agent/opa/pull/5916)) authored by @jaspervdj +- rego: Allow for extending the Rego evaluation targets with plugins ([#5939](https://github.com/open-policy-agent/opa/pull/5939)) authored by @srenatus + +### Miscellaneous + +- Add PITS Global Data Recovery Services to ADOPTERS.md (authored by @pheianox) +- Avoid unnecessary byte/string conversion by using alternative functions/methods ([#5944](https://github.com/open-policy-agent/opa/pull/5944)) authored by @Juneezee +- False positive finding of [CVE-2022-3517](https://github.com/advisories/GHSA-f8q6-p94x-37v3) addressed by removing the dead code ([#5941](https://github.com/open-policy-agent/opa/pull/5941)) authored by @testwill +- Dependency bumps, notably: + - golang from 1.20.3 to 1.20.4 + - golang.org/x/net from 0.9.0 to 0.10.0 + - google.golang.org/grpc from 1.54.0 to 1.55.0 + - oras.land/oras-go/v2 from 2.0.2 to 2.2.0 + - github.com/prometheus/client_golang from 1.15.0 to 1.15.1 + +## 0.52.0 + +This release contains some enhancements, bugfixes, and a new builtin function. + +### Allow Adding Labels via Discovery + +Previously OPA did not allow any updates to the labels provided in the boot configuration via the discovered (ie. service) +config. This was done to avoid breaking the discovery configuration. But there are use cases where labels can serve as a convenient +way to pass information that could be used in policies, status updates or decision logs. This change allows +additional labels to be configured in the service config which are then made available during runtime. + +See [the Discovery documentation](https://www.openpolicyagent.org/docs/v0.52.0/management-discovery/#limitations) +for more details. + +Authored by @mjungsbluth. + +### New Built-In Function: crypto.hmac.equal + +`crypto.hmac.equal` provides a convenient way to compare hashes generated by the MD5, SHA-1, SHA-256 and SHA-512 hashing algorithms. + +Below is a real world example of how this built-in function can be utilized. Imagine our server is registered as a +GitHub webhook which subscribes to certain events on GitHub.com. Now we want to limit requests to those coming from GitHub. +One of the ways to do that is to first set up a secret token and validate the information. Once we create the token on GitHub, +we'll set up an environment variable that stores this token and makes it available to OPA via the `opa.runtime` built-in. +In the case of GitHub webhooks the validation is done by comparing the hash signature received in the `X-Hub-Signature-256` +header and calculating a hash using the secret token and payload body. The `check_signature` rule implements this logic. + +```rego +package example + +import input.attributes.request.http as http_request + +allow { + http_request.method == "POST" + input.parsed_path = ["workflows", "github", "webhooks"] + check_signature +} + +check_signature { + secret_key := opa.runtime().env.GITHUB_SECRET_KEY + hash_body := crypto.hmac.sha256(http_request.raw_body, secret_key) + expected_signature := concat("", ["sha256=", hash_body]) + header_signature = http_request.headers["X-Hub-Signature-256"] + crypto.hmac.equal(header_signature, expected_signature) +} +``` + +See [the documentation on the new built-in](https://www.openpolicyagent.org/docs/v0.52.0/policy-reference/#builtin-crypto-cryptohmacequal) +for all the details. + +Authored by @sandokandias. + +### Extend Authentication Methods Supported by OCI Downloader + +Previously the OCI Downloader had support for only three types of authentication methods, namely `Client TLS Certificates`, +`Basic Authentication` and `Bearer Token`. This change adds support for other authentication methods such as [AWS Signature](https://www.openpolicyagent.org/docs/v0.52.0/configuration/#aws-signature), +[GCP Metadata Token](https://www.openpolicyagent.org/docs/v0.52.0/configuration/#gcp-metadata-token). See [the documentation](https://www.openpolicyagent.org/docs/v0.52.0/configuration/#using-private-image-from-oci-repositories) +for more details. + +Authored by @DerGut. + +### Update Profiler Output With Number of Generated Expressions + +The number of EVAL/REDO counts in the profile result are sometimes difficult to understand. This is mainly due to the +fact that the compiler rewrites expressions and assigns the same location to each generated expression and the profiler +keys the counters by the location. To provide more clarity, the profile output now includes the number of generated +expressions for each given expression thereby helping to better understand the result and also how the evaluation works. + +Here is an example of the updated profiler output with the new `NUM GEN EXPR` column: + +```ruby ++----------+----------+----------+--------------+-------------+ +| TIME | NUM EVAL | NUM REDO | NUM GEN EXPR | LOCATION | ++----------+----------+----------+--------------+-------------+ +| 20.291µs | 3 | 3 | 3 | test.rego:7 | +| 1µs | 1 | 1 | 1 | test.rego:6 | +| 2.333µs | 1 | 1 | 1 | test.rego:5 | +| 6.333µs | 1 | 1 | 1 | test.rego:4 | +| 84.75µs | 1 | 1 | 1 | data | ++----------+----------+----------+--------------+-------------+ +``` + +See [the Profiling documentation](https://www.openpolicyagent.org/docs/v0.52.0/policy-performance/#profiling) +for more details. + +Authored by @ashutosh-narkar. + +### Runtime, Tooling, SDK + +- bundle: Add ability to load bundles from an arbitrary filesystem ([#5833](https://github.com/open-policy-agent/opa/issues/5833)) authored by @kjothen +- server: Add a note to explicitly point out if OPA binds to the 0.0.0.0 interface on server initialization ([#5090](https://github.com/open-policy-agent/opa/issues/5090)) authored by @Parsifal-M +- Include trace and span identifier in decision logs to help with correlating logs and trace data ([#5230](https://github.com/open-policy-agent/opa/issues/5230)) authored by @ashutosh-narkar + +### Topdown and Rego + +- ast: Disallow partial object rules to have other partial object rule within their immediate extent ([#5855](https://github.com/open-policy-agent/opa/issues/5855)) authored by @johanfylling +- ast: Disallow multi-value rules to have other rules in their extent ([#5813](https://github.com/open-policy-agent/opa/issues/5813)) authored by @johanfylling +- ast: Set result of groundness check on indexer's AllRules func so that rule evaluation for complete rules is not skipped ([#5857](https://github.com/open-policy-agent/opa/issues/5857)) authored by @ashutosh-narkar +- rego: Fix duplicate text in error message during module parsing ([#5837](https://github.com/open-policy-agent/opa/pull/5837)) authored by @TzlilSwimmer123 +- planner: Fix bugs that have an impact on IR ([#5829](https://github.com/open-policy-agent/opa/pull/5829)) and Wasm usage ([#5839](https://github.com/open-policy-agent/opa/pull/5839)) authored by @srenatus +- ast: Include information about the location of rule value and reference in the AST's JSON representation based on the provided custom parsing options ([#5790](https://github.com/open-policy-agent/opa/issues/5790)) authored by @Trolloldem +- ast: Fix issue with unset annotation data when custom parsing options provided ([#5826](https://github.com/open-policy-agent/opa/issues/5826)) authored by @charlieegan3 + +### Docs + +- docs/rest-api: Update Compile API docs to include some use-cases ([#5858](https://github.com/open-policy-agent/opa/pull/5858)) authored by @charlieegan3 +- docs/extensions: Add Nondeterministic field to the Rego object initialization in the code example for the Custom Built-in Function section ([#5861](https://github.com/open-policy-agent/opa/pull/5861)) (authored by @RmStorm) + + +### Website + Ecosystem + +- Ecosystem: + - Reposaur ([#5854](https://github.com/open-policy-agent/opa/pull/5854)) authored by @charlieegan3 + - Update logo for Torque integration ([#5810](https://github.com/open-policy-agent/opa/pull/5810)) authored by @shirabendor-quali + +- Website: + - Reorganize the `MISCELLANEOUS` section to improve content navigation ([#4614](https://github.com/open-policy-agent/opa/issues/4614)) authored by @lakhanjindam + +### Miscellaneous + +- Dependency bumps, notably: + - golang from 1.20.2 to 1.20.3 + - golang.org/x/net from 0.8.0 to 0.9.0 + - github.com/prometheus/client_golang from 1.14.0 to 1.15.0 + + +## 0.51.0 + +This release contains improvements to monitoring and an assortment of fixes and improvements. + +### Monitoring + +#### Surface unauthorized request count from OPA HTTP API authz handler via Status API + +Currently when OPA's HTTP server rejects requests per +the [authz policy](https://www.openpolicyagent.org/docs/latest/security/#authentication-and-authorization), +this is not accounted for via the management APIs. +This change adds that count in the metric registry that is +part of the Status API for more visibility. + +([#3378](https://github.com/open-policy-agent/opa/issues/3378)) authored by @ashutosh-narkar. + +#### Surface more decision log errors via Status API + +Previously in [5732](https://github.com/open-policy-agent/opa/pull/5732), +we updated the decision log plugin to +surface errors via the Status API. However, in that change +certain events like encoder errors and log drops due to +buffer size limits had no metrics associated with them. +This change adds more metrics for these events so that they +can be surfaced via the Status API. + +([#5637](https://github.com/open-policy-agent/opa/issues/5637)) authored by @ashutosh-narkar. + +#### Include truncated HTTP response in logs + +This change updates the client debug log to include +the full HTTP response in case of non-200 status codes. +Recording the response in the logs can help to provide +more information to debug error scenarios. + +([#2961](https://github.com/open-policy-agent/opa/issues/2961)) authored by @ashutosh-narkar reported by @gshively11. + +### Topdown and Rego + +- Wasm: Add native support for `object.union_n` built-in function (authored by @Azanul) + +### Fixes + +- ast: Properly set the reported location of unused variables in strict-mode errors. ([#5662](https://github.com/open-policy-agent/opa/issues/5662)) authored by @boranx +- fmt: report wrong arity for built-in functions. ([#5646](https://github.com/open-policy-agent/opa/issues/5646)) authored by @Trolloldem +- topdown: http.send(): Ensuring intra-query caching consistency. ([#5736](https://github.com/open-policy-agent/opa/issues/5736)) authored by @johanfylling +- Performance improvements to decision logging. + Specifically, by removing superfluous json encoding roundtrip and double work in AST conversion of to-be-logged events. (authored by @srenatus) + +### Docs, Website, and Ecosystem + +- Fix typo in documentation (authored by @eternaltyro) +- Update TLS authentication docs (authored by @charlieegan3) +- Clarification in docs about checksums of Windows executables (authored by @Ronnie-personal) +- docs: Small fix to context placement in integration (authored by @craigpastro) +- docs/website: Fix floating navbar anchor issue ([5774](https://github.com/open-policy-agent/opa/issues/5774)) authored by @charlieegan3 reported by @kristiansvalland + +### Miscellaneous + +- Update -debug images to use Chainguard images ([5544](https://github.com/open-policy-agent/opa/issues/5544)) (authored by @charlieegan3) +- Various third-party dependencies were updated. + +## 0.50.2 + +This is a bug fix release that addresses a regression in 0.50.1. +This regression impacts policies with rules that, as its else-value, assign a comprehension containing variables. +Such rules would cause the compilation of the policy to fail with a `rego_unsafe_var_error` error. + +E.g. the following policy would fail to compile with a `policy.rego:5: rego_unsafe_var_error: var x is unsafe` error: +```rego +package example + +p { + false +} else := [x | x := 1] +``` + +### Fixes + +- ast: Fixing bug where comprehensions in rule else-heads weren't rewritten correctly ([#5771](https://github.com/open-policy-agent/opa/issues/5771)) authored by @johanfylling reported by @davidmdm + +## 0.50.1 + +This is a bug fix release addressing the following issues: + +### Fixes + +- ast/compile: Guard recursive module equality check. ([#5756](https://github.com/open-policy-agent/opa/issues/5756)) authored by @philipaconrad. + Resolves a performance regression when using large bundles. +- ast: Relaxing strict-mode check for unused args in else-branching functions ([#5758](https://github.com/open-policy-agent/opa/issues/5758)) authored by @johanfylling reported by @ethanjli. + +### Miscellaneous + +- Use normalized policy paths as compiler module keys and store IDs (authored by @ashutosh-narkar). + Resolves an issue with bundle loading on Windows. + +## 0.50.0 + +This release contains a mix of new features, bugfixes, security fixes, optimizations and build updates related to +OPA's published images. + +### New Built-in Functions: JSON Schema Verification and Validation + +These new built-in functions add functionality to verify and validate JSON Schema ([#5486](https://github.com/open-policy-agent/opa/pull/5486)) (co-authored by @jkulvich and @johanfylling). + +- `json.verify_schema`: Checks that the input is a valid JSON schema object +- `json.match_schema`: Checks that the document matches the JSON schema + +See the [documentation](https://www.openpolicyagent.org/docs/v0.50.0/policy-reference/#object) for all details. + +### Annotations scoped to `package` carries across modules + +`package` scoped schema annotations are now applied across modules instead of only local to the module where +it's declared ([#5251](https://github.com/open-policy-agent/opa/issues/5251)) (authored by @johanfylling). This change may cause compile-time errors and behavioural changes to +type checking when the `schemas` annotation is used, and to rules calling the `rego.metadata.chain()` built-in function: + + - Existing projects with the same package declared in multiple files will trigger a `rego_type_error: package annotation redeclared` +error _if_ two or more of these are annotated with the `package` scope. + - If using the `package` scope, the `schemas` annotation will be applied to type checking also for rules declared in +another file than the annotation declaration, as long as the package is the same. + - The chain of metadata returned by the `rego.metadata.chain()` built-in function will now contain an entry for the +package even if the annotations are declared in another file, if the scope is `package`. + +### Remote bundle URL shorthand for `run` command + +To load a remote bundle using `opa run`, the `set` directive can be provided multiple times as shown below: +``` + $ opa run -s --set "services.default.url=https://example.com" \ + --set "bundles.example.service=default" \ + --set "bundles.example.resource=/bundles/bundle.tar.gz" \ + --set "bundles.example.persist=true" +``` + +The following command can be used as a shorthand to easily start OPA with a remote bundle ([#5674](https://github.com/open-policy-agent/opa/issues/5674)) (authored by @anderseknert): +``` +$ opa run -s https://example.com/bundles/bundle.tar.gz +``` + +### Performance Improvements for `json.patch` Built-in Function + +Performance improvements in `json.patch` were achieved with the introduction of a new `EditTree` data structure, +which is built for applying in-place modifications to an `ast.Term`, and can render the final result of all edits efficiently +by applying all patches in a JSON-Patch sequence rapidly, and then collapsing all edits at the end with minimal wasted `ast.Term` copying (authored by @philipaconrad). +For more details and benchmarks refer [#5494](https://github.com/open-policy-agent/opa/pull/5494) and [#5390](https://github.com/open-policy-agent/opa/pull/5390). + +### Surface decision log errors via status API + +Errors encountered during decision log uploads will now be surfaced via the Status API in addition to being logged. This +functionality should give users greater visibility into any issues OPA may face while processing, uploading logs etc ([#5637](https://github.com/open-policy-agent/opa/issues/5637)) (authored by @ashutosh-narkar). + +See the [documentation](https://www.openpolicyagent.org/docs/v0.50.0/management-status/#status-service-api) for more details. + +### OPA Published Images Update + +All published OPA images now run with a non-root uid/gid. The `uid:gid` is set to `1000:1000` for all images. As a result +there is no longer a need for the `-rootless` image variant and hence it will be not be published as part of future releases. +This change is in line with container security best practices. OPA can still be run with root privileges by explicitly setting the user, +either with the `--user` argument for `docker run`, or by specifying the `securityContext` in the Kubernetes Pod specification. + + +### Runtime, Tooling, SDK + +- server: Support compression of response payloads if HTTP client supports it ([#5310](https://github.com/open-policy-agent/opa/issues/5310)) authored by @AdrianArnautu +- bundle: Ensure the bundle resulting from merging a set of bundles does not contain `nil` data ([#5703](https://github.com/open-policy-agent/opa/issues/5703)) authored by @anderseknert +- repl: Use lowercase for repl commands only and keep any provided arguments as-is ([#5229](https://github.com/open-policy-agent/opa/issues/5229)) authored by @Trolloldem +- metrics: New endpoint `/metrics/alloc_bytes` to show OPA's memory utilization ([#5715](https://github.com/open-policy-agent/opa/pull/5715)) authored by @anderseknert +- server: When using OPA TLS authorization, authz policy authors will now have access to the client certificates +presented as part of the TLS connection. This new data will be available under the key `client_certificates` ([#5538](https://github.com/open-policy-agent/opa/issues/5538)) authored by @charlieegan3 +- server: Use streaming implementation of json.Decode rather than using an intermediate buffer for the incoming request ([#5661](https://github.com/open-policy-agent/opa/pull/5661)) authored by @anderseknert + +### Topdown and Rego + +- ast: Extend compiler `strict` mode check to include unused arguments ([#5602](https://github.com/open-policy-agent/opa/issues/5602)) authored by @boranx. This change may cause +compile-time errors for policies that have unused arguments in the scope when the `strict` mode is enabled. These +variables could be replaced with `_` (wildcard) or get cleaned up if they are not intended to be used in the body of the functions. +- ast: Respect inlined `schemas` annotations even if `--schema` flag isn't used ([#5506](https://github.com/open-policy-agent/opa/issues/5506)) authored by @johanfylling +- ast: Force type-checker to respect `allow_net` capability when fetching remote schemas ([#5670](https://github.com/open-policy-agent/opa/issues/5670)) authored by @johanfylling +- ast/parse: Provide custom parsing options that allow location information of AST nodes to be included in their JSON +representation. This location information can be used by tools that work with the OPA AST ([#3143](https://github.com/open-policy-agent/opa/issues/3143)) authored by @charlieegan3 + +### Docs + +- docs/policy-reference: Fix typo in policy reference doc ([#5654](https://github.com/open-policy-agent/opa/pull/5654)) authored by @alvarogomez93 +- docs/extensions: Fix sample code provided in the custom built-in implementation example ([#5666](https://github.com/open-policy-agent/opa/pull/5666)) authored by @Ronnie-personal +- docs/bundles: Clarify delta bundle behavior when it contains an empty list of patch operations ([#5629](https://github.com/open-policy-agent/opa/issues/5629)) authored by @charlieegan3 +- docs/http-api-authz: Update the HTTP API authz tutorial with steps related to proper bundle creation ([#5682](https://github.com/open-policy-agent/opa/pull/5682)) authored by @lamoboos223 +- Fix broken 'future keywords' url link ([#5686](https://github.com/open-policy-agent/opa/pull/5686)) authored by @neelanjan00 + + +### Website + Ecosystem + +- Ecosystem: + - Styra Load ([#5659](https://github.com/open-policy-agent/opa/pull/5659)) authored by @charlieegan3 + +- Website: + - Update OPA documentation search to use Algolia v3 ([#5706](https://github.com/open-policy-agent/opa/pull/5706)) authored by @Parsifal-M + - Drop Google Universal Analytics (UA) code as part of Google Analytics 4 migration (authored by @chalin) + +### Miscellaneous + +- Dependency bumps, notably: + - golang from 1.20.1 to 1.20.2 + - github.com/containerd/containerd from 1.6.16 to 1.6.19 + - github.com/golang/protobuf from 1.5.2 to 1.5.3 + - golang.org/x/net from 0.5.0 to 0.8.0 + - google.golang.org/grpc from 1.52.3 to 1.53.0 + - OpenTelemetry-related dependencies (#5701) + + +## 0.49.2 + +This release migrates the [ORAS Go library](oras.land/oras-go/v2) from v1.2.2 to v2. +The earlier version of the library had a dependency on the [docker](github.com/docker/docker) +package. That version of the docker package had some reported vulnerabilities such as +CVE-2022-41716, CVE-2022-41720. The ORAS Go library v2 removes the dependency on the docker package. + +## 0.49.1 + +This is a bug fix release addressing the following Golang security issues: + +### Golang security fix CVE-2022-41723 + +> A maliciously crafted HTTP/2 stream could cause excessive CPU consumption in the HPACK decoder, sufficient to cause a +> denial of service from a small number of small requests. + +### Golang security fix CVE-2022-41724 + +> Large handshake records may cause panics in crypto/tls. Both clients and servers may send large TLS handshake records +> which cause servers and clients, respectively, to panic when attempting to construct responses. + +### Golang security fix CVE-2022-41722 + +> A path traversal vulnerability exists in filepath.Clean on Windows. On Windows, the filepath.Clean function could +> transform an invalid path such as "a/../c:/b" into the valid path "c:\b". This transformation of a relative +> (if invalid) path into an absolute path could enable a directory traversal attack. +> After fix, the filepath.Clean function transforms this path into the relative (but still invalid) path ".\c:\b". + +## 0.49.0 + +This release focuses on bugfixes and documentation improvements, as well as a few small performance improvements. + +### Runtime, Tooling, SDK + +- runtime: Update rule index's trie node scalar handling so that numerics compare correctly ([#5585](https://github.com/open-policy-agent/opa/issues/5585)) authored by @ashutosh-narkar reported by @alvarogomez93 +- ast: Improve error information when metadata yaml fails to compile ([#4475](https://github.com/open-policy-agent/opa/issues/4475)) authored and reported by @johanfylling +- bundle: Retain metadata annotations for Wasm entrypoints during inspection ([#5588](https://github.com/open-policy-agent/opa/issues/5588)) authored and reported by @johanfylling +- compile: Allow object generating rules to be annotated as entrypoints ([#5577](https://github.com/open-policy-agent/opa/issues/5577)) authored and reported by @johanfylling +- plugins/discovery: Support for persisting and loading discovery bundle from disk ([#2886](https://github.com/open-policy-agent/opa/issues/2886)) authored by @ashutosh-narkar reported by @anderseknert +- perf: Use `json.Encode` to avoid extra allocation (authored by @anderseknert) +- `opa inspect`: Fix prefix error when inspecting bundle from root ([#5503](https://github.com/open-policy-agent/opa/issues/5503)) authored by @harikannan512 reported by @HarshPathakhp +- topdown: `http.send` to cache responses based on status code ([#5617](https://github.com/open-policy-agent/opa/issues/5617)) authored by @ashutosh-narkar +- types: Add GoDoc about named types (authored by @wata727) +- deps: Remove `github.com/pkg/errors` dependency (authored by @Iceber) + + +### Docs + +- Update entrypoint documentation ([#5565](https://github.com/open-policy-agent/opa/issues/5565)) authored by @johanfylling reported by @robertgartman +- Add missing folder argument in bundle build example (authored by @charlieegan3) +- Clarify `crypto.x509.parse_certificates` docs (authored by @charlieegan3) +- Added AWS S3 Web Identity Credentials info to tutorial (authored by @vishrana) +- docs/graphql: non-nullable id argument and typo fix (authored by @philipaconrad) + +### Website + Ecosystem + +- Ecosystem: + - ccbr (authored by @niuzhi) + +- Website: + - Show prominent warning when viewing old docs (authored by @charlieegan3) + - Prevent navbar clipping on narrow screens + sticky nav (authored by @charlieegan3) + +### Miscellaneous + +Dependency bumps: +- build: bump golang 1.19.4 -> 1.19.5 (authored by @yanggangtony) +- ci: aquasecurity/trivy-action from 0.8.0 to 0.9.0 +- github.com/containerd/containerd from 1.6.15 to 1.6.16 +- google.golang.org/grpc from 1.51.0 to 1.52.3 + +## 0.48.0 + +This release rolls in security fixes from recent patch releases, along with +a number of bugfixes, and a new builtin function. + +### Improved error reporting available in `opa eval` + +A common frustration when writing policies in OPA is when an error happens, +causing a rule to unexpectedly return `undefined`. Using +`--strict-builtin-errors` would allow finding the first error encountered +during evaluation, but terminates execution immediately. + +To improve the debugging experience, it is now possible to display *all* of +the errors encountered during normal evaluation of a policy, via the new +`--show-builtin-errors` option. + +Consider the following error-filled policy, `multi-error.rego`: + +```rego +package play + +this_errors(number) := result { + result := number / 0 +} + +this_errors_too(number) := result { + result := number / 0 +} + +res1 := this_errors(1) + +res2 := this_errors_too(1) +``` + +Using `--strict-builtin-errors`, we would only see the first divide by zero +error: + + opa eval --strict-builtin-errors -d multi-error.rego data.play + +``` +1 error occurred: multi-error.rego:4: eval_builtin_error: div: divide by zero +``` + +Using `--show-builtin-errors` shows both divide by zero issues though: + + opa eval --show-builtin-errors -d multi-error.rego data.play -f pretty + +``` +2 errors occurred: +multi-error.rego:4: eval_builtin_error: div: divide by zero +multi-error.rego:8: eval_builtin_error: div: divide by zero +``` + +By showing more errors up front, we hope this will improve the overall +policy writing experience. + +### New Built-in Function: `time.format` + +It is now possible to format a time value from nanoseconds to a formatted +timestamp string via a built-in function. The builtin accepts 3 argument +formats, each allowing for different options: + + 1. A number representing the nanoseconds since the epoch (UTC). + 2. A two-element array of the nanoseconds, and a timezone string. + 3. A three-element array of nanoseconds, timezone string, and a layout + string (same format as for `time.parse_ns`). + +See [the documentation](https://www.openpolicyagent.org/docs/v0.48.0/policy-reference/#builtin-time-timeformat) +for all details. + +Implemented by @burnerlee. + +### Optimization in rule indexing + +Previously, every time the evaluator looked up a rule in the index, OPA +performed checks for grounded refs over the entire index *before* looking +up the rule. + +Now, OPA performs all groundedness checks once at index construction time, +which keeps index lookup times much more consistent as the number of +indexed rules scales up. + +Policies with large numbers of index-ready rules can expect a small +performance lift, proportional to the number of indexed rules. + +### Bundle fetching with AWS Signing Version 4A + +AWS has recently developed an extension to SigV4 called Signature Version +4A (SigV4A) which enables signatures that are valid in more than one AWS +Region. This new signature method is required for signing multi-region API +requests, such as Amazon S3 Multi-Region Access Points (MRAP). + +OPA now supports this new request signing method for bundle fetching, which +means that you can use an S3 MRAP as a bundle source. This is configured +via the new `services[].credentials.s3_signing.signature_version` +field. + +See the [the documentation](https://www.openpolicyagent.org/docs/v0.48.0/configuration/#aws-signature) +for more details. + +Implemented by @jwineinger + +### Runtime + +- rego: Check store modules before skipping parsing (authored by @charlieegan3) +- topdown/rego: Add BuiltinErrorList support to rego package, add to eval command (authored by @charlieegan3) +- topdown: Fix evaluator's re-wrapping of `NDBCache` errors (authored by @srenatus) +- Fix potential memory leak from `http.send` in interquery cache (authored by @asleire) +- ast/parser: Detect function rule head + `contains` keyword ([#5525](https://github.com/open-policy-agent/opa/issues/5525)) authored and reported by @philipaconrad +- ast/visit: Add `SomeDecl` to visitor walks ([#5480](https://github.com/open-policy-agent/opa/issues/5480)) authored by @srenatus +- ast/visit: Include `LazyObject` in visitor walks ([#5479](https://github.com/open-policy-agent/opa/issues/5479)) authored by @srenatus reported by @benweint + +### Tooling, SDK + +- topdown: cache undefined rule evaluations ([#593](https://github.com/open-policy-agent/opa/issues/593)) authored by @edpaget reported by @tsdandall +- topdown: Specify host verification policy for http redirects ([#5388](https://github.com/open-policy-agent/opa/issues/5388)) authored and reported by @ashutosh-narkar +- providers/aws: Refactor + Fix 2x Authorization header append issue ([#5472](https://github.com/open-policy-agent/opa/issues/5472)) authored by @philipaconrad reported by @Hiieu +- Add support to enable ND builtin cache via discovery ([#5457](https://github.com/open-policy-agent/opa/issues/5457)) authored by @ashutosh-narkar reported by @asadali +- format: Only use ref heads for all rule heads if necessary ([#5449](https://github.com/open-policy-agent/opa/issues/5449)) authored and reported by @srenatus +- `opa inspect`: Fix path of data namespaces on windows (authored by @shm12) +- ast+cmd: Only enforcing `schemas` annotations if `--schema` flag is used (authored by @johanfylling) +- sdk: Allow use of a query tracer (authored by @charlieegan3) +- sdk: Allow use of metrics, profilers, and instrumentation (authored by @charlieegan3) +- sdk: Return provenance information in Result types (authored by @charlieegan3) +- sdk: Allow use of StrictBuiltinErrors (authored by @charlieegan3) +- Allow print calls in IR (authored by @anderseknert) +- tester/runner: Fix panic'ing case in utility function ([#5496](https://github.com/open-policy-agent/opa/issues/5496)) authored and reported by @philipaconrad + +### Docs + +- Community page updates (authored by @anderseknert) +- Update Hugo version, update deprecated Page fields (authored by @charlieegan3) +- docs: Update TLS-based Authentication Example ([#5521](https://github.com/open-policy-agent/opa/issues/5521)) authored by @charlieegan3 reported by @jjthom87 +- docs: Update opa eval flags to link to bundle docs (authored by @charlieegan3) +- docs: Make SDK first option for Go integraton (authored by @anderseknert) +- docs: Fix typo on Policy Language page. (authored by @mcdonagj) +- docs/integrations: Update kubescape repo links (authored by @dwertent) +- docs/oci: Corrected config section (authored by @ogazitt) +- website/frontpage: Update Learn More links (authored by @pauly4it) + +- integrations.yaml: Ensure inventors listed in organizations (authored by @anderseknert) +- integrations: Fix malformed inventors item (authored by @anderseknert) +- Add Digraph to ADOPTERS.md (authored by @jamesphlewis) + +### Miscellaneous + +- Remove changelog maintainer mention filter (authored by @anderseknert) +- Chore: Fix len check in the `ast/visit_test` error message (authored by @boranx) +- `opa inspect`: Fix wrong windows bundle tar files path separator (authored by @shm12) +- Add CHANGELOG.md to website build triggers (authored by @srenatus) + +Dependency bumps: +- Golang 1.19.3 -> 1.19.4 +- github.com/containerd/containerd from 1.6.10 -> 1.6.15 +- github.com/dgraph-io/badger/v3 +- golang.org/x/net to 0.5.0 +- json5 and postcss-modules +- oras.land/oras-go from 1.2.1 -> 1.2.2 + +CI/Distribution fixes: +- Update base images for non debug builds (authored by @charlieegan3) +- Remove deprecated linters in golangci config (authored by @yanggangtony) + +## 0.47.4 + +This is a bug fix release addressing a panic in `opa test`. + + - tester/runner: Fix panic'ing case in utility function. ([#5496](https://github.com/open-policy-agent/opa/issues/5496)) authored by @philipaconrad + +## 0.47.3 + +This is a bug fix release addressing an issue that prevented OPA from fetching bundles stored in S3 buckets. + + - providers/aws: Refactor + fix 2x Authorization header append issue. ([#5472](https://github.com/open-policy-agent/opa/issues/5472)) authored by @philipaconrad, reported by @Hiieu + +## 0.47.2 and 0.46.3 + +This is a second security fix to address CVE-2022-41717/GO-2022-1144. + +We previously believed that upgrading the Golang version and its stdlib would be sufficient +to address the problem. It turns out we also need to bump the x/net dependency to v0.4.0., +a version that hadn't existed when v0.46.2 was released. + +This release bumps the golang.org/x/net dependency to v0.4.0, and contains no other +changes over v0.46.2. + +Note that the affected code is OPA's HTTP server. So if you're using OPA as a Golang library, +or if your confident that your OPA's HTTP interface is protected by other means (as it should +be -- not exposed to the public internet), you're OK. + +## 0.47.1 and 0.46.2 + +This is a bug fix release addressing two issues: one security issue, and one bug +related to formatting backwards-compatibility. + +### Golang security fix CVE-2022-41717 + +> An attacker can cause excessive memory growth in a Go server accepting HTTP/2 requests. + +Since we advise against running an OPA service exposed to the general public of the +internet, potential attackers would be limited to people that are already capable of +sending direct requests to the OPA service. + +### `opa fmt` and backwards compatibility ([#5449](https://github.com/open-policy-agent/opa/issues/5449)) + +In v0.46.1, it was possible that `opa fmt` would format a rule in such a way that: + +1. Before formatting, it was working fine with older OPA versions, and +2. after formatting, it would only work with OPA version >= 0.46.1. + +This backwards incompatibility wasn't intended, and has now been fixed. + +## 0.47.0 + +This release contains a mix of bugfixes, optimizations, and new features. + +### New Built-in Function: `object.keys` + +It is now possible to conveniently retrieve an object's keys via a built-in function. + +Before, you had to resort to constructs like + +```rego +import future.keywords.in + +keys[k] { + _ = input[k] +} + +allow if "my_key" in keys +``` + +Now, you can simply do + +```rego +import future.keywords.in + +allow if "my_key" in object.keys(input) +``` + +See [the documentation](https://www.openpolicyagent.org/docs/v0.47.0/policy-reference/#builtin-object-objectkeys) +for all details. + +Implemented by @kevinswiber. + +### New Built-in Function: AWS Signature v4 Request Signing + +It is now possible to use a built-in function to prepare a request with a signature, so that +it can be used with AWS endpoints that use request signing for authentication. + +See this example: + +```rego +req := {"method": "get", "url": "https://examplebucket.s3.amazonaws.com/data"} +aws_config := { + "aws_access_key": "MYAWSACCESSKEYGOESHERE", + "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", + "aws_service": "s3", + "aws_region": "us-east-1", +} +example_verify_resource { + resp := http.send(providers.aws.sign_req(req, aws_config, time.now_ns())) + # process response from AWS ... +} +``` + +See [the documentation on the new built-in](https://www.openpolicyagent.org/docs/v0.47.0/policy-reference/#providers.aws) +for all details. + +Reported by @jicowan and implemented by @philipaconrad. + +### Performance improvements for `object.get` and `in` operator + +Before, using `object.get` and `in` had come with a performance penalty that wasn't +to be expected just from the look of the calls: Since they have been implemented using +built-in functions (obvious for `object.get`, not obvious for `"admin" in input.user.roles`), +all of their operands had to be read from the store (if applicable) and converted into +AST types. + +Now, we use shallow references ("lazy objects") for store reads in the evaluator. +In these two cases, this can bring huge performance improvements, when the object +argument of these two calls is a ref into the base document (like `data.users`): + +```rego +object.get(data.roles, input.role, []) +{ "id": 12 } in data.users +``` + +### Tooling, SDK, and Runtime + +- `opa eval`: Added `--strict` to enable strict code checking in evaluation ([#5182](https://github.com/open-policy-agent/opa/issues/5182)) authored by @Parsifal-M +- `opa fmt`: Remove `{ true }` block following `else` head +- `opa fmt`: Generate new wildcards for else and chained function heads in the parser ([#5347](https://github.com/open-policy-agent/opa/issues/5347)). This fixes superfluous + introductions of `_1` instead of `_` in when formatting functions that use wildcard arguments, like `f(_) := true`. +- `opa fmt`: Fix assignment rewrite in else formatting ([#5348](https://github.com/open-policy-agent/opa/issues/5348)) +- OCI Download: Set auth credentials only if needed ([#5212](https://github.com/open-policy-agent/opa/issues/5212)) authored by @carabasdaniel +- Server: Differentiate between "missing" and "undefined doc" in default decision ([#5344](https://github.com/open-policy-agent/opa/issues/5344)) + +### Topdown and Rego + +- `http.send`: Fix interquery cache size calculation with concurrent requests ([#5359](https://github.com/open-policy-agent/opa/issues/5359)) reported and authored by @asleire +- `http.send`: Remove socket query param for unix sockets ([#5313](https://github.com/open-policy-agent/opa/issues/5313)) reported and authored by @michivi +- Annotations: Add type coercion guards to avoid panics ([#5368](https://github.com/open-policy-agent/opa/issues/5368)) +- Compiler: Provide more accurate error locations for `some` with unused vars ([#4238](https://github.com/open-policy-agent/opa/issues/4238)) +- Optimization: Read lazy objects from the store ([#5325](https://github.com/open-policy-agent/opa/issues/5325)). This improves the performance of `x in data.foo` and `object.get(data.bar, ...)` calls significantly. +- Partial Evaluation: Skip comprehensions when checking eqs in copy propagation ([#5367](https://github.com/open-policy-agent/opa/issues/5367)). This fixes a bug when optimization on bundles would change the outcome of the subsequent evaluation. +- Parser: Fix else error handling with ref heads -- errors had occurred at a later stage then desired, because an edge case slipped through the earlier check. +- Planner/IR: Fix ref heads processing -- the CallDynamic optimization wasn't planned properly; a bug introduced with ref heads. + +### Documentation + +- Builtins: Mention base64 URL encoding specifically ([#5406](https://github.com/open-policy-agent/opa/issues/5406)) reported by @phi1010 +- Builtins: Include behavior with sets in `json.patch` ([#5328](https://github.com/open-policy-agent/opa/issues/5328)) +- Comparison: small fix to table to match sample code and other tables (authored by @anlandu) +- Builtins: Document reference timestamp behavior for `time.parse_ns` +- Typo fixes, authored by @deining +- Golang integration: update example code, move SDK above low-level packages + +### Website + Ecosystem + +- Ecosystem: + - Add Easegress (authored by @localvar) + - Add Terraform Cloud +- Website: Updated Footer Color ([#5254](https://github.com/open-policy-agent/opa/issues/5254)), reported and authored by @UtkarshMishra12 +- Website: Add "canonical" link to latest to help with SEO and ancient pages being returned by search engines. +- Website: Add experimental "OPA version" badge. (Still needs to be tested more thorougly before advertisting it.) + +### Miscellaneous + +- Dependency bumps: Notably, we're now using wasmtime-go v3 +- CI fixes: + - Move performance tests to nightly tests + - CLI: add simple bundle build tests + - Nightly: Revamp how we're doing fuzz testing + +## 0.46.1 + +This is bugfix release to resolve an issue in the release pipeline. Everything else is +the same as 0.46.0. + +## 0.46.0 + +This release contains a mix of bugfixes, optimizations, and new features. + +### New language feature: refs in rule heads + +With this version of OPA, we can use a shorthand for defining deeply-nested structures +in Rego: + +Before, we had to use multiple packages, and hence multiple files to define a structure +like this: +```json +{ + "method": { + "get": { + "allowed": true + } + "post": { + "allowed": true + } + } +} +``` + +```rego +package method.get +default allowed := false +allowed { ... } +``` + + +```rego +package method.post +default allowed := false +allowed { ... } +``` + +Now, we can define those rules in single package (and file): + +```rego +package method +import future.keywords.if +default get.allowed := false +get.allowed if { ... } + +default post.allowed := false +post.allowed if { ... } +``` + +Note that in this example, the use of the future keyword `if` is mandatory +for backwards-compatibility: without it, `get.allowed` would be interpreted +as `get["allowed"]`, a definition of a partial set rule. + +Currently, variables may only appear in the last part of the rule head: + +```rego +package method +import future.keywords.if + +endpoints[ep].allowed if ep := "/v1/data" # invalid +repos.get.endpoint[x] if x := "/v1/data" # valid +``` + +The valid rule defines this structure: +```json +{ + "method": { + "repos": { + "get": { + "endpoint": { + "/v1/data": true + } + } + } + } +} +``` + +To define a nested key-value pair, we would use + +```rego +package method +import future.keywords.if + +repos.get.endpoint[x] = y if { + x := "/v1/data" + y := "example" +} +``` + +Multi-value rules (previously referred to as "partial set rules") that are +nested like this need to use `contains` future keyword, to differentiate them +from the "last part is a variable" case mentioned just above: + +```rego +package method +import future.keywords.contains + +repos.get.endpoint contains x if x := "/v1/data" +``` + +This rule defines the same structure, but with multiple values instead of a key: +```json +{ + "method": { + "repos": { + "get": { + "endpoint": ["/v1/data"] + } + } + } +} +``` + +To ensure that it's safe to build OPA policies for older OPA versions, a new +capabilities field was introduced: "features". It's a free-form string array: + +```json +{ + "features": [ + "rule_head_ref_string_prefixes" + ] +} +``` + +If this key is not present, the compiler will reject ref-heads. This could be +case when building bundles for older OPA version using their capabilities. + + +### Entrypoint annotations in rule metadata + +It is now possible to annotate a rule with `entrypoint: true`, and it will +automatically be picked up by the tooling that expected `--entrypoint` (`-e`) +parameters before. + +For example, to build this rego policy into a wasm module, you had to pass +an entrypoint: + +```rego +package test +allow { + input.x +} +``` +- `opa build --target wasm --entrypoint test/allow policy.rego` + +With the annotation: +```rego +package test + +# METADATA +# entrypoint: true +allow { + input.x +} +``` +- `opa build --target wasm policy.rego` + +The places where entrypoints are taken from metadata are: + +1. Building optimized bundles +2. Building Wasm bundles +3. Building Plan bundles +4. Using optimization with `opa eval` + +Knowing a module's entrypoints can also help in different analysis tasks. + +### New Built-in Functon: `graphql.schema_is_valid` + +The new built-in allows checking schemas: + +```rego +schema := ` + extend type User { + id: ID! + } + extend type Product { + upc: String! + } + union _Entity = Product | User + extend type Query { + entity: _Entity + } +` +valid_schema_example { + graphql.schema_is_valid(schema) +} +``` + +Requested by @olegroom. + +### New Built-in Functon: `net.cidr_is_valid` + +The new built-in function allows checking if a string is a valid CIDR. + +```rego +valid_cidr_example { + net.cidr_is_valid("192.168.0.0/24") +} +``` + +Authored by @ricardomaraschini. + +### Tooling, SDK, and Runtime + +- `opa build`: exit with failure on empty signing key ([#4972](https://github.com/open-policy-agent/opa/issues/4972)) authored by @Joffref reported by @caldwecr +- `opa exec`: add `--fail` and `--fail-defined` flags ([#5007](https://github.com/open-policy-agent/opa/issues/5007)) authored by @byronic reported by @phantlantis +- `opa exec`: convert slashes of explicit bundles (Windows) ([#5134](https://github.com/open-policy-agent/opa/issues/5134)) reported by @peterchenadded +- `opa test`: check coverage limit range `[0, 100]` ([#5284](https://github.com/open-policy-agent/opa/issues/5284)) authored by @hzliangbin reported by @aholmis +- `opa build`+`opa check`: respect capabilities for parsing, i.e. future keywords ([#5323](https://github.com/open-policy-agent/opa/issues/5323)) reported by @TheLunaticScripter +- `opa bench --e2e`: support providing OPA config ([#4899](https://github.com/open-policy-agent/opa/issues/4899)) +- `opa eval`: new explain mode, `--explain=debug`, that includes unifcations in traces (authored by @jaspervdj) + +- Decision logs: Allow rule-based dropping of decision log entries ([#3945](https://github.com/open-policy-agent/opa/issues/3945)) authored by @mariusblarsen and @iamatwork +- Decision Logs: Include the `req_id` attribute in the decision logs ([#5006](https://github.com/open-policy-agent/opa/issues/5006)) reported and authored by @humbertoc-silva +- Plugins: export OpenTelemetry TracerProvider for use in plugins (authored by @vinhph0906) + + +### Compiler + Topdown + +- `graph.reachable_path`: fix issue with missing subpaths ([#4666](https://github.com/open-policy-agent/opa/issues/4666)) authored by @fredallen-wk +- `http.send`: Ensure `force_cache` attribute ignores `Date` header ([#4960](https://github.com/open-policy-agent/opa/issues/4960)) reported by @bartandacc +- `with`: Allow replacing functions with rules ([#5299](https://github.com/open-policy-agent/opa/issues/5299)) +- Evaluation: Skip default functions in full extent ([#5202](https://github.com/open-policy-agent/opa/issues/5202)) reported by @ericjkao +- Evaluation: capture more cases of conflicts in function evaluation ([#5272](https://github.com/open-policy-agent/opa/issues/5272)) +- Rule Indexing: fix incorrect results from indexing `glob.match` even if output is captured ([#5283](https://github.com/open-policy-agent/opa/issues/5283)) + +- Planner: various correctness fixes: [#5271](https://github.com/open-policy-agent/opa/issues/5271), [#5265](https://github.com/open-policy-agent/opa/issues/5265), [#5252](https://github.com/open-policy-agent/opa/issues/5252) + +- Builtins: Refactor registration functions and signatures (authored by @philipaconrad) +- Compiler: Speed up typechecker when working with Refs (authored by @philipaconrad) +- Trace: add `UnifyOp` to tracer events (authored by @jaspervdj) + +### Documentation + +- Envoy Tutorial: use latest proxy_init (v8) +- Envoy Plugin: Add note about new config param to skip body parsing +- Policy Reference: Add `semver` examples +- Contributing Code: Provide some tips for style fixes + +### Website + Ecosystem + +- Website: Make "outdated version" banner red if looked-at version is ancient +- Ecosystem: Add CircleCI and Topaz + +### Miscellaneous + +- Code Cleanup: + - Don't use the deprecated `ioutil` functions + - Use `t.Setenv` in tests + - Use `t.TempDir` to create temporary test directory (authored by @Juneezee) + - Linters: add `unconvert` and `tenv` +- internal/strvals: port helm strvals fix (CLI --set arguments), reported by @pjbgf, helm fix authored by @mattfarina +- Wasm: Update README + +- Dependency bumps, notably: + - Golang: 1.19.2 -> 1.19.3 + - golang.org/x/text 0.3.7 -> 0.4.0 + - oras.land/oras-go 1.2.0 -> 1.2.1 + +## 0.45.0 + +This release contains a mix of bugfixes, optimizations, and new features. + +### Improved Decision Logging with `nd_builtin_cache` + +OPA has several non-deterministic built-ins, such as `rand.intn` and +`http.send` that can make debugging policies from decision log results +a surprisingly tricky and involved process. To improve the situation +around debugging policies that use those built-ins, OPA now provides +an opt-in system for caching the inputs and outputs of these built-ins +during policy evaluation, and can include this information in decision +log entries. + +A new top-level config key is used to enable the non-deterministic +builtin caching feature, as shown below: + + nd_builtin_cache: true + +This data is exposed to OPA's [decision log masking system](https://www.openpolicyagent.org/docs/v0.45.0/management-decision-logs/#masking-sensitive-data) +under the `/nd_builtin_cache` path, which allows masking or dropping +sensitive values from decision logs selectively. This can be useful +in situations where only some information about a non-deterministic +built-in was needed, or the arguments to the built-in involved +sensitive data. + +To prevent unexpected decision log size growth from non-deterministic +built-ins like `http.send`, the new cache information is included in +decision logs on a best-effort basis. If a decision log event exceeds +the `decision_logs.reporting.upload_size_limit_bytes` limit for an OPA +instance, OPA will reattempt uploading it, after dropping the non- +deterministic builtin cache information from the event. This behavior +will trigger a log error when it happens, and will increment the +`decision_logs_nd_builtin_cache_dropped` metrics counter, so that it +will be possible to debug cases where the cache information is unexpectedly +missing from a decision log entry. + +#### Decision Logging Example + +To observe the change in decision logging we can run OPA in server mode +with `nd_builtin_cache` enabled: + +```bash +opa run -s --set=decision_logs.console=true,nd_builtin_cache=true +``` + +After sending it the query `x := rand.intn("a", 15)` we should see +something like the following in the decision logs: + +``` +{..., "msg":"Decision Log", "nd_builtin_cache":{"rand.intn":{"[\"a\",15]":3}}, "query":"assign(x, rand.intn(\"a\", 15))", ..., "result":[{"x":3}], ..., "type":"openpolicyagent.org/decision_logs"} +``` + +The new information is included under the optional `nd_builtin_cache` +JSON key, and shows what arguments were provided for each unique +invocation of `rand.intn`, as well as what the output of that builtin +call was (in this case, `3`). + +If we sent the query `x := rand.intn("a", 15); y := rand.intn("b", 150)"` +we can see how unique input arguments get recorded in the cache: + +``` +{..., "msg":"Decision Log", "nd_builtin_cache":{"rand.intn":{"[\"a\",15]":12,"[\"b\",150]":149}}, "query":"assign(x, rand.intn(\"a\", 15)); assign(y, rand.intn(\"b\", 150))", ..., "result":[{"x":12,"y":149}], ..., "type":"openpolicyagent.org/decision_logs"} +``` + +With this information, it's now easier to debug exactly why a particular +rule is used or why a rule fails when non-deterministic builtins are used in +a policy. + +### New Built-in Function: `regex.replace` + +This release introduces a new builtin for regex-based search/replace on +strings: `regex.replace`. + +See [the built-in functions docs for all the details](https://www.openpolicyagent.org/docs/v0.45.0/policy-reference/#builtin-regex-regexreplace) + +This implementation fixes [#5162](https://github.com/open-policy-agent/opa/issues/5162) and was authored by @boranx. + +### `object.union_n` Optimization + +The `object.union_n` builtin allows easily merging together an array of Objects. + +Unfortunately, as noted in [#4985](https://github.com/open-policy-agent/opa/issues/4985) +its implementation generated unnecessary intermediate copies from doing +pairwise, recursive Object merges. These pairwise merges resulted in poor +performance for large inputs; in many cases worse than writing the +equivalent operation in pure Rego. + +This release changes the `object.union_n` builtin's implementation to use +a more efficient merge algorithm that respects the original implementation's +sequential, left-to-right merging semantics. The `object.union_n` builtin +now provides a 2-3x improvement in speed and memory efficiency over the pure +Rego equivalent. + +### Tooling, SDK, and Runtime + +- cli: Fix doubled CLI hints/errors. ([#5115](https://github.com/open-policy-agent/opa/issues/5115)) authored by @ivanphdz +- cli/test: Add capabilities flag to test command. (authored by @ivanphdz) +- fmt: Fix blank lines after multiline expressions. (authored by @jaspervdj) +- internal/report: Include heap usage in the telemetry report. +- plugins/logs: Improve error message when decision log chunk size is greater than the upload limit. ([#5155](https://github.com/open-policy-agent/opa/issues/5155)) +- ir: Make the `internal/ir` package public as `ir`. + +### Rego + +- ast/parser+formatter: Allow 'if' in rule 'else' statements. +- ast/schema: Add support for recursive json schema elements. ([#5166](https://github.com/open-policy-agent/opa/issues/5166)) authored and reported by @liamg +- ast/schema: Fix race condition in parsing with reused references.(authored by @liamg) +- internal/gojsonschema: Fix race condition in `SetAllowNet`. ([#5187](https://github.com/open-policy-agent/opa/issues/5187)) authored and reported by @liamg +- ast/compiler: Rewrite declared variables in function calls and recursively rewrite local variables in `with` clauses. ([#5148](https://github.com/open-policy-agent/opa/issues/5148)) authored and reported by @liu-du +- ast: Skip rules when parsing a body (or query) to help improve ambiguous parsing cases. + +### Topdown + +- topdown/object: Rework `object.union_n` to use in-place merge algorithm. (reported by @charlesdaniels) +- topdown/jwt_decode_verify: Ensure `exp` and `nbf` fields are numbers when present. ([#5165](https://github.com/open-policy-agent/opa/issues/5165)) authored and reported by @charlieflowers +- topdown: Fix `InterQueryCache` only dropping one entry when over the size limit. (authored by @vinhph0906) +- topdown+builtins: Block all ND builtins from partial evaluation. +- topdown/builtins: Add Rego Object support for GraphQL builtins to improve composability. +- topdown/json: Fix panic in `json.filter` on empty JSON paths. +- topdown/sets_bench_test: Add `intersection` builtin tests. +- topdown/tokens: Protect against nistec panics. ([#5128](https://github.com/open-policy-agent/opa/issues/5218)) + +### Documentation + +- Add IR to integration docs. +- Added Gloo Edge Tutorial with examples. (authored by @Parsifal-M) +- Updated examples for CLI commands. +- Updated section on performance metrics (authored by @hutchins) +- docs/annotations: Add policy example and a link to the policy reference. ([#4937](https://github.com/open-policy-agent/opa/issues/4937)) authored by @Parsifal-M +- docs/policy-language: Be more explicit about future keywords. +- docs/security: Fix token authz example. (authored by @pigletfly) +- docs: Update generated CLI docs. (authored by @charlieflowers) +- docs: Update mentions of `#development` to `#contributors`. (authored by @charlieflowers) + +### Website + Ecosystem + +- website/security: Style improvements. (authored by @orweis) + +### Miscellaneous + +- ci: Add `prealloc` linter check and linter fixes. +- ci: Add govulncheck to Nightly CI. +- build/wasm: Use golang1.16 `go:embed` mechanism. +- util/backoff: Seed from math/rand source. +- version: Use `runtime/debug.BuildInfo`. + +- Dependency bumps, notably: + - build: bump golang 1.19.1 -> 1.19.2 + - build(deps): bump golang.org/x/net + - build(deps): bump internal/gqlparser to v2.5.1 + - build(deps): bump tj-actions/changed-files from 29.0.3 -> 32.0.0 + - deps(build): bump wasmtime-go 0.36.0 -> 1.0.0 (authored by @Parsifal-M) + +## 0.44.0 + +This release contains a number of fixes, two new builtins, a few new features, +and several performance improvements. + +### Security Fixes + +This release includes the security fixes present in the recent v0.43.1 release, +which mitigate CVE-2022-36085 in OPA itself, and CVE-2022-27664 and +CVE-2022-32190 in our Go build tooling. + +See the Release Notes for v0.43.1 for more details. + +### Set Element Addition Optimization + +Rego Set element addition operations did not scale linearly ([#4999](https://github.com/open-policy-agent/opa/pull/4999)) +in the past, and like the Object type before v0.43.0, experienced noticeable +reallocation/memory movement overheads once the Set grew past 120k-150k elements +in size. + +This release introduces different handling of Set internals during element +addition operations to avoid pathological reallocation behavior, and allows +linear performance scaling up into the 500k key range and beyond. + +### Set `union` Built-in Optimization + +The Set `union` builtin allows applying the union operation to a set of sets. + +However, as discovered in [#4979](https://github.com/open-policy-agent/opa/issues/4979), +its implementation generated unnecessary intermediate copies, which resulted in +poor performance; in many cases, worse than writing the equivalent operation in +pure Rego. + +This release improves the `union` builtin's implementation, such that only the +final result set is ever modified, reducing memory allocations and GC pressure. +The `union` builtin is now about 15-30% faster than the equivalent operation in +pure Rego. + +### New Built-in Functions: `strings.any_prefix_match` and `strings.any_suffix_match` + +This release introduces two new builtins, optimized for bulk matching of string +prefixes and suffixes: `strings.any_prefix_match`, and +`strings.any_suffix_match`. +It works with sets and arrays of strings, allowing efficient matching of +collections of prefixes or suffixes against a target string. + +See [the built-in functions docs for all the details](https://www.openpolicyagent.org/docs/v0.42.0/policy-reference/#builtin-strings-stringsany_prefix_match) + +This implementation fixes [#4994](https://github.com/open-policy-agent/opa/issues/4994) and was authored by @cube2222. + +### Tooling, SDK, and Runtime + +- Logger: Allow configuration of the timestamp format ([#2413](https://github.com/open-policy-agent/opa/issues/2413)) +- loader: Add support for fs.FS (authored by @ear7h) + +#### Bundles + +This release includes several bugfixes and improvements around bundle building: + +- cmd: Add optimize flag to OPA eval command to allow building optimized bundles +- cmd/build+compile: Allow opt-out of dependents gathering to allow compilation of more bundles into WASM ([#5035](https://github.com/open-policy-agent/opa/issues/5035)) +- opa build -t wasm|plan: Fail on unmatched entrypoints ([#3957](https://github.com/open-policy-agent/opa/issues/3957)) +- opa build: Fix bundle mode to work with ignore flag +- bundle/status: Include bundle size in status information +- bundle: Remove raw bytes check for lazy bundle loading mode + +#### Storage Fixes + +This release has performance improvements and bugfixes for the disk storage system: + +- storage/disk: Improve handling of in-flight transactions during truncate operations ([#4900](https://github.com/open-policy-agent/opa/issues/4900)) +- storage/inmem: Allow disabling `util.Roundtrip` on Write for improved performance ([#4708](https://github.com/open-policy-agent/opa/issues/4708)) +- storage: Improve multi-bundle data with overlapping roots is handled ([#4998](https://github.com/open-policy-agent/opa/issues/4998)) reported by @sirpi +- storage: Fix issue with policyID in Truncate calls ([#4958](https://github.com/open-policy-agent/opa/issues/4958)) authored by @martinjoha reported by @martinjoha + +#### Rego + +- eval+rego: Support caching output of non-deterministic builtins. ([#1514](https://github.com/open-policy-agent/opa/issues/1514)) + +#### AST and Topdown + +The AST and Topdown module received a number of important bugfixes in this release: + +- ast/term: Fix multiple-reader race condition for Sets/Objects +- ast/compile: Respect unsafeBuiltinMap for 'with' replacements +- ast: Add capacity to array initialization when size is known (authored by @mstrYoda) +- topdown/object: Fix unchecked error case in `object.union_n` builtin ([#5073](https://github.com/open-policy-agent/opa/issues/5073)) +- topdown/reachable: Fix missing operand type checks. ([#4951](https://github.com/open-policy-agent/opa/issues/4951)) +- topdown/units_parse: Avoid extra decimal places for integers +- topdown/type+wasm: Fix inconsistent `is_type` return values. ([#4943](https://github.com/open-policy-agent/opa/issues/4943)) +- builtins: Fix inconsistent error messages in `units.parse*` +- Add query parameter in canonical request of AWS Sigv4 signature to avoid 403 errors from AWS (authored by @sinhaaks) + +#### Test Suite + +- Add error type to `units.*` builtin test assertions +- test/e2e/certrefresh: Add `file.Sync()` to eliminate test failures due to slow disk writes +- topdown/exported_tests: Remove Golang 1.16 x509 exception +- cmd/bench: Fix port collision in utility function used for E2E testing + +### Documentation + +- SECURITY: Migrate policy to web site, update content ([#4272](https://github.com/open-policy-agent/opa/issues/4272)) reported by @adoliver +- Add deprecated flag to all deprecated builtins ([#5072](https://github.com/open-policy-agent/opa/issues/5072)) +- builtins: Update description of `format_int` to say it rounds down +- docs/policy-reference: Update Rego EBNF grammar (authored by @shaded-enmity) +- docs/builtins: Fix typo in `semver.compare` ([#5012](https://github.com/open-policy-agent/opa/issues/5012)) reported by @tetsuya28 +- docs: Fix AWS Signature section in Configuration (authored by @pauly4it) +- docs: Update port and bundle folder for GraphQL tutorial +- docs: Document that function overloading is unsupported +- docs: Fixing related_resources annotations example ([#4982](https://github.com/open-policy-agent/opa/issues/4982)) reported by @humbertoc-silva +- docs: Fixing typo in metadata ([#5018](https://github.com/open-policy-agent/opa/issues/5018)) authored by @cimin0 reported by @cimin0 + +### Website + Ecosystem + +- Update links to opa-kafka-plugin +- Add OCI documentation (authored by @carabasdaniel) +- Add article on using OPA for data filtering in Kafka +- Ecosystem: Add some links to Rönd (authored by @ugho16) +- Add community integration for Fiber (authored by @mstrYoda) +- Add Spacelift Integration (authored by @theseanodell) +- Fix broken link for Minio OPA integration (authored by @unautre) + +- Ecosystem Additions: + - cosign (#5040) (authored by @Dentrax) + +### Miscellaneous + +- Dockerfile: Append root "/" to $PATH ([#5003](https://github.com/open-policy-agent/opa/issues/5003)) authored by @matusf reported by @matusf +- Add VNG Cloud to adopters (authored by @vinhph0906) + +- Dependency bumps, notably: + - build: bump golang: 1.19 -> 1.19.1 + - build: use go 1.19, drop go 1.16 + - build(deps): bump aquasecurity/trivy-action from 0.6.1 -> 0.7.1 + - build(deps): bump github.com/agnivade/levenshtein from 1.0.1 -> 1.1.1 + - build(deps): bump github.com/containerd/containerd from 1.6.6 -> 1.6.8 + - build(deps): bump github.com/go-ini/ini from 1.66.6 -> 1.67.0 + - build(deps): bump github.com/prometheus/client_golang + - build(deps): bump google.golang.org/grpc from 1.48.0 -> 1.49.0 + - build(deps): bump tj-actions/changed-files from 28.0.0 -> 29.0.3 + +- Dependency removals: + - internal: Vendor gqlparser library ([#5065](https://github.com/open-policy-agent/opa/issues/5065)) reported by @vikstrous2 + +## 0.43.1 + +This is a security release fixing the following vulnerabilities: + +- CVE-2022-36085: Respect unsafeBuiltinMap for 'with' replacements in the compiler + + See https://github.com/open-policy-agent/opa/security/advisories/GHSA-f524-rf33-2jjr for all details. + +- CVE-2022-27664 and CVE-2022-32190. + + Fixed by updating the Go version used in our builds to 1.18.6, + see https://groups.google.com/g/golang-announce/c/x49AQzIVX-s. + Note that CVE-2022-32190 is most likely not relevant for OPA's usage of net/url. + But since these CVEs tend to come up in security assessment tooling regardless, + it's better to get it out of the way. +## 0.43.0 + +This release contains a number of fixes, enhancements, and performance improvements. + +### Object Insertion Optimization + +Rego Object insertion operations did not scale linearly ([#4625](https://github.com/open-policy-agent/opa/issues/4625)) +in the past, and experienced noticeable reallocation/memory movement +overheads once the Object grew past 120k-150k keys in size. + +This release introduces different handling of Object internals during insert +operations to avoid pathological reallocation behavior, and allows linear +performance scaling up into the 500k key range and beyond. + +### Tooling, SDK, and Runtime + +- Add lines covered/not covered counts to test coverage report (authored by @FarisR99) +- Plugins: Status and logs plugins now accept any HTTP 2xx status code (authored by @lvisterin) +- Runtime: Generalize OS check for MacOS to other Unix-likes (authored by @iamleot) + +#### Bundles Fixes + +The Bundles system received several bugfixes and performance improvements in this release: + + - Bundle: `opa bundle` command now supports `.yml` files ([#4859](https://github.com/open-policy-agent/opa/issues/4859)) authored by @Joffref reported by @rdrgmnzsakt + - Plugins/Bundle: Use unique temporary files for persisting activated bundles to disk ([#4782](https://github.com/open-policy-agent/opa/issues/4782)) authored by @FredrikAppelros reported by @FredrikAppelros + - Server: Old policy path is now checked for bundle ownership before update ([#4846](https://github.com/open-policy-agent/opa/issues/4846)) + - Storage+Bundle: Old bundle data is now cleaned before new bundle activation ([#4940](https://github.com/open-policy-agent/opa/issues/4940)) + - Bundle: Paths are now normalized before bundle root check occurs to ensure checks are os-independent + +#### Storage Fixes + +The Storage system received mostly bugfixes, with a notable performance improvement for large bundles in this release: + + - storage/inmem: Speed up bundle activation by avoiding unnecessary read operations ([#4898](https://github.com/open-policy-agent/opa/issues/4898)) + - storage/inmem: Paths are now created during truncate operations if they did not exist before + - storage/disk: Symlinks work with relative paths now ([#4869](https://github.com/open-policy-agent/opa/issues/4869)) + +### Rego and Topdown + +The Rego compiler and runtime environment received a number of bugfixes, and a few new features this release, as well as a notable performance improvement for large Objects +(covered above). + +- AST/Compiler: New method for obtaining parsed, but otherwise unprocessed modules is now available ([#4910](https://github.com/open-policy-agent/opa/issues/4910)) +- `object.subset`: Support array + set combination ([#4858](https://github.com/open-policy-agent/opa/issues/4858)) authored by @x-color +- Compiler: Prevent erasure of `print()` statements in the compiler via a `WithEnablePrintStatements` option to `compiler.Compiler` and `compiler.optimizer` (authored by @kevinstyra) +- Topdown fixes: + - AST/Builtins: `type_name` builtin now has more precise type metadata and improved docs + - Topdown/copypropagation: Ref-based tautologies like `input.a == input.a` are no longer eliminated during the copy-propagation pass ([#4848](https://github.com/open-policy-agent/opa/issues/4848)) reported by @johanneskra + - Topdown/parse_units: Use big.Rat for units parsing to avoid floating-point rounding issues on fractional units. ([#4856](https://github.com/open-policy-agent/opa/issues/4856)) reported by @tmos22 + - Topdown: `is_valid` builtins no longer error, and should always return booleans ([#4760](https://github.com/open-policy-agent/opa/issues/4760)) + - Topdown: `glob.match` now can be used without delimiters ([#4923](https://github.com/open-policy-agent/opa/issues/4923)) authored by @vinhph0906 reported by @vinhph0906 + +### Documentation + + - Docs: Add GraphQL API authorization tutorial + - Docs/bundles: Add bundle CLI command documentation ([#3831](https://github.com/open-policy-agent/opa/issues/3831)) authored by @Joffref + - Docs/policy-reference: Remove extra quote in Grammar to fix formatting ([#4915](https://github.com/open-policy-agent/opa/issues/4915)) authored by @friedrichsenm reported by @friedrichsenm + - Docs/policy-testing: Add missing future.keywords imports ([#4849](https://github.com/open-policy-agent/opa/issues/4849)) reported by @robert-elles + - Docs: Add note about counter_server_query_cache_hit metric ([#4389](https://github.com/open-policy-agent/opa/issues/4389)) + - Docs: Kube tutorial includes updated cert install procedure ([#4902](https://github.com/open-policy-agent/opa/issues/4902)) reported by @Imp + - Docs: GraphQL builtins section now includes a note about framework-specific `@directive` definitions in GraphQL schemas + - Docs: Add warning about name collisions in older policies from importing 'future.keywords' + +### Website + Ecosystem + +- Website: Show navbar on smaller devices ([#3353](https://github.com/open-policy-agent/opa/issues/3353)) authored by @Parsifal-M reported by @OBrienCommaJosh +- Website/frontpage: Update front page examples to use the future.keywords imports +- Website/live-blocks: Only pass 'import future.keywords' when needed and supported +- Website/live-blocks: Update codemirror-rego to 1.3.0 +- Website: Fix community page layout/scrolling issues (authored by @mstade) + +- Ecosystem Additions: + - Rond (authored by @ugho16) + - walt.id + +### Miscellaneous + +- Dependency bumps, notably: + - aquasecurity/trivy-action from 0.5.1 to 0.6.1 + - github.com/sirupsen/logrus from 1.8.1 to 1.9.0 + - github.com/vektah/gqlparser/v2 from 2.4.5 to 2.4.6 + - google.golang.org/grpc from 1.47.0 to 1.48.0 + - terser in /docs/website/scripts/live-blocks + - glob-parent in /docs/website/scripts/live-blocks +- Added GKE Policy Automation to ADOPTERS.md (authored by @mikouaj) +- Fix minor code unreachability error (authored by @Abirdcfly) + +## 0.42.2 + +This is a bug fix release that addresses the following: + +- storage/disk: make symlinks work with relative paths ([#4869](https://github.com/open-policy-agent/opa/issues/4869)) +- bundle: Normalize paths before bundle root check + +## 0.42.1 + +This is a bug fix release that addresses the following: + +1. An issue while writing data to the in-memory store at a non-root nonexistent path ([#4855](https://github.com/open-policy-agent/opa/issues/4855)), reported by @wermerb and others. +2. Policies owned by a bundle could be replaced via the REST API because of a missing bundle scope check ([#4846](https://github.com/open-policy-agent/opa/issues/4846)). +3. Adds missing `future.keywords` import for the examples in the policy testing section of the docs ([#4849](https://github.com/open-policy-agent/opa/issues/4849)), reported by @robert-elles. + +## 0.42.0 + +This release contains a number of fixes and enhancements. + +### New built-in function: `object.subset` + +This function checks if a collection is a subset of another collection. +It works on objects, sets, and arrays. + +If both arguments are objects, then the operation is recursive, e.g. `{"c": {"x": {10, 15, 20}}` +is considered a subset of `{"a": "b", "c": {"x": {10, 15, 20, 25}, "y": "z"}`. + +See [the built-in functions docs for all the details](https://www.openpolicyagent.org/docs/v0.42.0/policy-reference/#builtin-object-objectsubset) + +This implementation fixes [#4358](https://github.com/open-policy-agent/opa/issues/4358) and was authored by @charlesdaniels. + +### New keywords: "contains" and "if" + +These new keywords let you increase the expressiveness of your policy code: + +Before + +```rego +package authz +allow { not denied } # `denied` left out for presentation purposes + +deny[msg] { + count(violations) > 0 + msg := sprintf("there are %d violations", [count(violations)]) +} +``` + +After + +```rego +package authz +import future.keywords + +allow if not denied # one expression only => no { ... } needed! + +deny contains msg if { + count(violations) > 0 + msg := sprintf("there are %d violations", [count(violations)]) +} +``` + +Note that rule bodies containing only one expression can be abbreviated when using `if`. + +To use the new keywords, use `import future.keywords.contains` and `import future.keywords.if`; or +import all of them at once via `import future.keywords`. When these future imports are present, the +pretty printer (`opa fmt`) will introduce `contains` and `if` where applicable. + +`if` is allowed in all places to separate the rule head from the body, like +```rego +response[key] = value if { key := "open", y := "sesame" } +``` +_but_ not for partial set rules, unless also using `contains`: +```rego +deny[msg] if msg := "forbidden" # INVALID +deny contains msg if msg := "forbidden" # VALID +``` + +### Tooling, SDK, and Runtime + +- Plugins: + - S3 Plugin: Allow multiple AWS credential providers at once, chained together ([#4791](https://github.com/open-policy-agent/opa/issues/4791)), reported and authored by @abhisek + - Discovery Plugin: Check for empty key config ([#4656](https://github.com/open-policy-agent/opa/issues/4656)) reported by @humbertoc-silva + - Logs Plugin: Update mechanism to escape field paths ([#4717](https://github.com/open-policy-agent/opa/issues/4717)) reported by @pauly4it + - Status Plugin: fix `bundle_failed_load_counter` metric for bundles without revisions ([#4822](https://github.com/open-policy-agent/opa/issues/4822)) reported and authored by @jkbschmid +- Server: The `system.authz` policy now properly supports the interquery caching of `http.send` calls ([#4829](https://github.com/open-policy-agent/opa/issues/4829)), reported by @HarshPathakhp +- `opa bench`: Passing `--e2e` makes the benchmark measure the performance of a query including the server's HTTP handlers and their processing. +- `opa fmt`: Output list _and_ diff changes with `--fail` flag (#4710) (authored by @davidkuridza) +- Disk Storage: Bundles are now streamed into the disk store, and not extracted completely in-memory ([#4539](https://github.com/open-policy-agent/opa/issues/4539)) +- Golang package `repl`: Add a `WithCapabilities` function (authored by @jaspervdj) +- SDK: Allow configurable ID (authored by @rakshasa-1729) +- Windows: User lookups in various code paths have been avoided. They had no use, but are costly, and removing them should increase + the performance of any CLI calls (even `opa version`) on Windows. Fixes [#4646](https://github.com/open-policy-agent/opa/issues/4646). +- Server: Open read storage transaction in Query API handler (not write) + +### Rego and Topdown + +- Runtime Errors: Fix type error message in `count`, `object.filter`, and `object.remove` built-in functions ([#4767](https://github.com/open-policy-agent/opa/issues/4767)) +- Parser: Remove early MHS return in infix parsing, fixing confusing error messages ([#4672](https://github.com/open-policy-agent/opa/issues/4672)) authored by @philipaconrad +- AST: Disallow shadowing of called functions in comprehension heads ([#4762](https://github.com/open-policy-agent/opa/issues/4762)) +- Planner/IR: shadow rule funcs if mocking functions ([#4746](https://github.com/open-policy-agent/opa/issues/4746)) +- Compiler: Fix "every" handling in partial eval: by reordering body for safety differently, and correctly plugging its terms on safe ([#4801](https://github.com/open-policy-agent/opa/pull/4801)), reported by @jguenther-va +- Compiler: fix util.HashMap eq comparison ([#4759](https://github.com/open-policy-agent/opa/pull/4759)) +- Built-ins: use strings.Builder in glob.match() (authored by @charlesdaniels) + +### Documentation + +- Builtins: Fix documentation of `startswith` and `endswith` (authored by @whme) +- Kubenetes Tutorial: Remove unused assignement in example ([#4778](https://github.com/open-policy-agent/opa/issues/4778)) authored by @Joffref +- OCI: Update configuration docs for private images in OCI registries (authored by @carabasdaniel) +- AWS S3 Signing: Fix profile_credentials docs (authored by @wangli1030) + +### Website + Ecosystem + +- Add "Edit on GitHub" button to docs ([#3784](https://github.com/open-policy-agent/opa/issues/3784)) authored by @avinashdesireddy +- Wasm: fix function table markup ([#4664](https://github.com/open-policy-agent/opa/issues/4664)) +- Ecosystem: use location.hash to track open modal ([#4667](https://github.com/open-policy-agent/opa/issues/4667)) + +Note that website changes like these become effective immediately and are not tied to a release. +We still use our release notes to record the nice fixes contributed by our community. + +- Ecosystem Additions: + - Alfred, the self-hosted playground (authored by @dolevf) + - Java Spring tutorial (authored by @psevestre) + - Pulumi + +### Miscellaneous + +- Add Terminus to ADOPTERS.md (#4734) ([#4713](https://github.com/open-policy-agent/opa/issues/4713)) reported by @charlieflowers +- Remove any data attributes not used in the "YAML tests" ([#4813](https://github.com/open-policy-agent/opa/issues/4813)) +- Dependency bumps, notably: + - github.com/prometheus/client_golang 1.12.2 ([#4697](https://github.com/open-policy-agent/opa/issues/4697)) + - github.com/vektah/gqlparser/v2 2.4.5 +- Build process and CI: + - Use Trivy for vulnerability scans in code and container images (authored by @JAORMX) + - Bump golangci-lint to v1.46.2, fix some issues ([#4765](https://github.com/open-policy-agent/opa/issues/4765)) + - Remove npm-opa-wasm test + - Skip flaky darwin tests on PR runs + - Fix flaky oci e2e test ([#4748](https://github.com/open-policy-agent/opa/issues/4748)) authored by @carabasdaniel + - Integrate builtin_metadata.json handling in release process ([#4754](https://github.com/open-policy-agent/opa/issues/4754)) + + +## 0.41.0 + +This release contains a number of fixes and enhancements. + +### GraphQL Built-in Functions + +A new set of built-in functions are now available to validate, parse and verify GraphQL query and schema! Following are +the new built-ins: + + graphql.is_valid: Checks that a GraphQL query is valid against a given schema + graphql.parse: Returns AST objects for a given GraphQL query and schema + graphql.parse_and_verify: Returns a boolean indicating success or failure alongside the parsed ASTs for a given GraphQL query and schema + graphql.parse_query: Returns an AST object for a GraphQL query + graphql.parse_schema: Returns an AST object for a GraphQL schema + +### Built-in Function Metadata + +Built-in function declarations now support additional metadata to specify name and description for function arguments +and return values. The metadata can be programmatically consumed by external tools such as IDE plugins. The built-in +function documentation is created using the new built-in function metadata. +Check out the new look of the [Built-In Reference](https://www.openpolicyagent.org/docs/latest/policy-reference/#built-in-functions) +page! + +Under the hood, a new file called `builtins_metadata.json` is generated via `make generate` which can be consumed by +external tools. + +### Tooling, SDK, and Runtime + +- OCI Downloader: Add logic to skip bundle reloading based on the digest of the OCI artifact ([#4637](https://github.com/open-policy-agent/opa/issues/4637)) authored by @carabasdaniel +- Bundles: Exclude empty manifest from bundle signature ([#4712](https://github.com/open-policy-agent/opa/issues/4712)) authored by @friedrichsenm reported by @friedrichsenm + +### Rego and Topdown + +- units.parse: New built-in for parsing standard metric decimal and binary SI units (e.g., K, Ki, M, Mi, G, Gi) +- format: Fix `opa fmt` location for non-key rules (#4695) (authored by @jaspervdj) +- token: Ignore keys of unknown alg when verifying JWTs with JWKS ([#4699](https://github.com/open-policy-agent/opa/issues/4699)) reported by @lenalebt + +### Documentation + +- Adding Built-in Functions: Add note about `capabilities.json` while creating a new built-in function +- Policy Reference: Add example for `rego.metadata.rule()` built-in function +- Policy Reference: Fix grammar for `import` keyword ([#4689](https://github.com/open-policy-agent/opa/issues/4689)) authored by @mmzeeman reported by @mmzeeman +- Security: Fix command line flag name for file containing the TLS certificate ([#4678](https://github.com/open-policy-agent/opa/issues/4678)) authored by @pramodak reported by @pramodak + +### Website + Ecosystem + +- Update Kubernetes policy examples on the website to use latest kubernetes schema (`apiVersion`: `admission.k8s.io/v1`) (authored by @vicmarbev) +- Ecosystem: + - Add Sansshell (authored by @sfc-gh-jchacon) + - Add Nginx + +### Miscellaneous + +- Various dependency bumps, notably: + - OpenTelemetry-go: 1.6.3 -> 1.7.0 + - go.uber.org/automaxprocs: 1.4.0 -> 1.5.1 + - github.com/containerd/containerd: 1.6.2 -> 1.6.4 + - google.golang.org/grpc: 1.46.0 -> 1.47.0 + - github.com/bytecodealliance/wasmtime-go: 0.35.0 -> 0.36.0 + - github.com/vektah/gqlparser/v2: 2.4.3 -> 2.4.4 +- `make test`: Fix "too many open files" issue on Mac OS +- Remove usage of github.com/pkg/errors package (authored by @imjasonh) + +## 0.40.0 + +This release contains a number of fixes and enhancements. + +### Metadata introspection + +The _rich metadata_ added in the v0.38.0 release can now be introspected +from the policies themselves! + + package example + + # METADATA + # title: Edits by owner only + # description: | + # Only the owner is allowed to edit their data. + deny[{"allowed": false, "message": rego.metadata.rule().description}] { + input.user != input.owner + } + +This snippet will evaluate to + + [{ + "allowed": false, + "message": "Only the owner is allowed to edit their data.\n" + }] + +Both the rule's metadata can be accessed, via `rego.metadata.rule()`, and the +entire chain of metadata attached to the rule via the various scopes that different +metadata annotations can have, via `rego.metadata.chain()`. + +All the details can be found in the documentation of [these new built-in functions](https://www.openpolicyagent.org/docs/v0.40.0/policy-reference/#rego). + +### Function mocking + +It is now possible to **mock functions** in tests! Both built-in and non-built-in +functions can be mocked: + + package authz + import data.jwks.cert + import data.helpers.extract_token + + allow { + [true, _, _] = io.jwt.decode_verify(extract_token(input.headers), {"cert": cert, "iss": "corp.issuer.com"}) + } + + test_allow { + allow + with input.headers as [] + with data.jwks.cert as "mock-cert" + with io.jwt.decode_verify as [true, {}, {}] # mocked built-in + with extract_token as "my-jwt" # mocked non-built-in + } + +For further information about policy testing with data and function mock, see [the Policy Testing docs](https://www.openpolicyagent.org/docs/v0.40.0/policy-testing/#data-and-function-mocking) +All details about `with` can be found in its [Policy Language section](https://www.openpolicyagent.org/docs/v0.40.0/policy-language/#with-keyword). + +### Assignments with `:=` + +Remaining restrictions around the use of `:=` in rules and functions have been lifted ([#4555](https://github.com/open-policy-agent/opa/issues/4555)). +These constructs are now valid: + + check_images(imgs) := x { # function + # ... + } + + allow := x { # rule + # ... + } + + response[key] := object { # partial object rule + # ... + } + +In the wake of this, rules may now be "redeclared", i.e. you can use `:=` for more than one rule body: + + deny := x { + # body 1 + } + deny := x { + # body 2 + } + +This was forbidden before, but didn't serve a real purpose: it would catch trivial-to-catch errors +like + + p := 1 + p := 2 # redeclared + +But it would do no good in more difficult to debug "multiple assignment" problems like + + p := x { + some x in [1, 2, 3] + } + +### Tooling, SDK, and Runtime + +- Status Plugin: Remove activeRevision label on all but one Prometheus metric ([#4584](https://github.com/open-policy-agent/opa/issues/4584)) reported and authored by @costimuraru +- Status: Include bundle type ("snapshot" or "delta") in status information +- `opa capabilities`: Expose capabilities through CLI, and allow using versions when passing `--capabilities v0.39.0` to the various commands ([#4236](https://github.com/open-policy-agent/opa/issues/4236)) authored by @IoannisMatzaris +- Logging: Log warnings at WARN level not ERROR, authored by @damienjburks +- Runtime: Persist activated bundle Etag to store ([#4544](https://github.com/open-policy-agent/opa/issues/4544)) +- `opa eval`: Don't use source locations when formatting partially evaluated output ([#4609](https://github.com/open-policy-agent/opa/issues/4609)) +- `opa inspect`: Fixing an issue where some errors encountered by the inspect command aren't properly reported +- `opa fmt`: Fix a bug with missing whitespace when formatting multiple `with` statements on one indented line ([#4634](https://github.com/open-policy-agent/opa/issues/4634)) + +#### Experimental OCI support + +When configured to do so, OPA's bundle and discovery plugins will retrieve bundles from **any OCI registry**. +Please see [the Services Configuration section](https://www.openpolicyagent.org/docs/v0.40.0/configuration/#services) +for details. + +Note that at this point, it's best considered a "feature preview". Be aware of this: +- Bundles are not cached, but re-retrieved and activated periodically. +- The persistence directory used for storing retrieved OCI artifacts is not yet managed by OPA, + so its content may accumulate. By default, the OCI downloader will use a temporary file location. +- The documentation on how to push bundles to an OCI repository currently only exists in the development + docs, see [OCI.md](https://github.com/open-policy-agent/opa/blob/v0.40.0/docs/devel/OCI.md). + +Thanks to @carabasdaniel for starting the work on this! + +### Rego and Topdown + +- Builtins: Require prefix length for IPv6 in `net.cidr_merge` ([#4596](https://github.com/open-policy-agent/opa/issues/4596)), reported by @alexhu20 +- Builtins: `http.send` can now parse and cache YAML responses, analogous to JSON responses +- Parser: Guard against invalid domains for "some" and "every", reported by @doyensec +- Formatting: Don't add 'in' keyword import when 'every' is there ([#4606](https://github.com/open-policy-agent/opa/issues/4606)) + +### Documentation + +- Policy Language: Reorder Universal Quantification content, stress `every` over other constructions ([#4603](https://github.com/open-policy-agent/opa/issues/4603)) +- Language pages: Use assignment operator where it's allowed. +- SSH Tutorial: Use bundle API +- Annotations: Update "Custom" annotation section +- Cloudformation: Fix markup and add warning related to booleans +- Blogs: mention OAuth2 and OIDC blog posts + +### Website + Ecosystem + +- Redirect previous patch releases to latest patch release ([#4225](https://github.com/open-policy-agent/opa/issues/4225)) +- Add playground button to navbar +- Add SRI to static html files +- Remove right margin on sidebar (#4529) (authored by @orweis) +- Show yellow banner for old version (#4533) +- Remove unused variables to avoid error in strict mode(#4534) (authored by @panpan0000) +- Ecosystem: + - Add AWS CloudFormation Hook + - Add GKE policy automation + - Add permit.io (authored by @ozradi) + - Add Magda (authored by @t83714) + +### Miscellaneous + +- Workflow: no content permissions for GitHub action 'post-release', authored by @naveensrinivasan +- Various dependency bumps, notably: + - OpenTelemetry-go: 1.6.1 -> 1.6.3 + - go.uber.org/automaxprocs: 1.4.0 -> 1.5.1 +- Binaries and Docker images are now built using Go 1.18.1. +- Dockerfile: add source annotation (#4626) + +## 0.39.0 + +This release contains a number of fixes and enhancements. + +### Disk Storage + +The on-disk storage backend has been fully integrated with the OPA server, and +can now be enabled via configuration: + +```yaml +storage: + disk: + directory: /var/opa # put data here + auto_create: true # create directory if it doesn't exist + partitions: # partitioning is important for data storage, + - /users/* # please see the documentation +``` + +It is intended to enable the use of OPA in scenarios where the data needed for +policy evaluation exceeds the available memory. + +The on-disk contents will persist among restarts, but should not be used as a +single source of truth: there are no backup mechanisms, and certain data partitioning +changes will require a start-over. These are things that may get improved in the +future. + +For all the details, please refer to the [configuration](https://www.openpolicyagent.org/docs/v0.39.0/configuration/#disk-storage) +and [detailled Disk Storage section](https://www.openpolicyagent.org/docs/v0.39.0/misc-disk/) +of the documentations. + +### Tooling, SDK, and Runtime + +- Server: Add warning when `input` attribute is missing in `POST /v1/data` API ([#4386](https://github.com/open-policy-agent/opa/issues/4386)) authored by @aflmp +- SDK: Support partial evaluation ([#4240](https://github.com/open-policy-agent/opa/pull/4240)), authored by @kroekle; with a fix to avoid using different state (authored by @Iceber) +- Runtime: Suppress payloads in debug logs for handlers that compress responses (`/metrics` and `/debug/pprof`) (authored by @christian1607) +- `opa test`: Add file path to failing tests to make debugging failing tests easier ([#4457](https://github.com/open-policy-agent/opa/issues/4457)), authored by @liamg +- `opa fmt`: avoid whitespace mixed with tabs on `with` statements ([#4376](https://github.com/open-policy-agent/opa/issues/4376)) reported by @tiwood +- Coverage reporting: Remove duplicates from coverage report ([#4393](https://github.com/open-policy-agent/opa/issues/4393)) reported by @gianna7wu +- Plugins: Fix broken retry logic in decision logs plugin ([#4486](https://github.com/open-policy-agent/opa/issues/4486)) reported by @iamatwork +- Plugins: Update regular polling fallback mechanism for downloader +- Plugins: Support for adding custom parameters and headers for OAuth2 Client Credentials Token request (authored by @srlk) +- Plugins: Log message on unexpected bundle content type ([#4278](https://github.com/open-policy-agent/opa/issues/4278)) +- Plugins: Mask Authorization header value in debug logs ([#4495](https://github.com/open-policy-agent/opa/issues/4495)) +- Docker images: Use GID 1000 in `-rootless` images ([#4380](https://github.com/open-policy-agent/opa/issues/4380)); also warn when using UID/GID 0. +- Runtime: change processed file event log level to info + +### Rego and Topdown + +- Type checker: Skip pattern JSON Schema attribute compilation ([#4426](https://github.com/open-policy-agent/opa/issues/4426)): These are not supported, but could have caused the parsing of a JSON Schema document to fail. +- Topdown: Copy without modifying expr, fixing a bug that could occur when running multiple partial evaluation requests concurrently. +- Compiler strict mode: Raise error on unused imports ([#4354](https://github.com/open-policy-agent/opa/issues/4354)) authored by @damienjburks +- AST: Fix print call rewriting in else rules ([#4489](https://github.com/open-policy-agent/opa/issues/4489)) +- Compiler: Improve error message on missing `with` target ([#4431](https://github.com/open-policy-agent/opa/issues/4431)) reported by @gabrielfern +- Parser: hint about 'every' future keyword import + +### Documentation and Website + +- AWS CloudFormation Hook: New tutorial +- Community: Stretch background so it covers on larger screens ([#4402](https://github.com/open-policy-agent/opa/issues/4402)) authored by @msorens +- Build: Make local dev and PR preview not build everything ([#4379](https://github.com/open-policy-agent/opa/issues/4379)) +- Philosophy: Grammar fixes (authored by @ajonesiii) +- README: Add note about Hugo version mismatch errors (authored by @ogazitt) +- Integrations: Add GraphQL-Graphene (authored by @dolevf), Emissary-Ingress (authored by @tayyabjamadar), rekor-sidekick, +- Integrations CI: ensure referenced software is listed, and logo file names match; allow SVG logos +- Envoy: Update policy primer with new control headers +- Envoy: Update bob_token and alice_token in tutorial (authored by @rokkiter) +- Envoy: Include new configurable gRPC msg sizes (authored by @emaincourt) +- Annotations: add missing title to index (authored by @itaysk) + +### Miscellaneous + +- Various dependency bumps, notably: + - OpenTelemetry-go: 1.4.1 -> 1.6.1 + - Wasmtime-go: 0.34.0 -> 0.35.0 +- Binaries and Docker images are now built using Go 1.18; CI runs build/test for Ubuntu and macos with Go 1.16 and 1.17. +- CI: remove go-fuzz, use native go 1.18 fuzzer + +## 0.38.1 + +This is a bug fix release that addresses one issue when using `opa test` with the +`--bundle` (`-b`) flag, and a policy that uses the `every` keyword. + +There are no other code changes in this release. + +### Fixes + +- Compiler: don't raise an error with unused declared+generated vars + (every) ([#4420](https://github.com/open-policy-agent/opa/issues/4420)), + reported by @kristiansvalland + +## 0.38.0 + +This release contains a number of fixes and enhancements. + +It contains one **backwards-incompatible change** to the JSON representation +of metrics in **Status API** payloads, please see the section below. + +### Rich Metadata + +It is now possible to annotate Rego policies in a way that can be +processed programmatically, using _Rich Metadata_. + + # METADATA + # title: My rule + # description: A rule that determines if x is allowed. + # authors: + # - Jane Austin + allow { + ... + } + +The available keys are: + +- title +- description +- authors +- organizations +- related_resources +- schemas +- scope +- custom + +Custom annotations can be used to annotate rules, packages, and +documents with whatever you specifically need, beyond the generic +keywords. + +Annotations can be retrieved using the [Golang library](https://www.openpolicyagent.org/docs/v0.38.0/annotations/#go-api) +or via the CLI, `opa inspect -a`. + +All the details can be found in the documentation on [Annotations](https://www.openpolicyagent.org/docs/v0.38.0/annotations/). + +### Every Keyword + +A new keyword for explicit iteration is added to Rego: `every`. + +It comes in two forms, iterating values, or keys and values, of a +collection, and asserting that the body evaluates successfully for +each binding of key and value to the collection's elements: + + every k, v in {"foo": "FOO", "bar": "BAR" } { + upper(k) == v + } + +To use it, `import future.keywords.every` or `future.keywords`. + +For further information, please refer to the [Every Keyword docs](https://www.openpolicyagent.org/docs/v0.38.0/policy-language/#every-keyword) +and the new section on [_FOR SOME and FOR ALL_ in the Intro docs](https://www.openpolicyagent.org/docs/v0.38.0/#for-some-and-for-all). + +### Tooling, SDK, and Runtime + +- Compile API: add `disableInlining` option ([#4357](https://github.com/open-policy-agent/opa/issues/4357)) reported and fixed by @srlk +- Status API: add `http_code` to response ([#4259](https://github.com/open-policy-agent/opa/issues/4259)) reported and fixed by @jkbschmid +- Status plugin: publish experimental bundle-related metrics via prometheus endpoint (authored by @rafaelreinert) -- See [Status Metrics](https://www.openpolicyagent.org/docs/v0.38.0/monitoring/#status-metrics) for details. +- SDK: don't panic without config ([#4303](https://github.com/open-policy-agent/opa/issues/4303)) authored by @damienjburks +- Storage: Support index for array appends (for JSON Patch compatibility) +- `opa deps`: Fix pretty printed output to show virtual documents ([#4342](https://github.com/open-policy-agent/opa/issues/4342)) + +### Rego and Topdown + +- Parser: parse 'with' on 'some x in xs' expression ([#4226](https://github.com/open-policy-agent/opa/issues/4226)) +- AST: hash containers on insert/update ([#4345](https://github.com/open-policy-agent/opa/issues/4345)), fixing a data race reported by @skillcoder +- Planner: Fix bug related to undefined results in dynamic lookups + +### Documentation and Website + +- Policy Reference: update EBNF to include "every" and "some x in ..." ([#4216](https://github.com/open-policy-agent/opa/issues/4216)) +- REST API: Update docs on 400 response +- README: Include Google Analytic Instructions +- Envoy primer: use variables instead of objects +- Istio tutorial: expose application to outside traffic +- New "Community" Webpage (authored by @msorens) + +### WebAssembly + +- OPA now uses Wasmtime 0.34.0 to evaluate its Wasm modules. + +### Miscellaneous + +- Build: `make build` now builds without errors (by disabling Wasm) on darwin/arm64 (M1) +- Various dependency bumps. + - OpenTelemetry SDK: 1.4.1 + - github.com/prometheus/client_golang: 1.12.1 + +### Backwards incompatible changes + +The JSON representation of the Status API's payloads -- both for `GET /v1/status` +responses and the metrics sent to a remote Status API endpoint -- have changed: + +Previously, they had been serialized into JSON using the standard library "encoding/json" +methods. However, the metrics coming from the Prometheus integration are only available +in Golang structs generated from Protobuf definitions. For serializing these into JSON, +the standard library functions are unsuited: + +- enums would be converted into numbers, +- field names would be `snake_case`, not `camelCase`, +- and NaNs would cause the encoder to panic. + +Now, we're using the protobuf ecosystem's `jsonpb` package, to serialize the Prometheus +metrics into JSON in a way that is compliant with the Protobuf specification. + +Concretely, what would before be +``` + "metrics": { + "prometheus": { + "go_gc_duration_seconds": { + "help": "A summary of the GC invocation durations.", + "metric": [ + { + "summary": { + "quantile": [ + { + "quantile": 0, + "value": 0.000011799 + }, + { + "quantile": 0.25, + "value": 0.000011905 + }, + { + "quantile": 0.5, + "value": 0.000040002 + }, + { + "quantile": 0.75, + "value": 0.000065238 + }, + { + "quantile": 1, + "value": 0.000104897 + } + ], + "sample_count": 7, + "sample_sum": 0.000309117 + } + } + ], + "name": "go_gc_duration_seconds", + "type": 2 + }, +``` + +is *now*: +``` + "metrics": { + "prometheus": { + "go_gc_duration_seconds": { + "name": "go_gc_duration_seconds", + "help": "A summary of the pause duration of garbage collection cycles.", + "type": "SUMMARY", + "metric": [ + { + "summary": { + "sampleCount": "1", + "sampleSum": 4.1765e-05, + "quantile": [ + { + "quantile": 0, + "value": 4.1765e-05 + }, + { + "quantile": 0.25, + "value": 4.1765e-05 + }, + { + "quantile": 0.5, + "value": 4.1765e-05 + }, + { + "quantile": 0.75, + "value": 4.1765e-05 + }, + { + "quantile": 1, + "value": 4.1765e-05 + } + ] + } + } + ] + }, +``` + +Note that `sample_count` is now `sampleCount`, and the `type` is using the enum's +string representation, `"SUMMARY"`, not `2`. + +Note: For compatibility reasons (the Prometheus golang client doesn't use the V2 +protobuf API), this change uses `jsonpb` and not `protojson`. + +## 0.37.2 + +This is a bugfix release addressing two bugs: + +1. A regression introduced in the formatter fix for CVE-2022-23628. +2. Support indices for appending to an array, conforming to JSON Patch (RFC6902) + for patch bundles. + +### Miscellaneous + +- format: generated vars may have a proper location +- storage: Support index for array appends + +## 0.37.1 + +This is a bug fix release that reverts the github.com/prometheus/client_golang +upgrade in v0.37.0. The upgrade exposed an issue in the serialization of Go +runtime metrics in the Status API +([#4319](https://github.com/open-policy-agent/opa/issues/4319)). + +### Miscellaneous + +- Revert "build(deps): bump github.com/prometheus/client_golang (#4307)" + +## 0.37.0 + +This release contains a number of fixes and enhancements. + +This is the first release that includes a binary and a docker image for +`linux/arm64`, `opa_linux_arm64_static` and `openpolicyagent/opa:0.37.0-static`. +Thanks to @ngraef for contributing the build changes necessary. + +### Strict Mode + +There have been numerous possible checks in the compiler that fall into this category: + +1. They would help avoid common mistakes; **but** +2. Introducing them would potentially break some uncommon, but legitimate use. + +We've thus far refrained from introducing them. **Now**, a new "strict mode" +allows you to opt-in to these checks, and we encourage you to do so! + +With *OPA 1.0*, they will become the new default behaviour. + +For more details, [see the docs on _Compiler Strict Mode_](https://www.openpolicyagent.org/docs/v0.37.0/strict/). + +### Delta Bundles + +Delta bundles provide a more efficient way to make data changes by containing +*patches to data* instead of snapshots. +Using them together with [HTTP Long Polling](https://www.openpolicyagent.org/docs/v0.37.0/management-bundles/#http-long-polling), +you can propagate small changes to bundles without waiting for polling delays. + +See [the documentation](https://www.openpolicyagent.org/docs/v0.37.0/management-bundles/#delta-bundles) +for more details. + + +### Tooling and Runtime + +- Bundles bug fix: Roundtrip manifest before hashing to allow changing the manifest + and still using signature verification of bundles ([#4233](https://github.com/open-policy-agent/opa/issues/4233)), + reported by @CristianJena + +- The test runner now also supports custom builtins, when invoked through the Golang + interface (authored by @MIA-Deltat1995) + +- The compile package and the `opa build` command support a new output format: "plan". + It represents a _query plan_, steps needed to take to evaluate a query (with policies). + The plan format is a JSON encoding of the intermediate representation (IR) used for + compiling queries and policies into Wasm. + + When calling `opa build -t plan ...`, the plan can be found in `plan.json` at the top- + level directory of the resulting bundle.tar.gz. + [See the documentation for details.](https://www.openpolicyagent.org/docs/v0.37.0/ir/). + +- Compiler+Bundles: Metadata to be added to a bundle's manifest can now be provided via `WithMetadata` + ([#4289](https://github.com/open-policy-agent/opa/issues/4289)), authored by @marensws, reported by @johanneslarsson +- Plugins: failures in auth plugin resolution are now output, previously panicked, authored by @jcchavezs +- Plugins: Fix error when initializing empty decision logging or status plugin ([#4291](https://github.com/open-policy-agent/opa/issues/4291)) +- Bundles: Persisted bundle activation failures are treated like failures with + non-persisted bundles ([#3840](https://github.com/open-policy-agent/opa/issues/3840)), reported by @dsoguet +- Server: `http.send` caching now works in system policy `system.authz` ([#3946](https://github.com/open-policy-agent/opa/issues/3946)), + reported by @amrap030. +- Runtime: Apply credentials masking on `opa.runtime().config` ([#4159](https://github.com/open-policy-agent/opa/issues/4159)) +- `opa test`: removing deprecated code for `--show-failure-line` (`-l`), authored by @damienjburks +- `opa eval`: add description to all output formats +- `opa inspect`: unhide command for [bundle inspection](https://www.openpolicyagent.org/docs/v0.37.0/cli/#opa-inspect) + +### Rego and Topdown + +Built-in function enhancements and fixes: + +- `object.union_n`: New built-in for creating the union of more than two objects ([#4012](https://github.com/open-policy-agent/opa/issues/4012)), + reported by @eliw00d +- `graph.reachable_paths`: New built-in to calculate the set of reachable paths in a graph (authored by @justinlindh-wf) +- `indexof_n`: New built-in function to get all the indexes of a specific substring (or character) from a string (authored by @shuheiktgw) +- `indexof`: Improved performance (authored by @shuheiktgw) +- `object.get`: Support nested key array for deeper lookups with default (authored by @charlieegan3) +- `json.is_valid`: Use Golang's `json.Valid` to avoid unnecessary allocations (authored by @kristiansvalland) + +Strict-mode features: + +- Add _duplicate imports_ check ([#2698](https://github.com/open-policy-agent/opa/issues/2698)) reported by @mikol +- _Deprecate_ `any()` and `all()` built-in functions ([#2437](https://github.com/open-policy-agent/opa/issues/2437)) +- Make `input` and `data` reserved keywords ([#2600](https://github.com/open-policy-agent/opa/issues/2600)) reported by @jpeach +- Add _unused local assignment_ check ([#2514](https://github.com/open-policy-agent/opa/issues/2514)) + + +Miscellaneous fixes and enhancements: + +- `format`: don't group iterable when one has defaulted location +- `topdown`: ability to retrieve input and plug bindings in the `Event`, authored by @istalker2 +- `print()` built-in: fix bug when used with `with` modifier and a function call value ([#4227](https://github.com/open-policy-agent/opa/issues/4227)) +- `ast`: don't error when future keyword import is redundant during parsing + +### Documentation + +- A [new "CLI" docs section](https://www.openpolicyagent.org/docs/v0.37.0/cli/) describes the various + OPA CLI commands and their arguments ([#3915](https://github.com/open-policy-agent/opa/issues/3915)) +- Policy Testing: Add reference to rule indexing in the context of test code coverage + ([#4170](https://github.com/open-policy-agent/opa/issues/4170)), reported by @ekcs +- Management: Add hint that S3 regional endpoint should be used with bundles (authored by @danoliver1) +- Many broken links were fixed, thanks to @phelewski +- Fix rendering of details: add detail-tab for collapsable markdown (authored by @bugg123) + +### WebAssembly + +- Add native support for `json.is_valid` built-in function + ([#4140](https://github.com/open-policy-agent/opa/issues/4140)), authored by @kristiansvalland +- Dependencies: bump wasmtime-go from 0.32.0 to 0.33.1 + +### Miscellaneous + +- Publish multi-arch image manifest lists including linux/arm64 ([#2233](https://github.com/open-policy-agent/opa/issues/2233)), + authored by @ngraef, reported by @povilasv +- `logging`: Remove logger `GetFields` function ([#4114](https://github.com/open-policy-agent/opa/issues/4114)), + authored by @viovanov +- Website: add versioned docs for latest version, so when 0.37.0 is released, both + https://www.openpolicyagent.org/docs/v0.37.0/ and https://www.openpolicyagent.org/docs/latest + contain docs, and 0.37.0 can already be used for stable links to versioned docs pages. +- Community: Initial draft of the community badges program +- `make test`: fix "too many open files" issue on Mac OS +- Various dependency bumps + +## 0.36.1 + +This release includes a number of documentation fixes. +It also includes the experimental binary for darwin/arm64. + +There are no code changes. + +### Documentation + +- OpenTelemetry: fix configuration example, authored by @rvalkenaers +- Configuration: fix typo for `tls-cert-refresh-period`, authored by @mattmahn +- SSH and Sudo authorization: Add missing filename +- Integration: fix example policy + +### Release + +- Build darwin/arm64 in post tag workflow + +## 0.36.0 + +This release contains a number of fixes and enhancements. + +### OpenTelemetry and opa exec + +This release adds OpenTelemetry support to OPA. This makes it possible to emit spans to an OpenTelemetry collector via +gRPC on both incoming and outgoing (i.e. http.send) calls in the server. See the updated docs on +[monitoring](https://www.openpolicyagent.org/docs/latest/monitoring/) for more information and configuration options +([#1469](https://github.com/open-policy-agent/opa/issues/1469)) authored by @[rvalkenaers](https://github.com/rvalkenaers) + +This release also adds a new `opa exec` command for doing one-off evaluations of policy against input similar to +`opa eval`, but using the full capabilities of the server (config file, plugins, etc). This is particularly useful in +contexts such as CI/CD or when enforcing policy for infrastructure as code, where one might want to run OPA with remote +bundles and decision logs but without having a running server. See the updated docs on +[Terraform](https://www.openpolicyagent.org/docs/latest/terraform/) for an example use case. +([#3525](https://github.com/open-policy-agent/opa/issues/3525)) + +### Built-in Functions + +- Four new functions for working with HMAC (`crypto.hmac.md5`, `crypto.hmac.sha1`, `crypto.hmac.sha256`, and `crypto.hmac.sha512`) was added ([#1740](https://github.com/open-policy-agent/opa/issues/1740)) reported by @[jshaw86](https://github.com/jshaw86) +- `array.reverse(array)` and `strings.reverse(string)` was added for reversing arrays and strings ([#3736](https://github.com/open-policy-agent/opa/issues/3736)) authored by @[kristiansvalland](https://github.com/kristiansvalland) and @[olamiko](https://github.com/olamiko) +- The `http.send` built-in function now uses a metric for counting inter-query cache hits ([#4023](https://github.com/open-policy-agent/opa/issues/4023)) authored by @[mirayadav](https://github.com/mirayadav) +- An overflow issue with dates very far in the future has been fixed in the `time.*` built-in functions ([#4098](https://github.com/open-policy-agent/opa/issues/4098)) reported by @[morgante](https://github.com/morgante) + +### Tooling + +- A problem with future keyword import of `in` was fixed for `opa fmt` ([#4111](https://github.com/open-policy-agent/opa/issues/4111)) reported by @[keshavprasadms](https://github.com/keshavprasadms) +- An issue with `opa fmt` when refs contained operators was fixed (authored by @[jaspervdj-luminal](https://github.com/jaspervdj-luminal)) +- Fix file renaming check in optimization using `opa build` (authored by @[davidmarne-wf](https://github.com/davidmarne-wf)) +- The `allow_net` capability was added, allowing setting limits on what hosts can be reached in built-ins like `http.send` and `net.lookup_ip_addr` ([#3665](https://github.com/open-policy-agent/opa/issues/3665)) + +### Server + +- A new credential provider for AWS credential files was added ([#2786](https://github.com/open-policy-agent/opa/issues/2786)) reported by @[rgueldem](https://github.com/rgueldem) +- The new `--tls-cert-refresh-period` flag can now be provided to `opa run`. If used with a positive duration, such as "5m" (5 minutes), + "24h", etc, the server will track the certificate and key files' contents. When their content changes, the certificates will be + reloaded ([#2500](https://github.com/open-policy-agent/opa/issues/2500)) reported by @[patoarvizu](https://github.com/patoarvizu) +- A new `v1/status` endpoint was added, providing the same data as the status plugin would send to a remote endpoint ([#4089](https://github.com/open-policy-agent/opa/issues/4089)) +- The HTTP router of OPA is now exposed to the plugin manager ([#2777](https://github.com/open-policy-agent/opa/issues/2777)) authored by @[bhoriuchi](https://github.com/bhoriuchi) reported by @[mneil](https://github.com/mneil) +- Calling `print` now works in decision masking policies +- An unintended switch between long/regular polling on 304 HTTP status was fixed ([#3923](https://github.com/open-policy-agent/opa/issues/3923)) authored by @[floriangasc](https://github.com/floriangasc) +- The error message about prohibited config in the discovery plugin has been improved +- The discovery plugin no longer panics in Trigger() if downloader is nil +- The bundle plugin now ignores service errors for file:// resources +- The bundle plugin file loader was updated to support directories +- A timer to HTTP request was added to the downloader +- The requested_by field in the logging plugin is now optional + +### Rego + +- The error message raised when using `-` with a number and a set is now more specific (as opposed to the correct usage with two sets, or two numbers) ([#1643](https://github.com/open-policy-agent/opa/issues/1643)) +- Fixed an edge case when using print and arrays in unification ([#4078](https://github.com/open-policy-agent/opa/issues/4078)) +- Improved performance of some array operations by caching an array's groundness bit ([#3679](https://github.com/open-policy-agent/opa/issues/3679)) +- ⚠️ Stricter check of arity in undefined function stage ([#4054](https://github.com/open-policy-agent/opa/issues/4054)). + This change will fail evaluation in some unusual cases where it previously would succeed, but these policies should be very uncommon. + + An example policy that previously would succeed but no longer will (wrong arity): + +```rego +package policy + +default p = false +p { + x := is_blue() + input.bar[x] +} + +is_blue(fruit) = y { # doesn't use fruit + y := input.foo +} +``` + +### SDK + +- The `opa.runtime()` built-in is now made available to the SDK ([#4050](https://github.com/open-policy-agent/opa/issues/4050) authored by @[oren-zohar](https://github.com/oren-zohar) and @[cmschuetz](https://github.com/cmschuetz) +- Plugins are now exposed on the SDK object +- The SDK now supports graceful shutdown ([#3980](https://github.com/open-policy-agent/opa/issues/3980)) reported by @[brianchhun-chime](https://github.com/brianchhun-chime) +- `print` output is now sent to the configured logger + +### Website and Documentation + +- All pages in the docs now have a feedback button ([#3664](https://github.com/open-policy-agent/opa/issues/3664)) authored by @[alan-ma](https://github.com/alan-ma) +- The Kafka docs have been updated to use the new Kafka plugin, and to use the OPA management APIs +- The Terraform tutorial was updated to use `opa exec` ([#3965](https://github.com/open-policy-agent/opa/issues/3965)) +- The docs on Contributing as well as the Vendor Guidelines have been updated +- The term "whitelist" has been replaced by "allowlist" across the docs +- A simple destructuring assignment example was added to the docs +- The docs have been reviewed on the use of assignment, equality and comparison operators, to make sure they follow best practice + +### CI + +- SHA256 checksums of CI builds now published to release directory ([#3448](https://github.com/open-policy-agent/opa/issues/3448)) authored by @[johanneslarsson](https://github.com/johanneslarsson) reported by @[raesene](https://github.com/raesene) +- golangci-lint upgraded to v1.43.0 (authored by @[shuheiktgw](https://github.com/shuheiktgw)) +- The build now creates an executable for darwin/arm64. This should work as expected, but is currently tested in the CI pipeline like the other binaries +- PRs targeting the [ecosystem](https://www.openpolicyagent.org/docs/latest/ecosystem/) page are now checked for mistakes using Rego policies + +## 0.35.0 + +This release contains a number of fixes and enhancements. + +### Early Exit Optimization + +This release adds an early exit optimization to the evaluator. With this optimization, the evaluator stops evaluating rules when an answer has been found and subsequent evaluation would not yield any new answers. The optimization is automatically applied to complete rules and functions that meet specific requirements. For more information see the [Early Exit in Rule Evaluation](https://www.openpolicyagent.org/docs/latest/policy-performance/#early-exit-in-rule-evaluation) section in the docs. [#2092](https://github.com/open-policy-agent/opa/issues/2092) + +### Built-in Functions + +- The `net.lookup_ip_addr` function was added to allow policies to resolve hostnames to IPv4/IPv6 addresses ([#3993](https://github.com/open-policy-agent/opa/issues/3993)) +- The `http.send` function has been improved to close TCP connections quickly after receiving the HTTP response and avoid creating HTTP clients unnecessarily when a cached response exists ([#4015](https://github.com/open-policy-agent/opa/issues/4015)). This change reduces the number of open file descriptors required in high-throughput environments and prevents OPA from encountering ulimit errors. + +### Rego + +- `print()` calls in the head of rules no longer cause runtime errors ([#3967](https://github.com/open-policy-agent/opa/issues/3967)) +- Type errors for calls to undefined functions no longer contain rewritten variable names ([#4031](https://github.com/open-policy-agent/opa/issues/4031)) +- The `rego.SkipPartialNamespace` option now correctly sets the flag on the partial evaluation queries (previously it would always set the value to `true`) ([#3996](https://github.com/open-policy-agent/opa/issues/3996)) authored by @[thomascoquet](https://github.com/thomascoquet) +- The internal set implementation has been updated to insert elements in sorted order rather than lazily sorting during comparisons. +- Fixed `import` alias parsing bug identified by fuzzer ([#3988](https://github.com/open-policy-agent/opa/issues/3988)) + +### WebAssembly + +- The Golang SDK will now issue a `grow()` call if the `input` document exceeds the available memory space. +- The `malloc()` implementation will now call `opa_abort` if the `grow()` call fails. + +### Server + +- The decision logger adapts upload chunk sizes based on previous outputs. This allows the decision loggger to encode significantly more decisions into each upload chunk, thereby reducing heap usage for buffered decisions. For more information on the adapative chunking behaviour, see the [Decision Logs](https://www.openpolicyagent.org/docs/latest/management-decision-logs/) page in the docs. +- The decision logger can be configured to send records to a custom plugin as well as an HTTP endpoint at the same time ([#4013](https://github.com/open-policy-agent/opa/issues/4013)) +- `print()` calls from the `system.authz` policy are now included in the logs ([#4048](https://github.com/open-policy-agent/opa/issues/4048)) +- OPA can use an [Azure Managed Identities Token](https://www.openpolicyagent.org/docs/latest/configuration/#azure-managed-identities-token) to authenticate with control plane services ([#3916](https://github.com/open-policy-agent/opa/issues/3916)) authored by @[Scowluga](https://github.com/Scowluga). +- The logging configuration will be correctly applied to service clients so that DEBUG logs are surfaced ([#4071](https://github.com/open-policy-agent/opa/issues/4071)) + +### Tooling + +- The `opa fmt` command will not generate a line-break when there are generated variables in a function call ([#4018](https://github.com/open-policy-agent/opa/issues/4018)) reported by @[torsrex](https://github.com/torsrex) +- The `opa inspect` command no longer prints a blank namespace when a data.json file is included at the root ([#4022](https://github.com/open-policy-agent/opa/issues/4022)) +- The `opa build` command will output debug messages if an optimized entrypoint is discarded. + +### Website and Documentation + +- The website has been updated to build with Hugo 0.88.1 ([#3787](https://github.com/open-policy-agent/opa/issues/3787)) +- The version picker in the documentation is now scrollable ([#3955](https://github.com/open-policy-agent/opa/issues/3955)) authored by @[orweis](https://github.com/orweis) +- The description of the `urlquery` built-in functions have been clarified ([#1592](https://github.com/open-policy-agent/opa/issues/1592)) reported by @[klarose](https://github.com/klarose) +- The decision logger documentation has been improved to cover controls for large-scale environments ([#3976](https://github.com/open-policy-agent/opa/issues/3976)) +- The "strict built-in errors" mode is now covered in the docs along with built-in function error behaviour ([#3686](https://github.com/open-policy-agent/opa/issues/3686)) +- The OAuth2 and OIDC examples around key rotation and caching have been improved + +### CI + +- Issues and PRs that have not seen activity in 30 days will be automatically marked as "inactive" +- The `Makefile` can now produce Docker images for other architectures. We do not yet publish binaries or images for non-amd64 architectures however if you want to build OPA yourself, the `Makefile` does not prohibit it. + +### Backwards Compatibility + +- The diagnostics buffer in the OPA server has been completely removed as part of the deprecation and removal of the diagnostic feature ([#1052](https://github.com/open-policy-agent/opa/issues/1052)) + +## 0.34.2 + +### Fixes + +- ast: Fix print call rewriting for calls in head ([#3967](https://github.com/open-policy-agent/opa/issues/3967)) + +## 0.34.1 + +### Fixes + +- runtime: Fix logging configuration (#3959) ([#3958](https://github.com/open-policy-agent/opa/issues/3958)) + +## 0.34.0 + +This release includes a number of enhancements and fixes. In particular, this +release adds a new keyword for membership and iteration (`in`) and a specialized +built-in function (`print`) for debugging. + +### The `in` operator + +This release adds a new `in` operator that provides syntactic sugar for +references that perform membership tests or iteration on collections (i.e., +arrays, sets, and objects.) The following table shows common patterns for arrays +with the old and new syntax: + +Pattern | Existing Syntax | New Syntax +--- | --- | --- +Check if 7 exists in array | `7 == arr[_]` | `7 in arr` +Check if 7 does not exist in array | n/a (requires helper rule) | `not 7 in arr` +Iterate over the elements of array | `x := arr[_]` | `some x in arr` + +For more information on the `in` operator see [Membership and iteration: +`in`](https://www.openpolicyagent.org/docs/edge/policy-language/#membership-and-iteration-in) +in the docs. + +### The `print` function + +This release adds a new `print` function for debugging purposes. The `print` +function can be used to output any value inside of the policy. The `print` +function has special handling for _undefined_ values so that execution does not +stop if any of the operands are undefined. Instead, a special marker is emitted +in the output. For example: + +```rego +package example + +default allow = false + +allow { + print("the subject's username is:", input.subject.username) + input.subject.username == "admin" +} +``` + +Given the policy above, we can see the output of the `print` function via STDERR when using `opa eval`: + +```bash +echo '{"subject": {"username": "admin"}}' | opa eval -d policy.rego -I -f pretty 'data.example.allow' +``` + +Output: + +``` +the subject's username is: admin +true +``` + +If the username, subject, or entire input document was undefined, the `print` function will still execute: + +```bash +echo '{}' | opa eval -d policy.rego -I -f pretty 'data.example.allow' +``` + +Output: + +``` +the subject's username is: +false +``` + +The `print` function is integrated into the `opa` subcommands, REPL, server, VS +Code extension, and the playground. Library users must opt-in to `print` +statements. For more information see the +[Debugging](https://www.openpolicyagent.org/docs/edge/policy-reference/#debugging) +section in the docs. + +### Enhancements + +- SDK: Allow map of plugins to be passed to SDK ([#3826](https://github.com/open-policy-agent/opa/issues/3826)) authored by @[edpaget](https://github.com/edpaget) +- `opa test`: Change exit status when tests are skipped ([#3773](https://github.com/open-policy-agent/opa/issues/3773)) authored by @[kirk-patton](https://github.com/kirk-patton) +- Bundles: Improve loading performance ([#3860](https://github.com/open-policy-agent/opa/issues/3860)) authored by @[0xAP](https://github.com/0xAP) +- `opa fmt`: Keep new lines in between function arguments ([#3836](https://github.com/open-policy-agent/opa/issues/3836)) reported by @[anbrsap](https://github.com/anbrsap) +- `opa inspect`: Add experimental subcommand for bundle inspection ([#3754](https://github.com/open-policy-agent/opa/issues/3754)) + +### Fixes + +- Bundles/API: When deleting a policy, the check determining if it's bundle-owned was using the path prefix, which would yield false positives under certain circumstances. + It now checks the path properly, piece-by-piece. ([#3863](https://github.com/open-policy-agent/opa/issues/3863) authored by @[edpaget](https://github.com/edpaget) +- CLI: Using `--set` with null value _again_ translates to empty object ([#3846](https://github.com/open-policy-agent/opa/issues/3846)) +- Rego: Forbid dynamic recursion with hidden (`system.*`) document ([#3876](https://github.com/open-policy-agent/opa/issues/3876) +- Rego: Raise conflict errors in functions when output not captured ([#3912](https://github.com/open-policy-agent/opa/issues/3912)) + + This change has the potential to break policies that previously evaluated successfully! + See _Backwards Compatibility_ notes below for details. +- Experimental disk storage: React to "txn too big" errors ([#3879](https://github.com/open-policy-agent/opa/issues/3879)), reported and authored by @[floriangasc](https://github.com/floriangasc) + +### Documentation + +- Kubernetes and Istio: Update tutorials for recent Kubernetes versions ([#3910](https://github.com/open-policy-agent/opa/issues/3910)) authored by @[olamiko](https://github.com/olamiko) +- Deployment: Add section about Capabilities ([#3769](https://github.com/open-policy-agent/opa/issues/3769)) +- Built-in functions: Add warning to `http.send` and extension docs about side-effects in other systems (#3922) ([#3893](https://github.com/open-policy-agent/opa/issues/3893)) +- Docker Authorization: The tutorial now uses a Bundles API server. +- SDK: An example of SDK use is provided. + +### Miscellaneous + +- Runtime: Refactor logger usage -- see below for *Backwards Compatibility* notes. +- Wasm: fix an issue with undefined, plain `input` references ([#3891](https://github.com/open-policy-agent/opa/issues/3891)) +- test/e2e: Extend TestRuntime to avoid global fixture +- types: Fix Arity function to return zero when type is known (#3932) +- Wasm/builder: bump LLVM to 13.0.0, latest versions of wabt and binaryen (#3908) +- Wasm: deal with importing memory in the compiler (#3763) + +### Backwards Compatibility + +* Function return values need to be well-defined: for a single input `x`, the function's + output `f(x)` can only be one value. When evaluating policies, this condition had not + been ensured for function calls that don't make use of their values, like + + ```rego + package p + r { + f(1) + } + f(_) = true + f(_) = false + ``` + + Before, `data.p.r` evaluated to `true`. Now, it will (correctly) return an error: + + eval_conflict_error: functions must not produce multiple outputs for same inputs + + In more realistic settings, this can be encountered when true/false return values + are captured and returned where they don't need to be: + + ```rego + package p + r { + f("any", "baz") + } + f(path, _) = r { + r := path == "any" + } + f(path, x) = r { + r := glob.match(path, ["/"], x) + } + ``` + + In this example, any function input containing `"any"` would make the function yield + two different results: + + 1. The first function body returns `true`, matching the `"any"` argument. + 2. The second function body returns the result of the `glob.match` call -- `false`. + + The fix here would be to _not_ capture the return value in the function bodies: + + ```rego + f(path, _) { + path == "any" + } + f(path, x) { + glob.match(path, ["/"], x) + } + ``` + +* The `github.com/open-policy-agent/opa/runtime#NewLoggingHandler` function now + requires a logger instance. Requiring the logger avoids the need for the + logging handler to depend on the global logrus logger (which is useful for + test purposes.) This change is unlikely to affect users. + +## 0.33.1 + +This is a bugfix release addressing an issue in the formatting of rego code that contains +object literals. With the last release, those objects would under some conditions have their +keys re-ordered, with some of them put into a single line. + +Thanks to @[iainmcgin](https://github.com/iainmcgin) for reporting. + +### Fixes + +- format: make groupIterable sort by row ([#3849](https://github.com/open-policy-agent/opa/issues/3849)) + +## 0.33.0 + +This release includes a number of improvements and fixes. + +### Built-in Functions + +This release introduces `crypto.x509.parse_rsa_private_key` so that policy authors can decode RSA private keys and structure them as JWKs ([#3765](https://github.com/open-policy-agent/opa/issues/3765)). Authored by @[cris-he](https://github.com/cris-he). + +### Fixes + +- Fix object comparison to avoid sorting keys in-place. This prevents the interpreter from generating non-deterministic results when values are inserted into the partial set memoization cache. ([#3819](https://github.com/open-policy-agent/opa/issues/3819)) +- Fix data races in `ast` package caused by sorting `types.Any` instances in-place and shallow-copying module comments when a deep-copy should be performed ([#3793](https://github.com/open-policy-agent/opa/issues/3793)). Reported by @[markushinz](https://github.com/markushinz). +- Fix "file name too long" error caused by bundle loader treating PEM encoded private keys as file paths ([#3766](https://github.com/open-policy-agent/opa/issues/3766)) +- Fix plugins to support manual triggering mode when discovery is disabled ([#3797](https://github.com/open-policy-agent/opa/issues/3797)) + +### Server & Tooling + +- The server now supports policy-based health checks that can inspect the state of plugins and other internal components ([#3759](https://github.com/open-policy-agent/opa/issues/3759)) authored by @[gshively11](https://github.com/gshively11) +- The bundle reader now loads files lazily to avoid hitting file descriptor limits ([#3777](https://github.com/open-policy-agent/opa/issues/3777)). Authored by @[bhoriuchi](https://github.com/bhoriuchi) +- The `opa eval` sub-command supports a `--timeout` option for limiting how long evaluation can run. + +### Rego + +- The type checker now supports variadic arguments on void functions. This change paves the way for `print()` support as well as variadic arguments on all functions. +- The parser now memoizes term parsing. This prevents non-linear runtime for large nested objects and sets. + +### CI & Dependencies + +- Fix spurious build errors in wasm library. +- Update wasmtime dependency to v0.30.0. +- Run PR checks on macOS in addition to Linux ([#3176](https://github.com/open-policy-agent/opa/issues/3176)). + +### Documentation + +- Update the Kubernetes and Envoy (standalone) tutorials to show how the OPA management APIs can be used to distribute policies. + +### Backwards Compatibility + +* The `github.com/open-policy-agent/opa/ast#ArgErrDetail` struct has been + modified to use the new `types.FuncArgs` struct to represent the required + arguments. Callers that depend on the exact structure of the error details + must update to use the `types.FuncArgs` struct. + +## 0.32.1 + +This is a bugfix release to address a problem related to mismatching checksums in the official go mod proxy. +As a consequence, users with code depending on the OPA Go module that bypassed the proxy would see an error like + + go get github.com/google/flatbuffers/go: github.com/google/flatbuffers@v1.12.0: verifying module: checksum mismatch + downloaded: h1:N8EguYFm2wwdpoNcpchQY0tPs85vOJkboFb2dPxmixo= + sum.golang.org: h1:/PtAHvnBY4Kqnx/xCQ3OIV9uYcSFGScBsWI3Oogeh6w= + +**Be aware** that Github's Dependabot feature makes use of that check, and will start to _fail_ for projects using the OPA Go module version 0.32.0. + +There workaround applied to OPA is to replace to flatbuffers dependency's version manually. + +For more information, see +- https://github.com/google/flatbuffers/issues/6466: The issue has been discussed upstream, and a 1.12.1 release has been published to address it. +- https://github.com/dgraph-io/badger/pull/1746: OPA transitively depends on the flatbuffer package because of badger. + +There are *no functional changes* in this bugfix release. +If you use the container images, or the published binaries, of OPA 0.32.0, you are **not affected** by this. + +Many thanks to [James Alseth](https://github.com/jalseth) for triaging this, and engaging with upstream to fix this. + +## 0.32.0 + +This release includes a number of improvements and fixes. + +### 💾 Disk-based Storage (Experimental) + +This release adds a disk-based storage implementation to OPA. The implementation can be found in [github.com/open-policy-agent/storage/disk](https://pkg.go.dev/github.com/open-policy-agent/opa/storage/disk). There is also an example in the [`rego` package](https://pkg.go.dev/github.com/open-policy-agent/opa/rego#pkg-examples) that shows how policies can be evaluated with the disk-based store. The disk-based store is currently only available as a library (i.e., it is not integrated into the rest of OPA yet.) In the next few releases, we are planning to integrate the implementation into the OPA server and provide tooling to help leverage the disk-based store. + +### Built-in Functions + +This release includes a few improvements to existing built-in functions: + +- The `http.send` function now supports UNIX domain sockets ([#3661](https://github.com/open-policy-agent/opa/issues/3661)) authored by @[kirk-patton](https://github.com/kirk-patton) +- The `units.parse_bytes` function now supports E* and P* units ([#2911](https://github.com/open-policy-agent/opa/issues/2911)) +- The `io.jwt.encode_sign` function uses the built-in context randomization source (which is helpful for replay purposes) + +### Server + +This release includes multiple improvements for OPA server deployments in serverless environments: + +- Plugins can now be triggered manually within OPA. This feature allows users extending and customizing OPA to control exactly when operations like bundle downloads and decision log uploads occur. The built-in plugins now include a `trigger` configuration that can be set to `manual` or `periodic` (which is the default). When `manual` triggering is enabled, the plugins WILL NOT perform any periodic/background operations. Instead, the plugins will only execute when the [`Trigger`](https://github.com/open-policy-agent/opa/blob/main/plugins/plugins.go#L101) API is invoked. +- Plugins can now wait for server initialization. When runtime initialization is finished, plugins can be notified. This allows plugins to synchronize their behaviour with server startup. [#3701](https://github.com/open-policy-agent/opa/issues/3701) authored by @[gshively11](https://github.com/gshively11). +- The [Health API](https://www.openpolicyagent.org/docs/latest/rest-api/#health-api) now supports an `exclude-plugin` parameter to control which plugins are checked. [#3713](https://github.com/open-policy-agent/opa/issues/3713) authored by @[gshively11](https://github.com/gshively11). + +### Tooling + +- The compiler no longer fetches remote schemas by default when used as as library. Capabilities have been updated to include an `allow_net` field to control whether network operations can be performed ([#3746](https://github.com/open-policy-agent/opa/issues/3746)). This field is only used to control schema fetching today. In future versions of OPA, the `allow_net` parameter will be used to control other behaviour like `http.send`. +- The `WebAssembly runtime not supported` error message has been improved [#3739](https://github.com/open-policy-agent/opa/pull/3739). + +### Rego + +- Added support for `anyOf` and `allOf` keywords in JSON schema support in the type checker ([#3592](https://github.com/open-policy-agent/opa/issues/3592)) authored by [@jchen10500](https://github.com/jchen10500) and [@juliafriedman8](https://github.com/juliafriedman8). +- Added support for custom JSON result marshalling in the `rego` package. +- Added a new convenience function (`Allowed() bool`) to the `rego.ResultSet` API. +- Improved string-representation construction performance for arrays, sets, and objects. +- Improved the topdown evaluator to support `ast.Value` results from the store so that unnecessary conversions can be avoided. +- Improved the `rego` package to make the wasmtime-go dependency optional at build-time ([#3545](https://github.com/open-policy-agent/opa/issues/3545)). +- Fixed a bug in the comprehension indexer whereby index keys were not constructed correctly leading to incorrect outputs ([#3579](https://github.com/open-policy-agent/opa/issues/3579)). +- Fixed a stack overflow during partial evaluation due to incorrect term rewriting in the copy propagation implementation ([#3071](https://github.com/open-policy-agent/opa/issues/3071)). +- Fixed a bug in partial evaluation when shallow inlinign is enabled that resulted in built-in functions being invoked instead of saved ([#3681](https://github.com/open-policy-agent/opa/issues/3681)). + +### WebAssembly + +- The internal Wasm SDK now supports the inter-query built-in cache. +- The pre-compiled runtime is now built with llvm 12.0.1 and the builder image includes clang-format. +- The internal Wasm SDK has been updated to use wasmtime-go v0.29.0. + +### Documentation + +This release includes a number of documentation improvements: + +- The wasm `opa_eval` arguments have been clarified [#3699](https://github.com/open-policy-agent/opa/issues/3696) +- The contributing and development guide have been moved into a dedicated [Contributing](https://www.openpolicyagent.org/docs/latest/contributing/) section on the website [#3751](https://github.com/open-policy-agent/opa/issues/3751) +- The Envoy standalone tutorial includes cleanup steps now (thanks [@princespaghetti](https://github.com/princespaghetti)) +- Various typos have been fixed by multiple folks (thanks [@Tej-Singh-Rana](https://github.com/Tej-Singh-Rana) [@gujun4990](https://github.com/gujun4990)) +- The Kubernetes ingress validation tutorial has been updated to include new mandatory attributes and newer API versions (thanks [@ereslibre](https://github.com/ereslibre)) +- The recommendations around using OPA Gatekeeper have been improved. + +### Infrastructure + +- OPA is now built with Go v1.17 and CI jobs have been added to ensure OPA builds with older versions of Go. + +### Backwards Compatibility + +The `rego` package no longer relies on build constraints to enable the Wasm runtime. Instead, library users must opt-in to Wasm runtime support by adding an import statement in the Go code: + +```go +import _ "github.com/open-policy-agent/opa/features/wasm" +``` + +This change ensures that (by default) the wasmtime-go blobs are not vendored in projects that embed OPA as a library. If you are currently relying on the Wasm runtime support in the `rego` package (via the `rego.Target("wasm")` option), please update you code to include the import above. See [#3545](https://github.com/open-policy-agent/opa/issues/3545) for more details. + +## 0.31.0 + +This release contains **performance improvements** for evaluating partial sets and objects, +and introduces a new ABI call to OPA's Wasm modules to speed up Wasm evaluations. + +It also comes with an improvement for checking policies -- unsafe declared variables are now caught at compile time. +This means that **some policies** that have been working fine with previous versions, because their unsafe variables +had not ever been queried, will fail to compile with OPA 0.31.0. +See below for details and what to do about that. + +### Spotlights + +#### Partial Sets and Objects Performance + +Resolving an issue ([#822](https://github.com/open-policy-agent/opa/issues/822)) created on July 4th 2018, +OPA can now cache the results of partial sets and partial objects. + +A benchmark that accesses a partial set of increasing size _twice_ shows a saving of more than 50%: + + name old time/op new time/op delta + PartialRuleSetIteration/10-16 230µs ±10% 101µs ± 3% -56.10% (p=0.000 n=10+10) + PartialRuleSetIteration/100-16 13.4ms ± 9% 5.5ms ± 9% -58.74% (p=0.000 n=10+9) + PartialRuleSetIteration/1000-16 1.31s ±10% 0.51s ± 8% -61.12% (p=0.000 n=10+9) + + name old alloc/op new alloc/op delta + PartialRuleSetIteration/10-16 77.7kB ± 0% 35.8kB ± 0% -53.94% (p=0.000 n=10+10) + PartialRuleSetIteration/100-16 3.72MB ± 0% 1.29MB ± 0% -65.26% (p=0.000 n=10+10) + PartialRuleSetIteration/1000-16 365MB ± 0% 114MB ± 0% -68.86% (p=0.000 n=10+10) + + name old allocs/op new allocs/op delta + PartialRuleSetIteration/10-16 1.84k ± 0% 0.69k ± 0% -62.42% (p=0.000 n=10+10) + PartialRuleSetIteration/100-16 99.3k ± 0% 14.5k ± 0% -85.43% (p=0.000 n=10+9) + PartialRuleSetIteration/1000-16 10.0M ± 0% 1.0M ± 0% -89.58% (p=0.000 n=10+9) + +These numbers were gathered querying `fixture[i]; fixture[j]` with a policy of + +```rego +fixture[x] { + x := numbers.range(1, n)[_] +} +``` +where `n` is 10, 100, or 1000. + +There are multiple access patterns that are accounted for: if a _ground_ scalar is used to +access a previously not-cached partial rule, + +```rego +allow { + managers[input.user] # here +} + +managers[x] { + # some logic here +} +``` + +the evaluation algorithm will calculate the set membership of `input.user` _only_, and cache the result. + +If there is a query that requires evaluating the entire partial, however, the algorithm will also cache the entire partial: +```rego +allow { + some person + managers[person] + # more expressions +} + +managers[x] { + # some logic here +} +``` +thus avoiding extra evaluations later on. +The same is true if `managers` was used as a fully materialized set in an execution. + + +This also means that the question about whether to write + +```rego +q = { x | ... } # set comprehension +``` + +or + +```rego +q[x] { ... } # partial set rule +``` + +becomes much less important for policy evaluation performance. + +#### WebAssembly Performance + +OPA-generated Wasm modules have gotten a fast-path evaluation method: +By calling the one-off function + + opa_eval(reserved, entrypoint, data_addr, input_addr, input_len, format) + +which returns a pointer to the serialized result set (in JSON if format is 0, "value" format if 1), +the number of VM calls needed for evaluating a policy via Wasm is drastically reduced. + +The performance benefit is huge: + + name old time/op new time/op delta + WasmRego-16 84.3µs ± 6% 15.1µs ± 0% -82.07% (p=0.008 n=5+5) + +The added `opa_eval` export comes with an ABI bump to version 1.2. +See [#3627](https://github.com/open-policy-agent/opa/pull/3627) for all details. + +Along the same line, we've examined the processing of query evaluations that are Wasm-backed _through the `rego` package_. +This allowed us to avoid unneccessary work ([#3666](https://github.com/open-policy-agent/opa/issues/3666)). + + +#### Unsafe declared variables now cause a compile-time error + +Before this release, local variables that had been _declared_, i.e. introduced via the `some` keyword, had been able +to slip through the safety checks unnoticed. + +For example, a policy like + +```rego +package demo + +q { + input == "open sesame" +} + +p[x] { + some x +} +``` + +would have _not_ caused any error **if `data.demo.p` wasn't queried**. +Querying `data.demo.p` would return an "var requires evaluation" error. + +With this release, the erroneous rule no longer goes unnoticed, but is **caught at compile time**: "var x is unsafe". + +The most likely fix is to remove the rule with the unsafe variable, since it cannot have contributed to a successful +evaluation in previous OPA versions. + +See [#3580](https://github.com/open-policy-agent/opa/issues/3580) for details. + +### Topdown and Rego + +- New built-in function: `crypto.x509.parse_and_verify_certificates` ([#3601](https://github.com/open-policy-agent/opa/issues/3601)), authored by @[jalseth](https://github.com/jalseth) + + This function enables you to verify that there is a chain from a leaf certificate back to the trusted root. +- New built-in function: `rand.intn` generates a random number between `0` and `n` ([#3615](https://github.com/open-policy-agent/opa/issues/3615)), authored by @[base698](https://github.com/base698) + + The function takes a string argument to ensure that the same call, within one policy evaluation, returns the same random number. +- `http.send` enhancement: New `caching_mode` parameter to configure if deserialized or serialized response bodies should be cached ([#3599](https://github.com/open-policy-agent/opa/issues/3599)) +- Custom built-in function enhancement: let custom builtins halt evaluation ([#3534](https://github.com/open-policy-agent/opa/issues/3534)) +- Partial evaluation: Fix stack overflow on certain expressions ([#3559](https://github.com/open-policy-agent/opa/issues/3559)) + +### Tooling + +- Query Profiling: `opa eval --profile` now supports a `--count=#` flag to gather metrics and profiling data over multiple runs, and displays aggregate statistics for the results ([#3651](https://github.com/open-policy-agent/opa/issues/3651)). + + This allows you to gather more robust numbers to assess policy performance. + +- Docker images: Publish static image ([#3633](https://github.com/open-policy-agent/opa/issues/3633)) + + As of this release, you can use the staticly-built Linux binary from a docker image: `openpolicyagent/opa:0.31.0-static`. + It contains the same binary that has been published since release v0.29.4, statically linked to musl, with evaluating Wasm disabled. + +### Fixes + +- Built-in `http.send`: ignore `tls_use_system_certs` setting on Windows. Having this set to _true_ (the default as of v0.29.0) would _always_ return an error on Windows. +- The console decision logger is no longer tied to the general log level ([#3654](https://github.com/open-policy-agent/opa/issues/3654)) +- Update query compiler to reject empty queries ([#3625](https://github.com/open-policy-agent/opa/issues/3625)) +- Partial Evaluation fix: Don't generate comprehension with unsafe variables ([#3557](https://github.com/open-policy-agent/opa/issues/3557)) +- Parser: modules containing _only_ tabs and spaces no longer lead to a runtime panic. +- Wasm: ensure that the desired stack space for the C library calls (64KiB) is not reduced by data segments added in the compiler. + This is achieved by putting the stack first -- stack overflows now become "out of bounds" memory access traps. + Before, it would silently corrupt the static data. + +### Server and Runtime + +- New configuration for Management APIs: using `resource`, the request path for sending decision logs can be configured now ([#3618](https://github.com/open-policy-agent/opa/issues/3618)), authored by @[cbuto](https://github.com/cbuto) + + `/logs` is still the default, but can now be overridden. + With this change, the `partition_name` config becomes deprecated, since its functionality is subsumed by this new configurable. + +### Documentation + +- How to debug? Clarify how to access `Note` events for debugging via explanations ([#3628](https://github.com/open-policy-agent/opa/issues/3628)) authored by @[enori](https://github.com/enori) +- Clarify special characters for key, i.e. what `x["y"]` is necessary because `x.y` isn't valid ([#3638](https://github.com/open-policy-agent/opa/issues/3638)) authored by @[Hongbo-Miao](https://github.com/Hongbo-Miao) +- Management APIs: Remove deprecated fields from docs +- Policy Reference: add missing backtick; `type_name` builtin is natively implemented in Wasm + +## 0.30.2 + +This is a bugfix release that modifies the AWS credential provider to use POST +instead of GET for retrieving AWS STS tokens. The GET method can leak +credentials into the debug log if the AWS STS endpoint is unavailable. + +## 0.30.1 + +This is a bugfix release to correct the behaviour of the `indexof` builtin ([#3606](https://github.com/open-policy-agent/opa/issues/3606)). +In v0.30.0, it only checked the first character of the substring to be found: `indexof("foo", "fox")` erroneously returned 0 instead of -1. + +### Miscellaneous + +- wasm-sdk: Fix typo in non-wasm error message, authored by @[olivierlemasle](https://github.com/olivierlemasle) + +## 0.30.0 + +This release contains a number of enhancements and fixes. + +### Server and Runtime + +- Support listening on abstract Unix Domain Sockets ([#3533](https://github.com/open-policy-agent/opa/issues/3533)) authored by @[amanymous-net](https://github.com/amanymous-net) +- Support minimum TLS version configuration, default to 1.2 ([#3226](https://github.com/open-policy-agent/opa/issues/3226)) authored by @[kale-amruta](https://github.com/kale-amruta) +- Enhancement in REST Plugin: You can now specify a CA cert for remote services implementing the management APIs (bundles, status, decision logs, discovery) ([#1954](https://github.com/open-policy-agent/opa/issues/1954)) +- Bugfix: treat missing/empty roots as owning all paths ([#3521](https://github.com/open-policy-agent/opa/issues/3521)) + + Before, it would have been possible to overwrite a policy that was supplied by a bundle (with an empty manifest, or a manifest without declared roots), due to an erroneous check. + This will now be forbidden, and return a 400 HTTP status, in accordance with the documentation. +- Extend POST v1/query endpoint to accept input, refactor index.html to use fetch() +- Bundle download: In case of download or activation errors, the cached Etag is reset to the last successful activation. Previously OPA would reset the cached Etag entirely, which could trigger unnecessary bundle downloads in edge-case scenarios. + +### Tooling + +- `opa build`: Do not write manifest if empty ([#3480](https://github.com/open-policy-agent/opa/issues/3480)). Under the hood, the manifest metadata is now included in the Equal() function's checks. +- `opa fmt`: Fix incorrect help text ([#3518](https://github.com/open-policy-agent/opa/issues/3518)) authored by @[andrehaland](https://github.com/andrehaland) +- `opa bench`: Do not print nil errors ([#3530](https://github.com/open-policy-agent/opa/issues/3530)) + +### Rego + +- Expose random seeding in rego package ([#3560](https://github.com/open-policy-agent/opa/issues/3560)) +- Enhance `ast.InterfaceToValue` to handle non-native types +- Enhance indexer to understand function args +- Enhance static property lookup of objects: Use binary search +- Fix PE unknown check to avoid saving unnecessarily ([#3552](https://github.com/open-policy-agent/opa/issues/3552)) +- Fix inlining controls for functions ([#3463](https://github.com/open-policy-agent/opa/issues/3463)) +- Fix (shallow) partial eval of ref to empty collection in presence of `with` statement ([#3420](https://github.com/open-policy-agent/opa/issues/3420)) +- Fix cache value size checking during insert operation +- Fix `indexof` when using UTF-8 characters +- Fix `http.send` flaky test + +#### Wasm + +- SDK: update wasmtime-go to 0.28.0, authored by @[olivierlemasle](https://github.com/olivierlemasle) +- Bugfix: count() now counts invalid UTF-8 runes (previously aborted) +- Compiler: emit unreachable instruction after opa_abort() + +### Miscellaneous + +- `make check` now uses golangci-lint via docker, authored by @[willbeason](https://github.com/willbeason) +- The statically-built linux binary is properly used in the make targets that need it, and published to edge binaries. +- Built binaries are now smoke tested on Windows, macos, and Linux. +- Fix test failing with Go 1.17 rc in gojsonschema ([#3589](https://github.com/open-policy-agent/opa/issues/3589)) authored by @[olivierlemasle](https://github.com/olivierlemasle) +- Build: Bump Go version to 1.16.3 ([#3555](https://github.com/open-policy-agent/opa/issues/3555)) +- CI: enable dependabot for wasmtime-go + +#### Documentation + +- OAuth2/OIDC: Fixed `concat` arguments in metadata discovery method ([#3543](https://github.com/open-policy-agent/opa/pull/3543), @[iggbom](https://github.com/iggbom)) +- Policy Reference: syntax highlighting EBNF grammar (@[PatMyron](https://github.com/PatMyron)) +- Extending OPA: fix typo (@[dxps](https://github.com/dxps)) +- Extending OPA: marshal the decision log (@[TheLunaticScripter](https://github.com/TheLunaticScripter)) +- Kubernetes Introduction: fix typo (@[dbaker-rh](https://github.com/dbaker-rh)) +- Envoy: Add guidance for OPA-Envoy benchmarks +- Change default linux download to `opa_linux_amd64_static` + +## 0.29.4 + +This is a bugfix release that re-introduces linux binaries that do not depend on glibc, i.e., run in unmodified Alpine Linux systems. + +### Fixes + +- build: add static (wasm-disabled) linux build (#3511) ([#3499](https://github.com/open-policy-agent/opa/issues/3499)) authored by @[srenatus](https://github.com/srenatus) + +### Miscellaneous + +- bundle: Implement a DirectoryLoader for fs.FS (#3493) ([#3489](https://github.com/open-policy-agent/opa/issues/3489)) authored by @[simongottschlag](https://github.com/simongottschlag) + +## 0.29.3 + +This bugfix release addresses another edge case in function evaluation ([#3505](https://github.com/open-policy-agent/opa/pull/3505)). + +## 0.29.2 + +This is a bugfix release to resolve an issue in topdown's function output caching ([#3501](https://github.com/open-policy-agent/opa/issues/3501)) + +## 0.29.1 + +This is a bugfix release to resolve an issue in the release pipeline. + +## 0.29.0 + +This release contains a number of enhancements and fixes. + +### SDK + +- This release includes a new top-level package to support OPA integrations in Go programs: `github.com/open-policy-agent/opa/sdk`. Users that want to integrate OPA as a library in Go and expose features like bundles and decision logging should use this package. The package is controlled by specifying an OPA configuration file. Hot reloading is supported out-of-the-box. See the GoDoc for [the package docs](https://pkg.go.dev/github.com/open-policy-agent/opa@v0.29.0/sdk) for more details. + +### Server + +- A deadlock in the bundle plugin during shutdown has been resolved ([#3363](https://github.com/open-policy-agent/opa/issues/3363)) +- An issue between bundle signing and bundle persistence when multiple data.json files are included in the bundle has been resolved ([#3472](https://github.com/open-policy-agent/opa/issues/3472)) +- The `github.com/open-policy-agent/opa/runtime#Params` struct now supports a router parameter to enable custom routes on the HTTP server. +- The bundle manifest can now include an extra `metadata` key where arbitrary key-value pairs can be stored. Authored by @[viovanov](https://github.com/viovanov) +- The bundle plugin now supports file:// urls in the `resource` field for test purposes. +- The decision log plugin emits a clearer message at DEBUG instead of INFO when there is no work to do. Authored by [andrewbanchich](https://github.com/andrewbanchich) +- The discovery plugin now supports a `resource` configuration field like the bundle plugin. Similarly, the `resource` is treated as the canonical setting to identify the discovery bundle. + +### Tooling + +- The `opa test` timeout as been increased to 30 seconds when benchmarking ([#3107](https://github.com/open-policy-agent/opa/issues/3107)) +- The `opa eval --schema` flag has been fixed to correctly set the schema when a _single_ schema file is passed +- The `opa build --debug` flag output has been improved for readability +- The `array.items` JSON schema value is now supported by the type checker +- The `opa fmt` subcommand can now exit with a non-zero status when a diff is detected (by passing `--fail`) +- The `opa test` subcommand no longer emits bogus file paths when fed a file:// url + +### Built-in Functions + +- The `http.send` built-in function falls back to the system certificate pool when the `tls_ca_cert` or `tls_ca_cert_env_variable` options are not specified ([#2271](https://github.com/open-policy-agent/opa/issues/2271)) authored by @[olamiko](https://github.com/olamiko) + +### Evaluation + +- The order of support rules emitted by partial evaluation is now deterministic ([#3453](https://github.com/open-policy-agent/opa/issues/3453)) authored by @[andrehaland](https://github.com/andrehaland) +- The big number performance regression caught by the fuzzer has been resolved ([#3262](https://github.com/open-policy-agent/opa/issues/3262)) +- The evaluator has been updated to memoize calls to rules with arguments (functions) within a single query. This avoids recomputing function results when the same input is passed multiple times (similar to how complete rules are memoized.) + +### WebAssembly + +- The `wasm` target no longer panics if the OPA binary does not include a wasm runtime ([#3264](https://github.com/open-policy-agent/opa/issues/3264)) +- The interrupt handling mechanism has been rewritten to make safe use of the wasmtime package. The SDK also returns structured errors now that are more aligned with topdown. ([#3225](https://github.com/open-policy-agent/opa/issues/3225)) +- The SDK provides the subset of required imports now (which is useful for debugging with opa_println in the runtime library if needed.) +- The opa_number_float type has been removed from the value library (it was unused after moving to libmpdec) +- The runtime library builder has been updated to use llvm-12 and the wasmtime-go package has been updated to v0.27.0 + +### Documentation + +- The HTTP API authorization tutorial has been updated to show how to distribute policies using bundles +- The Envoy tutorial has been tweaked to show better path matching examples + +### Infrastructure + +- The release-patch script has been improved to deal with _this file_ in bugfix/patch releases ([#2533](https://github.com/open-policy-agent/opa/issues/2533)) authored by @[jjshanks](https://github.com/jjshanks) +- The Makefile check targets now rely on golangci-lint and many linting errors have been resolved (authored by @[willbeason](https://github.com/willbeason)) +- Multiple nightly fuzzing and data race issues in test cases have been resolved + +## 0.28.0 + +This release includes a number of features, enhancements, and fixes. The default +branch for the Git repository has also been updated to `main`. + +#### Schema Annotations + +This release adds support for _annotations_. Annotations allow users to +declare metadata on rules and packages. Currently, OPA supports one form of +metadata: schema declarations. For example: + +```rego +package example + +# METADATA +# schemas: +# - input: schema.service +deny["service is missing required 'owner' label"] { + input.kind == "Service" + not input.metadata.labels.owner +} + +# METADATA +# schemas: +# - input: schema.deployment +deny["deployment replica count too low for 'production' namespace"] { + input.kind == "Deployment" + input.metadata.namespace == "production" + object.get(input.spec, "replicas", 1) < 3 +} +``` + +Users can include schema annotations in their policies to tell OPA about the +structure of external data loaded under `input` or `data`. By learning the +schema of base documents, OPA can surface mistakes in the policy at authoring +time (e.g., referring to a non-existent field in a JSON object or calling a +built-in function with an invalid value.) For more information on the +annotations and schema support see the [Type +Checking](https://www.openpolicyagent.org/docs/latest/schemas/) page in the +documentation. In the future, annotations will be expanded to support other +kinds of metadata and additional tooling will be added to leverage them. + +### Server + +- The server now automatically sets GOMAXPROCS when running inside of a container that has cgroups applied. This helps the Go runtime avoid consuming too many CPU resources and being throttled by the kernel. ([#3328](https://github.com/open-policy-agent/opa/issues/3328)) +- The server now logs an error if users enable the `token` authentication mode without a corresponding authorization policy. ([#3380](https://github.com/open-policy-agent/opa/issues/3380)) authored by @[kale-amruta](https://github.com/kale-amruta) +- The server now supports a `GET /v1/config` endpoint that returns OPA's active configuration. This API is useful if you need to debug the running configuration in an OPA configured via Discovery. ([#2020](https://github.com/open-policy-agent/opa/issues/2020)) +- The server now respects the `?pretty` option in the v0 API ([#3332](https://github.com/open-policy-agent/opa/issues/3332)) authored by @[clarshad](https://github.com/clarshad) +- The Bundle plugin is more forgiving when it comes to Etag processing on HTTP 304 responses ([#3361](https://github.com/open-policy-agent/opa/issues/3361)) +- The Decision Log plugin now supports a "Decision Per Second" rate limit configuration setting. +- The Status plugin can now be configured to use a custom reporter similar to the Decision Log plugin (e.g., so that Status messages can be sent to AWS Kinesis, etc.) +- The Status plugin now reports the number of decision logs that are dropped due to buffer limits. +- The service clients can authenticate with the Azure Identity OAuth2 implementation the client credentials JWT flow is used ([#3372](https://github.com/open-policy-agent/opa/issues/3372)) +- Library users can now customize the logger used by the plugins by providing the `plugins.Logger` option when creating the plugin manager. + +### Tooling + +- The various OPA subcommands that accept schema files now accept a directory tree of schemas instead of only a single schema. +- The `opa refactor move` subcommand was added to support package renaming use cases ([#3290](https://github.com/open-policy-agent/opa/issues/3290)) +- The `opa check` subcommand now supports a `-s`/`--schema` flag like the `opa eval` subcommand. + +### Documentation + +- The [Management API](https://www.openpolicyagent.org/docs/latest/management-introduction/) docs have been restructured so that each API has a dedicated page. In addition, the [Bundle API](https://www.openpolicyagent.org/docs/latest/management-bundles/#implementations) docs now include getting started steps for cloud-provider specific services (e.g., AWS, GCP, Azure, etc.) + +### Security + +- OPA now supports PKCS8 encoded EC private keys for JWT verification (which includes service authentication, bundle verification, and verification built-in functions) ([#3283](https://github.com/open-policy-agent/opa/issues/3283)). Authored by @[andrehaland](https://github.com/andrehaland). +- The bundle signing and verification APIs have been updated to support custom signers/verififers ([#3336](https://github.com/open-policy-agent/opa/pull/3336)). Authored by @[gshively11](https://github.com/gshively11). + +### Evaluation + +- The `time.diff` function was added to support calculating differences between date/time values ([#3348](https://github.com/open-policy-agent/opa/issues/3348)) authored by @[andrehaland](https://github.com/andrehaland) +- The `units.parse_bytes` function now supports floating-point values ([#3297](https://github.com/open-policy-agent/opa/issues/3297)) authored by @[andy-paine](https://github.com/andy-paine) +- The evaluator was fixed to use correct bindings when evaluating the full-extent of a partial rule set. This issue was causing unexpected undefined results and evaluation errors in some rare cases. ([#3369](https://github.com/open-policy-agent/opa/issues/3369) [#3376](https://github.com/open-policy-agent/opa/issues/3376)) +- The evaluator was fixed to correctly generate package paths when namespacing is disabled partial evaluation. ([#3302](https://github.com/open-policy-agent/opa/issues/3302)). +- The `http.send` function no longer errors out on invalid Expires headers. ([#3284](https://github.com/open-policy-agent/opa/issues/3284)) +- The inter-query cache now serializes elements on insertion thereby reducing memory usage significantly (because deserialized elements carry a ~20x cost.) ([#3042](https://github.com/open-policy-agent/opa/issues/3042)) +- The rule indexer was fixed to correctly handle mapped and non-mapped values which could occur with `glob.match` usage ([#3293](https://github.com/open-policy-agent/opa/issues/3293)) + +### WebAssembly + +- The `opa eval` subcommand now correctly returns the set of all variable bindings and expression values when the `wasm` target is enabled. Previously it returned only set of variable bindings. ([#3281](https://github.com/open-policy-agent/opa/issues/3281)) +- The `glob.match` function now handles the default delimiter correctly. ([#3294](https://github.com/open-policy-agent/opa/issues/3294)) +- The `opa build` subcommand no longer requires a capabilities file when the `wasm` target is enabled. If capabilities are not provided, OPA will use the capabilities for its own version. ([#3270](https://github.com/open-policy-agent/opa/issues/3270)) +- The `opa build` subcommand now dumps the IR emitted by the planner when `--debug` is specified. +- The `opa eval` subcommand no longer panics when a policy fails to type check and the `wasm` target is enabled. +- The comparison functions can now return `false` instead of either being `true` or `undefined`. ([#3271](https://github.com/open-policy-agent/opa/issues/3271)) +- The internal wasm runtime will now correctly return `CancelErr` to indicate cancellation errors (instead of `BuiltinErr` which it returned previously.) +- The internal wasm runtime now correctly handles non-halt built-in errors ([#3320](https://github.com/open-policy-agent/opa/issues/3320)) +- The planner no longer generates unexpected scan statements when negation used over base documents under `data` ([#3279](https://github.com/open-policy-agent/opa/issues/3279)) and ([#3305](https://github.com/open-policy-agent/opa/issues/3305)) +- The planner now correctly discards out-of-scope variables when exiting comprehensions ([#3325](https://github.com/open-policy-agent/opa/issues/3325)) +- The `rego` package no longer panics when the `wasm` target is enabled and undefined functions are encountered ([#3251](https://github.com/open-policy-agent/opa/issues/3251)) +- 🎈 The remaining exceptions in the e2e test framework for the internal wasm runtime have been resolved. + +### Build + +- The `make image` target now uses the CI image for building the Go binary. This avoids platform-specific build issues by building the Go binary inside of Docker. + +## 0.27.1 + +This release contains a fix for crashes experienced when configuring OPA to use S3 signing as service credentials ([#3255](https://github.com/open-policy-agent/opa/issues/3255)). + +In addition to that, we have a small number of enhancements and fixes: + +### Tooling + +- The `eval` subcommand now allows using `--import` without using `--package`. Authored by @[onelittlenightmusic](https://github.com/onelittlenightmusic), [#3240](https://github.com/open-policy-agent/opa/pull/3240). + +## Compiler + +- The `ast` package now exports another method for JSON conversion, `ast.JSONWithOpts`, that allows further options to be set ([#3244](https://github.com/open-policy-agent/opa/pull/3244). + +### Server + +- REST plugins using `s3_signing` as credentials method can now include the specified service in the signature (SigV4). Authored by @[cogwirrel](https://github.com/cogwirrel), [#3210](https://github.com/open-policy-agent/opa/pull/3210). + +### Documentation + +- Remove soon-to-be deprecated `any` and `all` from the [Policy Reference](https://www.openpolicyagent.org/docs/v0.27.1/policy-reference/#aggregates) ([#3241](https://github.com/open-policy-agent/opa/pull/3241)) -- see also [#2437](https://github.com/open-policy-agent/opa/issues/2437). +- Add missing `discovery.service` field to [Discovery configuration](https://www.openpolicyagent.org/docs/v0.27.1/configuration/#discovery) table ([#3237](https://github.com/open-policy-agent/opa/pull/3237)). +- Fix dead links to the Envoy pages ([#3248](https://github.com/open-policy-agent/opa/pull/3248)). + +### WebAssembly + +- Executions using the internal Wasm SDK will now be interrupted when the provided context is done (cancelled or deadline reached). +- The generated Wasm modules could become much smaller: unused functions are replaced by `unreachable` stubs, and the heavyweight runtime components related to regular expressions are excluded when none of the regex-related builtins are used: `glob.match`, `regex.is_valid`, `regex.match`, `regex.is_valid`, and `regex.find_all_string_submatch_n`. +- The Wasm runtime now allows passing in the time to be used for evaluation, enabling callers to control the time-of-day observed by Wasm compiled policies. +- Wasmtime runtime has been updated to the latest version (v0.24.0). + +## 0.27.0 + +This release contains a number of enhancements and bug fixes. + +### Tooling + +- The `eval` subcommand now supports a `-s`/`--schema` flag that accepts a JSON schema for the `input` document. The schema is used when type checking the policy so that invalid references to (or operations on) `input` data are caught at compile time. In the future, the schema support will be expanded to accept multiple schemas and rule-level annotations. See the new [Schemas](https://www.openpolicyagent.org/docs/edge/schemas/) documentation for details. Authored by @[aavarghese](https://github.com/aavarghese) and @[vazirim](https://github.com/vazirim). +- The `eval`, `test`, `bench` and REPL subcommands now supports a `-t`/`--target` flag to set the evaluation engine to use. The default engine is `rego` referring to the standard Rego interpreter in OPA. Users can now select `wasm` to enable Wasm compilation and execution of policies ([#2878](https://github.com/open-policy-agent/opa/issues/2878)). +- The `eval` subcommand now supports a `raw` option for `-f`/`--format` that is useful in bash scripts. Authored by @[jaspervdj-luminal](https://github.com/jaspervdj-luminal). +- The test framework now supports "skippable" tests. Prefix the test name with `todo_` to have the test runner skip the test, e.g., `todo_test_allow { ... }`. +- The `eval` subcommand now correctly supports the `--ignore` flag. Previously the flag was not being applied. + +### Server + +- The `POST /v1/compile` API now supports a `?metrics` query parameter similar to other APIs. Authored by @[jkbschmid](https://github.com/jkbschmid). +- The directory used for persisting downloaded bundles can now be configured. See the [Configuration](https://www.openpolicyagent.org/docs/latest/configuration/) page for details. +- The HTTP Decision Logger plugin no longer blocks server shutdown for the grace period when there are no logs to upload. +- The Bundle plugin now unregisters listeners correctly. This issue would cause listeners to be invoked when bundle updates were dispatched even if the listener was unregistered ([#3190](https://github.com/open-policy-agent/opa/issues/3190)). +- The server now correctly decodes policy IDs in the HTTP request URL. Authored by @[mattmahn](https://github.com/mattmahn) ([#2116](https://github.com/open-policy-agent/opa/issues/2116)). +- The server now configures the `http_request_duration_seconds` metric (for all of the server endpoitns) with smaller, more granular buckets that better map to actual response latencies from OPA. Authored by @[luong-komorebi](https://github.com/luong-komorebi) ([#3196](https://github.com/open-policy-agent/opa/issues/3196)). + +### Security + +- PKCS8 keys are now supported when signing bundles and communicating with control plane services. Previously only PKCS1 keys were supported ([#3116](https://github.com/open-policy-agent/opa/issues/3116)). +- The built-in OPA HTTP API authorizer policy can now return a _reason_ to explain why a request to the OPA API is denied ([#3056](https://github.com/open-policy-agent/opa/issues/3056)). See the [Security](https://www.openpolicyagent.org/docs/edge/security/) documentation for details. Thanks to @[ajanthan](https://github.com/ajanthan) for helping improve this. + +### Compiler + +- The compiler can be configured to emit debug messages that explain comprehension indexing decisions. Debug messages can be enabled when running `opa build` with `--debug`. +- A panic was fixed in one of the rewriting stages when comprehensions were used as object keys ([#2915](https://github.com/open-policy-agent/opa/issues/2915)) + +### Evaluation + +- A bug in big integer comparison was fixed. This issue was discovered when comparing serial numbers from X.509 certificates. Authored by @[andrehaland](https://github.com/andrehaland) ([#3147](https://github.com/open-policy-agent/opa/issues/3147)). +- The `io.jwt.decode_verify` function now uses the environment supplied time-of-day value instead of calling `time.Now()` ([#3105](https://github.com/open-policy-agent/opa/issues/3105)). + +### Documentation + +- The documentation now includes a dedicated section the OPA-Envoy integration. See [https://www.openpolicyagent.org/docs/latest/envoy-introduction/](https://www.openpolicyagent.org/docs/latest/envoy-introduction/) for details. +- The ecosystem page now ranks integrations by number of unique domains instead of the sheer number of references. + +### WebAssembly + +- The `data` document no longer needs to be initialized to an empty object ([#3130](https://github.com/open-policy-agent/opa/issues/3130)). +- The mpd library is now initalized by the module's `Start` function ([#3110](https://github.com/open-policy-agent/opa/issues/3110)). +- The planner now longer re-plans rules blindly when `with` statements are encountered ([#3150](https://github.com/open-policy-agent/opa/issues/3150)). +- The planner and compiler now support dynamic dispatch. Previously the planner would enumerate all functions and invocation was controlled at runtime ([#2936](https://github.com/open-policy-agent/opa/issues/2936)). +- The compiler now inserts memoization instructions into function bodies instead of at callsites. This reduces the number of wasm instructions in the resulting binary ([#3169](https://github.com/open-policy-agent/opa/pull/3169)). +- The wasmtime runtime is now the default runtime used by OPA to execute compiled policies. The new runtime no longer leaks memory when policies are reloaded. +- The planner and compiler now intern strings and booleans and implement a few micro-optimizations to reduce the size of the resulting binary. +- The capabilities support has been updated to include an ABI major and minor version for tracking backwards compatibility on compiled policies ([#3120](https://github.com/open-policy-agent/opa/issues/3120)). + +### Backwards Compatibility + +- The `opa test` subcommand previously supported a `-t` flag as shorthand for `--timeout`. With this release, the `-t` shorthand has been redefined for `--target`. After searching GitHub for examples of `opa test -t` (and finding nothing) we felt comfortable making this backwards incompatible change. +- The Go version used to build the OPA release has been updated from `1.14.9` to `1.15.8`. Because of this, TLS certificates that rely on Common Name for verification are no longer supported and will not work. For more information see https://github.com/golang/go/issues/39568. + +## 0.26.0 + +This release contains a number of enhancements and bug fixes. + +### Built-in Functions + +- This release includes a number of built-in function improvements for Wasm compiled policies. The following built-in functions have been implemented natively and no longer need to be supplied by SDKs: `graph.reachable`, `json.filter`, `json.remove`, `object.get`, `object.remove`, and `object.union`. + +- This release fixes several bugs in the Wasm implementation of certain `regex` built-in functions ([#2962](https://github.com/open-policy-agent/opa/issues/2962)), `format_int` ([#2923](https://github.com/open-policy-agent/opa/issues/2923)) and `round` ([#2999](https://github.com/open-policy-agent/opa/pull/2999)). + +- This release adds `ceil` and `floor` built-in functions. Previously these could be implemented in Rego using `round` however these are more convenient. + +### Enhancements + +- OPA has been extended support [OAuth2 JWT Bearer Grant Type](https://www.openpolicyagent.org/docs/latest/configuration/#oauth2-jwt-bearer-grant-type) and [OAuth2 Client Credential JWT](https://www.openpolicyagent.org/docs/edge/configuration/#oauth2-client-credentials-jwt-authentication) authentication options for communicating with control plane services. This change allows OPA to use services that rely on Ping Identity as well as GCP service accounts for authentication. OPA has also been extended to support [custom authentication plugins](https://www.openpolicyagent.org/docs/edge/configuration/#custom-plugin) (thanks @[gshively11](https://github.com/gshively11)). + +- OPA plugins can now enter a "WARN" state to indicate they are operating in a degraded capacity (thanks @[gshively11](https://github.com/gshively11)). + +- The `opa bench` command can now benchmark partial evaluation queries. The options to enable partial evaluation are shared with `opa eval`. See `opa bench --help` for details. + +- Wasm compiled policies now contain source locations that are included inside of runtime error messages (such as object key conflicts.) In addition, Wasm compiled policies only export the minimal set of APIs described on the [WebAssembly#exports](https://www.openpolicyagent.org/docs/latest/wasm/#exports) page. + +### Fixes + +- ast: Fix parsing of numbers to reject leading zeroes ([#2947](https://github.com/open-policy-agent/opa/issues/2947)) authored by @[LCartwright](https://github.com/LCartwright). +- bundle: Fix loader to only verify bundle keys if configured to do so ([#3028](https://github.com/open-policy-agent/opa/issues/3028)). +- cmd: Fix build to avoid packaging policy.wasm twice ([#3007](https://github.com/open-policy-agent/opa/issues/3007)). +- cmd: Fix pretty-printed PE output to hide spurious blank lines +- server: Fix false-positive in bundle root check that would prevent data updates in some cases ([#2868](https://github.com/open-policy-agent/opa/issues/2868)). +- server: Fix query cache to respect ?instrument option ([#3000](https://github.com/open-policy-agent/opa/issues/3000)). +- server: Fix server to support discovery on inter-query cache configuration +- topdown: Fix PE to avoid generating expressions that do not type check ([#3012](https://github.com/open-policy-agent/opa/issues/3012)). +- wasm: Fix planner to avoid generating a conflict error in some cases ([#2926](https://github.com/open-policy-agent/opa/issues/2926)). +- wasm: Fix planner to generate correct virtual document iteration instructions ([#3065](https://github.com/open-policy-agent/opa/issues/3065)). +- wasm, topdown: Fix with keyword handle to ensure last statement wins ([#3010]((https://github.com/open-policy-agent/opa/issues/3010))). +- wasm: Fix planner to handle assignment conflicts correctly when else keyword is used ([#3031]((https://github.com/open-policy-agent/opa/issues/3031))). + +### Documentation + +- Add new section on integrating policies with OAuth2 and OIDC. +- Update Kubernetes admission control tutorial to work as non-root user. +- Fix link to signing documentation ([#3027](https://github.com/open-policy-agent/opa/issues/3027)) authored by @[princespaghetti](https://github.com/princespaghetti). + +### Backwards Compatibility + +- Previously, OPA deduplicated sets and objects in all cases except when iterating over/referring directly to values generated by partial rules. This inconsistency would only be noticed when running ad-hoc queries or within policies when aggregating the results of array comprehensions (e.g., `count([1 | p[x]])` could observe duplicates in `p`.) This release removes the inconsistency by deduplicating sets and objects in all cases ([#429](https://github.com/open-policy-agent/opa/issues/429)). This was the second oldest open issue on the project. + +### Deprecations + +- OPA now logs warnings when it receives legacy `bundle` config sections instead of the `bundles` section introduced in v0.13.0. + +## 0.25.2 + +This release extends the HTTP server authorizer (`--authorization=basic`) to supply the HTTP message body in the `input` document. See the [Authentication and Authorization](https://www.openpolicyagent.org/docs/edge/security/#authentication-and-authorization) section in the security documentation for details. + +## 0.25.1 + +This release contains a fix for running OPA under Docker with a non-default working directory ([#2974](https://github.com/open-policy-agent/opa/issues/2974)). + +## 0.25.0 + +This release contains a number of improvements and fixes. Importantly, this release includes a notable change to built-in function error handling. See the section below for details. + +### Built-in Function Error Handling + +Previously, built-in function errors would cause policy evaluation to halt immediately. Going forward, by default, built-in function errors no longer halt evaluation. Instead, expressions are treated as false/undefined if any of the invoked built-in functions return errors. + +This change resolves a common issue people face when passing unsanitized input values to built-in functions. For example, prior to this change the expression `io.jwt.decode("GARBAGE")` would halt evaluation of the entire policy because the string is not a valid encoding of a JSON Web Token (JWT). If the expression was `io.jwt.decode(input.token)` and the user passed an invalid string value for `input.token` the same error would occur. With this change, the same expression is simply undefined, i.e., there is no result. This means policies can use negation to test for invalid values. For example: + +```rego +decision := {"allowed": allow, "denial_reason": reason} + +default allow = false + +allow { + io.jwt.verify_hs256(input.token, "secret") + [_, payload, _] := io.jwt.decode(input.token) + payload.role == "admin" +} + +reason["invalid JWT supplied as input"] { + not io.jwt.decode(input.token) +} +``` + +If you require the old behaviour, enable "strict" built-in errors on the query: + +| Caller | Example | +| --- | --- | +| HTTP | `POST /v1/data/example/allow?strict-builtin-errors` | +| Go (Library) | `rego.New(rego.Query("data.example.allow"), rego.StrictBuiltinErrors(true))` | +| CLI | `opa eval --strict-builtin-errors 'data.example.allow'` | + +If you have implemented custom built-in functions and require policy evaluation to halt on error in those built-in functions, modify your built-in functions to return the [topdown.Halt](./topdown/errors.go) error type. + +### Built-in Functions + +This release includes a few new built-in functions: + +- `base64url.encode_no_pad`, `hex.encode`, and `hex.decode` for dealing with encoded data ([#2849](https://github.com/open-policy-agent/opa/issues/2849)) authored by @[johanneslarsson](https://github.com/johanneslarsson) +- `json.patch` for applying JSON patches to values inside of policies ([#2839](https://github.com/open-policy-agent/opa/issues/2839)) authored by @[jaspervdj-luminal](https://github.com/jaspervdj-luminal) +- `json.is_valid` and `yaml.is_valid` for testing validity of encoded values (authored by @[jaspervdj-luminal](https://github.com/jaspervdj-luminal)) + +There were also a few fixes to existing built-in functions: + +- Fix unicode handling in a few string-related functions ([#2799](https://github.com/open-policy-agent/opa/issues/2799)) authored by @[anderseknert](https://github.com/anderseknert) +- Fix `http.send` to override `no-cache` HTTP header when `force_cache` specified ([#2841](https://github.com/open-policy-agent/opa/issues/2841)) authored by @[anderseknert](https://github.com/anderseknert) +- Fix `strings.replace_n` to replace overlapping patterns deterministically ([#2822](https://github.com/open-policy-agent/opa/issues/2822)) +- Fix panic in `units.parse_bytes` when passed a zero-length string ([#2901](https://github.com/open-policy-agent/opa/issues/2901)) + +### Miscellaneous + +This release adds new credential providers for management services: + +- GCP metadata server ([#2938](https://github.com/open-policy-agent/opa/pull/2938)) authored by @[kelseyhightower](https://github.com/kelseyhightower) +- AWS Web Identity credentials ([#2462](https://github.com/open-policy-agent/opa/pull/2725)) authored by @[RichiCoder1](https://github.com/RichiCoder1) +- OAuth2 ([#1205](https://github.com/open-policy-agent/opa/issues/1205)) authored by @[anderseknert](https://github.com/anderseknert) + +In addition the following server features were added: + +- Add shutdown wait period flag to `opa run` (`--shutdown-wait-period`) ([#2764](https://github.com/open-policy-agent/opa/issues/2764)) authored by @[bcarlsson](https://github.com/bcarlsson) +- Add bundle file size limit configuration option (`bundles[_].size_limit_bytes`) to override default 1GiB limit ([#2781](https://github.com/open-policy-agent/opa/issues/2781)) +- Separate decision log and status message logs from access logs (which useful for running OPA at log level `error` while continuing to report decision and status log to console) ([#2733](https://github.com/open-policy-agent/opa/issues/2733)) authored by @[anderseknert](https://github.com/anderseknert) + +### Fixes + +- Fix panic caused by race condition in the decision logger ([#2835](https://github.com/open-policy-agent/opa/pull/2948)) authored by @[kubaj](https://github.com/kubaj) +- Fix decision logger to flush on graceful shutdown ([#780](https://github.com/open-policy-agent/opa/issues/780)) authored by @[anderseknert](https://github.com/anderseknert) +- Fix `--verification-key` handling to accept PEM files ([#2796](https://github.com/open-policy-agent/opa/issues/2796)) +- Fix `--capabilities` flag in `opa build` command ([#2848](https://github.com/open-policy-agent/opa/issues/2848)) authored by @[srenatus](https://github.com/srenatus) +- Fix loading of **signed** persisted bundles ([#2824](https://github.com/open-policy-agent/opa/issues/2824)) +- Fix API response mutation caused by decision log masking ([#2752](https://github.com/open-policy-agent/opa/issues/2752)) authored by @[gshively11](https://github.com/gshively11) +- Fix evaluator to prevent `with` statements from mutating original `input` document ([#2813](https://github.com/open-policy-agent/opa/issues/2813)) +- Fix set iteration runtime to be O(n) instead of O(n^2) ([#2966](https://github.com/open-policy-agent/opa/pull/2966)) +- Increased OPA version telemetry report timeout from 1 second to 5 seconds to deal with slow networks + +### Documentation + +- Improve docs to mention built-in function support in WebAssembly compiled policies +- Improve docs around JWT HMAC encoding ([#2870](https://github.com/open-policy-agent/opa/issues/2870)) authored by @[anderseknert](https://github.com/anderseknert) +- Improve HTTP authorization tutorial steps for zsh ([#2917](https://github.com/open-policy-agent/opa/issues/2917) authored by @[ClaudenirFreitas](https://github.com/ClaudenirFreitas)) +- Improve docs to describe meaning of Prometheus metrics +- Remove mention of unsafe (and unsupported) "none" signature algorithm from JWT documentation + +### WebAssembly + +This release also includes a number of improvements to the Wasm support in OPA. Importantly, OPA now integrates a Wasm runtime that can be used to execute Wasm compiled policies. The runtime is integrated into the existing "topdown" evaluator so that specific portions of the policy can be compiled to Wasm as a performance optimization. When the evaluator executes a policy using the Wasm runtime it emits a special `Wasm` trace event. The Wasm runtime support in OPA is currently considered **experimental** and will be iterated on in coming releases. + +This release also extends the Wasm compiler in OPA to natively support the following built-in functions (in alphabetical order): + +* `base64.encode`, `base64.decode`, `base64url.encode`, and `base64url.decode` +* `glob.match` +* `json.marshal` and `json.unmarshal` +* `net.cidr_contains`, `net.cidr_intersects`, and `net.cidr_overlap` +* `regex.match`, `regex.is_valid`, and `regex.find_all_string_submatch_n` +* `to_number` +* `walk` + +### Backwards Compatibility + +- The `--insecure-addr` flag (which was deprecated in v0.10.0) has been removed completely ([#763](https://github.com/open-policy-agent/opa/issues/763)) + +## 0.24.0 + +This release contains a number of small enhancements and bug fixes. + +### Bundle Persistence + +This release adds support for persisting bundles for recovery purposes. When persistence is enabled, OPA will save activated bundles to disk. On startup, OPA checks for persisted bundles and activates them immediately. This allows OPA to startup if the bundle server is unavailable ([#2097](https://github.com/open-policy-agent/opa/issues/2097)). For more information see the [Bundle](https://www.openpolicyagent.org/docs/latest/management/#bundles) documentation. + +### Built-in Functions + +This release includes a few new built-in functions: + +- `base64.is_valid` for testing if strings are valid base64 encodings ([#2690](https://github.com/open-policy-agent/opa/issues/2690)) authored by @[carlpett](https://github.com/carlpett) +- `net.cidr_merge function` for merging sets of IPs and CIDRs ([#2692](https://github.com/open-policy-agent/opa/issues/2692)) +- `urlquery.decode_object` for parsing URL query parameters into objects ([#2647](https://github.com/open-policy-agent/opa/issues/2647)) authored by @[GBrawl](https://github.com/GBrawl) + +In addition, `http.send` has been enhanced to support caching overrides and in-band error handling ([#2666](https://github.com/open-policy-agent/opa/issues/2666) and [#2187](https://github.com/open-policy-agent/opa/issues/2187)). + +### Fixes + +- Fix `opa build` to support custom built-in functions ([#2738](https://github.com/open-policy-agent/opa/issues/2738)) authored by @[gshively11](https://github.com/gshively11) +- Fix for file watching volume mounted configmaps ([#2588](https://github.com/open-policy-agent/opa/issues/2588)) authored by @[drewwells](https://github.com/drewwells) +- Fix discovery plugin to set last request and last successful request timestamps in status updates ([#2630](https://github.com/open-policy-agent/opa/issues/2630)) +- Fix planner crash on virtual document iteration ([#2601](https://github.com/open-policy-agent/opa/issues/2601)) +- Fix decision logger to requeue failed chunks ([#2724](https://github.com/open-policy-agent/opa/pull/2724) authored by @[anderseknert](https://github.com/anderseknert)) +- Fix object/set implementation in WASM-C library to avoid resizing. +- Fix JSON parser in WASM-C library to copy memory for strings and numbers. +- Improve WASM-C library to recycle object and set element structures while growing. + +In addition, this release contains several fixes for panics identified by fuzzing: + +- ast: Fix compiler to expand exprs in rule args ([#2649](https://github.com/open-policy-agent/opa/issues/2649)) +- ast: Fix output var analysis to accept refs with non-var heads ([#2678](https://github.com/open-policy-agent/opa/issues/2678)) +- ast: Fix panic during local var rewriting ([#2720](https://github.com/open-policy-agent/opa/issues/2720)) +- ast: Fix panic in local var rewriting caused by object corruption ([#2661](https://github.com/open-policy-agent/opa/issues/2661)) +- ast: Fix panic in parser post-processing of expressions ([#2714](https://github.com/open-policy-agent/opa/issues/2714)) +- ast: Fix parser to ignore rules with args and key in head ([#2662](https://github.com/open-policy-agent/opa/issues/2662)) +- ast: Fix object corruption during safety reordering +- types: Fix panic on reference to object with composite key ([#2648](https://github.com/open-policy-agent/opa/issues/2648)) + +### Backwards Compatibility + +- Renamed `timer_rego_builtin_http.send_ns` to `timer_rego_builtin_http_send_ns` to avoid issues with periods in metric keys. +- Removed deprecated `watch` package ([#2265](https://github.com/open-policy-agent/opa/issues/2265)) + +### Miscellaneous + +- Add support for H2C on HTTP listener ([#2739](https://github.com/open-policy-agent/opa/issues/2739) thanks @[srenatus](http://github.com/srenatus)!). +- Add Go version information to `opa version` output (thanks @[srenatus](http://github.com/srenatus)!) +- The official OPA build has been updated to Go v1.14.9. Previously it was using v1.13.7 which is no longer supported (thanks @[srenatus](http://github.com/srenatus)!) + +## 0.23.2 + +This release contains a fix for a regression in v0.23.1 around bundle downloading. The bug caused OPA to cancel bundle downloads prematurely. Users affected by this issue would see the following error message in the OPA logs: + +``` +[ERROR] Bundle download failed: bundle read failed: archive read failed: context canceled + plugin = "bundle" + name = +``` + +## 0.23.1 + +### Fixes + +- plugins/discovery: Set the last request and last successful request in discovery status ([#2630](https://github.com/open-policy-agent/opa/issues/2630)) + +### Miscellaneous + +- plugins/rest: Add response header timeout for REST client + +## 0.23.0 + +### `http.send` Caching + +The `http.send` built-in function now supports caching across policy queries. The `caching.inter_query_builtin_cache.max_size_bytes` configuration setting places a limit on the amount of memory that will be used for built-in function caching. By default, not limit is set. For `http.send`, cache duration is controlled by HTTP response headers. For more details see the [`http.send`](https://www.openpolicyagent.org/docs/latest/policy-reference/#http) documentation. + +### Capabilities + +OPA now supports a _capabilities_ check on policies. The check allows callers to restrict the built-in functions that policies may depend on. If the policies passed to OPA require built-ins not listed in the capabilities structure, an error is returned. The capabilities check is currently supported by the `check` and `build` sub-commands and can be accessed programmatically on the `ast.Compiler` structure. The repository also includes a set of capabilities files for previous versions of OPA under the `capabilities/` directory. + +For example, given the following policy: + +```rego +package example + +deny["missing semantic version"] { + not valid_semantic_version_tag +} + +valid_semantic_version_tag { + semver.is_valid(input.version) +} +``` + +We can check whether it is compatible with different versions of OPA: + +```bash +# OK! +$ opa build ./policies/example.rego --capabilities ./capabilities/v0.22.0.json + +# ERROR! +$ opa build ./policies/example.rego --capabilities ./capabilities/v0.21.1.json +``` + +### Built-in Functions + +This release includes a new built-in function to test if a string is a valid regular expression: `regex.is_valid`. + +### WebAssembly + +* Host environments no longer have to provide the `opa_println` function when instantiating compiled policy modules. +* SDKs no longer have to set the heap top address during initialization. + +### Fixes + +- Add a new inter-query cache to cache responses across queries ([#1753](https://github.com/open-policy-agent/opa/issues/1753)) +- Fix `opa` CLI flags to match documentation ([#2586](https://github.com/open-policy-agent/opa/issues/2586)) authored by @[OmegaVVeapon](https://github.com/OmegaVVeapon) +- Fix rule indexing when multiple glob.match mappers are required ([#2617](https://github.com/open-policy-agent/opa/issues/2617)) +- Fix AST to marshal non-string object keys ([#516](https://github.com/open-policy-agent/opa/issues/516)) +- Fix signature calculation to include port if necessary ([#2568](https://github.com/open-policy-agent/opa/issues/2568)) +- Fix partial evaluation to check function output for false values ([#2573](https://github.com/open-policy-agent/opa/issues/2573)) + +### Miscellaneous + +- Add `http.send` latency to query metrics ([#2034](https://github.com/open-policy-agent/opa/issues/2034)) +- Add support for `opa build` unknowns under `data` ([#2581](https://github.com/open-policy-agent/opa/issues/2581)) +- Add support to wait for plugin readiness before starting server +- Add parameter to set wall clock time during evaluation for replay purposes +- Fix groundness bit on objects during update +- Fix x509 built-in functions to parse PEM or DER inputs +- Fix bundle signing and verification to use standard JWT key ID header +- Optimize AST collections to cache hash values +- Optimize object iteration to avoid hashing +- Optimize evaluator by removing unnecessary term copying + +### Deprecations + +* The `watch` query parameter on the Data API has been deprecated. The query watch feature was unused and the lack of incremental evaluation would have introduced scalability issues for users. The feature will be removed in a future release. + +* The `partial` query parameter on the Data API has been deprecated. Note, this only applies to the `partial` query parameter that the Data API supports, not Partial Evaluation itself. The `partial` parameter allowed users to lazily trigger Partial Evaluation (for optimization purposes) during a policy query. While this is useful for kicking the tires in a development environment, putting optimization into the policy query path is not recommended. If users want to kick the tires with Partial Evaluation, we recommend running the `opa build` command. + +### Backwards Compatibilty + +* The `storage.Indexing` interface has been removed. Storage indexing has not been supported since 0.5.12. It was time to remove the interface. Custom store implementations that may have included no-op implementations of the interface can be updated. + +* The `ast.Array` type has been redefined a struct. Previously `ast.Array` was a type alias for `[]*ast.Term`. This change is backwards incompatible because slice operations can no longer be performed directly on values of type `ast.Array`. To accomodate, the `ast.Array` type now exports functions for the same operations. This change decouples callers from the underlying array implementation which opens up room for future optimizations. + +## 0.22.0 + +### Bundle Signing + +OPA now supports digital signatures for policy bundles. Specifically, a signed bundle is a normal OPA bundle that includes a file named ".signatures.json" that dictates which files should be included in the bundle, what their SHA hashes are, and of course is cryptographically secure. When OPA receives a new bundle, it checks that it has been properly signed using a key that OPA has been configured with out-of-band. Only if that verification succeeds does OPA activate the new bundle; otherwise, OPA continues using its existing bundle and reports an activation failure via the status API and error logging. For more information see https://openpolicyagent.org/docs/latest/management/#signing. Many thanks to @[ashish246](https://github.com/ashish246) who co-designed the feature and provided valuable input to the development process with his proof-of-concept [#1757](https://github.com/open-policy-agent/opa/issues/1757). + +### Optimization Levels + +`opa build` now supports multiple optimization levels. The first level (`--optimize=1`) enables constant folding (based on partial evaluation) that only inlines values that can be computed entirely at build time. The second level (`--optimize=2`) enables the existing (more aggressive) version of partial evaluation that eagerly inlines as much of the policy as possible. For more information on the optimization levels see the [Optimization Levels](https://www.openpolicyagent.org/docs/latest/policy-performance/#optimization-levels) section in the documentation. + +### Built-in Functions + +- `numbers.range` ([#2479](https://github.com/open-policy-agent/opa/issues/2479)) was added to support policies that need to generate a range of integers (e.g., a network port range). +- `semver.is_valid` and `semver.compare` ([#2538](https://github.com/open-policy-agent/opa/pull/2538/)) was added to support policies that need to validate semantic version numbers (authored by @[charlieegan3](https://github.com/charlieegan3)). + +### WebAssembly + +- All [String](https://www.openpolicyagent.org/docs/latest/policy-reference/#strings) built-in functions (except `sprintf`) are now implemented natively inside of Wasm-compiled policies. + +### Fixes + +- A few small issues in the Go integration and `rego` package examples have been resolved ([#2294](https://github.com/open-policy-agent/opa/issues/2294)) and [#2367](https://github.com/open-policy-agent/opa/issues/2367)) authored by @[gaga5lala](https://github.com/gaga5lala). +- The Kubernetes Admission Controller tutorial as been updated to work with recent versions of Kubernetes ([#2467](https://github.com/open-policy-agent/opa/issues/2467) authored by @[gaga5lala](https://github.com/gaga5lala)). +- A few issues in partial evaluation around negation inlining and partial rules have been resolved (e.g., [#2492](https://github.com/open-policy-agent/opa/issues/2492), [#2491](https://github.com/open-policy-agent/opa/issues/2491)). + +### Miscellaneous + +- OPA now supports IMDSv2 for the AWS metadata service. This improves the security posture of OPA deployments in AWS ([#2482](https://github.com/open-policy-agent/opa/issues/2482)) authored by @[nhw76](https://github.com/nhw76). +- Several improvements to the project documentation including a policy style discussion, an integration option comparison, and discussion of bootstrapping and fail-open versus fail-closed modes. +- The project's CI/CD infrastructure has been migrated to GitHub Actions. The new CI/CD infrastructure is designed and implemented to be portable and includes a number of quality-of-life improvements. +- End-to-end query latency with decision logging enabled has been improved by 10%-15% in real-world cases. + +### Backwards Compatibility + +* The `rego.Tracer` and `rego.EvalTracer` API's have been deprecated in favor of + the newer `rego.QueryTracer` and `rego.EvalQueryTracer` API. +* The `tester.Runner#SetCoverageTracer` API has been deprecated in favor of the + newer `test.Runner#SetCoverageQueryTracer` API. + +## 0.21.1 + +This release fixes [#2497](https://github.com/open-policy-agent/opa/issues/2497) where the comprehension indexing optimization produced incorrect results for nested comprehensions that close over variables in the outer scope. This issue only affects policies containing nested comprehensions that are recognized by the indexer (which is a relatively small percentage). + +This release also backports the GitHub Actions migration and a fix to the Wasm library build step. + +## 0.21.0 + +### Features + +* Decision log masks can now mutate decision log events. Previously, the masks could only erase data in the events. With this change, users can implement masks that obfuscate or add information to the decision log events before they are emitted. Thanks to @dkiser for implementing this feature [#2379](https://github.com/open-policy-agent/opa/issues/2379))! + +* This release contains a new built-in function for parsing X.509 Certificate Signing Requests (`crypto.x509.parse_certificate_request`). Thanks to @vivekbagade for implementing this feature [#2402](https://github.com/open-policy-agent/opa/issues/2402)! + +* This release adds support for aggregation and bit arithmetic operations for WebAssembly compiled policies. These functions no longer have to be provided by the host environment. + +### Fixes + +- cmd: Fix bug in --disable-inlining option parsing ([#2196](https://github.com/open-policy-agent/opa/issues/2196)) authored by @[Syn3rman](https://github.com/Syn3rman) +- docs: Improve terraform example to incorporate `child_modules` ([#1772](https://github.com/open-policy-agent/opa/issues/1772)) +- server: Fix panic caused by compiler misuse with bundles ([#2197](https://github.com/open-policy-agent/opa/issues/2197)) +- topdown: Fix incorrect memoization during partial evaluation ([#2455](https://github.com/open-policy-agent/opa/issues/2455)) +- topdown: Fix loss of precision in arithmetic and aggregate builtins ([#2469](https://github.com/open-policy-agent/opa/issues/2469)) + +### Miscellaneous + +* Thanks to @Syn3rman for implementing an improvement to our release process to automatically tag external contributors ([#2323](https://github.com/open-policy-agent/opa/issues/2323))! + +* The coverage and profiling tracers no longer require variable values from the evaluator. This change improves perfomance significantly when coverage or profiling is enabled and policies inspect large data sets. Benchmarks show anywhere from 0.5x to over 30x speedup depending on the policy. + +### Backwards Compatibility + +* `topdown.Tracer` has been deprecated in favor of a newer interface + `topdown.QueryTracer`. +* All tracers (regardless of interface implementation) will now only be checked + for being enabled at the beginning of query evaluation rather than on a + per-event basis. +* `topdown.BuiltinContext#Tracers` has been deprecated in favor of + `topdown.BuiltinContext#QueryTracers`. The older `Tracers` field will be `nil` + starting this release, and eventually removed. + +## 0.20.5 + +### Fixes + +- compile: Change name of result var for wasm binary ([#2441](https://github.com/open-policy-agent/opa/issues/2441)) +- format: Deep copy inputs to avoid mutating the caller's copy ([#2439](https://github.com/open-policy-agent/opa/issues/2439)) + +### Miscellaneous + +- docs: Add `opa_println` to wasm required imports + +## 0.20.4 + +### Fixes + +- format: Refactor wildcard names to rewrite early ([#2430](https://github.com/open-policy-agent/opa/issues/2430)) + +## 0.20.3 + +### Fixes + +- docs/content small output correction on terraform page ([#1772](https://github.com/open-policy-agent/opa/issues/1772)) +- format: Fix wildcards in nested refs + +## 0.20.2 + +### Fixes + +- format: Fix panic with else blocks and comments ([#2420](https://github.com/open-policy-agent/opa/issues/2420)) + +## 0.20.1 + +This release fixes an issue in the Docker image build. The +default ca-certificates were not being included becasue the Docker +image is FROM scratch now. + +## 0.20.0 + +### Major Features + +This release includes a number of features, optimizations, and bugfixes. + +#### Version Reporting + +OPA now determines the latest stable release version using +https://telemetry.openpolicyagent.org. The only information provided to the +telemetry service is the version (e.g., `0.20.0`), a UUIDv4 generated on +startup, and the build platform/architecture (e.g., `darwin, amd64`). This +feature is on by default in `opa run` however it can be easily disabled by +specifying `--skip-version-check` on the command-line. If you are inside the +REPL, type `help` to see the latest version information. If you are running OPA +as a server, OPA will log an INFO level message indicating if OPA is out of +date. Version checking is best-effort. Any errors that occur while communicating +with https://telemetry.openpolicyagent.org are only logged at DEBUG level. For +more information see https://openpolicyagent.org/docs/latest/privacy/. + +#### New `opa build` command + +The `opa build` command can now be used to package OPA policy and data files +into [bundles](https://www.openpolicyagent.org/docs/latest/management-bundles) +that can be easily distributed via HTTP. See `opa build --help` for details. +This change is backwards incompatible. If you were previously relying on `opa +build` to compile policies to wasm, you can still do so: + +```bash +# before v0.20.0 +opa build -d policy.rego 'data.example.allow' + +# v0.20.0 and newer +opa build policy.rego -e example/allow -t wasm +``` + +### Built-in Functions + +This release includes a number of new built-in functions: + +* `graph.reachable` for computing the transitive closure from edge sets. This + function allows users to write policies that traverse organization charts, + security groups, etc. (thanks to @jaspervdj-luminal!) +* `io.jwt.verify_rs512` and other variants (`rs`/`es`/`hs`/`ps`, `384`/`512`) + were added (thanks to @GBrawl!) +* `uuid.rfc4122` for generating UUIDv4s (thanks to @reneklootwijk!) + +This release also includes a few fixes to existing built-in functions: + +* `units.parse_bytes` now supports units without the `B` or `b` suffix (thanks to @GBrawl!) +* `io.jwt.verify_decode` now supports floating-point `nbf` and `exp` claims (thanks to @GBrawl!) +* `array.slice` clamping logic fixed to prevent panic ([#2320](https://github.com/open-policy-agent/opa/issues/2320)). + +### Operations + +* The `opa run` command now supports a `--diagnostic-addr` flag that causes the + server to expose the `/health` and `/metric` endpoint on a different address. + This makes it easier to secure sidecar deployments in Kubernetes because the + main API endpoints can be served on localhost and the diagnostic endpoints can + be served on 0.0.0.0 so that the kubelet and other components can access them + ([#2002](https://github.com/open-policy-agent/opa/issues/2002)). The envoy + tutorial has been updated to show this in action. + +* The AWS credential provided has been updated to support the standard + `AWS_SESSION_TOKEN` and `AWS_SECURITY_TOKEN` environment variables. These are + used when signing S3 bundle requests for an AWS IAM assumed role (thanks to + @kpiotrowski!) + +### WebAssembly + +This release includes a number of improvements for wasm compiled policies. + +* UTF-8 and UTF-16 strings are now fully supported in the internal string + representation ([#1885](https://github.com/open-policy-agent/opa/issues/1885)) +* Numeric values are implemented on top of arbitrary-precision floating point + numbers to avoid loss-of-precision issues. +* The arithemetic, set, array, and type checking built-in function categories + are now supported by the wasm library. This means they do not have to be + implemented by the language-specific opa-wasm SDKs. +* The set and object implementations now use a chained hash set under the hood + ([#2225](https://github.com/open-policy-agent/opa/issues/2225)) + +### Performance + +* OPA will attempt to index collections generated by comprehensions to ensure + linear runtime for policies performing "group-by" operations (e.g., inverting + an objects.) For more information see the [Policy Performance](https://www.openpolicyagent.org/docs/latest/policy-performance/) + page ([#2276](https://github.com/open-policy-agent/opa/issues/2276)). + +### Tooling + +* The OPA extension for VS Code now supports `Go To Definition` inside policies. + This feature uses the new `opa oracle find-definition` command. +* The `opa test` command now includes location information on trace output. +* The `opa fmt` command now preserves `else` block style when possible (thanks to @mikaelcabot!) + +### Documentation + +This release includes several improvements to the website and documentation. + +* Improved terraform tutorial example ([#1772](https://github.com/open-policy-agent/opa/issues/1772)) (thanks to @princespaghetti!) +* Fixed token validation logic in envoy tutorial example ([#2395](https://github.com/open-policy-agent/opa/issues/2395)) (thanks to @princespaghetti!) +* Usability issues on the frontpage have been resolved ([#2205](https://github.com/open-policy-agent/opa/issues/2205), [#2206](https://github.com/open-policy-agent/opa/issues/2206) (thanks to @arunbsar!) +* The [Policy Performance](https://www.openpolicyagent.org/docs/latest/policy-performance/) + page now includes resource utilization guidelines ([#1601](https://github.com/open-policy-agent/opa/issues/1601)) +* By popular demand, the "document model" explanation has been brought back into + existence. It now lives in the [Philosophy](https://www.openpolicyagent.org/docs/latest/philosophy/#the-opa-document-model) + section ([#2284](https://github.com/open-policy-agent/opa/issues/2284)). +* The [Ecosystem](https://www.openpolicyagent.org/docs/latest/ecosystem/) page + implements a simple sorting algorithm that ranks items by amount of related + content. +* The policy cheat sheet has been merged into the [Policy Reference](https://www.openpolicyagent.org/docs/latest/policy-reference/) page. + +### Fixes + +* REPL now correctly displays booleans in tabled output ([#2338](https://github.com/open-policy-agent/opa/issues/2338), thanks to @timakin!) +* Discovery now supports service configuration updates. This makes token refresh easier in distributed environments on AWS. ([#2058](https://github.com/open-policy-agent/opa/issues/2058)) +* Fixed compiler panic if body omitted from `else` statement ([#2353](https://github.com/open-policy-agent/opa/issues/2353)) +* Fixed panic in /health API with the envoy plugin ([#2396](https://github.com/open-policy-agent/opa/issues/2396)) +* Partial Evaluation no longer generates unsafe queries for certain negated expressions ([#2045](https://github.com/open-policy-agent/opa/issues/2045)) +* Partial Evaluation no longer saves an incorrect binding list in some cases ([#2368](https://github.com/open-policy-agent/opa/issues/2368)) +* Output variable analysis no longer visits closures. This makes the analysis easier to use outside of the safety check. +* Rules parsed from expressions now have location information set correctly. + +### Miscellaneous + +* If you are building OPA for debian systems, the Makefile now supports a `make + deb` target. The target requires `dpkg-deb` to be installed. Thanks to @keshto + for contributing this! +* OPA is now built, by default, with CGO disabled. Also, the default Docker + image (`openpolicyagent/opa`) is back to using `FROM scratch`. + +### Backwards Compatibility + +* An internal utility function that unmarshals JSON (`util.UnmarshalJSON`) has + been fixed to return an error if the input bytes contain garbage following a + valid JSON value. In the past, the `util.UnmarshalJSON` function would just + return the valid JSON value and ignore the garbage following it. This change + is backwards incompatible since clients that were previously transmitting bad + data will now receive an error, however, we think it's important to surface + errors rather than hide them ([#2331](https://github.com/open-policy-agent/opa/issues/2331)). + +* The Go plugin/shared library loading feature that was deprecated in v0.14.0 + has finally been removed completely. If you are interested in extending OPA, + see the [Extensions](https://www.openpolicyagent.org/docs/latest/extensions/) + for how to do so at compile-time ([#2049](https://github.com/open-policy-agent/opa/issues/2049)). + +* The `github.com/open-policy-agent/opa/metrics#Counter` interface has been + extended to require an `Add(uint64)` function. This change only affects users + that have implemented their own version of the + `github.com/open-policy-agent/opa/metrics#Metrics` interface (which is the + factory for counters.) + +* As mentioned above, the `opa build` command-line syntax has changed. We think + this is the right time to refresh the command and we are more confident that + the new syntax will remain stable going forward. + +### Deprecation + +* This release deprecates `opa test -l` flag. Since we now display the trace + with line information, this flag is no longer needed. + +* In the next release we plan to deprecate the `?watch` and `?partial` HTTP API + parameters. The `?watch` feature is unused and introduces significant + complexity in the server implementation. The `?partial` parameter lazily + invokes Partial Evaluation _inline_ with policy invocation. This is useful for + development and debug purposes, however, it's not recommended for enforcement + points ot use (since PE optimization can introduce significant latency.) Users + should rely on the new `opa build` command to perform PE on their policies. + See `opa build --help` for more information. + + +## 0.19.2 + +### Fixes + +- plugins: Fix race between manager and plugin startup ([#2343](https://github.com/open-policy-agent/opa/issues/2343)) + +## 0.19.1 + +### Fixes + +- cmd/fmt: Only list files if there were changes ([#2295](https://github.com/open-policy-agent/opa/issues/2295)) + +## 0.19.0 + +### New Parser + +This release includes a new parser implementation that resolves a number +of existing issues with the old parser. As part of implementing the new parser +a small number of backwards incompatible changes have been made. + +#### Backwards Compatibility + +The new parser contains a small number of backwards incompatible changes that +correct questionable behaviour from the old parser. These changes affect +a very small number of actual policies and we feel confident in the decision to +break backwards compatibility here. + +- Numbers no longer lose-precision [#501](https://github.com/open-policy-agent/opa/issues/501) +- Leading commas do not cause objects to lose values [#2198](https://github.com/open-policy-agent/opa/issues/2198) +- Rules wrapped with braces no longer parse [#2199](https://github.com/open-policy-agent/opa/issues/2199) +- Rule names can no longer contain dots/hyphens [#2200](https://github.com/open-policy-agent/opa/issues/2200) +- Object comprehensions now have priority over logical OR in all cases [#2201](https://github.com/open-policy-agent/opa/issues/2201) + +In addition there are a few small changes backwards incompatible changes in APIs: + +- The `message` field on `rego_parse_error` objects contains a human-readable description + of the parse error. The old parser would often report "no match found" to indicate + the input contained invalid syntax. The new parser has slightly more specific + errors. If you integrated with OPA and implemented error handling based on the + content of these human-readable error message strings, your integration may be affected. +- The `github.com/open-policy-agent/opa/format#Bytes` function has been removed (it was unused.) + +#### Benchmark Results + +The output below shows the Go `benchstat` result for master (5a5d2a42) compared to the new parser. + +``` +name old time/op new time/op delta +ParseModuleRulesBase/1-16 210µs ± 1% 4µs ± 1% -98.02% (p=0.008 n=5+5) +ParseModuleRulesBase/10-16 1.39ms ± 1% 0.03ms ± 0% -97.93% (p=0.008 n=5+5) +ParseModuleRulesBase/100-16 13.5ms ± 1% 0.3ms ± 1% -97.93% (p=0.008 n=5+5) +ParseModuleRulesBase/1000-16 148ms ± 5% 3ms ± 6% -97.77% (p=0.008 n=5+5) +ParseStatementBasicCall-16 141µs ± 5% 3µs ± 1% -97.92% (p=0.008 n=5+5) +ParseStatementMixedJSON-16 9.06ms ± 2% 0.07ms ± 1% -99.19% (p=0.008 n=5+5) +ParseStatementSimpleArray/1-16 131µs ± 6% 2µs ± 1% -98.10% (p=0.008 n=5+5) +ParseStatementSimpleArray/10-16 499µs ± 6% 7µs ± 2% -98.54% (p=0.008 n=5+5) +ParseStatementSimpleArray/100-16 4.00ms ± 2% 0.06ms ± 4% -98.58% (p=0.008 n=5+5) +ParseStatementSimpleArray/1000-16 42.0ms ± 3% 0.5ms ± 4% -98.70% (p=0.008 n=5+5) +ParseStatementNestedObjects/1x1-16 233µs ± 6% 4µs ± 3% -98.49% (p=0.008 n=5+5) +ParseStatementNestedObjects/5x1-16 514µs ± 0% 9µs ± 4% -98.33% (p=0.008 n=5+5) +ParseStatementNestedObjects/10x1-16 911µs ± 5% 14µs ± 5% -98.46% (p=0.008 n=5+5) +ParseStatementNestedObjects/1x5-16 4.24ms ± 1% 0.01ms ± 1% -99.82% (p=0.016 n=4+5) +ParseStatementNestedObjects/1x10-16 138ms ± 1% 0ms ± 1% -99.99% (p=0.008 n=5+5) +ParseStatementNestedObjects/5x5-16 714ms ± 0% 5ms ± 5% -99.26% (p=0.016 n=4+5) +ParseBasicABACModule-16 3.12ms ± 3% 0.04ms ± 4% -98.63% (p=0.008 n=5+5) + +name old alloc/op new alloc/op delta +ParseModuleRulesBase/1-16 99.2kB ± 0% 5.7kB ± 0% -94.30% (p=0.008 n=5+5) +ParseModuleRulesBase/10-16 600kB ± 0% 29kB ± 0% -95.16% (p=0.008 n=5+5) +ParseModuleRulesBase/100-16 5.72MB ± 0% 0.27MB ± 0% -95.34% (p=0.008 n=5+5) +ParseModuleRulesBase/1000-16 58.0MB ± 0% 2.7MB ± 0% -95.42% (p=0.008 n=5+5) +ParseStatementBasicCall-16 70.2kB ± 0% 5.0kB ± 0% -92.82% (p=0.008 n=5+5) +ParseStatementMixedJSON-16 3.64MB ± 0% 0.06MB ± 0% -98.34% (p=0.008 n=5+5) +ParseStatementSimpleArray/1-16 63.7kB ± 0% 4.8kB ± 0% -92.42% (p=0.008 n=5+5) +ParseStatementSimpleArray/10-16 205kB ± 0% 8kB ± 0% -96.00% (p=0.008 n=5+5) +ParseStatementSimpleArray/100-16 1.64MB ± 0% 0.05MB ± 0% -97.19% (p=0.008 n=5+5) +ParseStatementSimpleArray/1000-16 16.5MB ± 0% 0.4MB ± 0% -97.50% (p=0.008 n=5+5) +ParseStatementNestedObjects/1x1-16 98.6kB ± 0% 5.7kB ± 0% -94.22% (p=0.008 n=5+5) +ParseStatementNestedObjects/5x1-16 224kB ± 0% 9kB ± 0% -96.05% (p=0.008 n=5+5) +ParseStatementNestedObjects/10x1-16 381kB ± 0% 13kB ± 0% -96.63% (p=0.008 n=5+5) +ParseStatementNestedObjects/1x5-16 1.76MB ± 0% 0.01MB ± 0% -99.38% (p=0.008 n=5+5) +ParseStatementNestedObjects/1x10-16 56.2MB ± 0% 0.0MB ± 0% -99.97% (p=0.008 n=5+5) +ParseStatementNestedObjects/5x5-16 280MB ± 0% 4MB ± 0% -98.67% (p=0.008 n=5+5) +ParseBasicABACModule-16 1.27MB ± 0% 0.04MB ± 0% -97.08% (p=0.008 n=5+5) + +name old allocs/op new allocs/op delta +ParseModuleRulesBase/1-16 2.28k ± 0% 0.07k ± 0% -96.75% (p=0.008 n=5+5) +ParseModuleRulesBase/10-16 16.1k ± 0% 0.5k ± 0% -96.59% (p=0.008 n=5+5) +ParseModuleRulesBase/100-16 159k ± 0% 5k ± 0% -96.64% (p=0.008 n=5+5) +ParseModuleRulesBase/1000-16 1.62M ± 0% 0.05M ± 0% -96.72% (p=0.008 n=5+5) +ParseStatementBasicCall-16 1.36k ± 0% 0.05k ± 0% -96.25% (p=0.008 n=5+5) +ParseStatementMixedJSON-16 105k ± 0% 1k ± 0% ~ (p=0.079 n=4+5) +ParseStatementSimpleArray/1-16 1.34k ± 0% 0.04k ± 0% -97.09% (p=0.008 n=5+5) +ParseStatementSimpleArray/10-16 5.49k ± 0% 0.12k ± 0% -97.90% (p=0.008 n=5+5) +ParseStatementSimpleArray/100-16 47.8k ± 0% 0.8k ± 0% ~ (p=0.079 n=4+5) +ParseStatementSimpleArray/1000-16 481k ± 0% 8k ± 0% -98.33% (p=0.008 n=5+5) +ParseStatementNestedObjects/1x1-16 2.38k ± 0% 0.05k ± 0% -97.82% (p=0.008 n=5+5) +ParseStatementNestedObjects/5x1-16 6.02k ± 0% 0.12k ± 0% -97.94% (p=0.008 n=5+5) +ParseStatementNestedObjects/10x1-16 10.6k ± 0% 0.2k ± 0% -98.01% (p=0.008 n=5+5) +ParseStatementNestedObjects/1x5-16 51.2k ± 0% 0.1k ± 0% ~ (p=0.079 n=4+5) +ParseStatementNestedObjects/1x10-16 1.66M ± 0% 0.00M ± 0% -99.99% (p=0.008 n=5+5) +ParseStatementNestedObjects/5x5-16 8.16M ± 0% 0.07M ± 0% -99.13% (p=0.008 n=5+5) +ParseBasicABACModule-16 36.5k ± 0% 0.7k ± 0% -98.09% (p=0.008 n=5+5) +``` + +### Fixes and Enhancements + +- ast: Add rules/functions that contain errors to the type env ([#2155](https://github.com/open-policy-agent/opa/issues/2155)) +- ast: Fix panic when rule args contain call expressions ([#2081](https://github.com/open-policy-agent/opa/issues/2081)) +- ast: Fix bug in term rewritten when 'input' is passed as an argument ([#2084](https://github.com/open-policy-agent/opa/issues/2084)) +- bundle: Remove extra root name in bundle file ids ([#2117](https://github.com/open-policy-agent/opa/issues/2117)) +- cmd/fmt: Fix to always write formatted file to stdout ([#2235](https://github.com/open-policy-agent/opa/issues/2235)) +- cmd/test: --explain now turns on verbose output ([#2069](https://github.com/open-policy-agent/opa/issues/2069)) +- cmd/test: Default `-v` traces show notes and fails ([#2068](https://github.com/open-policy-agent/opa/issues/2068)) +- docs/website: Fix mobile docs nav menu ([#2074](https://github.com/open-policy-agent/opa/issues/2074)) +- format: Print var if wildcard is used multiple times ([#2053](https://github.com/open-policy-agent/opa/issues/2053)) +- plugins/bundle: Update the downloader's e-tag based on bundle activation ([#2220](https://github.com/open-policy-agent/opa/issues/2220)) +- plugins: Add support to specify bearer token path (which enables token refresh) ([#2241](https://github.com/open-policy-agent/opa/issues/2241)) +- profiler: Fix panic when location is missing by grouping expressions missing a location ([#2134](https://github.com/open-policy-agent/opa/issues/2134)) +- rego: Avoid re-using transactions in compiler ([#2197](https://github.com/open-policy-agent/opa/issues/2197)) +- repl: Add unset-package command ([#2140](https://github.com/open-policy-agent/opa/issues/2140)) +- server: Do not return partial modules /v1/policies output ([#2036](https://github.com/open-policy-agent/opa/issues/2036)) +- server: Specify partial evaluation namespace to avoid conflicts ([#2247](https://github.com/open-policy-agent/opa/issues/2247)) +- topdown: Add time.add_date builtin ([#1990](https://github.com/open-policy-agent/opa/issues/1990)) +- topdown: Fix partial evaluation to save comprehensions correctly ([#2243](https://github.com/open-policy-agent/opa/issues/2243)) +- topdown: Improve pretty trace location details ([#2143](https://github.com/open-policy-agent/opa/issues/2143)) +- topdown: Include HTTP response headers in `http.send` output ([#2238](https://github.com/open-policy-agent/opa/issues/2238)) +- [Multiple](https://github.com/open-policy-agent/opa/commit/3eeb09c3e83749aff31e15bdfff5d82f3224c102) [important](https://github.com/open-policy-agent/opa/commit/29d8fbbef6facc96d03be3e07473d12e38acd843) [improvements](https://github.com/open-policy-agent/opa/commit/c5c85795aaa3701763f98d16308c5944f05f3da4) [to `http.send()`](https://github.com/open-policy-agent/opa/commit/ce92d19f655efffd6bda26006a2f4898cbdb69ed) [thanks to](https://github.com/open-policy-agent/opa/commit/351a7313df35e8de9e9474fd56a1a905cd51e0c1) @jpeach + +### Miscellaneous + +- [Added `man` target in the Makefile for `man` page generation!](https://github.com/open-policy-agent/opa/commit/4c81aa75c05e4dd69408b9c879be40f9f4369a2c) (thanks to @olivierlemasle) +- [Added Sublime Text syntax file](https://github.com/open-policy-agent/opa/blob/master/misc/syntax/sublime/rego.sublime-syntax) +- [Added link to Emacs mode for Rego](https://github.com/psibi/rego-mode) (thanks to @psibi) +- [Added net.cidr_contains_matches built-in function](https://github.com/open-policy-agent/opa/pull/2221/commits/6ae4ed9e6578ffb272604a79b1ef9a944cda7782) +- [Improved support for registering custom built-in functions](https://github.com/open-policy-agent/opa/blob/84b61c647a0d76e62043d6f52510411e8b00d2f0/docs/content/extensions.md) + +## 0.18.0 + +### Features + +- Add `opa bench` and `opa test --bench` sub commands for benchmarking policy evaluation. ([#1424](https://github.com/open-policy-agent/opa/issues/1424)) +- Permit verifying JWT's with a public key +- `http.send` improvements: + - Allow for skipping TLS verification via `tls_insecure_skip_verify` option + - Add `Host` header support + +### New Built-in Functions + +- Bitwise operators ([#1919](https://github.com/open-policy-agent/opa/issues/1919)) + - `bits.or` + - `bits.and` + - `bits.negate` + - `bits.xor` + - `bits.lsh` + - `bits.rsh` +- `json.remove` which works similar to `object.remove` but supports a JSON pointer path. + +### Fixes +- docs: Render tutorials as list ([#2071](https://github.com/open-policy-agent/opa/issues/2071)) +- ast: Fix type check for objects with non-json keys ([#2183](https://github.com/open-policy-agent/opa/issues/2183)) +- ast: Return an error when parsing an empty module ([#2054](https://github.com/open-policy-agent/opa/issues/2054)) +- docs: Fix broken PAM module link ([#2113](https://github.com/open-policy-agent/opa/issues/2113)) +- docs: Fix code fence in kubernetes-primer.md ([#2177](https://github.com/open-policy-agent/opa/issues/2177)) +- topdown: Invoke iterator when evaluating negation ([#2142](https://github.com/open-policy-agent/opa/issues/2142)) +- Correct checkptr errors found with Go 1.14 +- `opa parse`: fix panic when parsing invalid JSON + +### Compatibility Notes + +- The `ast.ParseModule` helper will now return an error if an empty module is provided. + Previously it would return a `nil` error and `nil` module. ([#2054](https://github.com/open-policy-agent/opa/issues/2054)) +- The `cmd` and `tester` packages in OPA will now require Go 1.13+ to compile. Most library users should be unaffected. + +### Miscellaneous + +- bundle: Dedicate `policy.wasm` for the compiled policy. + +## 0.17.3 + +### Fixes + +- vendor: Update xxhash to workaround checkptr errors with Go 1.14 +- cmd/parse: Fix panic when parsing encounters an error + +## 0.17.2 + +### Fixes + +- Add location information into pretty printed trace output. ([#2070](https://github.com/open-policy-agent/opa/issues/2070)) +- Add timeout for `http.send` builtin ([#2099](https://github.com/open-policy-agent/opa/issues/2099)) +- build: Force module mode and using only the vendor directory ([#2063](https://github.com/open-policy-agent/opa/issues/2063)) +- cover: Exclude `some` expressions in coverage report ([#1972](https://github.com/open-policy-agent/opa/issues/1972)) +- docs: How to say "ray-go" ([#2106](https://github.com/open-policy-agent/opa/issues/2106)) +- topdown: Make http.send() caching use full request ([#1980](https://github.com/open-policy-agent/opa/issues/1980)) +- topdown: Wrap all builtin functions for errors normalization ([#2101](https://github.com/open-policy-agent/opa/issues/2101)) +- topdown: http.send use provided CA without client certs ([#1976](https://github.com/open-policy-agent/opa/issues/1976)) + +### Miscellaneous + +- Add `object` manipulation built-ins +- docs: Add link to Rego Playground in table of contents +- docs: Update tutorial with note about consistency +- topdown: Export builtin implementations outside the package + +## 0.17.1 + +### Fixes + +- ast: Fix rewriting vars in rule args ([#2080](https://github.com/open-policy-agent/opa/issues/2080)) + +## 0.17.0 + +### Major Features + +- This release improves partial evaluation to avoid saving statements when they + do not depend on unknowns (e.g., comprehensions, references that require + materializing the full extent of partial sets/objects, etc.) Also, expressions + containing `with` statements are partially evaluated now. + +- This release lets policy authors to de-reference calls (and other terms) + without assigning the result to an intermediate variable. For example, instead + of writing `a := f(x); a.foo == 1` users can now write `f(x).a == 1` directly. + Thanks @jaspervdj-luminal! + +### New Built-in Functions + +This release includes the following new built-in functions: + +- `object.get` built-in function to lookup object keys with a fallback. +- `crypto.md5`, `crypto.sha1`, `crypto.sha256` built-in functions to hash strings. + +### Compatibility Notes + +- The `glob.match` built-in function was not defaulting the delimiter to "." + like the documentation described. This was fixed in + [#2061](https://github.com/open-policy-agent/opa/pull/2061) however the fix + is not backwards compatible. If you are using the `glob.match` built-in + function, you should ensure that a delimiter is being supplied. A search of + .rego files on GitHub only revealed a few instances of the `glob.match` in-use + so we decided to err towards fixing the broken behaviour rather than + preserving buggy behaviour going forward. + +- Related to the fix for [#2031](https://github.com/open-policy-agent/opa/issues/2031) + and the changes with OPA v0.16.0 to use `/` separated `path`'s with + the decision log plugin API. The decision logger will no longer modify + the `server.Info#Path` field. Older versions would substitute `.` for + `/` but this was causing incorrect results. As of v0.16.0 the server has + been updated to provide the correct paths so REST API users are unaffected. + Golang API users of the `plugins.log.Logger#Log` interface may be impacted + if passing `ast.Ref` style strings as a path as it will no longer be changed + to `/` separated. Callers need to do any transformation beforehand. + +### Fixes + +- docs: Update Kubernetes apiVersions to use `apps/v1` instead of `extensions/v1` ([#1977](https://github.com/open-policy-agent/opa/issues/1977)) +- plugins/logs: Leave the path unchanged for decisions ([#2031](https://github.com/open-policy-agent/opa/issues/2031)) +- plugins/bundle: Include last successful request timestamp in status ([#2009](https://github.com/open-policy-agent/opa/issues/2009)) +- plugins/bundle: Pass copy of status to bulk listeners ([#1962](https://github.com/open-policy-agent/opa/issues/1962)) +- rego: Fix panic when partial evaluating with tracers ([#2007](https://github.com/open-policy-agent/opa/issues/2007)) +- rego: Propagate custom builtins to `PartialResult` ([#1792](https://github.com/open-policy-agent/opa/issues/1792)) +- server: Update health check to use plugin status ([#2010](https://github.com/open-policy-agent/opa/issues/2010)) +- topdown: Correct glob default delimeter ([#2039](https://github.com/open-policy-agent/opa/issues/2039)) + +### Miscellaneous + + +- ast: Do not index expressions containing with statements +- ast: Fix panic in module parsing +- ast: Improve visitor performance by avoiding heap allocations +- cmd/build: return error if there is more than one positional argument +- docs: Fix live docs button size +- docs: Fix token validation example in Envoy tutorial + +## 0.16.2 + +This release includes an important bugfix for users that enable +tracing and use the "pretty" trace formatter. + +- topdown: Fix bug in var rewriting during trace formatting ([#2022](https://github.com/open-policy-agent/opa/issues/2022)) + +## 0.16.1 + +### Fixes + +- Fix for `*-rootless` Docker images `USER` being set incorrectly ([#1982](https://github.com/open-policy-agent/opa/issues/1982)) + +## 0.16.0 + +### New Built-in Functions + +- Add `json.filter` to mask/filter nested fields ([#1617](https://github.com/open-policy-agent/opa/issues/1617)) +- Add `net.cidr_expand` to generate CIDR hosts + +### Fixes + +- Reduce server latency for indexed policies by ~30-40% by caching prepared queries across requests ([#1958](https://github.com/open-policy-agent/opa/issues/1567)) +- Improve type checker error and trace output readability ([#1430](https://github.com/open-policy-agent/opa/issues/1430) and [#1208](https://github.com/open-policy-agent/opa/issues/1208)) +- Re-create service clients to pickup certificate changes ([#1898](https://github.com/open-policy-agent/opa/issues/1898)) +- Report full system path for bundle file locations ([#1796](https://github.com/open-policy-agent/opa/issues/1796)) +- Add `status.console` option to log Status messages to console ([#1937](https://github.com/open-policy-agent/opa/issues/1937)) +- Fix `io.jwt.decode_verify` to support multiple keys in JWKS ([#1901](https://github.com/open-policy-agent/opa/issues/1901)) +- Fix `path` decision log field for queries against "/data" ([1532](https://github.com/open-policy-agent/opa/issues/1532)) + +This release also includes: + +- Documentation improvements on how to use the `io.jwt.*` built-in functions for token verification +- Metrics for bundle processing and activation (e.g., read, parse, and compile times) +- Better parse metric reporting in the server + +### Compatibility Notes + +- The fix for #1532 required a backwards incompatible change for v0 and v1 + queries against "/data". This only affects queries against the exact path + "/data", not paths prefixed with "/data/", e.g., "/data/example/allow". Since + queries against "/data" are rare and normally only seen in development + environments, this is a low-impact change. As part of this change, the + `server.Info#Path` field has been changed to use slash-separated paths instead + of the string representation of Rego references (i.e., a dotted path rooted at + "data"). If you are registering a logging callback directly against the server + (e.g., by calling `server.Server#WithDecisionLoggerWithErr`) you will have to + update your logging callback to deal with the new path format. Decision log + consumers should treat a missing/empty `path` field as a query against + "/data". + +## 0.15.1 + +In this release we reached a milestone for Wasm: any Rego policy can +be compiled to Wasm now! In the next few weeks we will focus on +expanding on the set of built-ins supported out-of-the-box and inside +the NodeJS SDK. + +### Fixes + +- bundle: Make the DirectoryLoader public ([#1840](https://github.com/open-policy-agent/opa/issues/1840)) +- topdown: Add raw_body parameter to http.send ([#1903](https://github.com/open-policy-agent/opa/issues/1903)) +- wasm: Update planner to support with keyword ([#1116](https://github.com/open-policy-agent/opa/issues/1116)) + +### Miscellaneous + +- ast: Fix NoWith helper on exprs +- ast: Fix module JSON unmarshalling +- build: Fix build-release.sh by removing obsolete make deps command +- docs: Add JWT verification examples to reference +- docs: Fix introduction to refer to rules consistently +- topdown: Add environment variable to dump tests to disk +- topdown: Provide rewritten query vars in traces +- types: Fix constant select on array types +- wasm: Add support for built-in functions +- wasm: Extend wasm library to support shallow copying +- wasm: Fix JSON string lexing and parsing +- wasm: Fix object insertion operation +- wasm: Fix opa_json_dump to terminate keywords properly +- wasm: Fix opa_set_add to set next element correctly +- wasm: Fix planner to check call expression for false return value +- wasm: Fix planning of virtual document extent +- wasm: Improve calling convention of eval() function +- wasm: Improve planner to reuse local variables +- wasm: Fix planner to plan default rule bodies +- wasm: Remove unnecessary condition statements for scans +- wasm: Store parsed numbers as strings +- website: Replace homepage with new version + +## 0.15.0 + +This release includes many small improvements and bug fixes. + +### Built-in Functions + +This release includes a few new built-in functions for string +manipulation: + +- `trim_left`, `trim_right`, `trim_prefix`, and `trim_suffix` (thanks @hasit) +- `regex.find_all_string_submatch_n` and `strings.replace_n` (thanks @kenfdev) + +### Fixes + +- tester: Fix --timeout to apply to each test case ([#1788](https://github.com/open-policy-agent/opa/issues/1788)) +- ast: Check for undefined functions before safety check ([#1141](https://github.com/open-policy-agent/opa/issues/1141)) +- ast: Fix object corruption during local rewrite ([#1852](https://github.com/open-policy-agent/opa/issues/1852)) +- ast: Fix virtual predicate used for rule index build ([#1863](https://github.com/open-policy-agent/opa/issues/1863)) +- discovery: Fix log level message when on HTTP 304 ([#1826](https://github.com/open-policy-agent/opa/issues/1826)) +- docs: Update Kubernetes primer test to avoid false-positives ([#1794](https://github.com/open-policy-agent/opa/issues/1794)) +- repl: Fix unknown argument processing ([#1670](https://github.com/open-policy-agent/opa/issues/1670)) +- topdown: Fix namespacing to use caller bindings ([#1814](https://github.com/open-policy-agent/opa/issues/1814)) +- topdown: Fix units.parse_bytes implementation to use int64 ([#1815](https://github.com/open-policy-agent/opa/issues/1815)) +- topdown: Fix base document dereference with composite ([#1057](https://github.com/open-policy-agent/opa/issues/1057)) +- wasm: Add support for comprehensions ([#1120](https://github.com/open-policy-agent/opa/issues/1120)) +- wasm: Add support for full virtual document model ([#1117](https://github.com/open-policy-agent/opa/issues/1117)) +- wasm: Remove memory.grow calls on every malloc ([#1121](https://github.com/open-policy-agent/opa/issues/1121)) + +### Miscellaneous + +- build: Migrate to Go modules from Glide for dependency management +- build: Fix *-debug docker images to be ":debug" tag based +- ast: Replace "var" with "some" in SomeDecl#String +- ast: Add map of rewritten vars to Compiler +- topdown: Add API to disable rule indexing for evaluation +- bundle: Add more details to manifest root errors +- bundle: Ensure data paths use `/` separators for key +- bundle: Fix for overwriting data file keys +- cmd: Ensure all errors are in JSON formatted CLI output +- cmd: Add source output format for partial eval +- cmd: Fix opa eval to specify profiler tracer correctly +- discovery: Support `resource` configuration option +- rego: Don't propagate non-threadsafe fields from Rego to preparedQuery + +## 0.14.2 + +- topdown: Fix namespacing to use caller bindings ([#1814](https://github.com/open-policy-agent/opa/issues/1814)) +- file/loader: Standardize on forward slash paths + +## 0.14.1 + +- Fix a number of links in the OPA documentation. +- Fix issue with bundle root path comparisons on Windows. + +## 0.14.0 + +This release includes a large number of improvements to the docs as +well as performance optimizations that improve several end-to-end +benchmarks by ~25%. Also, the `opa eval` and other sub-commands now +accept a `-b` or `--bundle` flag that tell OPA to treat file paths as +bundles (either .tar.gz or directories). This improves behaviour in +large or mixed workspaces. + +### Compatibility Notes + +- Status API messages now include a dump of OPA's Prometheus metric + registry. This increases the Status API message size significantly + (~6KB). If you are indexing the Status API messages, consider + removing the metrics. Nonetheless, for Status API implementations, + having access to the Prometheus metrics is important for monitoring + the health of the OPAs. + +### Built-in Functions + +This release includes a few improvements to built-in functions: + +* A new function for converting SI strings (e.g., "10MB") to numbers: + `units.num_bytes(x)` + ([#1561](https://github.com/open-policy-agent/opa/issues/1561)). This + is useful in the context of Kubernetes if you need to deal with + resource limits and requests. + +* The `io.jwt.verify_*` functions have been extended to support JWKs. + +This release also improves support for providing custom built-in +functions to OPA. See the extensions documentation on openpolicyagent.org. + +### Fixes + +- ast, rego: Refactor unsafe built-in handling ([#1666](https://github.com/open-policy-agent/opa/issues/1666)) +- ast: Fix ordering of rule type checking errors ([#1620](https://github.com/open-policy-agent/opa/issues/1620)) +- ast: Update rule head to track assignments ([#1541](https://github.com/open-policy-agent/opa/issues/1541)) +- ast: Fix bug that allowed recursion in dynamic refs ([#1565](https://github.com/open-policy-agent/opa/issues/1565)) +- ast: Fix parsing of var-like scalars ([#1582](https://github.com/open-policy-agent/opa/issues/1582)) +- docs: Add note about benchmark result page ([#1275](https://github.com/open-policy-agent/opa/issues/1275)) +- docs: Update to show undefined example with != ([#1626](https://github.com/open-policy-agent/opa/issues/1626)) +- docs: Update to use live blocks ([#1650](https://github.com/open-policy-agent/opa/issues/1650)) +- format: Fix formatter to start line after writing comments ([#1560](https://github.com/open-policy-agent/opa/issues/1560)) +- loader: Update to accept file:// URLs. ([#1505](https://github.com/open-policy-agent/opa/issues/1505)) +- server: Improve decision log-related error messages ([#1367](https://github.com/open-policy-agent/opa/issues/1367)) + +### Miscellaneous + +- Add support for fuzzing the ast package in CI +- Add search bar powered by Algolia to the docs +- Add "type" field to decision log events sent to the console +- Add support for := assignments at file level +- Add build commit and version to runtime info +- Fix moduleLoader to copy returned parsed Modules +- Fix panic in /health?bundle=true +- Update the --plugin-dir flag as deprecated +- Update formatter to preserve rule assigmemnts +- Update metrics object to be thread-safe +- Support loading bundles and files w/ Rego API + +## 0.13.5 + +- Fix panic in OPA HTTP server with `/health?bundle=true` when + using bundles loaded from CLI ([#1703](https://github.com/open-policy-agent/opa/issues/1703)). + +## 0.13.4 + +- Fix panic in OPA HTTP server caused by concurrent map writes ([#1666](https://github.com/open-policy-agent/opa/issues/1666)) + +## 0.13.3 + +### Fixes + +- Fix bundle plugin to report error in case bundle manifest roots overlap ([#1635](https://github.com/open-policy-agent/opa/issues/1635)) + +## 0.13.2 + +This release updates OPA to use the latest stable Golang release +(1.12.8) that includes important fixes in the net/http package. See +this +[golang-nuts](https://groups.google.com/forum/#!topic/golang-nuts/fCQWxqxP8aA) +group message for details. + +## 0.13.0 + +### Multiple Bundles + +This release adds support for downloading multiple bundles to OPA +using the new `bundles` key in the configuration. APIs that include +bundle information have been updated to support multiple bundles: + +* Status API messages include the status and revision of each bundle. +* Decision Log API messages include the revision of each bundle. +* Data API responses include the revision of each bundle in the + provenance field if requested. +* Health API waits for all bundles to activate if requested. + +These changes are **backwards compatible**. If you are using the +existing `bundle` key in the configuration, you will not see any +changes in the APIs listed above. + +We recommend that you switch to the new `bundles` key and update +consumers of the above APIs to support multiple bundles. + +For more information on bundles see the [this +page](https://www.openpolicyagent.org/docs/latest/bundles/) in the OPA +documentation. + +### Console Decision Logger + +This release adds support for emitting decision logs to stdout. This +is useful for shipping decision logs directly to existing logging +backends. + +You can enable console decision logging on the command line: + +``` +opa run --server --set decision_logs.console=true +``` + +Console decision logging can be enabled alongside normal and custom +decision logging. + +### Fixes + +- ast: Report safety errors on line where expression starts ([#1497](https://github.com/open-policy-agent/opa/issues/1497)) +- ast: Update rule index to support glob.match ([#1496](https://github.com/open-policy-agent/opa/issues/1496)) +- bundle: Add support for loading YAML files from bundles ([#1471](https://github.com/open-policy-agent/opa/issues/1471)) +- bundle: Cache compiler on storage context ([#1515](https://github.com/open-policy-agent/opa/issues/1515)) +- cmd: Fix double print of rego errors ([#1518](https://github.com/open-policy-agent/opa/issues/1518)) +- docs: Add section on how to express "FOR ALL" in Rego ([#1307](https://github.com/open-policy-agent/opa/issues/1307)) +- docs: Fix mention of reference head var ([#1477](https://github.com/open-policy-agent/opa/issues/1477)) +- docs: Remove cast_xyz functions from docs ([#1405](https://github.com/open-policy-agent/opa/issues/1405)) +- server: Pass transaction in decision log event ([#1543](https://github.com/open-policy-agent/opa/issues/1543)) +- storage: Add safety checks to in-memory store ([#1594](https://github.com/open-policy-agent/opa/issues/1594)) +- topdown: Fix corrupt object panic caused by copy propagation ([#1177](https://github.com/open-policy-agent/opa/issues/1177)) +- topdown: Fix virtual cache to allow composite key terms ([#1197](https://github.com/open-policy-agent/opa/issues/1197)) + +### Miscellaneous + +- OPA sets the User-Agent header in requests made to services. +- `openpolicyagent/opa:edge` Docker images are available now. The + `edge` tag refers to the tip of master. +- OPA supports signing and encoding of JWTs. See [Token + Signing](https://www.openpolicyagent.org/docs/latest/language-reference/#token-signing) + for details. +- Prometheus metrics include cancelled HTTP requests. +- Compiler exposes optional unsafe built-in function check. +- Discovery query can be configured now. See [Discovery + Configuration](https://www.openpolicyagent.org/docs/latest/configuration/#discovery) + for details. +- Optimized rewriteDynamics stage in compiler to reduce allocations. +- OPA subcommands support "fails" explanation now. The "fails" + explanation is similar to the "notes" explanation except that it + prints Fail events instead of Note events. This is useful for among + other things, debugging test failures. +- Partial evaluation can disable inlining on specific virtual + documents. If set correctly this can improve partial evaluation + performance significantly because OPA can avoid computing + cross-products. +- `rego.Rego#PrepareForEVal` now times partial evaluation properly. +- The diagnostics feature deprecated in v0.10.1 has been removed. + +## 0.12.2 + +### Fixes + +- Fix performance impact of bundle activation on policy queries ([#1516](https://github.com/open-policy-agent/opa/issues/1516)) +- Fix log masking to use correct transaction ([#1551](https://github.com/open-policy-agent/opa/pull/1551)) + +## 0.12.1 + +### Fixes + +- Fix deadlock caused by log masking decision evaluation ([#1543](https://github.com/open-policy-agent/opa/issues/1543)) + +### Miscellaneous + +- Add decision log event for undefined decision on `POST /` endpoint + +## 0.12.0 + +This release includes two new features and an important bug fix. + +### Decision Log Masking + +This release includes an important feature for protecting sensitive +information in decision logs: masking. With the new decision log +masking feature you can configure OPA to remove sensitive information +from the `input` and `result` fields of decision log events. See the +[Decision Log](https://www.openpolicyagent.org/docs/edge/decision-logs/#masking-sensitive-data) documentation for details. + +### AWS Signing for Bundle Downloads + +This release adds support for signing bundle download requests using +an AWS signing scheme. This feature allows you to configure OPA to +download bundles directly from S3. See the [Configuration](https://www.openpolicyagent.org/docs/edge/configuration/#aws-signature) +documentation for details. + +### Fixes + +* server: Fix deadlock caused by leaked write transaction ([#1478](https://github.com/open-policy-agent/opa/issues/1478)) + +### Miscellaneous + +- server: Add request headers to authorization input ([#1456](https://github.com/open-policy-agent/opa/issues/1456)) +- rego: Add time zone support to time/date built-in functions +- eval: Add --instrument flag for profiling evaluation via command line + +## 0.11.0 + +### Compatibility Notes + +This release includes a few small but backward incompatible +changes: + +* The compiler will reject functions that redeclare arguments. A + search of public .rego files on GitHub only returned one result + which was contained in the OPA documentation. For example: + + ``` + f(x) { + x := 1 # bad: redeclaration of 'x' + x == 1 # ok + } + ``` + +* Errors returned by built-in calls are no longer coded as + `eval_internal_error`. Instead they are returned as + `eval_builtin_error`. This change is made so callers can + differentiate between actual internal errors and built-in errors + that are result of bad inputs from the policy. + +* The `ast.QueryCompiler#WithInput` function and + `ast.QueryContext#Input` field have been removed because they were + unused and had no affect. + +* The `ast.Compiler` and `ast.QueryCompiler` functions to register + extra changes now require a stage and metric name. + +### Major Features + +This release includes a few notable features and improvements: + +* The `some` keyword allows you to declare local variables to avoid + namespacing issues. See the [Some + Keyword](https://www.openpolicyagent.org/docs/edge/how-do-i-write-policies/#some-keyword) + section in the documentation for more detail. + +* The `opa test`, `eval`, REPL, and HTTP API have been extended with a + new explanation mode for filtering tracing notes. This makes it + easier to see the output of `trace(msg)` calls from your policy. + +* The WebAssembly (Wasm) compiler has been extended to include support for + compiling rules into Wasm. Previously the compiler relied on partial + evaluation to inline all rules. In some cases this is not possible + due to limitations on Rego queries. In coming releases, the Wasm + support will be extended to cover the entire language. + +* The `rego` package has been extended to support prepared + queries. Prepared queries cache the parsed and compiled query ASTs + for re-use across multiple `Eval` calls. For small policies the + speedup can be significant. See the [GoDoc](https://godoc.org/github.com/open-policy-agent/opa/rego#example-Rego-PrepareForEval) for details. + +### Fixes + +- Add Kubernetes admission control debugging tips ([#1039](https://github.com/open-policy-agent/opa/issues/1039)) +- Add docs on health check API endpoint ([#1086](https://github.com/open-policy-agent/opa/issues/1086)) +- Add hardened configuration example to security page ([#1172](https://github.com/open-policy-agent/opa/issues/1172)) +- Add support for with keyword stacking ([#802](https://github.com/open-policy-agent/opa/issues/802)) +- Fix type inferencing on object keys ([#1361](https://github.com/open-policy-agent/opa/issues/1361)) +- Fix simple Kubernetes deployment example ([#874](https://github.com/open-policy-agent/opa/issues/874)) +- Fix bug in data mocking that resulted in wrong iteration behavior ([#1261](https://github.com/open-policy-agent/opa/issues/1261)) +- Fix bug in set deep copy that caused panic ([#1406](https://github.com/open-policy-agent/opa/issues/1406)) +- Fix bug in REPL that prevented rules from being declared ([#1104](https://github.com/open-policy-agent/opa/issues/1104)) + +### Miscellaneous + +- docs: Better documentation for providing the `input` document over HTTP ([#1293](https://github.com/open-policy-agent/opa/issues/1293)) +- docs: Add note about HTTP_PROXY friends ([#1410](https://github.com/open-policy-agent/opa/issues/1410)) +- Add CLI config overrides and ENV injection +- Add additional compiler metrics for each stage +- Add an “edge” release to the docs +- Add param to include bundle activation in /health response +- Add provenance query output +- Add support for graceful shutdown of OPA server +- Improve discovery feature documentation +- Make `json` logs the default and add `json-pretty` +- Raise error when loading empty module in bundle +- Return eval_builtin_error instead of eval_internal_error +- Rewrite == to = in queries passed to the compile API +- docs: Update bundle docs with caching info +- Update logrus to 1.4.0 +- server: Add early exit on PUT /v1/policies +- topdown: Fix set unification partial eval bug +- topdown: Omit rule body from enter/redo events + +## 0.10.7 + +This release publishes the Hugo-based documentation to GitHub Pages :tada: + +### Fixes + +- Add `array.slice` built-in function ([#1243](https://github.com/open-policy-agent/opa/issues/1243)) +- Add `net.cidr_contains` and `net.cidr_intersects` built-ins + ([#1289](https://github.com/open-policy-agent/opa/issues/1289)). This + change deprecates the old `net.cidr_overlap` built-in function. The + latter will be supported for backwards compatibility but new + policies should refer to `net.cidr_contains`. + +### Miscellaneous + +- Bump kube-mgmt container version to 0.8 in tutorial +- Remove unnecessary resizing allocs from AST set and object +- Add Kubernetes Admission Control guide + +## 0.10.6 + +This release migrates the OPA documentation over to Hugo (from +GitBook). Going forward the OPA documentation will be generated using +Hugo and hosted on Netlify (instead of GitHub Pages). The Hugo/Netlify +stack brings us inline with the goal for other CNCF projects and +provides nice features like "preview before merge". + +This release includes a small but backwards incompatible change to the +`http.send` built-in. Previously, `http.send` would _always_ decode +responses as JSON even if the Content-Type was unset or explicitly not +JSON. If you were previously relying on HTTP responses that did not +set the Content-Type correctly, you will need to update your policy to +pass `"force_json_decode": true` as in the `http.send` parameters. + +### Fixes + +- Fix panic in mod operation ([#1245](https://github.com/open-policy-agent/opa/issues/1245)) +- Fix eval tree enumeration to return errors ([#1272](https://github.com/open-policy-agent/opa/issues/1272)) +- Fix http.send to handle non-JSON responses ([#1258](https://github.com/open-policy-agent/opa/issues/1258)) +- Fix backticks in SSH example that were causing problems ([#1260](https://github.com/open-policy-agent/opa/issues/1260)) +- Fix IAM examples to use regex instead of glob syntax ([#1282](https://github.com/open-policy-agent/opa/issues/1282)) + +### Miscellaneous + +- Add support to register custom stages in the compiler +- Add rootless Docker image stream +- Improve hash distribution on objects +- Reduce number of allocs in set membership implementation +- docs: Add homebrew install instruction to the Getting Started tutorial +- docs: Many improvements around := vs ==, best practices, cheatsheet, etc. +- cmd: Add --fail-defined flag to eval subcommand +- server: Fix patch path escaping + +## 0.10.5 + +* These release contians a small but backwards incompatible change to + the custom decision logger API. Custom decision loggers can now + return an error which will cause the OPA to fail-closed. + +### Fixes + +- Fix substring built-in bounds checking ([#1235](https://github.com/open-policy-agent/opa/issues/1235)) +- Add trailing newlines when pretty printing API responses +- Add default Go metrics to Prometheus +- Add pprof endpoint to HTTP server + +## 0.10.4 + +* This release adds support for scoping bundles to specific roots + under `data`. This allows bundles to be used in conjunction with + sidecars like `kube-mgmt` that load local data and policy into + OPA. See the [Bundles](https://www.openpolicyagent.org/docs/latest/management-bundles) + page for more details. + +* This release includes a small but backwards incompatible change to + the Decision Log event format. Instead of including the OPA version + as a top-level field, the OPA version is included in the labels. The + OPA version field was only added in v0.10.3 so this should not + impact many consumers. + +### Fixes + +- Add coverage support to `opa eval` sub-command +- Fix path checking in server to prevent overlapping base and virtual docs ([#1207](https://github.com/open-policy-agent/opa/issues/1207)) +- Fix cmd integration tests to cleanup plugin directory ([#1185](https://github.com/open-policy-agent/opa/issues/1185)) +- Improve TLS support in `http.send` ([#1067](https://github.com/open-policy-agent/opa/issues/ + +## 0.10.3 + +* This release includes support for authentication via client + certificates (thanks @srenatus!) For improvements to authentication + see [#1163](https://github.com/open-policy-agent/opa/issues/1163). + +* This release includes a backwards incompatible change to the + plugin interface. Specifically, when plugins are registered, callers + must provide a factory that can _validate_ configuration before + instantiating the plugin. This allows OPA to ensure that all + configuration is valid before activating changes. Since plugins were + undocumented prior to this release, this change should be low + impact. For details on plugin development see the new Plugins page + on the website. + +* This release includes a backwards incompatible change to the HTTP + decision logger event type. Specifically, "null" inputs are now + handled correctly and decision logs for ad-hoc queries now populate + the "query" field in the event instead of the "path" field. If you + are using consuming decision log events in Go, please switch to the + decision logger framework documented here: https://github.com/open-policy-agent/opa/blob/master/docs/book/plugins.md. + +### Fixes + +- Add OPA version to decision logs ([#1089](https://github.com/open-policy-agent/opa/issues/1089)) +- Add query metrics to decision logs ([#1033](https://github.com/open-policy-agent/opa/issues/1033)) +- Add health endpoint to HTTP server ([#1086](https://github.com/open-policy-agent/opa/issues/1086)) +- Add line of failure in `opa test` ([#961](https://github.com/open-policy-agent/opa/issues/961)) +- Fix panic caused by assignment rewriting ([#1125](https://github.com/open-policy-agent/opa/issues/1125)) +- Fix parser to avoid duplicate comments in AST ([#426](https://github.com/open-policy-agent/opa/issues/426)) +- Fix semantic check for function references ([#1132](https://github.com/open-policy-agent/opa/issues/1132)) +- Fix query API to return 4xx on bad request ([#1081](https://github.com/open-policy-agent/opa/issues/1081)) +- Fix incorrect early exit from ref resolver ([#1110](https://github.com/open-policy-agent/opa/issues/1110)) +- Fix rewriting of assignment values ([#1154](https://github.com/open-policy-agent/opa/issues/1154)) +- Fix resolution inside references ([#1155](https://github.com/open-policy-agent/opa/issues/1155)) +- Fix '^' location of lines starting with tabs ([#1129](https://github.com/open-policy-agent/opa/issues/1129)) +- docs: Update count function doc to mention strings (#1126) ([#1122](https://github.com/open-policy-agent/opa/issues/1122)) + +### Miscellaneous + +- Add tutorial for OPA/Ceph integration using Rook +- Add metrics timer for server handler +- Add support for custom backends in decision logger +- Fix find operation on sets for non-empty refs +- Fix bug in local declaration rewriting +- Fix discovery docs to show a realistic example +- Update decision log event to include error +- Update decision log events to model paths and queries +- Update server and decision logger to represent input properly +- Update server to include decision ID in error events +- Avoid zero values in http.Transport{} in REST client + +### WebAssembly + +- wasm: Add support for composite terms ([#1113](https://github.com/open-policy-agent/opa/issues/1113)) +- wasm: Add support for not keyword ([#1112](https://github.com/open-policy-agent/opa/issues/1112)) +- wasm: Add == operator +- wasm: Add checks on single term and dot stmts +- wasm: Add support for boolean and null literals +- wasm: Add support for pattern matching on composites +- wasm: Fix planner for chained iteration +- wasm: Fix pretty printer writer usage +- wasm: Output filenames in testgen errors +- wasm: Refactor assignment for better typing +- wasm: Remove module dumping from build command +- wasm: Rename ir.LoopStmt to ir.ScanStmt +- wasm: Update tester to allow for missing cases + +## 0.10.2 + +### Fixes + +- Add manifest metadata to bundle data (#1079) ([#1062](https://github.com/open-policy-agent/opa/issues/1062)) +- Add profile command to REPL ([#838](https://github.com/open-policy-agent/opa/issues/838)) +- Add decision ID note in API docs ([#1061](https://github.com/open-policy-agent/opa/issues/1061)) +- Fix formatting of trailing comments in composites ([#1060](https://github.com/open-policy-agent/opa/issues/1060)) +- Fix panic caused by input being set incorrectly ([#1083](https://github.com/open-policy-agent/opa/issues/1083)) +- Fix partial eval to apply saved terms ([#1074](https://github.com/open-policy-agent/opa/issues/1074)) + +### Miscellaneous + +- Add Stringer implementation for expr values +- Add Stringer implementation on metrics object +- Add helper function to compile strings +- Add note to configuration reference about -c flag +- Add support for configuration discovery +- Add support for multiple tracers +- Add trace helper to rego package +- Add code coverage percentage +- Fix REPL to check number of assignment operands +- Fix bug in test runner rule name dedup +- Fix security link in REST API reference +- Fix formatting of empty sets +- Fix incorrect reporting of module parse time +- Fix out of range errors for eq/assign in compiler +- Fix parser to limit size of exponents +- Update compiler to iterate over modules in sort order +- Update OPA front page +- Mark diagnostics feature as deprecated + +## 0.10.1 + +### Fixes + +- Add show debug command to REPL ([#750](https://github.com/open-policy-agent/opa/issues/750)) + +### Miscellaneous + +- Add `glob` built-ins for easier path matching (thanks @aeneasr) +- Add support for specifying services as object + +## 0.10.0 + +### Major Features + +- **Wasm compiler**. This release adds initial/experimental support for + compiling Rego policies into Wasm executables. Wasm executables can be loaded + and executed in compatible Wasm runtimes like V8 (nodejs). You can try this + out by running `opa build`. + +- **Data mocking**. This release adds support for replacing/mocking the `data` + document using the `with` keyword. In the past, `with` only supported the + `input` document. This made it tricky to test context-dependent policies. With + the new `with` keyword support, it's easier to write tests against contextual + policies. + +- **Negation Optimization**. This release includes an optimization in partial + evaluation for dealing with negated statements (`not` keyword). In the past, + OPA would generate a support rule for negated statements. This is harder for + clients to consume and not readily optimized. The optimization computes the + necessary cross-product of the negated query and inlines it into the caller. + This leads to simpler partial evaluation results that are readily optimized, + translated into other query languages (e.g., [SQL and Elasticsearch](https://blog.openpolicyagent.org/write-policy-in-opa-enforce-policy-in-sql-d9d24db93bf4)), + or compiled into Wasm. + +### Fixes + +- Add builtin to verify and decode JWT ([#884](https://github.com/open-policy-agent/opa/issues/884)) +- Add GoDoc sample for using rego.Tracer ([#1002](https://github.com/open-policy-agent/opa/issues/1002)) +- Add built-in function to get runtime info ([#420](https://github.com/open-policy-agent/opa/issues/420)) +- Add support for YAML encoded input values ([#290](https://github.com/open-policy-agent/opa/issues/290)) +- Add support for client certificates ([#684](https://github.com/open-policy-agent/opa/issues/684)) +- Add support for non-zero exit code in eval subcommand ([#981](https://github.com/open-policy-agent/opa/issues/981)) +- Fix == rewriting on embedded terms ([#995](https://github.com/open-policy-agent/opa/issues/995)) +- Fix copy propagation panic in comprehensions ([#1012](https://github.com/open-policy-agent/opa/issues/1012)) +- Implement regex.find_n (#1001) ([#747](https://github.com/open-policy-agent/opa/issues/747)) +- Improve with modifier target error ([#343](https://github.com/open-policy-agent/opa/issues/343)) +- Iterate over smaller set when intersecting ([#531](https://github.com/open-policy-agent/opa/issues/531)) +- Only write one trailing newline at end of file ([#1032](https://github.com/open-policy-agent/opa/issues/1032)) +- Redirect HTTP requests with trailing slashes ([#972](https://github.com/open-policy-agent/opa/issues/972)) +- Update bundle reader to allow relative data.json ([#1019](https://github.com/open-policy-agent/opa/issues/1019)) +- Expose version information via REST API ([#277](https://github.com/open-policy-agent/opa/issues/277)) + +### Miscellaneous + +- Add default decision configuration +- Add extra helpers to loader result +- Add indentation to trace in failure output +- Add router option to the HTTP server +- Add support for headers in http.send (thanks @repenno) +- Deprecating --insecure-addr flag (thanks @repenno) +- Add POST v1/query API for large inputs (thanks @rite2nikhil) +- Remove heap allocations from AST set with open addressing +- Replace siphash with xxhash in AST +- Output traces on failures in verbose mode (thanks @srenatus) +- Rewrite duplicate test rule names (thanks @srenatus) + +## 0.9.2 + +### Miscellaneous Fixes + +- Add option to enable http redirects ([#921](https://github.com/open-policy-agent/opa/issues/921)) +- Add copy propagation to support rules ([#911](https://github.com/open-policy-agent/opa/issues/911)) +- Add support for inlining negated expressions in partial evaluation +- Add deps subcommand to analyze base and virtual document dependencies +- Add partial evaluation support to eval subcommand +- Add `net.cidr_overlap` built-in function (thanks @aeneasr) +- Add `regex.template_match` built-in function (thanks @aeneasr) +- Add external security audit information (thanks @caniszczyk) +- Add initial support for plugin loading (thanks @vrnmthr) +- Fix copy propagator type assertion panic ([#912](https://github.com/open-policy-agent/opa/issues/912)) +- Fix panic in parser error detail construction ([#948](https://github.com/open-policy-agent/opa/issues/948)) +- Fix with value rewriting for call terms ([#916](https://github.com/open-policy-agent/opa/issues/916)) +- Fix coverage flag for test command (thanks @johscheuer) +- Fix compile operation timing in REPL +- Fix to indent 4 spaces instead of a tab (thanks @superbrothers) +- Fix REPL output in policy guide (thanks @ttripp) +- Multiple fixes in the Kubernetes admission controller tutorial (thanks @johscheuer) +- Improve formatting of empty ast.Body ([#909](https://github.com/open-policy-agent/opa/issues/909)) +- Improve Kubernetes admission control policy loading explanation (thanks @rite2nihkil) +- Update http.send test to work without internet access ([#945](https://github.com/open-policy-agent/opa/issues/945)) +- Update test runner to set Fail to true ([#954](https://github.com/open-policy-agent/opa/issues/954)) + +### Security Audit Fixes + +- Improve token authentication docs and handler ([#901](https://github.com/open-policy-agent/opa/issues/901)) +- Link to security docs in tutorials ([#917](https://github.com/open-policy-agent/opa/issues/917)) +- Update bundle reader to cap buffer size ([#920](https://github.com/open-policy-agent/opa/issues/920)) +- Validate queries by checking unsafe builtins ([#919](https://github.com/open-policy-agent/opa/issues/919)) +- Fix XSS in debug page ([#918](https://github.com/open-policy-agent/opa/issues/918)) + +### Miscellaneous + +## 0.9.1 + +### Fixes + +- Add io.jwt.verify_es256 and io.jwt.verify_ps256 built-in functions (@optnfast) +- Add array.concat built-in function ([#851](https://github.com/open-policy-agent/opa/issues/851)) +- Add support for command line bundle loading ([#870](https://github.com/open-policy-agent/opa/issues/870)) +- Add regex split built-in function +- Fix incorrect AST node in Index events ([#859](https://github.com/open-policy-agent/opa/issues/859)) +- Fix terraform tutorial type check errors ([#888](https://github.com/open-policy-agent/opa/issues/888)) +- Fix CONTRIBUTING.md to include sign-off step (@optnfast) +- Improve save set performance ([#860](https://github.com/open-policy-agent/opa/issues/860)) + +## 0.9.0 + +### Major Features + +This release adds two major features to OPA itself. + +- Query Profiler: the `opa eval` subcommand now supports a `--profiler` option + to help policy authors understand the performance profile of their policies. + Give it a shot and let us know if you find it helpful or if you find cases + that could be improved! + +- Compile API: OPA now exposes Partial Evaluation with first-class interfaces. + In prior releases, Partial Evaluation was only used for optimizations + purposes. As of v0.9, callers can use Partial Evaluation via HTTP or Golang to + obtain conditional decisions that can be evaluated on the client-side. + +### Fixes + +- Add ADOPTERS.md file ([#691](https://github.com/open-policy-agent/opa/issues/691)) +- Add time.weekday builtin ([#789](https://github.com/open-policy-agent/opa/issues/789)) +- Fix REPL output for multiple bool exprs ([#850](https://github.com/open-policy-agent/opa/issues/850)) +- Remove support rule if default value is not needed ([#820](https://github.com/open-policy-agent/opa/issues/820)) + +### Miscellaneous + +Here is a short list of notable miscellaneous improvements. + +- Add any/all built-in functions (thanks @vrnmthr) +- Add built-in function to parse Rego modules +- Add copy propagation optimization to partial evaluation output +- Add docs for exercising policies with test framework +- Add extra output formats to eval subcommand +- Add support for providing input to eval via stdin +- Improve parser error readability +- Improve rule index to support unknown values +- Rewrite == with = in compiler +- Update build to enable CGO + +...along with 30+ other fixes and improvements. + +## 0.8.2 + +### Fixes + +- Fix virtual document cache invalidation ([#736](https://github.com/open-policy-agent/opa/issues/736)) +- Fix partial cache invalidation for data changes ([#589](https://github.com/open-policy-agent/opa/issues/589)) +- Fix query to path conversion in decision logger ([#783](https://github.com/open-policy-agent/opa/issues/783)) +- Fix handling of pointers to structs ([#722](https://github.com/open-policy-agent/opa/issues/722), thanks @srenatus) +- Improve sprintf number handling ([#748](https://github.com/open-policy-agent/opa/issues/748)) +- Reduce memory overhead of decision logs ([#705](https://github.com/open-policy-agent/opa/issues/705)) +- Set bundle status in case of HTTP 304 ([#794](https://github.com/open-policy-agent/opa/issues/794)) + +### Miscellaneous + +- Add docs on best practices around identity +- Add built-in function to verify JWTs signed with HS246 (thanks @hbouvier) +- Add built-in function to URL encode objects (thanks @vrnmthr) +- Add query parameters to authorization policy input ([#786](https://github.com/open-policy-agent/opa/pull/786)) +- Add support for listening on a UNIX domain socket ([#692](https://github.com/open-policy-agent/opa/issues/692), thanks @JAORMX) +- Add trace event for rule index lookups ([#716](https://github.com/open-policy-agent/opa/issues/716)) +- Add support for multiple listeners in server (thanks @JAORMX) +- Remove decision log buffer size limit by default +- Update codebase with various go-fmt/ineffassign/mispell fixes (thanks @srenatus) +- Update REPL command to set unknowns +- Update subcommands to support loader filter ([#782](https://github.com/open-policy-agent/opa/issues/782)) +- Update evaluator to cache storage reads +- Update object to keep track of groundness + +## 0.8.1 + +### Fixes + +- Handle escaped paths in data writes ([#695](https://github.com/open-policy-agent/opa/issues/695)) +- Rewrite with modifiers to allow refs as values ([#701](https://github.com/open-policy-agent/opa/issues/701)) + +### Miscellaneous + +- Add Kafka authorization tutorial +- Add URL query encoding built-ins +- Add runtime API to register plugins +- Update eval subcommand to support multiple files or directories (thanks @devenney) +- Update Terraform tutorial for OPA v0.8 +- Fix bug in topdown query ID generation + +## 0.8.0 + +### Major Features + +This release includes a few major features that improve OPA's management +capabilities. + +- Bundles: OPA can be configured to download bundles of policy and data from + remote HTTP servers. This allows administrators to configure OPA to pull down + all of the policy and data required at the enforcement point. When OPA boots + it will download the bundle and active it. OPA will periodically check in with + the server to download new revisions of the bundle. + +- Status: OPA can be configured to report its status to remote HTTP servers. The + status includes a description of the active bundle. This allows administrators + to monitor the status of OPA in a central place. + +- Decision Logs: OPA can be configured to report _decision logs_ to remote HTTP + servers. This allows administrators to audit and debug decisions in a central + place. + +### File Loading Convention + +The command line file loading convention has been changed slightly. If you were +previously loading files with `opa run *` you should use `opa run .` now. OPA +will not namespace data under top-level directory names anymore. The problem +with the old approach was that data layout was dependent on the root directory +name. For example `opa run /some/path1` and `opa run /some/path2` would yield +different results even if both paths contained identical data. + +### Tracing Improvements + +Thanks to @jyoverna for adding a `trace` built-in function that allows policy +authors to include notes in the trace. For example, authors can now embed +`trace` calls in their policies. When OPA encounters a `trace` call it will +include a "note" in the trace. Callers can filter the trace results to show only +notes. This helps diagnose incorrect decisions in large policies. For example: + +``` +package example + +allow { + input.method = allows_methods[_] + trace(sprintf("input method is %v", [input.method])) +} + +allowed_methods = ["GET", "HEAD"] +``` + +### Fixes + +- Add RS256 JWT signature verification built-in function ([#421](https://github.com/open-policy-agent/opa/issues/421)) +- Add X.509 certificate parsing built-in function ([#635](https://github.com/open-policy-agent/opa/issues/635)) +- Fix substring built-in bounds checking ([#465](https://github.com/open-policy-agent/opa/issues/465)) +- Generate support rules for negated expressions ([#623](https://github.com/open-policy-agent/opa/issues/623)) +- Ignore some built-in calls during partial eval ([#622](https://github.com/open-policy-agent/opa/issues/622)) +- Plug comprehensions in partial eval results ([#656](https://github.com/open-policy-agent/opa/issues/656)) +- Report safety errors for generated vars ([#661](https://github.com/open-policy-agent/opa/issues/661)) +- Update partial eval to check call args recursively ([#621](https://github.com/open-policy-agent/opa/issues/621)) + +### Other Notable Changes + +- Add base64 encoding built-in functions +- Add JSON format to test and check subcommands +- Add coverage package and update test subcommand to report coverage +- Add eval subcommand to run queries from the command line (deprecates opa run --eval) +- Add parse subcommand to parse Rego modules and print AST +- Add reminder/reminder (%) operator +- Update rule index to support == +- Update to Go 1.10 +- Various fixes to fmt subcommand and format package +- Fix input and data loading to roundtrip values. Allows loading of []string, []int, etc. + +As well as many other smaller improvements, refactoring, and fixes. + +## 0.7.1 + +### Fixes + +- Use rego.ParsedInput to provide input from form ([#571](https://github.com/open-policy-agent/opa/issues/571)) + +### Miscellaneous + +- Add omitempty tag for ad-hoc query result field +- Fix rego package to check capture vars +- Fix root document assignment in REPL +- Update query compiler to deep copy parsed query + +## 0.7.0 + +### Major Features + +- Nested expressions: now you can write expressions like `(temp_f - 32)*5/9`! + +- Assignment/comparison operators: now you can write `x := ` to + declare local variables and `x == y` when you strictly want to compare two + values (and not bind any variables like with `=`). + +- Prometheus support: now you can hook up Prometheus to OPA and collect + performance metrics on the different APIs. (thanks @rlguarino) + +### New Built-in Functions + +This release adds and improves a bunch of new built-in functions. See the [Language Reference](http://www.openpolicyagent.org/docs/language-reference.html) for details. + +- Add globs_match built-in function (thanks @yashtewari) +- Add HTTP request built-in function +- Add time.clock and time.date built-in functions +- Add n-way set union and intersection built-in functions +- Improve walk built-in function performance for partially ground paths + +### Fixes + +- Fix REPL assignment support ([#615](https://github.com/open-policy-agent/opa/issues/615)) +- Fix panic due to nil term value ([#601](https://github.com/open-policy-agent/opa/issues/601)) +- Fix safety check bug for call args ([#625](https://github.com/open-policy-agent/opa/issues/625)) +- Update Kubernetes Admission Control tutorial ([#567](https://github.com/open-policy-agent/opa/issues/567)) +- Update release script to build for Windows ([#573](https://github.com/open-policy-agent/opa/issues/573)) + +### Miscellaneous + +- Add support for DELETE method in Data API ([#609](https://github.com/open-policy-agent/opa/issues/609)) (thanks @repenno) +- Add basic query performance instrumentation +- Add documentation covering how OPA compares to other systems +- Remove use of unsafe.Pointer for string hashing + +## 0.6.0 + +This release adds initial support for partial evaluation. Partial evaluation +allows callers to mark certain inputs as unknown and then evaluate queries to +produce *new* queries which can be evaluated once inputs become known. + +### Features + +- Add initial implementation of partial evaluation +- Add sort built-in function ([#465](https://github.com/open-policy-agent/opa/issues/465)) +- Add built-in function to check value types + +### Fixes + +- Fix rule arg type inferencing ([#542](https://github.com/open-policy-agent/opa/issues/542)) +- Fix documentation on "else" keyword ([#475](https://github.com/open-policy-agent/opa/issues/475)) +- Fix REPL to deduplicate auto-complete paths ([#432](https://github.com/open-policy-agent/opa/pull/432) +- Improve getting started example ([#532](https://github.com/open-policy-agent/opa/issues/532)) +- Improve handling of forbidden methods in HTTP server ([#445](https://github.com/open-policy-agent/opa/issues/445)) + +### Miscellaneous + +- Refactor sets and objects for constant time lookup + +## 0.5.13 + +### Fixes + +- Improve InterfaceToValue to handle other Go types ([#473](https://github.com/open-policy-agent/opa/issues/473)) +- Fix bug in conflict detection ([#518](https://github.com/open-policy-agent/opa/issues/518)) + +## 0.5.12 + +### Fixes + +- Fix eval of objects/sets containing vars ([#505](https://github.com/open-policy-agent/opa/issues/505)) +- Fix REPL printing of generated vars + +## 0.5.11 + +### Fixes + +- Refactor topdown evaluation/unification ([#131](https://github.com/open-policy-agent/opa/issues/131)) +- Rewrite refs in rule args ([#497](https://github.com/open-policy-agent/opa/issues/497)) + +### Miscellaneous + +- Fix bug in expression formatting +- Fix dynamic rewriting to copy with modifiers +- Fix off-by-one bug in array helper + +## 0.5.10 + +### Fixes + +- Fix index usage for virtual docs ([#490](https://github.com/open-policy-agent/opa/issues/490)) +- Fix match error panic ([#494](https://github.com/open-policy-agent/opa/issues/494)) +- Fix wildcard mangling in rule head ([#480](https://github.com/open-policy-agent/opa/issues/480)) + +### Miscellaneous + +- Add parse_duration_ns to generate nanos based on duration string +- Add product to calculate the product of array or set + +## 0.5.9 + +### Fixes + +- Fix unsafe var errors on functions ([#471](https://github.com/open-policy-agent/opa/issues/471), [#467](https://github.com/open-policy-agent/opa/issues/467)) + +### Miscellaneous + +- Fix docs example of set union +- Fix file watch bug causing panic in server mode +- Modify AST to represent function names as refs +- Refactor runtime to separate init and start +- Refactor test runner to accept Store argument + +## 0.5.8 + +### Fixes + +- Substitute comprehension terms requring eval ([#453](https://github.com/open-policy-agent/opa/issues/453)) + +### Miscellaneous + +- Add alpine-based Docker image +- Add stdin mode to opa fmt +- Fix syntax error in comprehension example +- Improve input parsing performance in V0 API +- Refactor loader to read inputs once (allows use of process substitution) +- Remove backup creation from fmt subcommand +- Remove use of sprintf in formatter + +## 0.5.7 + +This release adds a new `test` subcommand to OPA. The `test` subcommand enables policy unit testing. The unit tests are expressed as rules containing assertions over test data. The `test` subcommand provides a test runner that automatically discovers and executes these test rules. See `opa test --help` for examples. + +### Fixes + +- Fix type error marshalling bug ([#391](https://github.com/open-policy-agent/opa/issues/391)) +- Fix type inference bug ([#381](https://github.com/open-policy-agent/opa/issues/381)) +- Fix unification bug ([#436](https://github.com/open-policy-agent/opa/issues/436)) +- Fix type inferecen bug for partial objects with non-string keys ([#440](https://github.com/open-policy-agent/opa/issues/440)) +- Suppress match errors if closures contained errors ([#438](https://github.com/open-policy-agent/opa/issues/438)) + +## 0.5.6 + +As part of this release, logrus was revendored to deal with the naming issue. If you use logrus, or one of your other dependencies does (such as Docker), be sure to check out https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276. + +### Fixes + +- Fix incorrect REPL interpretation of some exprs ([#433](https://github.com/open-policy-agent/opa/issues/433)) +- Fix inaccurate location information in some parser errors ([#214](https://github.com/open-policy-agent/opa/issues/214)) + +### Miscellaneous + +- Add Terraform Testing tutorial to documentation +- Add shorthand for defining partial documents (e.g., `p[1]` instead of `p[1] { true }`) +- Add walk built-in function to recursively process nested documents +- Refactor Policy API response representations based on usage + +## 0.5.5 + +This release adds [Diagnostics](http://www.openpolicyagent.org/docs/rest-api.html#diagnostics) support to the server. This greatly improves OPA's debuggability when deployed as a daemon. + +### Miscellaneous + +- Fix data race in the parser extensions +- Fix index.html GET requests returning error on empty input +- Fix race condition in watch test +- Fix image version in HTTP API tutorial +- Add metrics command to the REPL +- Limit length of pretty printed values in the REPL +- Simplify input query parameters in data GET requests +- Update server to support pretty explanations + +## 0.5.4 + +### Miscellaneous + +- Properly remove temporary files when running `opa fmt -d` +- Add support for refs with composite operands (e.g,. `p[[x,y]]`) + +## 0.5.3 + +### Fixes + +- Add support for raw strings ([#265](https://github.com/open-policy-agent/opa/issues/265)) +- Add support to cancel compilation after some number of errors ([#249](https://github.com/open-policy-agent/opa/issues/249)) + +### Miscellaneous + +- Add Kubernetes admission control tutorial +- Add tracing support to rego package +- Add watch package for watching changes to queries +- Add dependencies package to perform dependency analysis on ASTs + +## 0.5.2 + +### Fixes + +- Fix mobile view navigation bug +- Fix panic in compiler from concurrent map writes ([#379](https://github.com/open-policy-agent/opa/pull/379) +- Fix ambiguous syntax around body and set comprehensions ([#377](https://github.com/open-policy-agent/opa/issues/377)) + +### Miscellaneous + +- Add support for set and object comprehensions +- Add support for system.main policy in server +- Add transaction support in rego package +- Improve type checking error messages +- Format REPL modules before printing them + +## 0.5.1 + +### Fixes + +- Correct `opa fmt` panic on missing files +- Fix minor site issues + +### Miscellaneous + +- Add rego examples with input and compiler +- Add support for query cancellation + +## 0.5.0 + +### User Functions + +OPA now supports user-defined functions that have the same semantics as built-in +functions. This allows policy authors to quickly define reusable pieces of logic +in Rego without overloading the input document or thinking about variable +safety. + +### Storage Improvements + +The storage layer has been improved to support single-writer/multiple-reader +concurrency. The storage interfaces have been simplified in the process. Users +can rely on https://godoc.org/github.com/open-policy-agent/opa/storage/inmem in +place of the old storage package. + +### Website Refresh + +The website has been redesigned and the documentation has been ported over to +GitBook. + +### `opa check` and `opa fmt` + +OPA supports two new commands that check and format policies. Check out `opa +help` for more information. + +### Miscellaneous + +- Add YAML serialization built-ins +- Add time built-ins + +### Fixes + +- Fixed incorrect source locations on refs and manually constructed terms. All + term locations should be set correctly now. +- Fixed evaluation bug that caused partial sets and partial objects to be + undefined in some cases. + +## 0.4.10 + +This release includes a bunch of new built-in functions to help with string manipulation, JWTs, and more. + +The JSON marshalling built-ins have been renamed. Policies that used `json_unmarshal` and `json_marshal` before will need to be updated to use `json.marshal` and `json.unmarshal` respectively. + +### Misc + +- Add `else` keyword +- Improved undefined built-in error message +- Fixed error message in `-` built-in +- Fixed exit instructions in REPL tutorial +- Relax safety check for built-in outputs + +## 0.4.9 + +This release includes a bunch of cool stuff! + +- Basic type checking for queries and virtual docs ([#312](https://github.com/open-policy-agent/opa/pull/312)) +- Optimizations for HTTP API authorization policies ([#319](https://github.com/open-policy-agent/opa/pull/319)) +- New /v0 API to support webhook integrations ([docs](http://www.openpolicyagent.org/documentation/references/rest-v0)) + +### Fixes + +- Add support for namespaced built-ins ([#314](https://github.com/open-policy-agent/opa/issues/314)) +- Improve logging to include request/response bodies ([#328](https://github.com/open-policy-agent/opa/pull/328)) +- Add basic performance metrics ([#320](https://github.com/open-policy-agent/opa/pull/320)) + +### Miscellaneous + +- Add built-ins to un/marshal JSON +- Add input form to diagnostic page + +## 0.4.8 + +### Miscellaneous + +- Fix top-level navigation links +- Improve file loader error handling + +## 0.4.7 + +### Fixes + +- Fix recursive binding by short-circuiting ref eval ([#298](https://github.com/open-policy-agent/opa/issues/298)) +- Fix reordering for unsafe ref heads ([#297](https://github.com/open-policy-agent/opa/issues/297)) +- Fix rewriting of single term exprs ([#299](https://github.com/open-policy-agent/opa/issues/299)) + +## 0.4.6 + +This release changes the `run` command options: + +- Removed glog in favour of Sirupsen/logrus. This means the command line arguments to control logging have changed. See `run --help` for details. +- Removed `--policy-dir` option. For now, if policy persistence is required, users can treat policies as config files and manage them outside of OPA. Once OPA supports persistence of data (e.g., with file-based storage) then policy persistence will be added back in. + +### Fixes + +- Add support for additional HTTP listener ([#289](https://github.com/open-policy-agent/opa/issues/289)) +- Allow slash in policy id/path ([#292](https://github.com/open-policy-agent/opa/issues/292)) +- Improve request logging ([#281](https://github.com/open-policy-agent/opa/issues/281)) + +### Miscellaneous + +- Add deployment documentation +- Remove erroneous flag.Parse() call +- Remove persist/--policy-dir option +- Replace glog with logrus + +Also, updated Docker tagging so that latest points to most recent release (instead of most recent development build). The most recent development build can still be obtained with the {version}-dev tag. + +## 0.4.5 + +### API security + +This release adds support for TLS, token-based authentication, and authorization in the OPA APIs! + +For details on how to secure the OPA API, go to http://openpolicyagent.org/documentation/references/security. + +### Fixes + +- Fix stray built-in error messages ([#275](https://github.com/open-policy-agent/opa/issues/275)) +- Update error codes and messages throughout ([#237](https://github.com/open-policy-agent/opa/issues/237)) +- [Fix evaluation bug with nested value refs](https://github.com/open-policy-agent/opa/pull/276/commits/e3336cce130eedda08f224ce4f28e19212447dcb) +- [Fix rego.Eval to close transactions](https://github.com/open-policy-agent/opa/pull/276/commits/745bd235127fae6bc22ff870bf62922c9358ccc0) +- [Fix buggy usage of errors.Cause](https://github.com/open-policy-agent/opa/pull/276/commits/bdf43b6a52de639e4f66810306311641ed7eea85) + +### Miscellaneous + +- Updated to support Go 1.8 + +## 0.4.4 + +### Fixes + +- Fix issue in high-level Go API ([#261](https://github.com/open-policy-agent/opa/issues/261)) + +## 0.4.3 + +### Fixes + +- Fix parsing of inline comments ([#258](https://github.com/open-policy-agent/opa/issues/258)) +- Fix unset of input/data in REPL ([#259](https://github.com/open-policy-agent/opa/issues/259)) +- Handle non-string/var values in rule tree lookup ([#257](https://github.com/open-policy-agent/opa/issues/257)) + +## 0.4.2 + +### Rego + +This release changes the Rego syntax. The two main changes are: + +- Expressions are now separated by semicolons (instead of commas). When writing rules, the semicolons are optional. +- Rules are no longer written in the form: `head :- body`. Instead they are written as `head { body }`. + +Also: + +- Set, array, and object literals now support trailing commas. +- To declare a set literal with one element, you must include a trailing comma, e.g., `{ foo, }`. +- Arithmetic and set operations can now be performed with infix notation, e.g., `x = 2 + 1`. +- Sets can be referred to like objects and arrays now ([#243](https://github.com/open-policy-agent/opa/issues/243)). E.g., `p[_].foo = 1 # check if element in has attr foo equal to 1`. + +### Evaluation + +This release changes the evaluation behaviour for packages. Previously, if a package contained no rules OR all of the rules were undefined when evaluated, a query against the package path would return undefined. As of v0.4.2 the query will return an empty object. + +### REST API + +This release changes the Data API to return an HTTP 200 response if the document is undefined. The message body will contain an object without the `result` property. + +### Fixes + +- Allow sets to be treated like objects/arrays + +### Miscellaneous + +- Added high level API for Go users. See `github.com/open-policy-agent/opa/rego` package. +- Improved expression String() function to handle infix operators better. +- Added support for set intersection and union built-ins. See language docs. + +## 0.4.1 + +### Rego + +For more details on these changes see sections in [How Do I Write Policies](http://www.openpolicyagent.org/documentation/how-do-i-write-policies/). + +- Added new **default** keyword. The default keyword can be used to provide a default value for rules with complete definitions. +- Added new **with** keyword. The with keyword can be used to programmatically set the value of the input document inside policies. + +### Fixes + +- Fix input document definition in REPL ([#231](https://github.com/open-policy-agent/opa/issues/231)) +- Fix reference evaluation bug ([#238](https://github.com/open-policy-agent/opa/issues/238)) + +### Miscellaneous + +- Add basic REST API authorization benchmark + +## 0.4.0 + +### REST API changes + +This release contains a few non-backwards compatible changes to the REST API: + +- The `request` document has been renamed to `input`. If you were calling the + GET /data[/path]?request=value you should update to use [POST + requests](http://www.openpolicyagent.org/documentation/references/rest#get-a-document-with-input) + (see below). + +- The API responses have been updated to return results embedded inside a + wrapper object: `{"result": value}`. This will allow OPA to return unambiguous + metadata in future (e.g., pagination, analysis, etc.) If you were previously + consuming Data API GET responses, you should update your code to access the + value under the `"result"` key of the response object. + +- The API models have been updated to use snake_case + ([#222](https://github.com/open-policy-agent/opa/issues/222)). This would only + affect you if you were previously consuming error responses or policy ASTs. + +The Data API has been updated to support the [POST +requests](http://www.openpolicyagent.org/documentation/references/rest#get-a-document-with-input). +This is the recommended way of supplying query inputs. + +### Built-in Function changes + +The built-in framework has been extended to support simplified built-in +implementations: + +- Refactor topdown built-in functions + ([#205](https://github.com/open-policy-agent/opa/issues/205)) + +### Fixes + +- Add cURL note to REST API docs ([#211](https://github.com/open-policy-agent/opa/issues/211)) +- Fix empty request parameter parsing ([#212](https://github.com/open-policy-agent/opa/issues/212)) +- Fix handling of missing input document ([#227](https://github.com/open-policy-agent/opa/issues/227)) +- Improve floating point literal support ([#215](https://github.com/open-policy-agent/opa/issues/215)) +- Improve module parsing errors ([#213](https://github.com/open-policy-agent/opa/issues/213)) +- Fix ast.Number hash and equality +- Fix parsing of escaped strings + +### Miscellaneous + +- Improve evaluation error messages + +## 0.3.1 + +### Fixes + +- Fixed unsafe vars with built-in operator names bug ([#206](https://github.com/open-policy-agent/opa/issues/206)) +- Fixed body to rule conversion bug ([#202](https://github.com/open-policy-agent/opa/issues/202)) +- Improved request parameter handling ([#201](https://github.com/open-policy-agent/opa/issues/201)) + +### Miscellaneous + +- Improved release infrastructure + +## 0.3.0 + +The last major/minor release of 2016! Woohoo! This release contains a few +non-backwards compatible changes to the APIs. + +### Storage API changes + +These changes simplify and clean up the storage.Store interface. This should +make it easier to implement custom stores in the future. + +- Update storage to support context.Context ([#155](https://github.com/open-policy-agent/opa/issues/155)) +- Update underlying number representation ([#154](https://github.com/open-policy-agent/opa/issues/154)) +- Updates to use new storage.Path type ([#159](https://github.com/open-policy-agent/opa/issues/159)) + +### The request Document + +These changes update the language to align query arguments with state stored in +OPA. With these changes, OPA can readily analyze policies and determine +references that refer to state stored in OPA versus query arguments versus local +variables. + +These changes also update how query arguments are provided via the REST API. + +- Updates to how query arguments are handled [#197](https://github.com/open-policy-agent/opa/pull/197) + +### topdown API changes + +- topdown.Context has been renamed to topdown.Topdown to avoid confusion with Golang's context. + +### Fixes + +- Add help topics to REPL ([#172](https://github.com/open-policy-agent/opa/issues/172)) +- Fix error handling bug in Query API ([#183](https://github.com/open-policy-agent/opa/issues/183)) +- Fix handling of prefixed paths with -w flag ([#193](https://github.com/open-policy-agent/opa/issues/193)) +- Improve exit handling in REPL ([#175](https://github.com/open-policy-agent/opa/issues/175)) +- Update parser support for = rules ([#192](https://github.com/open-policy-agent/opa/issues/192)) + +### Miscellaneous + +- Add Visual Studio and Atom plugins +- Add lazy loading of modules during compilation +- Fix bug in serialization of empty objects/arrays + +## 0.2.2 + +### Fixes + +- Add YAML loading and refactor into separate file ([#135](https://github.com/open-policy-agent/opa/issues/135)) +- Add command line flag to eval, print, and exit ([#152](https://github.com/open-policy-agent/opa/issues/152)) +- Add compiler check for consistent rule types ([#147](https://github.com/open-policy-agent/opa/issues/147)) +- Add set_diff built-in ([#133](https://github.com/open-policy-agent/opa/issues/133)) +- Add simple 'show' command to print current module ([#108](https://github.com/open-policy-agent/opa/issues/108)) +- Added examples to 'help' output in REPL ([#151](https://github.com/open-policy-agent/opa/issues/151)) +- Check package declarations for conflicts ([#137](https://github.com/open-policy-agent/opa/issues/137)) +- Deep copy modules in compiler ([#158](https://github.com/open-policy-agent/opa/issues/158)) +- Fix evaluation of refs to set literals ([#149](https://github.com/open-policy-agent/opa/issues/149)) +- Fix indexing usage for refs with intersecting vars ([#153](https://github.com/open-policy-agent/opa/issues/153)) +- Fix output for references iterating sets ([#148](https://github.com/open-policy-agent/opa/issues/148)) +- Fix parser handling of keywords in variable names ([#178](https://github.com/open-policy-agent/opa/issues/178)) +- Improve file loading support ([#163](https://github.com/open-policy-agent/opa/issues/163)) +- Remove conflict error for same key/value pairs ([#165](https://github.com/open-policy-agent/opa/issues/165)) +- Support "data" query in REPL ([#150](https://github.com/open-policy-agent/opa/issues/150)) + +### Miscellaneous + +- Add new compiler harness for ad-hoc queries +- Add tab completion of imports + +## 0.2.1 + +### Improvements + +- Added support for non-ground global values +- Added several new string manipulation built-ins +- Added TextMate grammar file +- Setup Docker image build and push to Docker Hub as part of CI + +## 0.2.0 + +### Language + +- Set literals +- Composite and reference values in Rule head +- Complete Rule definitions containing variables +- Builtins for regular expressions, string concatenation, casting to numbers + +### Compiler + +- Improved error reporting in parser and compiler + +### Evaluation + +- Iteration over base and virtual documents (in the same reference) +- Query tracing and explanation support + +### Storage + +- Pluggable data storage support + +### Documentation + +- GoDoc strings with examples +- REST API specification +- Concise language reference + +### Performance + +- Per-query cache of virtual documents in topdown + +And many other small improvements and fixes. + +## 0.1.0 + +### Language + +- Basic value types: null, boolean, number, string, object, and array +- Reference and variables types +- Array comprehensions +- Built-in functions for basic arithmetic and aggregation +- Incremental and complete rule definitions +- Negation and disjunction +- Module system + +### Compiler + +- Reference resolver to support packages +- Safety check to prevent recursive rules +- Safety checks to ensure successful evaluation will bind all variables in head + and body of rules + +### Evaluation + +- Initial top down query evaluation algorithm + +### Storage + +- Basic in-memory storage that exposes JSON Patch style API + +### Tooling + +- REPL that can be run to experiment with ad-hoc queries + +### APIs + +- Server mode supports HTTP APIs to manage policies, push and query documents, and execute ad-hoc queries. + +### Infrastructure + +- Basic build infrastructure to produce cross-platform builds, run + style/lint/format checks, execute tests, static HTML site + +### Documentation + +- Introductions to policy, policy-enabling, and how OPA works +- Language reference that serves as guide for new users +- Tutorial that introduces users to the REPL +- Tutorial that introduces users to policy-enabling with a Docker Authorization plugin diff --git a/third_party/opa/CODE_OF_CONDUCT.md b/third_party/opa/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..0b23e19ed336 --- /dev/null +++ b/third_party/opa/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +## Community Code of Conduct + +We follow the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). diff --git a/third_party/opa/COMMUNITY_GUIDELINES.md b/third_party/opa/COMMUNITY_GUIDELINES.md new file mode 100644 index 000000000000..eacee362c8f4 --- /dev/null +++ b/third_party/opa/COMMUNITY_GUIDELINES.md @@ -0,0 +1,63 @@ +# OPA Community Guidelines v2.0 + +The [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md) is enforced in all areas of the OPA community, plus the following. + +## Relevancy + +Any content posted or shared in the OPA community should be relevant to the specific Slack Channel or GitHub Category, and generally to the OPA community. If you're unsure about the content you want to share, posting in #help channel in Slack or the Community category in GitHub Discussions is always a safe choice; admins will be around to help guide new members. + +## Spamming + +Excessive re-posting, unnecessary cross-posting, unsolicited advertisements for services or products are not allowed on any of the OPA communication channels and are considered spam. Posting content that is considered spam will be removed and these actions are subject to the same enforcement rules as unacceptable behavior. + +## Vendors + +The OPA community has a rich ecosystem of tools, integrations, and Vendors to support them. Any company whose primary revenue stream includes a cloud-native service or technology is considered a Vendor. As a valuable part of the OPA ecosystem Vendors are encouraged to participate in the community with the expectation that they have good intentions, this means interacting with members with the intent to be helpful and supportive. Any unsolicited advertisements will be removed and are subject to our enforcement rules. + +## End-users + +Companies that use cloud-native services internally, but do not sell any of these services externally, are considered an End User Company in the OPA Community. End User companies are expected to operate with positive intentions, this is not the place to build your marketing funnel for external tools and services. + +## Member Participation + +The OPA community is here for everyone to connect with one another, share information, and build amazing products. By choosing to participate in the OPA community as a Vendor, End User, or general contributor you are agreeing to respect these guidelines. When interacting with any of our social channels, Slack, Twitter, GitHub, and any other channels we participate in, there is an expectation that you will exhibit the values of the OPA community. + +## Values + +### Be Respectful + +Value each other’s ideas, styles and viewpoints. We may not always agree, but disagreement is no excuse for poor manners. Be open to different possibilities and to being wrong. Be respectful in all interactions and communications, especially when debating the merits of different options. Be aware of your impact and how intense interactions may be affecting people. Be direct, constructive and positive. Take responsibility for your impact and your mistakes – if someone says they have been harmed through your words or actions, listen carefully, apologize sincerely, and correct the behavior going forward. + +### Be Direct but Professional + +We are likely to have some discussions about if and when criticism is respectful and when it’s not. We must be able to speak directly when we disagree and when we think we need to improve. We cannot withhold hard truths. Doing so respectfully is hard, doing so when others don’t seem to be listening is harder, and hearing such comments when one is the recipient can be even harder still. We need to be honest and direct, as well as respectful. + +### Be Inclusive + +Seek diverse perspectives. Diversity of views and of people on teams powers innovation, even if it is not always comfortable. Encourage all voices. Help new perspectives be heard and listen actively. If you find yourself dominating a discussion, it is especially important to step back and encourage other voices to join in. Be aware of how much time is taken up by dominant members of the group. Provide alternative ways to contribute or participate when possible. + +Be inclusive of everyone in an interaction, respecting and facilitating people’s participation whether they are: + +- Remote (on video or phone) +- Not native language speakers +- Coming from a different culture +- Using pronouns other than “he” or “she” +- Living in a different time zone +- Facing other challenges to participate +- Think about how you might facilitate alternative ways to contribute or participate. If you find yourself dominating a discussion, step back. Make way for other voices and listen actively to them. + +> These values were inspired by the [Mozilla Community Participation Guidelines](https://www.mozilla.org/en-US/about/governance/policies/participation/) + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior will not be tolerated. An admin may take any action deemed appropriate, up to and including, a warning, a temporary ban(30 days), and a permanent ban for repeated violation of these guidelines. Admins may also remove content that violates the guidelines. + + +## Reporting + +Please reach out to one of the admins below, or use the anonymous feedback form. + +- Peter ONeill (peteroneilljr@styra.com or @peteroneilljr) +- Torin Sandall (torin@styra.com or @tsandall) +- Amye Scavarda Parrin (amye@linuxfoundation.org) +- Anonymous Feedback: https://forms.gle/vFkrC1jMai1q3EZY6 diff --git a/third_party/opa/CONTRIBUTING.md b/third_party/opa/CONTRIBUTING.md new file mode 100644 index 000000000000..45f46eb6c1f6 --- /dev/null +++ b/third_party/opa/CONTRIBUTING.md @@ -0,0 +1,6 @@ +# Contributing + +Thanks for your interest in contributing to the Open Policy Agent (OPA) project! + +Please refer to [OPA's contribution guidelines](https://www.openpolicyagent.org/docs/latest/contributing/) +to find out how you can help. diff --git a/third_party/opa/Dockerfile b/third_party/opa/Dockerfile new file mode 100644 index 000000000000..9a894e85efa6 --- /dev/null +++ b/third_party/opa/Dockerfile @@ -0,0 +1,28 @@ +# Copyright 2019 The OPA Authors. All rights reserved. +# Use of this source code is governed by an Apache2 +# license that can be found in the LICENSE file. + +ARG BASE + +FROM ${BASE} + +LABEL org.opencontainers.image.authors="Torin Sandall " +LABEL org.opencontainers.image.source="https://github.com/open-policy-agent/opa" + +# Any non-zero number will do, and unfortunately a named user will not, as k8s +# pod securityContext runAsNonRoot can't resolve the user ID: +# https://github.com/kubernetes/kubernetes/issues/40958. +ARG USER=1000:1000 +USER ${USER} + +# TARGETOS and TARGETARCH are automatic platform args injected by BuildKit +# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope +ARG TARGETOS +ARG TARGETARCH +ARG BIN_DIR=. +ARG BIN_SUFFIX= +COPY ${BIN_DIR}/opa_${TARGETOS}_${TARGETARCH}${BIN_SUFFIX} /opa +ENV PATH=${PATH}:/ + +ENTRYPOINT ["/opa"] +CMD ["run"] diff --git a/third_party/opa/GOVERNANCE.md b/third_party/opa/GOVERNANCE.md new file mode 100644 index 000000000000..db9ffd5b828f --- /dev/null +++ b/third_party/opa/GOVERNANCE.md @@ -0,0 +1,63 @@ +# Project Governance + +This document defines the governance process for the open-policy-agent GitHub organization. + +The MAINTAINERS.md file in this repository contains the list of OPA project maintainers and their "area of expertise". An area of expertise is defined as a set of repositories or repository subtrees. + +## Voting + +Maintainers use "organizational voting" to approve changes so that no single organization can dominate an area of expertise. + +* "Organizations relevant to a change" are all those organizations with an area of expertise that covers the change. + +* "Organizations with an area of expertise" are those organizations for which there is a maintainer from that organization with that area of expertise. + +* Individuals not associated with or employed by a company or organization are allowed one organization vote. + +* Each company or organization (regardless of the number of maintainers associated with or employed by that company/organization) receives one organization vote. Any maintainer from an organization may cast the vote for that organization. + +For example, consider the following scenario. + +* Two maintainers are employed by Company X, two by Company Y, two by Company Z, and one maintainer is an unaffiliated individual + +* Area of expertise E covers the repository R + +* One maintainer from Company X, two from Company Y, and the un-affiliated individual all have expertise E + +For any change requiring a vote to repository R, three "organization votes" are possible: one for X, one for Y, and one for the un-affiliated individual. + +Unless specified otherwise, a vote passes when greater than fifty percent of the organization votes are in favour. + +## Code Changes + +All code changes should go through the Pull Request (PR) process. PRs should only be merged after receiving approval (via GitHub) from at least one other member of the GitHub team associated with the area(s) of expertise. + +We do not vote formally on every code change, but we do expect that every code change merged has the same community support as if the change were approved by a formal vote. When a merge occurs without sufficient community support, the change should be reverted until the dispute is resolved through discussion. Any team member who feels that a technical decision cannot be reached can call for a formal vote following the rules outlined above in either the PR or a separate issue. + +## Non-code Changes + +Changes that are not PRs will be voted on through GitHub issues. Maintainers should indicate their yes/no vote on that GitHub issue, and after a suitable period of time, the votes will be tallied and the outcome noted. + +The following changes, while governed by the language above, require additional clarification. + +### Changes in Maintainership + +New maintainers for an area of expertise are proposed by an existing maintainer for that area of expertise and are elected by a 2/3 majority of the organizations with that area of expertise. + +Maintainer status expires after 1 year but a request to self-renew can be made within 1 month of expiry. + +Maintainers for an area of expertise can be removed by a 2/3 majority of the organizations with that area of expertise. + +### Changes in Governance + +All changes in Governance require a 2/3 majority organization vote from all areas of expertise. + +### New Repositories + +New repositories require a 2/3 majority organization vote from all areas of expertise. + +## GitHub Project Administration + +Maintainers for an area of expertise belong to the associated GitHub team(s) (e.g., `opa-maintainers`, `gatekeeper-maintainers`, etc.) so that GitHub permissions reasonably follow this governance model. + +Individuals may be added to that repository's GitHub team but need not be added to the MAINTAINERS.md file. This provision enables new subprojects and contributors to be onboarded without immediately creating new maintainers. \ No newline at end of file diff --git a/third_party/opa/LICENSE b/third_party/opa/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/third_party/opa/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/third_party/opa/LONG_PATHS.sha256 b/third_party/opa/LONG_PATHS.sha256 new file mode 100644 index 000000000000..e30305145cc1 --- /dev/null +++ b/third_party/opa/LONG_PATHS.sha256 @@ -0,0 +1,122 @@ +dee92ae93edefb13acb97e1c9efccf43d025a2922aa17b2d31c9680026fdf90c docs/docs/policy-reference/_examples/encoding/envoy_header_manipulation/config.json +cb8e6147688882f39efa39ac676c3180dc10cf2e792f8700abcc785b32d17379 docs/docs/policy-reference/_examples/encoding/envoy_header_manipulation/input.json +1b090ad84667855976e72d79e98aa79c6fa438286b90e6405b9c97b5d22d0e7e docs/docs/policy-reference/_examples/encoding/envoy_header_manipulation/policy.rego +b4b005aa48b6003c0b78ad6b90074a8512531ecf395f773a48d58111a51687e2 docs/docs/policy-reference/_examples/encoding/envoy_header_manipulation/title.txt +d53b2f7f3c7255ecb316c26032ac73e73e1e53f6ffa9e107102b4c018c58d8a5 v1/test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1073.yaml +d16ed81b0c8b038ce64887b69602fa27c13a9fd65064ae01c4977c6a233ca1e1 v1/test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1074.yaml +325d79a995774630ad9c8a1c44ba0aa100872a156a6acc70e574e521817ead47 v1/test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1075.yaml +56cb4b9a02ac63a0a54a485c23676f9e5016be57634a15ab44ce59fb29a0e50c v1/test/cases/testdata/v0/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml +209115369f7883ef64d899dd493ad968be906d113623efd48c8f01a2afb299a2 v1/test/cases/testdata/v0/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml +08d0a58339cf0ab816afbf538cedc05b86d0d09b85d1b03672a03aff2f211538 v1/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml +167c3adbfcb993d4e920ad33afa25edc0bbf09b10cdb22aa55d9741928f00b56 v1/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml +c3fdd909a317b0ff2dd240b216094abf7cfabbbdcf0d628a089b69f28fe8339b v1/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml +c56d16e9458d932557ea0b46c25062407d7e9122f31e9ce30f57f6775b7b014e v1/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml +e4b2751d1642199af4c340e6c4cc2821f68c58ab65a799d7e860659708c8aac1 v1/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml +1d5612de6f56518eddc7ba8922020f63f42535c2db9672d9e47141f81b16560d v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml +11f6495b52c3adc85bb5b45b26f48c3b8686b9cc2f776cfaf9b243a8e0a2de3e v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml +7606b595de7400c792d1085be86389026999cdec2b6bbcf7e39f476daa435862 v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml +b53f27c68f2123f4fff95ed1e93482c2ead5ec8daa83bc2e3c92395e009b5f14 v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml +ffb04b902f2d429cfa7693a2263e331d3b1804c030dbe7edd2545fd76235b9b3 v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml +48664c103b7093806331997100d31be9856acdfdfb8771bbe5c71f204a585a06 v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml +2930e888e12d8bf770531faad49f78b0d4654598e2b2615517df84e570d10d1a v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml +15680a7fe9b0e694cadb9c3dd1960dd5ed135e25011f5daa1ae755743a8f3b3c v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml +418f4b790991320662cd8c0824577a52a7198e92cdd5a64e7b5704701bba0dad v1/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml +0b0fd103a26ae13eff6d07d1c529129e77241e9e67b6d5e8971af224f054c333 v1/test/cases/testdata/v0/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml +6061cf0c8c8db3acb015b21ac71a92e9b38deb4ecf0f8a6443f12367ad296d64 v1/test/cases/testdata/v0/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml +6ee6b622c609f9b86e7d2fd8c03d27c100bb533924036575f0c602065be4dd5e v1/test/cases/testdata/v0/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml +0c23e8edac4ef6a28496ba2a5f8febda26ca04b4edb69b0892d5fe61f882bce1 v1/test/cases/testdata/v0/functionerrors/test-functionerrors-undefined-builtin-result.yaml +e29da04449d37ea279d4ac83a3de966b2f2be199a6672f9644b7a0b1a28a7151 v1/test/cases/testdata/v0/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml +8ba4cc6ef3bb404c1adab6908c376493c1c2a5b7f5c847e47710e98d2be0624b v1/test/cases/testdata/v0/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml +a059fce866d17b3f6c0bc9641b9c12b558a2532a91acbeb6ca0aadc9fb6130f1 v1/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml +1bc0d047327927d138a73006fcbf9eac1c38bca828d976bcd549d143b53e6de7 v1/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml +8b1746637a80e029bc4371e7c38cb011e1c50f15317253698b4bb4bb1844e79d v1/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml +68da575ff4a6734fa019f21c8482439e89c7b7d2791bf0a02b78ba53e1749d62 v1/test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml +87d21634460a27a15bbf5f0b7c07c812e9896ab4571f13039d85b332c3c50f70 v1/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml +98474473c99caf3f5b97c486679303aad71d8557c191d8ed342527d36c5580f1 v1/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml +a4727947015233a9c7724a3477ce534b22c53bcc2f9070a7dec5785ed824b873 v1/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml +a2bebd784c51de56428835ac12d67e54b882b13abc7c19fe16ddc7f7ff5b214e v1/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml +fee763a86f96422514009bca4f3e08f197d4dc4f3d6118bed1912c67e4ea1713 v1/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml +e2e2639ea33d94fafd6a08ea13f17c6e4ffa6a5ac0b52a2178945392632ccdf2 v1/test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml +01d29d03e58f760c2e2611a86dfc5df692b33acc88ec41f2558adc84885e8d10 v1/test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml +c70f8bf4698f4b482b4179d337de4ee0a15ad5336c07f7be61028c309ab27b27 v1/test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml +42895fe5f8d1a1c0d88eae6822d18a0b3318a4e22a650df07e8b6bc8910d7222 v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml +fed00ced39d837dd7d18dafd941628fd80e8cf60c8a648ba20482f4bf4993893 v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml +0131bbe3e16f32424ac998bdb7656ca2ec1f77b6123c4f8e27587cce517d658e v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml +003bd0fc75ee1b31215d7277d18371284e8ebe0c290e78aa70b87e81b8eede72 v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml +bec23eb6b643b674547fe9d5bd22fa67241cd77eb713e0a871af4f41f9132c0e v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml +dc56f57a5b4fcdf3d8bfabc558b3c59750285fa77ff0a5e8ec87354b38e2d801 v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml +acf24168621c679a29f5555a3d04e7baa082eaf98258d679734c7a1893dfbce1 v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml +0eec074eec2d091e4ba6978f4b91824f7e312f2f0e0d260653fda9ef4a0268a1 v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml +a29bfd1e795b3ad42359f91a089def270edb85462a40bc4a86ce84902ddfa5d4 v1/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml +5048fc4281dcce11c61b63de9f06eaad6e3b5d94da964058506093da8c2918a0 v1/test/cases/testdata/v0/objectfilteridempotent/test-objectfilteridempotent-0319.yaml +2524801b6d7066b17310f6c780997e756b58e15d5341f67da1abffe0ff3cd9bf v1/test/cases/testdata/v0/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml +05807ee946b4779dd7c4ed78309454b824396ac91eb6cdbf4f8cb7f71b95de28 v1/test/cases/testdata/v0/objectremoveidempotent/test-objectremoveidempotent-0298.yaml +cb2bea1cd1d65f7034ba81d43cd95591156edde8c166e8330498dc766d44fab6 v1/test/cases/testdata/v0/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml +1a846422b20d95ccf2f65547253406898a30601f77fbdae32455e5808b969bbf v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml +f3e7f6efcf343e306cc476db6c93eb85c68a8c73b58014989fd64b76301d4791 v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml +b6e02b041f8ece9e64ac2f69de9bbc849552f0325b10a0a708c1aa2f251a5faf v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml +905a4011ef7d68db9e94bb3c4c492370cd156defcb38873f19201c114d43da88 v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml +9656781d04ff2276715f1d4a7705b07e90555132f5987bba138b69199fd0d95d v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml +ced1f770271b2889745ea4af6d504ea2b9e6e3f78cb054d0f9bc0d2ac22d312b v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml +73ebef5ea7f1b91ee11a5973854ada0c6ab87d4dc3189db379a41f7ee2d07643 v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml +9fc86246ee0cf7592f0d35680c581d8efe842d124f4b71e8ebf258dd5962ff62 v1/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml +c6e7046746c384a2ce35b1388bb35162dbe2ad6fd9917aacee8aaeea5e43ee8f v1/test/cases/testdata/v0/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml +c9d72f3fe507344cfaf155ff15c11b33f716dfc152c1ea23db109e62be39130c v1/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1073.yaml +7fd64242530f33bfe074af378a6a9eba9313144fa2cc0e60e4a9f71996a1cb6f v1/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1074.yaml +c38602a2d8c4adf81da5136c771241ad78bb16116fd42cde78a70133786358a0 v1/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1075.yaml +f5d8426a7e0ee25ade7cb607f692ed7da4bf007c0e4c0005e8c3cd467ea81c21 v1/test/cases/testdata/v1/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml +0e0d7cb37c4f44974d1f06b422242022e87f2fabf415e297f0757f9353b5f558 v1/test/cases/testdata/v1/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml +1efa44432be6cd67edb65601f0b9d399260a7cc853627737b9004200defc609b v1/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml +578515380574bf16e69637b4a82ca58794e07df82355c7fd2a6443f9376e4bb9 v1/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml +687f5b728bc2d51bd252a934206511f4607b98509a7f5d916eb914b3116c3b5b v1/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml +c3425aa1d7eb382b97b03980686d08deb71794bf77fb251f62d4736ce4232b41 v1/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml +b1ed5480d451bb929479e9c7a2759d4398a07070e7513e0b2506a008233f4f3d v1/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml +b42803d60c4d94afdfbc2013f79fe16defd5815b38b5fea3e3fb6a6655e7ffe4 v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml +142b850f5b311b04464d428c012295f5da8fbbeedfd954c83491565c0d771372 v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml +743b1d45ca38ea0ff537487aab0ce84ca4a13807a68dc4967c550e3dbb6f31a5 v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml +1d9ed8ff6b6cf6e6f8a3e3891c415a6acb8e1a02525195d114e15d6dd9a36fdd v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml +2e1d55883b35ccb6ff519364fa61596b09e9a7a035f609e11167a4f56d29214c v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml +5bf247e2e033095b7e89691a65b713e726579f109635b86c1aa6037a798b4bd6 v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml +ba9aa11f8c7476147b21f0609cd53d08ea1787b8b1783e954da320c35d3ea83a v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml +234275516c56765582a7546e08618ea1f01d0fa5dba66a05ac8c92990b90d3e2 v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml +d430d39f8a9db3cce65429560442150e38b973d64ae9c421d80d1e0472d39f67 v1/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml +28eac44bb6521a77fee0af1d47274ed2e1a03c897b67e9db56e15dbd523a1ae7 v1/test/cases/testdata/v1/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml +e33f640963a70317acdd4ca0ee68edfbeb52450017fb2b07a44042f0e0e334e9 v1/test/cases/testdata/v1/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml +04c8a69cec9f4aa79e495c197e34ba054771d32e594b15bcd6dd8e7fe49327c7 v1/test/cases/testdata/v1/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml +929c97a6e457fcf32b03c943c5a72caf8f2611463d7b8173184318c40b77b5c7 v1/test/cases/testdata/v1/functionerrors/test-functionerrors-undefined-builtin-result.yaml +fe5d3b169bee63ac981b4bda7f5c8df4c85c53703955fdf50c35037dc7a7b7d6 v1/test/cases/testdata/v1/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml +20cdae96e272459fa1249a4c30f31926ff3f642e222bc8565c4e4ba8e7e0e303 v1/test/cases/testdata/v1/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml +3c035ef449bf6d5589d77885168f3f164d18a1d35e193b403c75cdf7bc53e4ae v1/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml +757aa42f1a8a0313d4ea9e36887e90c5c676222959c3460b036957e6256d8ad6 v1/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml +b15e8ebec80f1a34926be8ddbe010b7e09c65fa66f3b113d59daef4feea82cf9 v1/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml +00012ba9d1f0e3cab1fea3234baa7cb47c79cbe5d76f1e9c9756dcf0dae74ad5 v1/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml +15ff44be6bf6757f7d7e60b0a813431b97a02f3b1b88f18fcf5fc2d7bda2c924 v1/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml +4f2d40d3c680ff4dda9de0d18393f3d5d8ab0e302c18b766eff971a893d3e472 v1/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml +aaf28fb02dd0528e35f494b9d4490b836369f51cb907b96b070f8a71e7818dd0 v1/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml +108035d7407d47dedba064130bd08a48e9dfcf991f3fea6368b8fad1e4c74e27 v1/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml +3dce04e1845d4091180e07efa9dc90385f3fcaf0796b7271ff17113a73a4c4ed v1/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml +d12dbabd25162575110695aa38c42c0c24117a807c85dd4a65d604a0f31a6145 v1/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml +77b2b96eed06a0085858060ce13706c7f5b941fa0e1100c11d5478a879529875 v1/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml +82d5f1705dcc76fc6ea35f192427a1853407dc8df531f4539bb67e7698592901 v1/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml +14f7a995a25e625046bcbd7433c0ec838c0c2703afe609a6766cc6bac0322b67 v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml +94a8f9ccb46f5b77f6a6451849773b97e9f22ca8cc0326f487d461296b4eda62 v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml +1c60dec891d0e8f67c19ed33b4fd2fa9aa1386155a27f0985414faf085e30507 v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml +7b35d34b3f8c1df64d344619bd72caa8d5505e376d1af62e7272e4fce729fa46 v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml +324af45df9a432a40916da9cb3eddaf560ea711ec615a38bb30fa48385b1f3d7 v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml +626309689be9d48e02a528240c8ba61858babc0cacdfac628ec15443e91436d1 v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml +6ff53c8f14e9407dfda5ddd6b9d760db354d337bb1ff4b12f273c28704d01114 v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml +4c4bf66ea94558e5f317bb5996044429646e8e15f205c590e3d7645bce3436c1 v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml +063b67edc9da323dfb7dd89b1da1c63440daee739d4e4e68f687b5f02fc58f04 v1/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml +5bca8012946950a323d5045dac1f6b0693bb6ae0ad89cd1099a94a9436539738 v1/test/cases/testdata/v1/objectfilteridempotent/test-objectfilteridempotent-0319.yaml +a42dd606f4966f53bc3805901c0f697f2c961ec64396def3562e65ec34d24fc8 v1/test/cases/testdata/v1/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml +b69a62e3e2dd1290d8d52566b18621da846fa53b048df467dace105ee8c57183 v1/test/cases/testdata/v1/objectremoveidempotent/test-objectremoveidempotent-0298.yaml +04ad1f3e51c8f9dab2858941a64f846429e30402d8701ebd4fc426fbe91a9f63 v1/test/cases/testdata/v1/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml +ce5d6a498534f2ac2c9ac02500cfb62275a1a981b757650b96002af6adf51b9d v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml +fcb0d6bb49e9348909915a935f418c60003b372180698a070970a3a978b6fb91 v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml +7d99970dd965ba68a87026c06ddb5e45b5054c0e405ddaefa991bfe2e1eef500 v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml +bcf65d9f68ad111f5d0559a3ef3b02ae30d989ff708816840d31433c4351b2f3 v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml +41c94970d1ea023cc836afa1043bbaf2612d7ea1a2404c0cb2677a2b501e3b6c v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml +a1803da07215662cd767117461d710cb6db6146cb9f74440067368ad7e965b0a v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml +9e43b5b451a16cff6421876cb57c681fa11a23a85024b280734a9da140b43671 v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml +1b86974fdb3249c4fdedc46cd4b336e10dca059b69476ba36174535e83e61644 v1/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml +2513698fa712433d8e98384de4c51967268dacc32d3977689f0c7df41745a123 v1/test/cases/testdata/v1/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml diff --git a/third_party/opa/LONG_PATHS.tar.gz b/third_party/opa/LONG_PATHS.tar.gz new file mode 100644 index 000000000000..efd5591252f3 Binary files /dev/null and b/third_party/opa/LONG_PATHS.tar.gz differ diff --git a/third_party/opa/MAINTAINERS.md b/third_party/opa/MAINTAINERS.md new file mode 100644 index 000000000000..7743aebac3c7 --- /dev/null +++ b/third_party/opa/MAINTAINERS.md @@ -0,0 +1,26 @@ +# Maintainers + +The following table lists OPA project maintainers and areas of expertise in alphabetical order: + +| Name | GitHub | Email | Organization | Repositories/Area of Expertise | Added/Renewed On | +| --- | --- | --- | --- | --- |------------------| +| Anders Eknert | @anderseknert | anders@styra.com | Styra | opa | 2025-01-27 | +| Ash Narkar | @ashutosh-narkar | anarkar4387@gmail.com | Styra | opa, opa-envoy-plugin | 2024-03-31 | +| Charlie Egan | @charlieegan3 | charlie@styra.com | Styra | opa | 2025-01-27 | +| Max Smythe | @maxsmythe | smythe@google.com | Google | frameworks/constraints, gatekeeper, gatekeeper-library, cert-controller | 2024-03-31 | +| Nilekh Chaudhari | @nilekhc | nilekhc@gmail.com | Microsoft | gatekeeper-library | 2024-03-31 | +| Rita Zhang | @ritazh | rita.z.zhang@gmail.com | Microsoft | frameworks/constraints, gatekeeper, gatekeeper-library, cert-controller | 2024-03-31 | +| Sertaç Özercan | @sozercan | sozercan@gmail.com | Microsoft | gatekeeper, gatekeeper-library, cert-controller, gatekeeper-external-data-provider | 2024-03-31 | +| Jaydip Gabani | @JaydipGabani | gabanijaydip@gmail.com | Microsoft | frameworks/constraints, gatekeeper, gatekeeper-library, cert-controller | 2024-11-06 | +| Stephan Renatus | @srenatus | stephan@styra.com | Styra | opa | 2024-03-31 | +| Tim Hinrichs | @timothyhinrichs | timothy.l.hinrichs@gmail.com | Styra | all repositories | 2024-03-31 | +| Torin Sandall | @tsandall | torinsandall@gmail.com | Styra | all repositories | 2024-03-31 | + +## Emeritus + +* [Craig Tabita](https://github.com/ctab) +* [Ernest Wong](https://github.com/chewong) +* [Patrick East](https://github.com/patrick-east) +* [Will Beason](https://github.com/willbeason) +* [Oren Shomron](https://github.com/shomron) +* [Andrew Peabody](https://github.com/apeabody) diff --git a/third_party/opa/Makefile b/third_party/opa/Makefile new file mode 100644 index 000000000000..3e270100f21b --- /dev/null +++ b/third_party/opa/Makefile @@ -0,0 +1,565 @@ +# Copyright 2016 The OPA Authors. All rights reserved. +# Use of this source code is governed by an Apache2 +# license that can be found in the LICENSE file. + +VERSION := $(shell ./build/get-build-version.sh) + +CGO_ENABLED ?= 1 +WASM_ENABLED ?= 1 +GOFLAGS ?= "-buildmode=exe" + +# See https://golang.org/cmd/go/#hdr-Build_modes: +# > -buildmode=exe +# > Build the listed main packages and everything they import into +# > executables. Packages not named main are ignored. +GO := CGO_ENABLED=$(CGO_ENABLED) GOFLAGS="$(GOFLAGS)" go +GO_TEST_TIMEOUT := -timeout 30m + +GOVERSION ?= $(shell cat ./.go-version) +GOARCH := $(shell go env GOARCH) +GOOS := $(shell go env GOOS) + +ifeq ($(GOOS)/$(GOARCH),darwin/arm64) +WASM_ENABLED=0 +endif + +GO_TAGS := -tags= +ifeq ($(WASM_ENABLED),1) +GO_TAGS = -tags=opa_wasm +endif + +GOLANGCI_LINT_VERSION := v1.64.5 +YAML_LINT_VERSION := 0.29.0 +YAML_LINT_FORMAT ?= auto + +DOCKER_RUNNING ?= $(shell docker ps >/dev/null 2>&1 && echo 1 || echo 0) + +# We use root because the windows build, invoked through the ci-go-build-windows +# target, installs the gcc mingw32 cross-compiler. +# For image, it's overridden, so that the built binary isn't root-owned. +DOCKER_UID ?= 0 +DOCKER_GID ?= 0 + +ifeq ($(shell tty > /dev/null && echo 1 || echo 0), 1) +DOCKER_FLAGS := --rm -it +else +DOCKER_FLAGS := --rm +endif + +DOCKER := docker + +# BuildKit is required for automatic platform arg injection (see Dockerfile) +export DOCKER_BUILDKIT := 1 + +# Supported platforms to include in image manifest lists +DOCKER_PLATFORMS := linux/amd64 +DOCKER_PLATFORMS_STATIC := linux/amd64,linux/arm64 + +BIN := opa_$(GOOS)_$(GOARCH) + +# Optional external configuration useful for forks of OPA +DOCKER_IMAGE ?= openpolicyagent/opa +S3_RELEASE_BUCKET ?= opa-releases +FUZZ_TIME ?= 1h +TELEMETRY_URL ?= #Default empty + +BUILD_HOSTNAME := $(shell ./build/get-build-hostname.sh) + +RELEASE_BUILD_IMAGE := golang:$(GOVERSION)-bullseye + +RELEASE_DIR ?= _release/$(VERSION) + +ifneq (,$(TELEMETRY_URL)) +TELEMETRY_FLAG := -X github.com/open-policy-agent/opa/internal/report.ExternalServiceURL=$(TELEMETRY_URL) +endif + +LDFLAGS := "$(TELEMETRY_FLAG) \ + -X github.com/open-policy-agent/opa/version.Hostname=$(BUILD_HOSTNAME)" + + +###################################################### +# +# Development targets +# +###################################################### + +# If you update the 'all' target make sure the 'ci-release-test' target is consistent. +.PHONY: all +all: build test perf wasm-sdk-e2e-test check + +.PHONY: version +version: + @echo $(VERSION) + +.PHONY: release-dir +release-dir: + @echo $(RELEASE_DIR) + +.PHONY: generate +generate: wasm-lib-build +ifeq ($(GOOS),windows) + GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.5.0 +endif + $(GO) generate + +.PHONY: build +build: go-build + +.PHONY: image +image: + DOCKER_UID=$(shell id -u) DOCKER_GID=$(shell id -g) $(MAKE) ci-go-ci-build-linux ci-go-ci-build-linux-static + @$(MAKE) image-quick + +.PHONY: install +install: generate + $(GO) install $(GO_TAGS) -ldflags $(LDFLAGS) + +.PHONY: test +test: go-test wasm-test + +.PHONY: test-short +test-short: go-test-short + +.PHONY: go-build +go-build: generate + $(GO) build $(GO_TAGS) -o $(BIN) -ldflags $(LDFLAGS) + +.PHONY: go-test +go-test: generate + $(GO) test $(GO_TAGS),slow ./... + +.PHONY: go-test-short +go-test-short: generate + $(GO) test $(GO_TAGS) -short ./... + +.PHONY: race-detector +race-detector: generate + $(GO) test $(GO_TAGS),slow -race -vet=off ./... + +.PHONY: test-coverage +test-coverage: generate + $(GO) test $(GO_TAGS),slow -coverprofile=coverage.txt -covermode=atomic ./... + +.PHONY: perf +perf: generate + $(GO) test $(GO_TAGS),slow $(GO_TEST_TIMEOUT) -run=- -bench=. -benchmem ./... + +.PHONY: perf-noisy +perf-noisy: generate + $(GO) test $(GO_TAGS),slow,noisy $(GO_TEST_TIMEOUT) -run=- -bench=. -benchmem ./... + +.PHONY: wasm-sdk-e2e-test +wasm-sdk-e2e-test: generate + $(GO) test $(GO_TAGS),slow,wasm_sdk_e2e $(GO_TEST_TIMEOUT) ./internal/wasm/sdk/test/e2e + +.PHONY: check +check: +ifeq ($(DOCKER_RUNNING), 1) + docker run --rm -v $(shell pwd):/app:ro,Z -w /app golangci/golangci-lint:${GOLANGCI_LINT_VERSION} golangci-lint run -v +else + @echo "Docker not installed or running. Skipping golangci run." +endif + +.PHONY: fmt +fmt: +ifeq ($(DOCKER_RUNNING), 1) + docker run --rm -v $(shell pwd):/app:Z -w /app golangci/golangci-lint:${GOLANGCI_LINT_VERSION} golangci-lint run -v --fix +else + @echo "Docker not installed or running. Skipping golangci run." +endif + +.PHONY: clean +clean: wasm-lib-clean + rm -f opa_*_* + +.PHONY: fuzz +fuzz: + go test ./ast -fuzz FuzzParseStatementsAndCompileModules -fuzztime ${FUZZ_TIME} -v -run '^$$' + +###################################################### +# +# Documentation targets +# +###################################################### + +# The docs-% pattern target will shim to the +# makefile in ./docs +.PHONY: docs-% +docs-%: + $(MAKE) -C docs $* + +.PHONY: man +man: + ./build/gen-man.sh man + +###################################################### +# +# Linux distro package targets +# +###################################################### + +.PHONY: deb +deb: + VERSION=$(VERSION) ./build/gen-deb.sh + +###################################################### +# +# Wasm targets +# +###################################################### + +.PHONY: wasm-test +wasm-test: wasm-lib-test wasm-rego-test + +.PHONY: wasm-lib-build +wasm-lib-build: +ifeq ($(DOCKER_RUNNING), 1) + @$(MAKE) -C wasm ensure-builder build + cp wasm/_obj/opa.wasm internal/compiler/wasm/opa/opa.wasm + cp wasm/_obj/callgraph.csv internal/compiler/wasm/opa/callgraph.csv +else + @echo "Docker not installed or not running. Skipping OPA-WASM library build." +endif + +.PHONY: wasm-lib-test +wasm-lib-test: +ifeq ($(DOCKER_RUNNING), 1) + @$(MAKE) -C wasm ensure-builder test +else + @echo "Docker not installed or not running. Skipping OPA-WASM library test." +endif + +.PHONY: wasm-rego-test +wasm-rego-test: generate +ifeq ($(DOCKER_RUNNING), 1) + GOVERSION=$(GOVERSION) DOCKER_UID=$(DOCKER_UID) DOCKER_GID=$(DOCKER_GID) ./build/run-wasm-rego-tests.sh +else + @echo "Docker not installed or not running. Skipping Rego-WASM test." +endif + +.PHONY: wasm-lib-clean +wasm-lib-clean: + @$(MAKE) -C wasm clean + +.PHONY: wasm-rego-testgen-install +wasm-rego-testgen-install: + $(GO) install ./v1/test/wasm/cmd/wasm-rego-testgen + +###################################################### +# +# CI targets +# +###################################################### + +CI_GOLANG_DOCKER_MAKE := $(DOCKER) run \ + $(DOCKER_FLAGS) \ + -u $(DOCKER_UID):$(DOCKER_GID) \ + -v $(PWD):/src \ + -w /src \ + -e GOCACHE=/src/.go/cache \ + -e GOARCH=$(GOARCH) \ + -e CGO_ENABLED=$(CGO_ENABLED) \ + -e WASM_ENABLED=$(WASM_ENABLED) \ + -e FUZZ_TIME=$(FUZZ_TIME) \ + -e TELEMETRY_URL=$(TELEMETRY_URL) \ + $(RELEASE_BUILD_IMAGE) + +.PHONY: ci-go-% +ci-go-%: generate + $(CI_GOLANG_DOCKER_MAKE) /bin/bash -c "git config --system --add safe.directory /src && make $*" + +.PHONY: ci-release-test +ci-release-test: generate + $(CI_GOLANG_DOCKER_MAKE) make test perf wasm-sdk-e2e-test check + +.PHONY: ci-check-working-copy +ci-check-working-copy: generate + ./build/check-working-copy.sh + +.PHONY: ci-wasm +ci-wasm: wasm-test + +.PHONY: ci-build-linux +ci-build-linux: ensure-release-dir ensure-linux-toolchain + @$(MAKE) build GOOS=linux + chmod +x opa_linux_$(GOARCH) + mv opa_linux_$(GOARCH) $(RELEASE_DIR)/ + cd $(RELEASE_DIR)/ && shasum -a 256 opa_linux_$(GOARCH) > opa_linux_$(GOARCH).sha256 + +.PHONY: ci-build-linux-static +ci-build-linux-static: ensure-release-dir + @$(MAKE) build GOOS=linux WASM_ENABLED=0 CGO_ENABLED=0 + chmod +x opa_linux_$(GOARCH) + mv opa_linux_$(GOARCH) $(RELEASE_DIR)/opa_linux_$(GOARCH)_static + cd $(RELEASE_DIR)/ && shasum -a 256 opa_linux_$(GOARCH)_static > opa_linux_$(GOARCH)_static.sha256 + +.PHONY: ci-build-darwin +ci-build-darwin: ensure-release-dir + @$(MAKE) build GOOS=darwin + chmod +x opa_darwin_$(GOARCH) + mv opa_darwin_$(GOARCH) $(RELEASE_DIR)/ + cd $(RELEASE_DIR)/ && shasum -a 256 opa_darwin_$(GOARCH) > opa_darwin_$(GOARCH).sha256 + +.PHONY: ci-build-darwin-arm64-static +ci-build-darwin-arm64-static: ensure-release-dir + @$(MAKE) build GOOS=darwin GOARCH=arm64 WASM_ENABLED=0 CGO_ENABLED=0 + chmod +x opa_darwin_arm64 + mv opa_darwin_arm64 $(RELEASE_DIR)/opa_darwin_arm64_static + cd $(RELEASE_DIR)/ && shasum -a 256 opa_darwin_arm64_static > opa_darwin_arm64_static.sha256 + +# NOTE: This target expects to be run as root on some debian/ubuntu variant +# that can install the `gcc-mingw-w64-x86-64` package via apt-get. +.PHONY: ci-build-windows +ci-build-windows: ensure-release-dir + build/ensure-windows-toolchain.sh + @$(MAKE) build GOOS=windows CC=x86_64-w64-mingw32-gcc + mv opa_windows_$(GOARCH) $(RELEASE_DIR)/opa_windows_$(GOARCH).exe + cd $(RELEASE_DIR)/ && shasum -a 256 opa_windows_$(GOARCH).exe > opa_windows_$(GOARCH).exe.sha256 + rm resource.syso + +.PHONY: ensure-release-dir +ensure-release-dir: + mkdir -p $(RELEASE_DIR) + +.PHONY: ensure-executable-bin +ensure-executable-bin: + find $(RELEASE_DIR) -type f ! -name "*.sha256" | xargs chmod +x + +.PHONY: ensure-linux-toolchain +ensure-linux-toolchain: +ifeq ($(CGO_ENABLED),1) + $(eval export CC = $(shell GOARCH=$(GOARCH) build/ensure-linux-toolchain.sh)) +else + @echo "CGO_ENABLED=$(CGO_ENABLED). No need to check gcc toolchain." +endif + +.PHONY: build-all-platforms +build-all-platforms: ci-build-linux ci-build-linux-static ci-build-darwin ci-build-darwin-arm64-static ci-build-windows + +.PHONY: image-quick +image-quick: image-quick-$(GOARCH) + +# % = arch +.PHONY: image-quick-% +image-quick-%: ensure-executable-bin +ifneq ($(GOARCH),arm64) # build only static images for arm64 + $(DOCKER) build \ + -t $(DOCKER_IMAGE):$(VERSION) \ + --build-arg BASE=chainguard/glibc-dynamic \ + --build-arg BIN_DIR=$(RELEASE_DIR) \ + --platform linux/$* \ + . + $(DOCKER) build \ + -t $(DOCKER_IMAGE):$(VERSION)-debug \ + --build-arg BASE=chainguard/glibc-dynamic:latest-dev \ + --build-arg BIN_DIR=$(RELEASE_DIR) \ + --platform linux/$* \ + . +endif + $(DOCKER) build \ + -t $(DOCKER_IMAGE):$(VERSION)-static \ + --build-arg BASE=chainguard/static:latest \ + --build-arg BIN_DIR=$(RELEASE_DIR) \ + --build-arg BIN_SUFFIX=_static \ + --platform linux/$* \ + . + + $(DOCKER) build \ + -t $(DOCKER_IMAGE):$(VERSION)-static-debug \ + --build-arg BASE=chainguard/busybox:latest-glibc \ + --build-arg BIN_DIR=$(RELEASE_DIR) \ + --build-arg BIN_SUFFIX=_static \ + --platform linux/$* \ + . + +# % = base tag +.PHONY: push-manifest-list-% +push-manifest-list-%: ensure-executable-bin + $(DOCKER) buildx build \ + --tag $(DOCKER_IMAGE):$* \ + --build-arg BASE=chainguard/glibc-dynamic:latest \ + --build-arg BIN_DIR=$(RELEASE_DIR) \ + --platform $(DOCKER_PLATFORMS) \ + --provenance=false \ + --push \ + . + $(DOCKER) buildx build \ + --tag $(DOCKER_IMAGE):$*-debug \ + --build-arg BASE=chainguard/glibc-dynamic:latest-dev \ + --build-arg BIN_DIR=$(RELEASE_DIR) \ + --platform $(DOCKER_PLATFORMS) \ + --provenance=false \ + --push \ + . + + $(DOCKER) buildx build \ + --tag $(DOCKER_IMAGE):$*-static \ + --build-arg BASE=chainguard/static:latest \ + --build-arg BIN_DIR=$(RELEASE_DIR) \ + --build-arg BIN_SUFFIX=_static \ + --platform $(DOCKER_PLATFORMS_STATIC) \ + --provenance=false \ + --push \ + . + + $(DOCKER) buildx build \ + --tag $(DOCKER_IMAGE):$*-static-debug \ + --build-arg BASE=chainguard/busybox:latest-glibc \ + --build-arg BIN_DIR=$(RELEASE_DIR) \ + --build-arg BIN_SUFFIX=_static \ + --platform $(DOCKER_PLATFORMS_STATIC) \ + --provenance=false \ + --push \ + . + +.PHONY: ci-image-smoke-test +ci-image-smoke-test: ci-image-smoke-test-$(GOARCH) + +# % = arch +.PHONY: ci-image-smoke-test-% +ci-image-smoke-test-%: image-quick-% +ifneq ($(GOARCH),arm64) # we build only static images for arm64 + $(DOCKER) run --platform linux/$* $(DOCKER_IMAGE):$(VERSION) version + $(DOCKER) run --platform linux/$* $(DOCKER_IMAGE):$(VERSION)-debug version + + $(DOCKER) image inspect $(DOCKER_IMAGE):$(VERSION) |\ + $(DOCKER) run --interactive --platform linux/$* $(DOCKER_IMAGE):$(VERSION) \ + eval --fail --format raw --stdin-input 'input[0].Config.User = "1000:1000"' +endif + $(DOCKER) run --platform linux/$* $(DOCKER_IMAGE):$(VERSION)-static version + +# % = rego/wasm +.PHONY: ci-binary-smoke-test-% +ci-binary-smoke-test-%: + chmod +x "$(RELEASE_DIR)/$(BINARY)" + ./build/binary-smoke-test.sh "$(RELEASE_DIR)/$(BINARY)" "$*" + +.PHONY: push-binary-edge +push-binary-edge: + aws s3 sync $(RELEASE_DIR) s3://$(S3_RELEASE_BUCKET)/edge/ --no-progress --region us-west-1 + +.PHONY: docker-login +docker-login: + @echo "Docker Login..." + @echo ${DOCKER_PASSWORD} | $(DOCKER) login -u ${DOCKER_USER} --password-stdin + +.PHONY: push-image +push-image: docker-login push-manifest-list-$(VERSION) + +.PHONY: push-wasm-builder-image +push-wasm-builder-image: docker-login + $(MAKE) -C wasm push-builder + +.PHONY: deploy-ci +deploy-ci: push-image push-manifest-list-edge push-binary-edge + +.PHONY: release-ci +# Don't tag and push "latest" image tags if the version is a release candidate or a bugfix branch +# where the changes don't exist in main +ifneq (,$(or $(findstring rc,$(VERSION)), $(findstring release-,$(shell git branch --contains HEAD)))) +release-ci: push-image +else +release-ci: push-image push-manifest-list-latest +endif + +.PHONY: netlify +netlify: docs-clean docs-ci docs-build + +# Kept for compatibility. Use `make fuzz` instead. +.PHONY: check-fuzz +check-fuzz: fuzz + +# GOPRIVATE=* causes go to fetch all dependencies from their corresponding VCS +# source, not through the golang-provided proxy services. We're cleaning out +# /src/.go by providing a tmpfs mount, so the `go mod vendor -v` command will +# not be able to use any module cache. +.PHONY: check-go-module +check-go-module: + docker run \ + $(DOCKER_FLAGS) \ + -w /src \ + -v $(PWD):/src:Z \ + -e 'GOPRIVATE=*' \ + --tmpfs /src/.go \ + $(RELEASE_BUILD_IMAGE) \ + /bin/bash -c "git config --system --add safe.directory /src && go mod vendor -v" + +.PHONY: check-yaml-tests +check-yaml-tests: +ifeq ($(DOCKER_RUNNING), 1) + docker run --rm -v $(shell pwd):/data:ro,Z -w /data pipelinecomponents/yamllint:${YAML_LINT_VERSION} yamllint -f $(YAML_LINT_FORMAT) v1/test/cases/testdata +else + @echo "Docker not installed or running. Skipping yamllint run." +endif + +###################################################### +# +# Release targets +# +###################################################### + +.PHONY: release-patch +release-patch: +ifeq ($(GITHUB_TOKEN),) + @echo "\033[0;31mGITHUB_TOKEN environment variable missing.\033[33m Provide a GitHub Personal Access Token (PAT) with the 'read:org' scope.\033[0m" +endif + @$(DOCKER) run $(DOCKER_FLAGS) \ + -e GITHUB_TOKEN=$(GITHUB_TOKEN) \ + -e LAST_VERSION=$(LAST_VERSION) \ + -v $(PWD):/_src:Z \ + ashtalk/python-go-perl:v2 \ + /_src/build/gen-release-patch.sh --version=$(VERSION) --source-url=/_src + +.PHONY: dev-patch +dev-patch: + @$(DOCKER) run $(DOCKER_FLAGS) \ + -v $(PWD):/_src:Z \ + ashtalk/python-go-perl:v2 \ + /_src/build/gen-dev-patch.sh --version=$(VERSION) --source-url=/_src + +# Deprecated targets. To be removed. +.PHONY: build-linux depr-build-linux build-windows depr-build-windows build-darwin depr-build-darwin release release-local +build-linux: deprecation-build-linux +build-windows: deprecation-build-windows +build-darwin: deprecation-build-darwin +release: deprecation-release +release-local: deprecation-release-local + +.PHONY: deprecation-% +deprecation-%: + @echo "----------------------------------------------" + @echo "The '$*' make target is deprecated!" + @echo "----------------------------------------------" + @echo "To run build for your platform, use 'make build'." + @echo "To cross-compile for a specific platform, use the corresponding 'ci-build-*' target." + @echo + @$(MAKE) depr-$* + +depr-build-linux: ensure-release-dir + @$(MAKE) build GOOS=linux CGO_ENABLED=0 WASM_ENABLED=0 + mv opa_linux_$(GOARCH) $(RELEASE_DIR)/ + +depr-build-darwin: ensure-release-dir + @$(MAKE) build GOOS=darwin CGO_ENABLED=0 WASM_ENABLED=0 + mv opa_darwin_$(GOARCH) $(RELEASE_DIR)/ + +depr-build-windows: ensure-release-dir + @$(MAKE) build GOOS=windows CGO_ENABLED=0 WASM_ENABLED=0 + mv opa_windows_$(GOARCH) $(RELEASE_DIR)/opa_windows_$(GOARCH).exe + rm resource.syso + +depr-release: + $(DOCKER) run $(DOCKER_FLAGS) \ + -v $(PWD)/$(RELEASE_DIR):/$(RELEASE_DIR):Z \ + -v $(PWD):/_src:Z \ + -e TELEMETRY_URL=$(TELEMETRY_URL) \ + $(RELEASE_BUILD_IMAGE) \ + /_src/build/build-release.sh --version=$(VERSION) --output-dir=/$(RELEASE_DIR) --source-url=/_src + +depr-release-local: + $(DOCKER) run $(DOCKER_FLAGS) \ + -v $(PWD)/$(RELEASE_DIR):/$(RELEASE_DIR):Z \ + -v $(PWD):/_src:Z \ + -e TELEMETRY_URL=$(TELEMETRY_URL) \ + $(RELEASE_BUILD_IMAGE) \ + /_src/build/build-release.sh --output-dir=/$(RELEASE_DIR) --source-url=/_src diff --git a/third_party/opa/PROVENANCE.md b/third_party/opa/PROVENANCE.md new file mode 100644 index 000000000000..ce477385d94c --- /dev/null +++ b/third_party/opa/PROVENANCE.md @@ -0,0 +1,30 @@ +# Temporary maintained-YAML backport + +Source: https://github.com/DataDog/opa +Exact source commit: `d2e1e78e081663d4b11109032715b68eb9b9d17a` (v0.0.0-20251126100856-d2e1e78e0816). +Logical module identity: `github.com/open-policy-agent/opa`. + +Upstream source, tests, fixtures, licenses and attribution are retained. Upstream +CI metadata and vendored dependency snapshots are excluded; dependency sources +continue to resolve through Go modules. The only code edits select the matching +maintained YAML v2/v3 API, including typed YAML node methods and tests. Module +metadata changes select those parsers and satisfy their Go minima. + +Tracking and temporary ownership: https://github.com/StackVista/stackstate/issues/717 +Removal condition: adopt a compatible owning-library release (or Datadog +lightweight OPA patch release) with maintained YAML and passing consumer tests, +then remove this source and its explicit root/workspace/consumer selections. +Dependency replacements do not propagate: external consumers must explicitly +select this independently addressable nested module as well. + +Long upstream fixture/document paths are stored byte-for-byte in +`LONG_PATHS.tar.gz` with `LONG_PATHS.sha256` verification, preserving the agent's +Windows checkout path limit without weakening its filename gate. Before running +all upstream fixtures, restore them from this module directory with: + +```sh +tar -xzf LONG_PATHS.tar.gz +sha256sum -c LONG_PATHS.sha256 +``` + +These are fixture/docs assets, not Go source or embedded production resources. diff --git a/third_party/opa/README.md b/third_party/opa/README.md new file mode 100644 index 000000000000..33e51ddefefb --- /dev/null +++ b/third_party/opa/README.md @@ -0,0 +1,104 @@ +# ![logo](./logo/logo-144x144.png) Open Policy Agent + +[![Build Status](https://github.com/open-policy-agent/opa/workflows/Post%20Merge/badge.svg)](https://github.com/open-policy-agent/opa/actions) [![Go Report Card](https://goreportcard.com/badge/open-policy-agent/opa)](https://goreportcard.com/report/open-policy-agent/opa) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1768/badge)](https://bestpractices.coreinfrastructure.org/projects/1768) [![Netlify Status](https://api.netlify.com/api/v1/badges/4a0a092a-8741-4826-a28f-826d4a576cab/deploy-status)](https://app.netlify.com/sites/openpolicyagent/deploys) + +Open Policy Agent (OPA) is an open source, general-purpose policy engine that enables unified, context-aware policy enforcement across the entire stack. + +OPA is proud to be a graduated project in the [Cloud Native Computing Foundation](https://cncf.io) (CNCF) landscape. For details read the CNCF [announcement](https://www.cncf.io/announcements/2021/02/04/cloud-native-computing-foundation-announces-open-policy-agent-graduation/). + +## Get started with OPA + +- Write your first Rego policy with the [Rego Playground](https://play.openpolicyagent.org) or use it to share your work with others for feedback and support. Have a look at the [Access Control examples](https://play.openpolicyagent.org/?example-group=access-control) if you're not sure where to start. +- Install the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=tsandall.opa) to get started locally with live diagnostics, debugging and formatting. See [Editor and IDE Support](https://www.openpolicyagent.org/docs/editor-and-ide-support/) for other supported editors. +- Go to the [OPA Documentation](https://www.openpolicyagent.org/docs/latest/) to + learn about the Rego language as well as how to deploy and integrate OPA. +- Check out the learning resources in the [Learning Rego](https://www.openpolicyagent.org/ecosystem/by-feature/learning-rego/) section of the ecosystem directory. +- Follow the [Running OPA](https://www.openpolicyagent.org/docs/latest/#running-opa) instructions to get started with the OPA CLI locally. +- See [Docker Hub](https://hub.docker.com/r/openpolicyagent/opa/tags/) for container images and the [GitHub releases](https://github.com/open-policy-agent/opa/releases) for binaries. +- Check out the [OPA Roadmap](https://docs.google.com/presentation/d/16QV6gvLDOV3I0_guPC3_19g6jHkEg3X9xqMYgtoCKrs/edit?usp=sharing) to see a high-level snapshot of OPA features in-progress and planned. + +## Want to talk about OPA or get support? + +- Join the [OPA Slack](https://slack.openpolicyagent.org) to talk to other OPA users and maintainers. See `#help` for support. +- Check out the [Community Discussions](https://github.com/orgs/open-policy-agent/discussions) to ask questions. +- See the [Support](https://www.openpolicyagent.org/support/) page for commercial support options. + +## Interested to learn what others are doing with OPA? + +- Browse community projects on the [OPA Ecosystem Directory](http://openpolicyagent.org/ecosystem/) - don't forget to [list your own](https://github.com/open-policy-agent/opa/tree/main/docs#opa-ecosystem)! +- Check out the [ADOPTERS.md](./ADOPTERS.md) file for a list of production adopters. Does your organization use OPA in production? Support the OPA project by submitting a PR to add your organization to the list with a short description of your OPA use cases! + +## Want to integrate OPA? + +- See the high-level [Go SDK](https://www.openpolicyagent.org/docs/latest/integration/#integrating-with-the-go-sdk) or the low-level Go API + [![GoDoc](https://godoc.org/github.com/open-policy-agent/opa?status.svg)](https://godoc.org/github.com/open-policy-agent/opa/rego) + to integrate OPA with services written in Go. +- See the [REST API](https://www.openpolicyagent.org/docs/rest-api.html) + reference to integrate OPA with services written in other languages. +- See the [integration docs](https://www.openpolicyagent.org/docs/latest/integration/) for more options. + +## Want to contribute to OPA? + +- Read the [Contributing Guide](https://www.openpolicyagent.org/docs/latest/contributing/) to learn how to make your first contribution. +- Use [#contributors](https://openpolicyagent.slack.com/archives/C02L1TLPN59) in Slack to talk to other contributors and OPA maintainers. +- File a [GitHub Issue](https://github.com/open-policy-agent/opa/issues) to request features or report bugs. + +## How does OPA work? + +OPA gives you a high-level declarative language to author and enforce policies +across your stack. + +With OPA, you define _rules_ that govern how your system should behave. These +rules exist to answer questions like: + +- Can user X call operation Y on resource Z? +- What clusters should workload W be deployed to? +- What tags must be set on resource R before it's created? + +You integrate services with OPA so that these kinds of policy decisions do not +have to be _hardcoded_ in your service. Services integrate with OPA by +executing _queries_ when policy decisions are needed. + +When you query OPA for a policy decision, OPA evaluates the rules and data +(which you give it) to produce an answer. The policy decision is sent back as +the result of the query. + +For example, in a simple API authorization use case: + +- You write rules that allow (or deny) access to your service APIs. +- Your service queries OPA when it receives API requests. +- OPA returns allow (or deny) decisions to your service. +- Your service _enforces_ the decisions by accepting or rejecting requests accordingly. + +For concrete examples of how to integrate OPA with systems like +[Kubernetes](https://www.openpolicyagent.org/docs/kubernetes), +[Terraform](https://www.openpolicyagent.org/docs/terraform), +[Docker](https://www.openpolicyagent.org/docs/docker-authorization), +[SSH](https://www.openpolicyagent.org/docs/ssh-and-sudo-authorization), +and more, see [openpolicyagent.org](https://www.openpolicyagent.org). + +## Presentations + +- Open Policy Agent (OPA) Intro & Deep Dive @ Kubecon NA 2023: [video](https://www.youtube.com/watch?v=wJkjsvVpj_Q) +- Open Policy Agent (OPA) Intro & Deep Dive @ Kubecon EU 2023: [video](https://www.youtube.com/watch?v=6RNp3m_THw4) +- Running Policy in Hard to Reach Places with WASM & OPA @ CN Wasm Day EU 2023: [video](https://www.youtube.com/watch?v=BdeBhukLwt4) +- OPA maintainers talk @ Kubecon NA 2022: [video](https://www.youtube.com/watch?v=RMiovzGGCfI) +- Open Policy Agent (OPA) Intro & Deep Dive @ Kubecon EU 2022: [video](https://www.youtube.com/watch?v=MhyQxIp1H58) +- Open Policy Agent Intro @ KubeCon EU 2021: [Video](https://www.youtube.com/watch?v=2CgeiWkliaw) +- Using Open Policy Agent to Meet Evolving Policy Requirements @ KubeCon NA 2020: [video](https://www.youtube.com/watch?v=zVuM7F_BTyc) +- Applying Policy Throughout The Application Lifecycle with Open Policy Agent @ CloudNativeCon 2019: [video](https://www.youtube.com/watch?v=cXfsaE6RKfc) +- Open Policy Agent Introduction @ CloudNativeCon EU 2018: [video](https://youtu.be/XEHeexPpgrA), [slides](https://www.slideshare.net/TorinSandall/opa-the-cloud-native-policy-engine) +- Rego Deep Dive @ CloudNativeCon EU 2018: [video](https://youtu.be/4mBJSIhs2xQ), [slides](https://www.slideshare.net/TorinSandall/rego-deep-dive) +- How Netflix Is Solving Authorization Across Their Cloud @ CloudNativeCon US 2017: [video](https://www.youtube.com/watch?v=R6tUNpRpdnY), [slides](https://www.slideshare.net/TorinSandall/how-netflix-is-solving-authorization-across-their-cloud). +- Policy-based Resource Placement in Kubernetes Federation @ LinuxCon Beijing 2017: [slides](https://www.slideshare.net/TorinSandall/policybased-resource-placement-across-hybrid-cloud), [screencast](https://www.youtube.com/watch?v=hRz13baBhfg&feature=youtu.be) +- Enforcing Bespoke Policies In Kubernetes @ KubeCon US 2017: [video](https://www.youtube.com/watch?v=llDI8VvkUj8), [slides](https://www.slideshare.net/TorinSandall/enforcing-bespoke-policies-in-kubernetes) +- Istio's Mixer: Policy Enforcement with Custom Adapters @ CloudNativeCon US 2017: [video](https://www.youtube.com/watch?v=czZLXUqzd24), [slides](https://www.slideshare.net/TorinSandall/istios-mixer-policy-enforcement-with-custom-adapters-cloud-nativecon-17) + +## Security + +A third party security audit was performed by Cure53, you can see the full report [here](SECURITY_AUDIT.pdf). + +Please report vulnerabilities by email to [open-policy-agent-security](mailto:open-policy-agent-security@googlegroups.com). +We will send a confirmation message to acknowledge that we have received the +report and then we will send additional messages to follow up once the issue +has been investigated. diff --git a/third_party/opa/SECURITY.md b/third_party/opa/SECURITY.md new file mode 100644 index 000000000000..d90b7e962ff8 --- /dev/null +++ b/third_party/opa/SECURITY.md @@ -0,0 +1,5 @@ +# Security Policy + +Please refer to the [OPA Security Policy](https://openpolicyagent.org/security) +for details on how to report security issues, our disclosure policy, and how to +receive notifications about security issues. \ No newline at end of file diff --git a/third_party/opa/SECURITY_AUDIT.pdf b/third_party/opa/SECURITY_AUDIT.pdf new file mode 100644 index 000000000000..ccc3b57f4bca Binary files /dev/null and b/third_party/opa/SECURITY_AUDIT.pdf differ diff --git a/third_party/opa/ast/annotations.go b/third_party/opa/ast/annotations.go new file mode 100644 index 000000000000..3bc5fb36a51f --- /dev/null +++ b/third_party/opa/ast/annotations.go @@ -0,0 +1,37 @@ +// Copyright 2022 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +type ( + // Annotations represents metadata attached to other AST nodes such as rules. + Annotations = v1.Annotations + + // SchemaAnnotation contains a schema declaration for the document identified by the path. + SchemaAnnotation = v1.SchemaAnnotation + + AuthorAnnotation = v1.AuthorAnnotation + + RelatedResourceAnnotation = v1.RelatedResourceAnnotation + + AnnotationSet = v1.AnnotationSet + + AnnotationsRef = v1.AnnotationsRef + + AnnotationsRefSet = v1.AnnotationsRefSet + + FlatAnnotationsRefSet = v1.FlatAnnotationsRefSet +) + +func NewAnnotationsRef(a *Annotations) *AnnotationsRef { + return v1.NewAnnotationsRef(a) +} + +func BuildAnnotationSet(modules []*Module) (*AnnotationSet, Errors) { + return v1.BuildAnnotationSet(modules) +} diff --git a/third_party/opa/ast/builtins.go b/third_party/opa/ast/builtins.go new file mode 100644 index 000000000000..d0ab69a16303 --- /dev/null +++ b/third_party/opa/ast/builtins.go @@ -0,0 +1,634 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// Builtins is the registry of built-in functions supported by OPA. +// Call RegisterBuiltin to add a new built-in. +var Builtins = v1.Builtins + +// RegisterBuiltin adds a new built-in function to the registry. +func RegisterBuiltin(b *Builtin) { + v1.RegisterBuiltin(b) +} + +// DefaultBuiltins is the registry of built-in functions supported in OPA +// by default. When adding a new built-in function to OPA, update this +// list. +var DefaultBuiltins = v1.DefaultBuiltins + +// BuiltinMap provides a convenient mapping of built-in names to +// built-in definitions. +var BuiltinMap = v1.BuiltinMap + +// Deprecated: Builtins can now be directly annotated with the +// Nondeterministic property, and when set to true, will be ignored +// for partial evaluation. +var IgnoreDuringPartialEval = v1.IgnoreDuringPartialEval + +/** + * Unification + */ + +// Equality represents the "=" operator. +var Equality = v1.Equality + +/** + * Assignment + */ + +// Assign represents the assignment (":=") operator. +var Assign = v1.Assign + +// Member represents the `in` (infix) operator. +var Member = v1.Member + +// MemberWithKey represents the `in` (infix) operator when used +// with two terms on the lhs, i.e., `k, v in obj`. +var MemberWithKey = v1.MemberWithKey + +var GreaterThan = v1.GreaterThan + +var GreaterThanEq = v1.GreaterThanEq + +// LessThan represents the "<" comparison operator. +var LessThan = v1.LessThan + +var LessThanEq = v1.LessThanEq + +var NotEqual = v1.NotEqual + +// Equal represents the "==" comparison operator. +var Equal = v1.Equal + +var Plus = v1.Plus + +var Minus = v1.Minus + +var Multiply = v1.Multiply + +var Divide = v1.Divide + +var Round = v1.Round + +var Ceil = v1.Ceil + +var Floor = v1.Floor + +var Abs = v1.Abs + +var Rem = v1.Rem + +/** + * Bitwise + */ + +var BitsOr = v1.BitsOr + +var BitsAnd = v1.BitsAnd + +var BitsNegate = v1.BitsNegate + +var BitsXOr = v1.BitsXOr + +var BitsShiftLeft = v1.BitsShiftLeft + +var BitsShiftRight = v1.BitsShiftRight + +/** + * Sets + */ + +var And = v1.And + +// Or performs a union operation on sets. +var Or = v1.Or + +var Intersection = v1.Intersection + +var Union = v1.Union + +/** + * Aggregates + */ + +var Count = v1.Count + +var Sum = v1.Sum + +var Product = v1.Product + +var Max = v1.Max + +var Min = v1.Min + +/** + * Sorting + */ + +var Sort = v1.Sort + +/** + * Arrays + */ + +var ArrayConcat = v1.ArrayConcat + +var ArraySlice = v1.ArraySlice + +var ArrayReverse = v1.ArrayReverse + +/** + * Conversions + */ + +var ToNumber = v1.ToNumber + +/** + * Regular Expressions + */ + +var RegexMatch = v1.RegexMatch + +var RegexIsValid = v1.RegexIsValid + +var RegexFindAllStringSubmatch = v1.RegexFindAllStringSubmatch + +var RegexTemplateMatch = v1.RegexTemplateMatch + +var RegexSplit = v1.RegexSplit + +// RegexFind takes two strings and a number, the pattern, the value and number of match values to +// return, -1 means all match values. +var RegexFind = v1.RegexFind + +// GlobsMatch takes two strings regexp-style strings and evaluates to true if their +// intersection matches a non-empty set of non-empty strings. +// Examples: +// - "a.a." and ".b.b" -> true. +// - "[a-z]*" and [0-9]+" -> not true. +var GlobsMatch = v1.GlobsMatch + +/** + * Strings + */ + +var AnyPrefixMatch = v1.AnyPrefixMatch + +var AnySuffixMatch = v1.AnySuffixMatch + +var Concat = v1.Concat + +var FormatInt = v1.FormatInt + +var IndexOf = v1.IndexOf + +var IndexOfN = v1.IndexOfN + +var Substring = v1.Substring + +var Contains = v1.Contains + +var StringCount = v1.StringCount + +var StartsWith = v1.StartsWith + +var EndsWith = v1.EndsWith + +var Lower = v1.Lower + +var Upper = v1.Upper + +var Split = v1.Split + +var Replace = v1.Replace + +var ReplaceN = v1.ReplaceN + +var RegexReplace = v1.RegexReplace + +var Trim = v1.Trim + +var TrimLeft = v1.TrimLeft + +var TrimPrefix = v1.TrimPrefix + +var TrimRight = v1.TrimRight + +var TrimSuffix = v1.TrimSuffix + +var TrimSpace = v1.TrimSpace + +var Sprintf = v1.Sprintf + +var StringReverse = v1.StringReverse + +var RenderTemplate = v1.RenderTemplate + +/** + * Numbers + */ + +// RandIntn returns a random number 0 - n +// Marked non-deterministic because it relies on RNG internally. +var RandIntn = v1.RandIntn + +var NumbersRange = v1.NumbersRange + +var NumbersRangeStep = v1.NumbersRangeStep + +/** + * Units + */ + +var UnitsParse = v1.UnitsParse + +var UnitsParseBytes = v1.UnitsParseBytes + +// +/** + * Type + */ + +// UUIDRFC4122 returns a version 4 UUID string. +// Marked non-deterministic because it relies on RNG internally. +var UUIDRFC4122 = v1.UUIDRFC4122 + +var UUIDParse = v1.UUIDParse + +/** + * JSON + */ + +var JSONFilter = v1.JSONFilter + +var JSONRemove = v1.JSONRemove + +var JSONPatch = v1.JSONPatch + +var ObjectSubset = v1.ObjectSubset + +var ObjectUnion = v1.ObjectUnion + +var ObjectUnionN = v1.ObjectUnionN + +var ObjectRemove = v1.ObjectRemove + +var ObjectFilter = v1.ObjectFilter + +var ObjectGet = v1.ObjectGet + +var ObjectKeys = v1.ObjectKeys + +/* + * Encoding + */ + +var JSONMarshal = v1.JSONMarshal + +var JSONMarshalWithOptions = v1.JSONMarshalWithOptions + +var JSONUnmarshal = v1.JSONUnmarshal + +var JSONIsValid = v1.JSONIsValid + +var Base64Encode = v1.Base64Encode + +var Base64Decode = v1.Base64Decode + +var Base64IsValid = v1.Base64IsValid + +var Base64UrlEncode = v1.Base64UrlEncode + +var Base64UrlEncodeNoPad = v1.Base64UrlEncodeNoPad + +var Base64UrlDecode = v1.Base64UrlDecode + +var URLQueryDecode = v1.URLQueryDecode + +var URLQueryEncode = v1.URLQueryEncode + +var URLQueryEncodeObject = v1.URLQueryEncodeObject + +var URLQueryDecodeObject = v1.URLQueryDecodeObject + +var YAMLMarshal = v1.YAMLMarshal + +var YAMLUnmarshal = v1.YAMLUnmarshal + +// YAMLIsValid verifies the input string is a valid YAML document. +var YAMLIsValid = v1.YAMLIsValid + +var HexEncode = v1.HexEncode + +var HexDecode = v1.HexDecode + +/** + * Tokens + */ + +var JWTDecode = v1.JWTDecode + +var JWTVerifyRS256 = v1.JWTVerifyRS256 + +var JWTVerifyRS384 = v1.JWTVerifyRS384 + +var JWTVerifyRS512 = v1.JWTVerifyRS512 + +var JWTVerifyPS256 = v1.JWTVerifyPS256 + +var JWTVerifyPS384 = v1.JWTVerifyPS384 + +var JWTVerifyPS512 = v1.JWTVerifyPS512 + +var JWTVerifyES256 = v1.JWTVerifyES256 + +var JWTVerifyES384 = v1.JWTVerifyES384 + +var JWTVerifyES512 = v1.JWTVerifyES512 + +var JWTVerifyHS256 = v1.JWTVerifyHS256 + +var JWTVerifyHS384 = v1.JWTVerifyHS384 + +var JWTVerifyHS512 = v1.JWTVerifyHS512 + +// Marked non-deterministic because it relies on time internally. +var JWTDecodeVerify = v1.JWTDecodeVerify + +// Marked non-deterministic because it relies on RNG internally. +var JWTEncodeSignRaw = v1.JWTEncodeSignRaw + +// Marked non-deterministic because it relies on RNG internally. +var JWTEncodeSign = v1.JWTEncodeSign + +/** + * Time + */ + +// Marked non-deterministic because it relies on time directly. +var NowNanos = v1.NowNanos + +var ParseNanos = v1.ParseNanos + +var ParseRFC3339Nanos = v1.ParseRFC3339Nanos + +var ParseDurationNanos = v1.ParseDurationNanos + +var Format = v1.Format + +var Date = v1.Date + +var Clock = v1.Clock + +var Weekday = v1.Weekday + +var AddDate = v1.AddDate + +var Diff = v1.Diff + +/** + * Crypto. + */ + +var CryptoX509ParseCertificates = v1.CryptoX509ParseCertificates + +var CryptoX509ParseAndVerifyCertificates = v1.CryptoX509ParseAndVerifyCertificates + +var CryptoX509ParseAndVerifyCertificatesWithOptions = v1.CryptoX509ParseAndVerifyCertificatesWithOptions + +var CryptoX509ParseCertificateRequest = v1.CryptoX509ParseCertificateRequest + +var CryptoX509ParseKeyPair = v1.CryptoX509ParseKeyPair +var CryptoX509ParseRSAPrivateKey = v1.CryptoX509ParseRSAPrivateKey + +var CryptoParsePrivateKeys = v1.CryptoParsePrivateKeys + +var CryptoMd5 = v1.CryptoMd5 + +var CryptoSha1 = v1.CryptoSha1 + +var CryptoSha256 = v1.CryptoSha256 + +var CryptoHmacMd5 = v1.CryptoHmacMd5 + +var CryptoHmacSha1 = v1.CryptoHmacSha1 + +var CryptoHmacSha256 = v1.CryptoHmacSha256 + +var CryptoHmacSha512 = v1.CryptoHmacSha512 + +var CryptoHmacEqual = v1.CryptoHmacEqual + +/** + * Graphs. + */ + +var WalkBuiltin = v1.WalkBuiltin + +var ReachableBuiltin = v1.ReachableBuiltin + +var ReachablePathsBuiltin = v1.ReachablePathsBuiltin + +/** + * Type + */ + +var IsNumber = v1.IsNumber + +var IsString = v1.IsString + +var IsBoolean = v1.IsBoolean + +var IsArray = v1.IsArray + +var IsSet = v1.IsSet + +var IsObject = v1.IsObject + +var IsNull = v1.IsNull + +/** + * Type Name + */ + +// TypeNameBuiltin returns the type of the input. +var TypeNameBuiltin = v1.TypeNameBuiltin + +/** + * HTTP Request + */ + +// Marked non-deterministic because HTTP request results can be non-deterministic. +var HTTPSend = v1.HTTPSend + +/** + * GraphQL + */ + +// GraphQLParse returns a pair of AST objects from parsing/validation. +var GraphQLParse = v1.GraphQLParse + +// GraphQLParseAndVerify returns a boolean and a pair of AST object from parsing/validation. +var GraphQLParseAndVerify = v1.GraphQLParseAndVerify + +// GraphQLParseQuery parses the input GraphQL query and returns a JSON +// representation of its AST. +var GraphQLParseQuery = v1.GraphQLParseQuery + +// GraphQLParseSchema parses the input GraphQL schema and returns a JSON +// representation of its AST. +var GraphQLParseSchema = v1.GraphQLParseSchema + +// GraphQLIsValid returns true if a GraphQL query is valid with a given +// schema, and returns false for all other inputs. +var GraphQLIsValid = v1.GraphQLIsValid + +// GraphQLSchemaIsValid returns true if the input is valid GraphQL schema, +// and returns false for all other inputs. +var GraphQLSchemaIsValid = v1.GraphQLSchemaIsValid + +/** + * JSON Schema + */ + +// JSONSchemaVerify returns empty string if the input is valid JSON schema +// and returns error string for all other inputs. +var JSONSchemaVerify = v1.JSONSchemaVerify + +// JSONMatchSchema returns empty array if the document matches the JSON schema, +// and returns non-empty array with error objects otherwise. +var JSONMatchSchema = v1.JSONMatchSchema + +/** + * Cloud Provider Helper Functions + */ + +var ProvidersAWSSignReqObj = v1.ProvidersAWSSignReqObj + +/** + * Rego + */ + +var RegoParseModule = v1.RegoParseModule + +var RegoMetadataChain = v1.RegoMetadataChain + +// RegoMetadataRule returns the metadata for the active rule +var RegoMetadataRule = v1.RegoMetadataRule + +/** + * OPA + */ + +// Marked non-deterministic because of unpredictable config/environment-dependent results. +var OPARuntime = v1.OPARuntime + +/** + * Trace + */ + +var Trace = v1.Trace + +/** + * Glob + */ + +var GlobMatch = v1.GlobMatch + +var GlobQuoteMeta = v1.GlobQuoteMeta + +/** + * Networking + */ + +var NetCIDRIntersects = v1.NetCIDRIntersects + +var NetCIDRExpand = v1.NetCIDRExpand + +var NetCIDRContains = v1.NetCIDRContains + +var NetCIDRContainsMatches = v1.NetCIDRContainsMatches + +var NetCIDRMerge = v1.NetCIDRMerge + +var NetCIDRIsValid = v1.NetCIDRIsValid + +// Marked non-deterministic because DNS resolution results can be non-deterministic. +var NetLookupIPAddr = v1.NetLookupIPAddr + +/** + * Semantic Versions + */ + +var SemVerIsValid = v1.SemVerIsValid + +var SemVerCompare = v1.SemVerCompare + +/** + * Printing + */ + +// Print is a special built-in function that writes zero or more operands +// to a message buffer. The caller controls how the buffer is displayed. The +// operands may be of any type. Furthermore, unlike other built-in functions, +// undefined operands DO NOT cause the print() function to fail during +// evaluation. +var Print = v1.Print + +// InternalPrint represents the internal implementation of the print() function. +// The compiler rewrites print() calls to refer to the internal implementation. +var InternalPrint = v1.InternalPrint + +/** + * Deprecated built-ins. + */ + +// SetDiff has been replaced by the minus built-in. +var SetDiff = v1.SetDiff + +// NetCIDROverlap has been replaced by the `net.cidr_contains` built-in. +var NetCIDROverlap = v1.NetCIDROverlap + +// CastArray checks the underlying type of the input. If it is array or set, an array +// containing the values is returned. If it is not an array, an error is thrown. +var CastArray = v1.CastArray + +// CastSet checks the underlying type of the input. +// If it is a set, the set is returned. +// If it is an array, the array is returned in set form (all duplicates removed) +// If neither, an error is thrown +var CastSet = v1.CastSet + +// CastString returns input if it is a string; if not returns error. +// For formatting variables, see sprintf +var CastString = v1.CastString + +// CastBoolean returns input if it is a boolean; if not returns error. +var CastBoolean = v1.CastBoolean + +// CastNull returns null if input is null; if not returns error. +var CastNull = v1.CastNull + +// CastObject returns the given object if it is null; throws an error otherwise +var CastObject = v1.CastObject + +// RegexMatchDeprecated declares `re_match` which has been deprecated. Use `regex.match` instead. +var RegexMatchDeprecated = v1.RegexMatchDeprecated + +// All takes a list and returns true if all of the items +// are true. A collection of length 0 returns true. +var All = v1.All + +// Any takes a collection and returns true if any of the items +// is true. A collection of length 0 returns false. +var Any = v1.Any + +// Builtin represents a built-in function supported by OPA. Every built-in +// function is uniquely identified by a name. +type Builtin = v1.Builtin diff --git a/third_party/opa/ast/capabilities.go b/third_party/opa/ast/capabilities.go new file mode 100644 index 000000000000..bc7278a885ac --- /dev/null +++ b/third_party/opa/ast/capabilities.go @@ -0,0 +1,58 @@ +// Copyright 2020 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + "io" + + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// VersonIndex contains an index from built-in function name, language feature, +// and future rego keyword to version number. During the build, this is used to +// create an index of the minimum version required for the built-in/feature/kw. +type VersionIndex = v1.VersionIndex + +// In the compiler, we used this to check that we're OK working with ref heads. +// If this isn't present, we'll fail. This is to ensure that older versions of +// OPA can work with policies that we're compiling -- if they don't know ref +// heads, they wouldn't be able to parse them. +const FeatureRefHeadStringPrefixes = v1.FeatureRefHeadStringPrefixes +const FeatureRefHeads = v1.FeatureRefHeads +const FeatureRegoV1 = v1.FeatureRegoV1 +const FeatureRegoV1Import = v1.FeatureRegoV1Import + +// Capabilities defines a structure containing data that describes the capabilities +// or features supported by a particular version of OPA. +type Capabilities = v1.Capabilities + +// WasmABIVersion captures the Wasm ABI version. Its `Minor` version is indicating +// backwards-compatible changes. +type WasmABIVersion = v1.WasmABIVersion + +// CapabilitiesForThisVersion returns the capabilities of this version of OPA. +func CapabilitiesForThisVersion() *Capabilities { + return v1.CapabilitiesForThisVersion(v1.CapabilitiesRegoVersion(DefaultRegoVersion)) +} + +// LoadCapabilitiesJSON loads a JSON serialized capabilities structure from the reader r. +func LoadCapabilitiesJSON(r io.Reader) (*Capabilities, error) { + return v1.LoadCapabilitiesJSON(r) +} + +// LoadCapabilitiesVersion loads a JSON serialized capabilities structure from the specific version. +func LoadCapabilitiesVersion(version string) (*Capabilities, error) { + return v1.LoadCapabilitiesVersion(version) +} + +// LoadCapabilitiesFile loads a JSON serialized capabilities structure from a file. +func LoadCapabilitiesFile(file string) (*Capabilities, error) { + return v1.LoadCapabilitiesFile(file) +} + +// LoadCapabilitiesVersions loads all capabilities versions +func LoadCapabilitiesVersions() ([]string, error) { + return v1.LoadCapabilitiesVersions() +} diff --git a/third_party/opa/ast/check.go b/third_party/opa/ast/check.go new file mode 100644 index 000000000000..4cf00436df1c --- /dev/null +++ b/third_party/opa/ast/check.go @@ -0,0 +1,22 @@ +// Copyright 2017 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// UnificationErrDetail describes a type mismatch error when two values are +// unified (e.g., x = [1,2,y]). +type UnificationErrDetail = v1.UnificationErrDetail + +// RefErrUnsupportedDetail describes an undefined reference error where the +// referenced value does not support dereferencing (e.g., scalars). +type RefErrUnsupportedDetail = v1.RefErrUnsupportedDetail + +// RefErrInvalidDetail describes an undefined reference error where the referenced +// value does not support the reference operand (e.g., missing object key, +// invalid key type, etc.) +type RefErrInvalidDetail = v1.RefErrInvalidDetail diff --git a/third_party/opa/ast/compare.go b/third_party/opa/ast/compare.go new file mode 100644 index 000000000000..5e617e992fa1 --- /dev/null +++ b/third_party/opa/ast/compare.go @@ -0,0 +1,39 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// Compare returns an integer indicating whether two AST values are less than, +// equal to, or greater than each other. +// +// If a is less than b, the return value is negative. If a is greater than b, +// the return value is positive. If a is equal to b, the return value is zero. +// +// Different types are never equal to each other. For comparison purposes, types +// are sorted as follows: +// +// nil < Null < Boolean < Number < String < Var < Ref < Array < Object < Set < +// ArrayComprehension < ObjectComprehension < SetComprehension < Expr < SomeDecl +// < With < Body < Rule < Import < Package < Module. +// +// Arrays and Refs are equal if and only if both a and b have the same length +// and all corresponding elements are equal. If one element is not equal, the +// return value is the same as for the first differing element. If all elements +// are equal but a and b have different lengths, the shorter is considered less +// than the other. +// +// Objects are considered equal if and only if both a and b have the same sorted +// (key, value) pairs and are of the same length. Other comparisons are +// consistent but not defined. +// +// Sets are considered equal if and only if the symmetric difference of a and b +// is empty. +// Other comparisons are consistent but not defined. +func Compare(a, b any) int { + return v1.Compare(a, b) +} diff --git a/third_party/opa/ast/compile.go b/third_party/opa/ast/compile.go new file mode 100644 index 000000000000..5a3daa910a7c --- /dev/null +++ b/third_party/opa/ast/compile.go @@ -0,0 +1,127 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// CompileErrorLimitDefault is the default number errors a compiler will allow before +// exiting. +const CompileErrorLimitDefault = 10 + +// Compiler contains the state of a compilation process. +type Compiler = v1.Compiler + +// CompilerStage defines the interface for stages in the compiler. +type CompilerStage = v1.CompilerStage + +// CompilerEvalMode allows toggling certain stages that are only +// needed for certain modes, Concretely, only "topdown" mode will +// have the compiler build comprehension and rule indices. +type CompilerEvalMode = v1.CompilerEvalMode + +const ( + // EvalModeTopdown (default) instructs the compiler to build rule + // and comprehension indices used by topdown evaluation. + EvalModeTopdown = v1.EvalModeTopdown + + // EvalModeIR makes the compiler skip the stages for comprehension + // and rule indices. + EvalModeIR = v1.EvalModeIR +) + +// CompilerStageDefinition defines a compiler stage +type CompilerStageDefinition = v1.CompilerStageDefinition + +// RulesOptions defines the options for retrieving rules by Ref from the +// compiler. +type RulesOptions = v1.RulesOptions + +// QueryContext contains contextual information for running an ad-hoc query. +// +// Ad-hoc queries can be run in the context of a package and imports may be +// included to provide concise access to data. +type QueryContext = v1.QueryContext + +// NewQueryContext returns a new QueryContext object. +func NewQueryContext() *QueryContext { + return v1.NewQueryContext() +} + +// QueryCompiler defines the interface for compiling ad-hoc queries. +type QueryCompiler = v1.QueryCompiler + +// QueryCompilerStage defines the interface for stages in the query compiler. +type QueryCompilerStage = v1.QueryCompilerStage + +// QueryCompilerStageDefinition defines a QueryCompiler stage +type QueryCompilerStageDefinition = v1.QueryCompilerStageDefinition + +// NewCompiler returns a new empty compiler. +func NewCompiler() *Compiler { + return v1.NewCompiler().WithDefaultRegoVersion(DefaultRegoVersion) +} + +// ModuleLoader defines the interface that callers can implement to enable lazy +// loading of modules during compilation. +type ModuleLoader = v1.ModuleLoader + +// SafetyCheckVisitorParams defines the AST visitor parameters to use for collecting +// variables during the safety check. This has to be exported because it's relied on +// by the copy propagation implementation in topdown. +var SafetyCheckVisitorParams = v1.SafetyCheckVisitorParams + +// ComprehensionIndex specifies how the comprehension term can be indexed. The keys +// tell the evaluator what variables to use for indexing. In the future, the index +// could be expanded with more information that would allow the evaluator to index +// a larger fragment of comprehensions (e.g., by closing over variables in the outer +// query.) +type ComprehensionIndex = v1.ComprehensionIndex + +// ModuleTreeNode represents a node in the module tree. The module +// tree is keyed by the package path. +type ModuleTreeNode = v1.ModuleTreeNode + +// TreeNode represents a node in the rule tree. The rule tree is keyed by +// rule path. +type TreeNode = v1.TreeNode + +// NewRuleTree returns a new TreeNode that represents the root +// of the rule tree populated with the given rules. +func NewRuleTree(mtree *ModuleTreeNode) *TreeNode { + return v1.NewRuleTree(mtree) +} + +// Graph represents the graph of dependencies between rules. +type Graph = v1.Graph + +// NewGraph returns a new Graph based on modules. The list function must return +// the rules referred to directly by the ref. +func NewGraph(modules map[string]*Module, list func(Ref) []*Rule) *Graph { + return v1.NewGraph(modules, list) +} + +// GraphTraversal is a Traversal that understands the dependency graph +type GraphTraversal = v1.GraphTraversal + +// NewGraphTraversal returns a Traversal for the dependency graph +func NewGraphTraversal(graph *Graph) *GraphTraversal { + return v1.NewGraphTraversal(graph) +} + +// OutputVarsFromBody returns all variables which are the "output" for +// the given body. For safety checks this means that they would be +// made safe by the body. +func OutputVarsFromBody(c *Compiler, body Body, safe VarSet) VarSet { + return v1.OutputVarsFromBody(c, body, safe) +} + +// OutputVarsFromExpr returns all variables which are the "output" for +// the given expression. For safety checks this means that they would be +// made safe by the expr. +func OutputVarsFromExpr(c *Compiler, expr *Expr, safe VarSet) VarSet { + return v1.OutputVarsFromExpr(c, expr, safe) +} diff --git a/third_party/opa/ast/compile_test.go b/third_party/opa/ast/compile_test.go new file mode 100644 index 000000000000..356084334203 --- /dev/null +++ b/third_party/opa/ast/compile_test.go @@ -0,0 +1,97 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + "strings" + "testing" +) + +func TestCompile_DefaultRegoVersion(t *testing.T) { + tests := []struct { + note string + modules map[string]*Module + expErrs []string + }{ + { + note: "no module rego-version, no v1 violations", + modules: map[string]*Module{ + "test": { + Package: MustParsePackage(`package test`), + Imports: MustParseImports(`import data.foo + import data.bar`), + }, + }, + }, + { + note: "no module rego-version, v1 violations", // default is v0, no errors expected + modules: map[string]*Module{ + "test": { + Package: MustParsePackage(`package test`), + Imports: MustParseImports(`import data.foo + import data.bar as foo`), + }, + }, + }, + { + note: "v0 module, v1 violations", + modules: map[string]*Module{ + "test": MustParseModuleWithOpts(`package test + import data.foo + import data.bar as foo`, + ParserOptions{RegoVersion: RegoV0}), + }, + }, + { + note: "v1 module, v1 violations", + modules: map[string]*Module{ + "test": MustParseModuleWithOpts(`package test + import data.foo + import data.bar as foo`, + ParserOptions{RegoVersion: RegoV1}), + }, + expErrs: []string{ + "3:7: rego_compile_error: import must not shadow import data.foo", + }, + }, + } + + for _, tc := range tests { + t.Run(tc.note, func(t *testing.T) { + compiler := NewCompiler() + + compiler.Compile(tc.modules) + + if len(tc.expErrs) > 0 { + assertErrors(t, compiler.Errors, tc.expErrs) + } else if len(compiler.Errors) > 0 { + t.Fatalf("Unexpected errors: %v", compiler.Errors) + } + }) + } +} + +func assertErrors(t *testing.T, actual Errors, expected []string) { + t.Helper() + if len(expected) != len(actual) { + t.Fatalf("Expected %d errors, got %d:\n\n%s\n", len(expected), len(actual), actual.Error()) + } + incorrectErrs := false + for _, e := range expected { + found := false + for _, actual := range actual { + if strings.Contains(actual.Error(), e) { + found = true + break + } + } + if !found { + incorrectErrs = true + } + } + if incorrectErrs { + t.Fatalf("Expected errors:\n\n%s\n\nGot:\n\n%s\n", expected, actual.Error()) + } +} diff --git a/third_party/opa/ast/compilehelper.go b/third_party/opa/ast/compilehelper.go new file mode 100644 index 000000000000..37ede329ea4c --- /dev/null +++ b/third_party/opa/ast/compilehelper.go @@ -0,0 +1,48 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import v1 "github.com/open-policy-agent/opa/v1/ast" + +// CompileModules takes a set of Rego modules represented as strings and +// compiles them for evaluation. The keys of the map are used as filenames. +func CompileModules(modules map[string]string) (*Compiler, error) { + return CompileModulesWithOpt(modules, CompileOpts{ + ParserOptions: ParserOptions{ + RegoVersion: DefaultRegoVersion, + }, + }) +} + +// CompileOpts defines a set of options for the compiler. +type CompileOpts = v1.CompileOpts + +// CompileModulesWithOpt takes a set of Rego modules represented as strings and +// compiles them for evaluation. The keys of the map are used as filenames. +func CompileModulesWithOpt(modules map[string]string, opts CompileOpts) (*Compiler, error) { + if opts.ParserOptions.RegoVersion == RegoUndefined { + opts.ParserOptions.RegoVersion = DefaultRegoVersion + } + + return v1.CompileModulesWithOpt(modules, opts) +} + +// MustCompileModules compiles a set of Rego modules represented as strings. If +// the compilation process fails, this function panics. +func MustCompileModules(modules map[string]string) *Compiler { + return MustCompileModulesWithOpts(modules, CompileOpts{}) +} + +// MustCompileModulesWithOpts compiles a set of Rego modules represented as strings. If +// the compilation process fails, this function panics. +func MustCompileModulesWithOpts(modules map[string]string, opts CompileOpts) *Compiler { + + compiler, err := CompileModulesWithOpt(modules, opts) + if err != nil { + panic(err) + } + + return compiler +} diff --git a/third_party/opa/ast/compilehelper_test.go b/third_party/opa/ast/compilehelper_test.go new file mode 100644 index 000000000000..e6828be8a6f8 --- /dev/null +++ b/third_party/opa/ast/compilehelper_test.go @@ -0,0 +1,222 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + "strings" + "testing" +) + +func TestCompileModules_DefaultRegoVersion(t *testing.T) { + tests := []struct { + note string + modules map[string]string + expErrs []string + }{ + // default rego-version + { + note: "v0 module, no v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + p[x] { + x = "a" + }`, + }, + }, + { + note: "v0 module, v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + import data.foo + import data.bar as foo + + p[x] { + x = "a" + }`, + }, + }, + + // cross-rego-version + { + note: "rego.v1 import, no v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + import rego.v1 + + p contains x if { + x = "a" + }`, + }, + }, + { + note: "rego.v1 import, v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + import rego.v1 + + import data.foo + import data.bar as foo + + p contains x if { + x = "a" + }`, + }, + expErrs: []string{ + "test.rego:5: rego_compile_error: import must not shadow import data.foo", + }, + }, + + // NOT default rego-version + { + note: "v1 module, no v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + p contains x if { + x = "a" + }`, + }, + expErrs: []string{ + "test.rego:2: rego_parse_error: var cannot be used for rule name", + }, + }, + { + note: "v1 module, v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + import data.foo + import data.bar as foo + + p contains x if { + x = "a" + }`, + }, + expErrs: []string{ + "test.rego:5: rego_parse_error: var cannot be used for rule name", + }, + }, + } + + for _, tc := range tests { + t.Run(tc.note, func(t *testing.T) { + _, err := CompileModules(tc.modules) + + if len(tc.expErrs) > 0 { + for _, expErr := range tc.expErrs { + if err := err.Error(); !strings.Contains(err, expErr) { + t.Fatalf("Expected error to contain:\n\n%s\n\nbut got:\n\n%s", expErr, err) + } + } + } else if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + }) + } +} + +func TestCompileModulesWithOpt_DefaultRegoVersion(t *testing.T) { + tests := []struct { + note string + modules map[string]string + expErrs []string + }{ + // default rego-version + { + note: "v0 module, no v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + p[x] { + x = "a" + }`, + }, + }, + { + note: "v0 module, v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + import data.foo + import data.bar as foo + + p[x] { + x = "a" + }`, + }, + }, + + // cross-rego-version + { + note: "rego.v1 import, no v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + import rego.v1 + + p contains x if { + x = "a" + }`, + }, + }, + { + note: "rego.v1 import, v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + import rego.v1 + + import data.foo + import data.bar as foo + + p contains x if { + x = "a" + }`, + }, + expErrs: []string{ + "test.rego:5: rego_compile_error: import must not shadow import data.foo", + }, + }, + + // NOT default rego-version + { + note: "v1 module, no v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + p contains x if { + x = "a" + }`, + }, + expErrs: []string{ + "test.rego:2: rego_parse_error: var cannot be used for rule name", + }, + }, + { + note: "v1 module, v1 compile-time violations", + modules: map[string]string{ + "test.rego": `package test + import data.foo + import data.bar as foo + + p contains x if { + x = "a" + }`, + }, + expErrs: []string{ + "test.rego:5: rego_parse_error: var cannot be used for rule name", + }, + }, + } + + for _, tc := range tests { + t.Run(tc.note, func(t *testing.T) { + _, err := CompileModulesWithOpt(tc.modules, CompileOpts{EnablePrintStatements: true}) + + if len(tc.expErrs) > 0 { + for _, expErr := range tc.expErrs { + if err := err.Error(); !strings.Contains(err, expErr) { + t.Fatalf("Expected error to contain:\n\n%s\n\nbut got:\n\n%s", expErr, err) + } + } + } else if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + }) + } +} diff --git a/third_party/opa/ast/conflicts.go b/third_party/opa/ast/conflicts.go new file mode 100644 index 000000000000..10edce382c30 --- /dev/null +++ b/third_party/opa/ast/conflicts.go @@ -0,0 +1,15 @@ +// Copyright 2019 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// CheckPathConflicts returns a set of errors indicating paths that +// are in conflict with the result of the provided callable. +func CheckPathConflicts(c *Compiler, exists func([]string) (bool, error)) Errors { + return v1.CheckPathConflicts(c, exists) +} diff --git a/third_party/opa/ast/doc.go b/third_party/opa/ast/doc.go new file mode 100644 index 000000000000..ba974e5ba600 --- /dev/null +++ b/third_party/opa/ast/doc.go @@ -0,0 +1,8 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +// Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. +// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead. +// See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information. +package ast diff --git a/third_party/opa/ast/env.go b/third_party/opa/ast/env.go new file mode 100644 index 000000000000..ef0ccf89ce8e --- /dev/null +++ b/third_party/opa/ast/env.go @@ -0,0 +1,12 @@ +// Copyright 2017 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// TypeEnv contains type info for static analysis such as type checking. +type TypeEnv = v1.TypeEnv diff --git a/third_party/opa/ast/errors.go b/third_party/opa/ast/errors.go new file mode 100644 index 000000000000..722cfc0fb7c8 --- /dev/null +++ b/third_party/opa/ast/errors.go @@ -0,0 +1,46 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// Errors represents a series of errors encountered during parsing, compiling, +// etc. +type Errors = v1.Errors + +const ( + // ParseErr indicates an unclassified parse error occurred. + ParseErr = v1.ParseErr + + // CompileErr indicates an unclassified compile error occurred. + CompileErr = v1.CompileErr + + // TypeErr indicates a type error was caught. + TypeErr = v1.TypeErr + + // UnsafeVarErr indicates an unsafe variable was found during compilation. + UnsafeVarErr = v1.UnsafeVarErr + + // RecursionErr indicates recursion was found during compilation. + RecursionErr = v1.RecursionErr +) + +// IsError returns true if err is an AST error with code. +func IsError(code string, err error) bool { + return v1.IsError(code, err) +} + +// ErrorDetails defines the interface for detailed error messages. +type ErrorDetails = v1.ErrorDetails + +// Error represents a single error caught during parsing, compiling, etc. +type Error = v1.Error + +// NewError returns a new Error object. +func NewError(code string, loc *Location, f string, a ...any) *Error { + return v1.NewError(code, loc, f, a...) +} diff --git a/third_party/opa/ast/index.go b/third_party/opa/ast/index.go new file mode 100644 index 000000000000..7e80bb7716c4 --- /dev/null +++ b/third_party/opa/ast/index.go @@ -0,0 +1,20 @@ +// Copyright 2017 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// RuleIndex defines the interface for rule indices. +type RuleIndex v1.RuleIndex + +// IndexResult contains the result of an index lookup. +type IndexResult = v1.IndexResult + +// NewIndexResult returns a new IndexResult object. +func NewIndexResult(kind RuleKind) *IndexResult { + return v1.NewIndexResult(kind) +} diff --git a/third_party/opa/ast/interning.go b/third_party/opa/ast/interning.go new file mode 100644 index 000000000000..29231006aa5b --- /dev/null +++ b/third_party/opa/ast/interning.go @@ -0,0 +1,24 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +func InternedBooleanTerm(b bool) *Term { + return v1.InternedTerm(b) +} + +// InternedIntNumberTerm returns a term with the given integer value. The term is +// cached between -1 to 512, and for values outside of that range, this function +// is equivalent to ast.IntNumberTerm. +func InternedIntNumberTerm(i int) *Term { + return v1.InternedTerm(i) +} + +func HasInternedIntNumberTerm(i int) bool { + return v1.HasInternedIntNumberTerm(i) +} diff --git a/third_party/opa/ast/json/doc.go b/third_party/opa/ast/json/doc.go new file mode 100644 index 000000000000..26aee9b9940a --- /dev/null +++ b/third_party/opa/ast/json/doc.go @@ -0,0 +1,8 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +// Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. +// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead. +// See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information. +package json diff --git a/third_party/opa/ast/json/json.go b/third_party/opa/ast/json/json.go new file mode 100644 index 000000000000..8a3a36bb9b18 --- /dev/null +++ b/third_party/opa/ast/json/json.go @@ -0,0 +1,15 @@ +package json + +import v1 "github.com/open-policy-agent/opa/v1/ast/json" + +// Options defines the options for JSON operations, +// currently only marshaling can be configured +type Options = v1.Options + +// MarshalOptions defines the options for JSON marshaling, +// currently only toggling the marshaling of location information is supported +type MarshalOptions = v1.MarshalOptions + +// NodeToggle is a generic struct to allow the toggling of +// settings for different ast node types +type NodeToggle = v1.NodeToggle diff --git a/third_party/opa/ast/location/doc.go b/third_party/opa/ast/location/doc.go new file mode 100644 index 000000000000..b559963a5245 --- /dev/null +++ b/third_party/opa/ast/location/doc.go @@ -0,0 +1,8 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +// Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. +// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead. +// See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information. +package location diff --git a/third_party/opa/ast/location/location.go b/third_party/opa/ast/location/location.go new file mode 100644 index 000000000000..f746bb93b31c --- /dev/null +++ b/third_party/opa/ast/location/location.go @@ -0,0 +1,14 @@ +// Package location defines locations in Rego source code. +package location + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// Location records a position in source code +type Location = v1.Location + +// NewLocation returns a new Location object. +func NewLocation(text []byte, file string, row int, col int) *Location { + return v1.NewLocation(text, file, row, col) +} diff --git a/third_party/opa/ast/map.go b/third_party/opa/ast/map.go new file mode 100644 index 000000000000..070ad3e5dedb --- /dev/null +++ b/third_party/opa/ast/map.go @@ -0,0 +1,18 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// ValueMap represents a key/value map between AST term values. Any type of term +// can be used as a key in the map. +type ValueMap = v1.ValueMap + +// NewValueMap returns a new ValueMap. +func NewValueMap() *ValueMap { + return v1.NewValueMap() +} diff --git a/third_party/opa/ast/parser.go b/third_party/opa/ast/parser.go new file mode 100644 index 000000000000..45cd4da06efc --- /dev/null +++ b/third_party/opa/ast/parser.go @@ -0,0 +1,49 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +var RegoV1CompatibleRef = v1.RegoV1CompatibleRef + +// RegoVersion defines the Rego syntax requirements for a module. +type RegoVersion = v1.RegoVersion + +const DefaultRegoVersion = RegoV0 + +const ( + RegoUndefined = v1.RegoUndefined + // RegoV0 is the default, original Rego syntax. + RegoV0 = v1.RegoV0 + // RegoV0CompatV1 requires modules to comply with both the RegoV0 and RegoV1 syntax (as when 'rego.v1' is imported in a module). + // Shortly, RegoV1 compatibility is required, but 'rego.v1' or 'future.keywords' must also be imported. + RegoV0CompatV1 = v1.RegoV0CompatV1 + // RegoV1 is the Rego syntax enforced by OPA 1.0; e.g.: + // future.keywords part of default keyword set, and don't require imports; + // 'if' and 'contains' required in rule heads; + // (some) strict checks on by default. + RegoV1 = v1.RegoV1 +) + +func RegoVersionFromInt(i int) RegoVersion { + return v1.RegoVersionFromInt(i) +} + +// Parser is used to parse Rego statements. +type Parser = v1.Parser + +// ParserOptions defines the options for parsing Rego statements. +type ParserOptions = v1.ParserOptions + +// NewParser creates and initializes a Parser. +func NewParser() *Parser { + return v1.NewParser().WithRegoVersion(DefaultRegoVersion) +} + +func IsFutureKeyword(s string) bool { + return v1.IsFutureKeywordForRegoVersion(s, RegoV0) +} diff --git a/third_party/opa/ast/parser_ext.go b/third_party/opa/ast/parser_ext.go new file mode 100644 index 000000000000..2d5961693214 --- /dev/null +++ b/third_party/opa/ast/parser_ext.go @@ -0,0 +1,311 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + "errors" + "fmt" + + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// MustParseBody returns a parsed body. +// If an error occurs during parsing, panic. +func MustParseBody(input string) Body { + return MustParseBodyWithOpts(input, ParserOptions{}) +} + +// MustParseBodyWithOpts returns a parsed body. +// If an error occurs during parsing, panic. +func MustParseBodyWithOpts(input string, opts ParserOptions) Body { + return v1.MustParseBodyWithOpts(input, setDefaultRegoVersion(opts)) +} + +// MustParseExpr returns a parsed expression. +// If an error occurs during parsing, panic. +func MustParseExpr(input string) *Expr { + parsed, err := ParseExpr(input) + if err != nil { + panic(err) + } + return parsed +} + +// MustParseImports returns a slice of imports. +// If an error occurs during parsing, panic. +func MustParseImports(input string) []*Import { + parsed, err := ParseImports(input) + if err != nil { + panic(err) + } + return parsed +} + +// MustParseModule returns a parsed module. +// If an error occurs during parsing, panic. +func MustParseModule(input string) *Module { + return MustParseModuleWithOpts(input, ParserOptions{}) +} + +// MustParseModuleWithOpts returns a parsed module. +// If an error occurs during parsing, panic. +func MustParseModuleWithOpts(input string, opts ParserOptions) *Module { + return v1.MustParseModuleWithOpts(input, setDefaultRegoVersion(opts)) +} + +// MustParsePackage returns a Package. +// If an error occurs during parsing, panic. +func MustParsePackage(input string) *Package { + parsed, err := ParsePackage(input) + if err != nil { + panic(err) + } + return parsed +} + +// MustParseStatements returns a slice of parsed statements. +// If an error occurs during parsing, panic. +func MustParseStatements(input string) []Statement { + parsed, _, err := ParseStatements("", input) + if err != nil { + panic(err) + } + return parsed +} + +// MustParseStatement returns exactly one statement. +// If an error occurs during parsing, panic. +func MustParseStatement(input string) Statement { + parsed, err := ParseStatement(input) + if err != nil { + panic(err) + } + return parsed +} + +func MustParseStatementWithOpts(input string, popts ParserOptions) Statement { + return v1.MustParseStatementWithOpts(input, setDefaultRegoVersion(popts)) +} + +// MustParseRef returns a parsed reference. +// If an error occurs during parsing, panic. +func MustParseRef(input string) Ref { + parsed, err := ParseRef(input) + if err != nil { + panic(err) + } + return parsed +} + +// MustParseRule returns a parsed rule. +// If an error occurs during parsing, panic. +func MustParseRule(input string) *Rule { + parsed, err := ParseRule(input) + if err != nil { + panic(err) + } + return parsed +} + +// MustParseRuleWithOpts returns a parsed rule. +// If an error occurs during parsing, panic. +func MustParseRuleWithOpts(input string, opts ParserOptions) *Rule { + return v1.MustParseRuleWithOpts(input, setDefaultRegoVersion(opts)) +} + +// MustParseTerm returns a parsed term. +// If an error occurs during parsing, panic. +func MustParseTerm(input string) *Term { + parsed, err := ParseTerm(input) + if err != nil { + panic(err) + } + return parsed +} + +// ParseRuleFromBody returns a rule if the body can be interpreted as a rule +// definition. Otherwise, an error is returned. +func ParseRuleFromBody(module *Module, body Body) (*Rule, error) { + return v1.ParseRuleFromBody(module, body) +} + +// ParseRuleFromExpr returns a rule if the expression can be interpreted as a +// rule definition. +func ParseRuleFromExpr(module *Module, expr *Expr) (*Rule, error) { + return v1.ParseRuleFromExpr(module, expr) +} + +// ParseCompleteDocRuleFromAssignmentExpr returns a rule if the expression can +// be interpreted as a complete document definition declared with the assignment +// operator. +func ParseCompleteDocRuleFromAssignmentExpr(module *Module, lhs, rhs *Term) (*Rule, error) { + return v1.ParseCompleteDocRuleFromAssignmentExpr(module, lhs, rhs) +} + +// ParseCompleteDocRuleFromEqExpr returns a rule if the expression can be +// interpreted as a complete document definition. +func ParseCompleteDocRuleFromEqExpr(module *Module, lhs, rhs *Term) (*Rule, error) { + return v1.ParseCompleteDocRuleFromEqExpr(module, lhs, rhs) +} + +func ParseCompleteDocRuleWithDotsFromTerm(module *Module, term *Term) (*Rule, error) { + return v1.ParseCompleteDocRuleWithDotsFromTerm(module, term) +} + +// ParsePartialObjectDocRuleFromEqExpr returns a rule if the expression can be +// interpreted as a partial object document definition. +func ParsePartialObjectDocRuleFromEqExpr(module *Module, lhs, rhs *Term) (*Rule, error) { + return v1.ParsePartialObjectDocRuleFromEqExpr(module, lhs, rhs) +} + +// ParsePartialSetDocRuleFromTerm returns a rule if the term can be interpreted +// as a partial set document definition. +func ParsePartialSetDocRuleFromTerm(module *Module, term *Term) (*Rule, error) { + return v1.ParsePartialSetDocRuleFromTerm(module, term) +} + +// ParseRuleFromCallEqExpr returns a rule if the term can be interpreted as a +// function definition (e.g., f(x) = y => f(x) = y { true }). +func ParseRuleFromCallEqExpr(module *Module, lhs, rhs *Term) (*Rule, error) { + return v1.ParseRuleFromCallEqExpr(module, lhs, rhs) +} + +// ParseRuleFromCallExpr returns a rule if the terms can be interpreted as a +// function returning true or some value (e.g., f(x) => f(x) = true { true }). +func ParseRuleFromCallExpr(module *Module, terms []*Term) (*Rule, error) { + return v1.ParseRuleFromCallExpr(module, terms) +} + +// ParseImports returns a slice of Import objects. +func ParseImports(input string) ([]*Import, error) { + return v1.ParseImports(input) +} + +// ParseModule returns a parsed Module object. +// For details on Module objects and their fields, see policy.go. +// Empty input will return nil, nil. +func ParseModule(filename, input string) (*Module, error) { + return ParseModuleWithOpts(filename, input, ParserOptions{}) +} + +// ParseModuleWithOpts returns a parsed Module object, and has an additional input ParserOptions +// For details on Module objects and their fields, see policy.go. +// Empty input will return nil, nil. +func ParseModuleWithOpts(filename, input string, popts ParserOptions) (*Module, error) { + return v1.ParseModuleWithOpts(filename, input, setDefaultRegoVersion(popts)) +} + +// ParseBody returns exactly one body. +// If multiple bodies are parsed, an error is returned. +func ParseBody(input string) (Body, error) { + return ParseBodyWithOpts(input, ParserOptions{SkipRules: true}) +} + +// ParseBodyWithOpts returns exactly one body. It does _not_ set SkipRules: true on its own, +// but respects whatever ParserOptions it's been given. +func ParseBodyWithOpts(input string, popts ParserOptions) (Body, error) { + return v1.ParseBodyWithOpts(input, setDefaultRegoVersion(popts)) +} + +// ParseExpr returns exactly one expression. +// If multiple expressions are parsed, an error is returned. +func ParseExpr(input string) (*Expr, error) { + body, err := ParseBody(input) + if err != nil { + return nil, fmt.Errorf("failed to parse expression: %w", err) + } + if len(body) != 1 { + return nil, fmt.Errorf("expected exactly one expression but got: %v", body) + } + return body[0], nil +} + +// ParsePackage returns exactly one Package. +// If multiple statements are parsed, an error is returned. +func ParsePackage(input string) (*Package, error) { + return v1.ParsePackage(input) +} + +// ParseTerm returns exactly one term. +// If multiple terms are parsed, an error is returned. +func ParseTerm(input string) (*Term, error) { + body, err := ParseBody(input) + if err != nil { + return nil, fmt.Errorf("failed to parse term: %w", err) + } + if len(body) != 1 { + return nil, fmt.Errorf("expected exactly one term but got: %v", body) + } + term, ok := body[0].Terms.(*Term) + if !ok { + return nil, fmt.Errorf("expected term but got %v", body[0].Terms) + } + return term, nil +} + +// ParseRef returns exactly one reference. +func ParseRef(input string) (Ref, error) { + term, err := ParseTerm(input) + if err != nil { + return nil, fmt.Errorf("failed to parse ref: %w", err) + } + ref, ok := term.Value.(Ref) + if !ok { + return nil, fmt.Errorf("expected ref but got %v", term) + } + return ref, nil +} + +// ParseRuleWithOpts returns exactly one rule. +// If multiple rules are parsed, an error is returned. +func ParseRuleWithOpts(input string, opts ParserOptions) (*Rule, error) { + return v1.ParseRuleWithOpts(input, setDefaultRegoVersion(opts)) +} + +// ParseRule returns exactly one rule. +// If multiple rules are parsed, an error is returned. +func ParseRule(input string) (*Rule, error) { + return ParseRuleWithOpts(input, ParserOptions{}) +} + +// ParseStatement returns exactly one statement. +// A statement might be a term, expression, rule, etc. Regardless, +// this function expects *exactly* one statement. If multiple +// statements are parsed, an error is returned. +func ParseStatement(input string) (Statement, error) { + stmts, _, err := ParseStatements("", input) + if err != nil { + return nil, err + } + if len(stmts) != 1 { + return nil, errors.New("expected exactly one statement") + } + return stmts[0], nil +} + +func ParseStatementWithOpts(input string, popts ParserOptions) (Statement, error) { + return v1.ParseStatementWithOpts(input, setDefaultRegoVersion(popts)) +} + +// ParseStatements is deprecated. Use ParseStatementWithOpts instead. +func ParseStatements(filename, input string) ([]Statement, []*Comment, error) { + return ParseStatementsWithOpts(filename, input, ParserOptions{}) +} + +// ParseStatementsWithOpts returns a slice of parsed statements. This is the +// default return value from the parser. +func ParseStatementsWithOpts(filename, input string, popts ParserOptions) ([]Statement, []*Comment, error) { + return v1.ParseStatementsWithOpts(filename, input, setDefaultRegoVersion(popts)) +} + +// ParserErrorDetail holds additional details for parser errors. +type ParserErrorDetail = v1.ParserErrorDetail + +func setDefaultRegoVersion(opts ParserOptions) ParserOptions { + if opts.RegoVersion == RegoUndefined { + opts.RegoVersion = DefaultRegoVersion + } + return opts +} diff --git a/third_party/opa/ast/parser_ext_test.go b/third_party/opa/ast/parser_ext_test.go new file mode 100644 index 000000000000..02ca80eefc28 --- /dev/null +++ b/third_party/opa/ast/parser_ext_test.go @@ -0,0 +1,127 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast_test + +import ( + "strings" + "testing" + + "github.com/open-policy-agent/opa/ast" + "github.com/open-policy-agent/opa/format" +) + +func TestParseModule_DefaultRegoVersion(t *testing.T) { + tests := []struct { + note string + mod string + expRules []string + expErrs []string + }{ + { + note: "v0", // default rego-version + mod: `package test +p[x] { + x = "a" +}`, + expRules: []string{"p"}, + }, + { + note: "import rego.v1", + mod: `package test +import rego.v1 + +p contains x if { + x = "a" +}`, + expRules: []string{"p"}, + }, + { + note: "v1", // NOT default rego-version + mod: `package test +p contains x if { + x = "a" +}`, + expErrs: []string{ + "test.rego:2: rego_parse_error: var cannot be used for rule name", + }, + }, + } + + for _, tc := range tests { + t.Run(tc.note, func(t *testing.T) { + m, err := ast.ParseModule("test.rego", tc.mod) + + if len(tc.expErrs) > 0 { + for i, expErr := range tc.expErrs { + if !strings.Contains(err.Error(), expErr) { + t.Fatalf("Expected error %d to contain %q, got %q", i, expErr, err.Error()) + } + } + } else { + if err != nil { + t.Fatalf("Unexpected error: %s", err) + } + + if len(m.Rules) != len(tc.expRules) { + t.Fatalf("Expected %d rules, got %d", len(tc.expRules), len(m.Rules)) + } + for i, r := range m.Rules { + if r.Head.Name.String() != tc.expRules[i] { + t.Fatalf("Expected rule %q, got %q", tc.expRules[i], r.Head.Name.String()) + } + } + } + }) + } +} + +func TestParseBody_DefaultRegoVersion(t *testing.T) { + tests := []struct { + note string + body string + expStmts int + assertSame bool + }{ + { + note: "v0", // default rego-version + body: `x := ["a", "b", "c"][i] +`, + expStmts: 1, + assertSame: true, + }, + { + note: "v1", // NOT default rego-version + body: `some x, i in ["a", "b", "c"] +`, + expStmts: 3, + assertSame: false, + }, + } + + for _, tc := range tests { + t.Run(tc.note, func(t *testing.T) { + body, err := ast.ParseBody(tc.body) + + if err != nil { + t.Fatalf("Unexpected error: %s", err) + } + + if len(body) != tc.expStmts { + t.Fatalf("Expected %d statements, got %d:%q\n\n", tc.expStmts, len(body), body) + } + + if tc.assertSame { + formatted, err := format.AstWithOpts(body, format.Opts{RegoVersion: ast.RegoV1}) // every body is v1-compatible + if err != nil { + t.Fatalf("Unexpected error: %s", err) + } + + if strings.Compare(string(formatted), tc.body) != 0 { + t.Fatalf("Expected body to be %q, got %q", tc.body, string(formatted)) + } + } + }) + } +} diff --git a/third_party/opa/ast/parser_test.go b/third_party/opa/ast/parser_test.go new file mode 100644 index 000000000000..24487e2d06bb --- /dev/null +++ b/third_party/opa/ast/parser_test.go @@ -0,0 +1,52 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + "bytes" + "testing" +) + +func TestParser_DefaultRegoVersion(t *testing.T) { + tests := []struct { + note string + input string + expStmtCount int + }{ + { + note: "v0", + input: `package test +p[x] { + c = ["a", "b", "c"][i] +}`, + expStmtCount: 2, // package, p + }, + { + note: "v1", + input: `package test +p contains x if { + c = ["a", "b", "c"][i] +}`, + // v1 Keywords are not recognized, and interpreted as individual statements + expStmtCount: 5, // package, p, contains, x, if + }, + } + + for _, tc := range tests { + t.Run(tc.note, func(t *testing.T) { + parser := NewParser(). + WithFilename("test.rego"). + WithReader(bytes.NewBufferString(tc.input)) + stmts, _, err := parser.Parse() + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + + if len(stmts) != tc.expStmtCount { + t.Fatalf("Expected %d statements but got %d:\n\n%v", tc.expStmtCount, len(stmts), stmts) + } + }) + } +} diff --git a/third_party/opa/ast/policy.go b/third_party/opa/ast/policy.go new file mode 100644 index 000000000000..5055e8f23f29 --- /dev/null +++ b/third_party/opa/ast/policy.go @@ -0,0 +1,235 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + astJSON "github.com/open-policy-agent/opa/ast/json" + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// DefaultRootDocument is the default root document. +// +// All package directives inside source files are implicitly prefixed with the +// DefaultRootDocument value. +var DefaultRootDocument = v1.DefaultRootDocument + +// InputRootDocument names the document containing query arguments. +var InputRootDocument = v1.InputRootDocument + +// SchemaRootDocument names the document containing external data schemas. +var SchemaRootDocument = v1.SchemaRootDocument + +// FunctionArgRootDocument names the document containing function arguments. +// It's only for internal usage, for referencing function arguments between +// the index and topdown. +var FunctionArgRootDocument = v1.FunctionArgRootDocument + +// FutureRootDocument names the document containing new, to-become-default, +// features. +var FutureRootDocument = v1.FutureRootDocument + +// RegoRootDocument names the document containing new, to-become-default, +// features in a future versioned release. +var RegoRootDocument = v1.RegoRootDocument + +// RootDocumentNames contains the names of top-level documents that can be +// referred to in modules and queries. +// +// Note, the schema document is not currently implemented in the evaluator so it +// is not registered as a root document name (yet). +var RootDocumentNames = v1.RootDocumentNames + +// DefaultRootRef is a reference to the root of the default document. +// +// All refs to data in the policy engine's storage layer are prefixed with this ref. +var DefaultRootRef = v1.DefaultRootRef + +// InputRootRef is a reference to the root of the input document. +// +// All refs to query arguments are prefixed with this ref. +var InputRootRef = v1.InputRootRef + +// SchemaRootRef is a reference to the root of the schema document. +// +// All refs to schema documents are prefixed with this ref. Note, the schema +// document is not currently implemented in the evaluator so it is not +// registered as a root document ref (yet). +var SchemaRootRef = v1.SchemaRootRef + +// RootDocumentRefs contains the prefixes of top-level documents that all +// non-local references start with. +var RootDocumentRefs = v1.RootDocumentRefs + +// SystemDocumentKey is the name of the top-level key that identifies the system +// document. +const SystemDocumentKey = v1.SystemDocumentKey + +// ReservedVars is the set of names that refer to implicitly ground vars. +var ReservedVars = v1.ReservedVars + +// Wildcard represents the wildcard variable as defined in the language. +var Wildcard = v1.Wildcard + +// WildcardPrefix is the special character that all wildcard variables are +// prefixed with when the statement they are contained in is parsed. +const WildcardPrefix = v1.WildcardPrefix + +// Keywords contains strings that map to language keywords. +var Keywords = v1.Keywords + +var KeywordsV0 = v1.KeywordsV0 + +var KeywordsV1 = v1.KeywordsV1 + +func KeywordsForRegoVersion(v RegoVersion) []string { + return v1.KeywordsForRegoVersion(v) +} + +// IsKeyword returns true if s is a language keyword. +func IsKeyword(s string) bool { + return v1.IsKeyword(s) +} + +func IsInKeywords(s string, keywords []string) bool { + return v1.IsInKeywords(s, keywords) +} + +// IsKeywordInRegoVersion returns true if s is a language keyword. +func IsKeywordInRegoVersion(s string, regoVersion RegoVersion) bool { + return v1.IsKeywordInRegoVersion(s, regoVersion) +} + +type ( + // Node represents a node in an AST. Nodes may be statements in a policy module + // or elements of an ad-hoc query, expression, etc. + Node = v1.Node + + // Statement represents a single statement in a policy module. + Statement = v1.Statement +) + +type ( + + // Module represents a collection of policies (defined by rules) + // within a namespace (defined by the package) and optional + // dependencies on external documents (defined by imports). + Module = v1.Module + + // Comment contains the raw text from the comment in the definition. + Comment = v1.Comment + + // Package represents the namespace of the documents produced + // by rules inside the module. + Package = v1.Package + + // Import represents a dependency on a document outside of the policy + // namespace. Imports are optional. + Import = v1.Import + + // Rule represents a rule as defined in the language. Rules define the + // content of documents that represent policy decisions. + Rule = v1.Rule + + // Head represents the head of a rule. + Head = v1.Head + + // Args represents zero or more arguments to a rule. + Args = v1.Args + + // Body represents one or more expressions contained inside a rule or user + // function. + Body = v1.Body + + // Expr represents a single expression contained inside the body of a rule. + Expr = v1.Expr + + // SomeDecl represents a variable declaration statement. The symbols are variables. + SomeDecl = v1.SomeDecl + + Every = v1.Every + + // With represents a modifier on an expression. + With = v1.With +) + +// NewComment returns a new Comment object. +func NewComment(text []byte) *Comment { + return v1.NewComment(text) +} + +// IsValidImportPath returns an error indicating if the import path is invalid. +// If the import path is valid, err is nil. +func IsValidImportPath(v Value) (err error) { + return v1.IsValidImportPath(v) +} + +// NewHead returns a new Head object. If args are provided, the first will be +// used for the key and the second will be used for the value. +func NewHead(name Var, args ...*Term) *Head { + return v1.NewHead(name, args...) +} + +// VarHead creates a head object, initializes its Name, Location, and Options, +// and returns the new head. +func VarHead(name Var, location *Location, jsonOpts *astJSON.Options) *Head { + return v1.VarHead(name, location, jsonOpts) +} + +// RefHead returns a new Head object with the passed Ref. If args are provided, +// the first will be used for the value. +func RefHead(ref Ref, args ...*Term) *Head { + return v1.RefHead(ref, args...) +} + +// DocKind represents the collection of document types that can be produced by rules. +type DocKind = v1.DocKind + +const ( + // CompleteDoc represents a document that is completely defined by the rule. + CompleteDoc = v1.CompleteDoc + + // PartialSetDoc represents a set document that is partially defined by the rule. + PartialSetDoc = v1.PartialSetDoc + + // PartialObjectDoc represents an object document that is partially defined by the rule. + PartialObjectDoc = v1.PartialObjectDoc +) + +type RuleKind = v1.RuleKind + +const ( + SingleValue = v1.SingleValue + MultiValue = v1.MultiValue +) + +// NewBody returns a new Body containing the given expressions. The indices of +// the immediate expressions will be reset. +func NewBody(exprs ...*Expr) Body { + return v1.NewBody(exprs...) +} + +// NewExpr returns a new Expr object. +func NewExpr(terms any) *Expr { + return v1.NewExpr(terms) +} + +// NewBuiltinExpr creates a new Expr object with the supplied terms. +// The builtin operator must be the first term. +func NewBuiltinExpr(terms ...*Term) *Expr { + return v1.NewBuiltinExpr(terms...) +} + +// Copy returns a deep copy of the AST node x. If x is not an AST node, x is returned unmodified. +func Copy(x any) any { + return v1.Copy(x) +} + +// RuleSet represents a collection of rules that produce a virtual document. +type RuleSet = v1.RuleSet + +// NewRuleSet returns a new RuleSet containing the given rules. +func NewRuleSet(rules ...*Rule) RuleSet { + return v1.NewRuleSet(rules...) +} diff --git a/third_party/opa/ast/policy_test.go b/third_party/opa/ast/policy_test.go new file mode 100644 index 000000000000..3e35ba7695ef --- /dev/null +++ b/third_party/opa/ast/policy_test.go @@ -0,0 +1,85 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import "testing" + +func TestRuleString_DefaultRegoVersion(t *testing.T) { + // ast.Rule.String() will respect the rego-version of the ast.Module it is part of. + + tests := []struct { + note string + module string + regoVersion RegoVersion + exp string + }{ + { + note: "v0", + regoVersion: RegoV0, + module: `package a.b.c + +p[x] { x = "a" }`, + exp: `p[x] { x = "a" }`, + }, + { + note: "v1", + regoVersion: RegoV1, + module: `package a.b.c + +p contains x if { x = "a" }`, + exp: `p contains x if { x = "a" }`, + }, + { + note: "default rego-version", + module: `package a.b.c + +p[x] { x = "a" }`, + exp: `p[x] { x = "a" }`, + }, + } + + for _, tc := range tests { + t.Run(tc.note, func(t *testing.T) { + var mod *Module + + if tc.regoVersion == RegoUndefined { + mod = MustParseModule(tc.module) + } else { + mod = MustParseModuleWithOpts(tc.module, ParserOptions{RegoVersion: tc.regoVersion}) + } + + rule := mod.Rules[0] + act := rule.String() + + if act != tc.exp { + t.Fatalf("Expected:\n\n%s\n\nbut got:\n\n%s", tc.exp, act) + } + }) + } +} + +func TestModuleString(t *testing.T) { + + // v0 module + input := `package a.b.c + +import data.foo.bar +import input.xyz + +p = true { not bar } +q = true { xyz.abc = 2 } +wildcard = true { bar[_] = 1 }` + + mod := MustParseModule(input) + + roundtrip, err := ParseModule("", mod.String()) + if err != nil { + t.Fatalf("Unexpected error while parsing roundtripped module: %v", err) + } + + if !roundtrip.Equal(mod) { + t.Fatalf("Expected roundtripped to equal original but:\n\nExpected:\n\n%v\n\nDoes not equal result:\n\n%v", mod, roundtrip) + } +} diff --git a/third_party/opa/ast/pretty.go b/third_party/opa/ast/pretty.go new file mode 100644 index 000000000000..84e42f9aec56 --- /dev/null +++ b/third_party/opa/ast/pretty.go @@ -0,0 +1,18 @@ +// Copyright 2018 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + "io" + + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// Pretty writes a pretty representation of the AST rooted at x to w. +// +// This is function is intended for debug purposes when inspecting ASTs. +func Pretty(w io.Writer, x any) { + v1.Pretty(w, x) +} diff --git a/third_party/opa/ast/schema.go b/third_party/opa/ast/schema.go new file mode 100644 index 000000000000..979958a3c00a --- /dev/null +++ b/third_party/opa/ast/schema.go @@ -0,0 +1,17 @@ +// Copyright 2021 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// SchemaSet holds a map from a path to a schema. +type SchemaSet = v1.SchemaSet + +// NewSchemaSet returns an empty SchemaSet. +func NewSchemaSet() *SchemaSet { + return v1.NewSchemaSet() +} diff --git a/third_party/opa/ast/strings.go b/third_party/opa/ast/strings.go new file mode 100644 index 000000000000..c2c81de8b779 --- /dev/null +++ b/third_party/opa/ast/strings.go @@ -0,0 +1,14 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// TypeName returns a human readable name for the AST element type. +func TypeName(x any) string { + return v1.TypeName(x) +} diff --git a/third_party/opa/ast/term.go b/third_party/opa/ast/term.go new file mode 100644 index 000000000000..202355070f1b --- /dev/null +++ b/third_party/opa/ast/term.go @@ -0,0 +1,306 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + "encoding/json" + "io" + + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// Location records a position in source code. +type Location = v1.Location + +// NewLocation returns a new Location object. +func NewLocation(text []byte, file string, row int, col int) *Location { + return v1.NewLocation(text, file, row, col) +} + +// Value declares the common interface for all Term values. Every kind of Term value +// in the language is represented as a type that implements this interface: +// +// - Null, Boolean, Number, String +// - Object, Array, Set +// - Variables, References +// - Array, Set, and Object Comprehensions +// - Calls +type Value = v1.Value + +// InterfaceToValue converts a native Go value x to a Value. +func InterfaceToValue(x any) (Value, error) { + return v1.InterfaceToValue(x) +} + +// ValueFromReader returns an AST value from a JSON serialized value in the reader. +func ValueFromReader(r io.Reader) (Value, error) { + return v1.ValueFromReader(r) +} + +// As converts v into a Go native type referred to by x. +func As(v Value, x any) error { + return v1.As(v, x) +} + +// Resolver defines the interface for resolving references to native Go values. +type Resolver = v1.Resolver + +// ValueResolver defines the interface for resolving references to AST values. +type ValueResolver = v1.ValueResolver + +// UnknownValueErr indicates a ValueResolver was unable to resolve a reference +// because the reference refers to an unknown value. +type UnknownValueErr = v1.UnknownValueErr + +// IsUnknownValueErr returns true if the err is an UnknownValueErr. +func IsUnknownValueErr(err error) bool { + return v1.IsUnknownValueErr(err) +} + +// ValueToInterface returns the Go representation of an AST value. The AST +// value should not contain any values that require evaluation (e.g., vars, +// comprehensions, etc.) +func ValueToInterface(v Value, resolver Resolver) (any, error) { + return v1.ValueToInterface(v, resolver) +} + +// JSON returns the JSON representation of v. The value must not contain any +// refs or terms that require evaluation (e.g., vars, comprehensions, etc.) +func JSON(v Value) (any, error) { + return v1.JSON(v) +} + +// JSONOpt defines parameters for AST to JSON conversion. +type JSONOpt = v1.JSONOpt + +// JSONWithOpt returns the JSON representation of v. The value must not contain any +// refs or terms that require evaluation (e.g., vars, comprehensions, etc.) +func JSONWithOpt(v Value, opt JSONOpt) (any, error) { + return v1.JSONWithOpt(v, opt) +} + +// MustJSON returns the JSON representation of v. The value must not contain any +// refs or terms that require evaluation (e.g., vars, comprehensions, etc.) If +// the conversion fails, this function will panic. This function is mostly for +// test purposes. +func MustJSON(v Value) any { + return v1.MustJSON(v) +} + +// MustInterfaceToValue converts a native Go value x to a Value. If the +// conversion fails, this function will panic. This function is mostly for test +// purposes. +func MustInterfaceToValue(x any) Value { + return v1.MustInterfaceToValue(x) +} + +// Term is an argument to a function. +type Term = v1.Term + +// NewTerm returns a new Term object. +func NewTerm(v Value) *Term { + return v1.NewTerm(v) +} + +// IsConstant returns true if the AST value is constant. +func IsConstant(v Value) bool { + return v1.IsConstant(v) +} + +// IsComprehension returns true if the supplied value is a comprehension. +func IsComprehension(x Value) bool { + return v1.IsComprehension(x) +} + +// ContainsRefs returns true if the Value v contains refs. +func ContainsRefs(v any) bool { + return v1.ContainsRefs(v) +} + +// ContainsComprehensions returns true if the Value v contains comprehensions. +func ContainsComprehensions(v any) bool { + return v1.ContainsComprehensions(v) +} + +// ContainsClosures returns true if the Value v contains closures. +func ContainsClosures(v any) bool { + return v1.ContainsClosures(v) +} + +// IsScalar returns true if the AST value is a scalar. +func IsScalar(v Value) bool { + return v1.IsScalar(v) +} + +// Null represents the null value defined by JSON. +type Null = v1.Null + +// NullTerm creates a new Term with a Null value. +func NullTerm() *Term { + return v1.NullTerm() +} + +// Boolean represents a boolean value defined by JSON. +type Boolean = v1.Boolean + +// BooleanTerm creates a new Term with a Boolean value. +func BooleanTerm(b bool) *Term { + return v1.BooleanTerm(b) +} + +// Number represents a numeric value as defined by JSON. +type Number = v1.Number + +// NumberTerm creates a new Term with a Number value. +func NumberTerm(n json.Number) *Term { + return v1.NumberTerm(n) +} + +// IntNumberTerm creates a new Term with an integer Number value. +func IntNumberTerm(i int) *Term { + return v1.IntNumberTerm(i) +} + +// UIntNumberTerm creates a new Term with an unsigned integer Number value. +func UIntNumberTerm(u uint64) *Term { + return v1.UIntNumberTerm(u) +} + +// FloatNumberTerm creates a new Term with a floating point Number value. +func FloatNumberTerm(f float64) *Term { + return v1.FloatNumberTerm(f) +} + +// String represents a string value as defined by JSON. +type String = v1.String + +// StringTerm creates a new Term with a String value. +func StringTerm(s string) *Term { + return v1.StringTerm(s) +} + +// Var represents a variable as defined by the language. +type Var = v1.Var + +// VarTerm creates a new Term with a Variable value. +func VarTerm(v string) *Term { + return v1.VarTerm(v) +} + +// Ref represents a reference as defined by the language. +type Ref = v1.Ref + +// EmptyRef returns a new, empty reference. +func EmptyRef() Ref { + return v1.EmptyRef() +} + +// PtrRef returns a new reference against the head for the pointer +// s. Path components in the pointer are unescaped. +func PtrRef(head *Term, s string) (Ref, error) { + return v1.PtrRef(head, s) +} + +// RefTerm creates a new Term with a Ref value. +func RefTerm(r ...*Term) *Term { + return v1.RefTerm(r...) +} + +func IsVarCompatibleString(s string) bool { + return v1.IsVarCompatibleString(s) +} + +// QueryIterator defines the interface for querying AST documents with references. +type QueryIterator = v1.QueryIterator + +// ArrayTerm creates a new Term with an Array value. +func ArrayTerm(a ...*Term) *Term { + return v1.ArrayTerm(a...) +} + +// NewArray creates an Array with the terms provided. The array will +// use the provided term slice. +func NewArray(a ...*Term) *Array { + return v1.NewArray(a...) +} + +// Array represents an array as defined by the language. Arrays are similar to the +// same types as defined by JSON with the exception that they can contain Vars +// and References. +type Array = v1.Array + +// Set represents a set as defined by the language. +type Set = v1.Set + +// NewSet returns a new Set containing t. +func NewSet(t ...*Term) Set { + return v1.NewSet(t...) +} + +func SetTerm(t ...*Term) *Term { + return v1.SetTerm(t...) +} + +// Object represents an object as defined by the language. +type Object = v1.Object + +// NewObject creates a new Object with t. +func NewObject(t ...[2]*Term) Object { + return v1.NewObject(t...) +} + +// ObjectTerm creates a new Term with an Object value. +func ObjectTerm(o ...[2]*Term) *Term { + return v1.ObjectTerm(o...) +} + +func LazyObject(blob map[string]any) Object { + return v1.LazyObject(blob) +} + +// Item is a helper for constructing an tuple containing two Terms +// representing a key/value pair in an Object. +func Item(key, value *Term) [2]*Term { + return v1.Item(key, value) +} + +// NOTE(philipc): The only way to get an ObjectKeyIterator should be +// from an Object. This ensures that the iterator can have implementation- +// specific details internally, with no contracts except to the very +// limited interface. +type ObjectKeysIterator = v1.ObjectKeysIterator + +// ArrayComprehension represents an array comprehension as defined in the language. +type ArrayComprehension = v1.ArrayComprehension + +// ArrayComprehensionTerm creates a new Term with an ArrayComprehension value. +func ArrayComprehensionTerm(term *Term, body Body) *Term { + return v1.ArrayComprehensionTerm(term, body) +} + +// ObjectComprehension represents an object comprehension as defined in the language. +type ObjectComprehension = v1.ObjectComprehension + +// ObjectComprehensionTerm creates a new Term with an ObjectComprehension value. +func ObjectComprehensionTerm(key, value *Term, body Body) *Term { + return v1.ObjectComprehensionTerm(key, value, body) +} + +// SetComprehension represents a set comprehension as defined in the language. +type SetComprehension = v1.SetComprehension + +// SetComprehensionTerm creates a new Term with an SetComprehension value. +func SetComprehensionTerm(term *Term, body Body) *Term { + return v1.SetComprehensionTerm(term, body) +} + +// Call represents as function call in the language. +type Call = v1.Call + +// CallTerm returns a new Term with a Call value defined by terms. The first +// term is the operator and the rest are operands. +func CallTerm(terms ...*Term) *Term { + return v1.CallTerm(terms...) +} diff --git a/third_party/opa/ast/transform.go b/third_party/opa/ast/transform.go new file mode 100644 index 000000000000..8c03c4866371 --- /dev/null +++ b/third_party/opa/ast/transform.go @@ -0,0 +1,46 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// Transformer defines the interface for transforming AST elements. If the +// transformer returns nil and does not indicate an error, the AST element will +// be set to nil and no transformations will be applied to children of the +// element. +type Transformer = v1.Transformer + +// Transform iterates the AST and calls the Transform function on the +// Transformer t for x before recursing. +func Transform(t Transformer, x any) (any, error) { + return v1.Transform(t, x) +} + +// TransformRefs calls the function f on all references under x. +func TransformRefs(x any, f func(Ref) (Value, error)) (any, error) { + return v1.TransformRefs(x, f) +} + +// TransformVars calls the function f on all vars under x. +func TransformVars(x any, f func(Var) (Value, error)) (any, error) { + return v1.TransformVars(x, f) +} + +// TransformComprehensions calls the functio nf on all comprehensions under x. +func TransformComprehensions(x any, f func(any) (Value, error)) (any, error) { + return v1.TransformComprehensions(x, f) +} + +// GenericTransformer implements the Transformer interface to provide a utility +// to transform AST nodes using a closure. +type GenericTransformer = v1.GenericTransformer + +// NewGenericTransformer returns a new GenericTransformer that will transform +// AST nodes using the function f. +func NewGenericTransformer(f func(x any) (any, error)) *GenericTransformer { + return v1.NewGenericTransformer(f) +} diff --git a/third_party/opa/ast/unify.go b/third_party/opa/ast/unify.go new file mode 100644 index 000000000000..3cb260272aad --- /dev/null +++ b/third_party/opa/ast/unify.go @@ -0,0 +1,14 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import v1 "github.com/open-policy-agent/opa/v1/ast" + +// Unify returns a set of variables that will be unified when the equality expression defined by +// terms a and b is evaluated. The unifier assumes that variables in the VarSet safe are already +// unified. +func Unify(safe VarSet, a *Term, b *Term) VarSet { + return v1.Unify(safe, a, b) +} diff --git a/third_party/opa/ast/varset.go b/third_party/opa/ast/varset.go new file mode 100644 index 000000000000..9e7db8efdad1 --- /dev/null +++ b/third_party/opa/ast/varset.go @@ -0,0 +1,17 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import ( + v1 "github.com/open-policy-agent/opa/v1/ast" +) + +// VarSet represents a set of variables. +type VarSet = v1.VarSet + +// NewVarSet returns a new VarSet containing the specified variables. +func NewVarSet(vs ...Var) VarSet { + return v1.NewVarSet(vs...) +} diff --git a/third_party/opa/ast/visit.go b/third_party/opa/ast/visit.go new file mode 100644 index 000000000000..f4f2459ecc44 --- /dev/null +++ b/third_party/opa/ast/visit.go @@ -0,0 +1,123 @@ +// Copyright 2016 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package ast + +import v1 "github.com/open-policy-agent/opa/v1/ast" + +// Visitor defines the interface for iterating AST elements. The Visit function +// can return a Visitor w which will be used to visit the children of the AST +// element v. If the Visit function returns nil, the children will not be +// visited. +// Deprecated: use GenericVisitor or another visitor implementation +type Visitor = v1.Visitor + +// BeforeAndAfterVisitor wraps Visitor to provide hooks for being called before +// and after the AST has been visited. +// Deprecated: use GenericVisitor or another visitor implementation +type BeforeAndAfterVisitor = v1.BeforeAndAfterVisitor + +// Walk iterates the AST by calling the Visit function on the Visitor +// v for x before recursing. +// Deprecated: use GenericVisitor.Walk +func Walk(v Visitor, x any) { + v1.Walk(v, x) +} + +// WalkBeforeAndAfter iterates the AST by calling the Visit function on the +// Visitor v for x before recursing. +// Deprecated: use GenericVisitor.Walk +func WalkBeforeAndAfter(v BeforeAndAfterVisitor, x any) { + v1.WalkBeforeAndAfter(v, x) +} + +// WalkVars calls the function f on all vars under x. If the function f +// returns true, AST nodes under the last node will not be visited. +func WalkVars(x any, f func(Var) bool) { + v1.WalkVars(x, f) +} + +// WalkClosures calls the function f on all closures under x. If the function f +// returns true, AST nodes under the last node will not be visited. +func WalkClosures(x any, f func(any) bool) { + v1.WalkClosures(x, f) +} + +// WalkRefs calls the function f on all references under x. If the function f +// returns true, AST nodes under the last node will not be visited. +func WalkRefs(x any, f func(Ref) bool) { + v1.WalkRefs(x, f) +} + +// WalkTerms calls the function f on all terms under x. If the function f +// returns true, AST nodes under the last node will not be visited. +func WalkTerms(x any, f func(*Term) bool) { + v1.WalkTerms(x, f) +} + +// WalkWiths calls the function f on all with modifiers under x. If the function f +// returns true, AST nodes under the last node will not be visited. +func WalkWiths(x any, f func(*With) bool) { + v1.WalkWiths(x, f) +} + +// WalkExprs calls the function f on all expressions under x. If the function f +// returns true, AST nodes under the last node will not be visited. +func WalkExprs(x any, f func(*Expr) bool) { + v1.WalkExprs(x, f) +} + +// WalkBodies calls the function f on all bodies under x. If the function f +// returns true, AST nodes under the last node will not be visited. +func WalkBodies(x any, f func(Body) bool) { + v1.WalkBodies(x, f) +} + +// WalkRules calls the function f on all rules under x. If the function f +// returns true, AST nodes under the last node will not be visited. +func WalkRules(x any, f func(*Rule) bool) { + v1.WalkRules(x, f) +} + +// WalkNodes calls the function f on all nodes under x. If the function f +// returns true, AST nodes under the last node will not be visited. +func WalkNodes(x any, f func(Node) bool) { + v1.WalkNodes(x, f) +} + +// GenericVisitor provides a utility to walk over AST nodes using a +// closure. If the closure returns true, the visitor will not walk +// over AST nodes under x. +type GenericVisitor = v1.GenericVisitor + +// NewGenericVisitor returns a new GenericVisitor that will invoke the function +// f on AST nodes. +func NewGenericVisitor(f func(x any) bool) *GenericVisitor { + return v1.NewGenericVisitor(f) +} + +// BeforeAfterVisitor provides a utility to walk over AST nodes using +// closures. If the before closure returns true, the visitor will not +// walk over AST nodes under x. The after closure is invoked always +// after visiting a node. +type BeforeAfterVisitor = v1.BeforeAfterVisitor + +// NewBeforeAfterVisitor returns a new BeforeAndAfterVisitor that +// will invoke the functions before and after AST nodes. +func NewBeforeAfterVisitor(before func(x any) bool, after func(x any)) *BeforeAfterVisitor { + return v1.NewBeforeAfterVisitor(before, after) +} + +// VarVisitor walks AST nodes under a given node and collects all encountered +// variables. The collected variables can be controlled by specifying +// VarVisitorParams when creating the visitor. +type VarVisitor = v1.VarVisitor + +// VarVisitorParams contains settings for a VarVisitor. +type VarVisitorParams = v1.VarVisitorParams + +// NewVarVisitor returns a new VarVisitor object. +func NewVarVisitor() *VarVisitor { + return v1.NewVarVisitor() +} diff --git a/third_party/opa/build/binary-smoke-test.sh b/third_party/opa/build/binary-smoke-test.sh new file mode 100755 index 000000000000..827a2fb72ca8 --- /dev/null +++ b/third_party/opa/build/binary-smoke-test.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +set -eo pipefail +OPA_EXEC="$1" +TARGET="$2" + +PATH_SEPARATOR="/" +BASE_PATH=$(pwd) +TEST_PATH="${BASE_PATH}/v1/test/cli/smoke/namespace/data.json" +if [[ $OPA_EXEC == *".exe" ]]; then + PATH_SEPARATOR="\\" + BASE_PATH=$(pwd -W) + TEST_PATH="$(echo ${BASE_PATH}/v1/test/cli/smoke/namespace/data.json | sed 's/^\///' | sed 's/\//\\\\/g')" + BASE_PATH=$(echo ${BASE_PATH} | sed 's/^\///' | sed 's/\//\\/g') +fi + +github_actions_group() { + local args="$*" + echo "::group::$args" + $args + echo "::endgroup::" +} + +opa() { + local args="$*" + github_actions_group $OPA_EXEC $args +} + +# assert_contains checks if the actual string contains the expected string. +assert_contains() { + local expected="$1" + local actual="$2" + if [[ "$actual" != *"$expected"* ]]; then + echo "Expected '$expected' but got '$actual'" + exit 1 + fi +} + +# assert_not_contains checks if the actual string does not contain the expected string. +assert_not_contains() { + local expected="$1" + local actual="$2" + if [[ "$actual" == *"$expected"* ]]; then + echo "Didn't expect '$expected' in '$actual'" + exit 0 + fi +} + +opa version +opa eval -t $TARGET 'time.now_ns()' +opa eval --format pretty --bundle v1/test/cli/smoke/golden-bundle.tar.gz --input v1/test/cli/smoke/input.json data.test.result --fail +opa exec --bundle v1/test/cli/smoke/golden-bundle.tar.gz --decision test/result v1/test/cli/smoke/input.json +opa build --output o0.tar.gz v1/test/cli/smoke/data.yaml v1/test/cli/smoke/test.rego +echo '{"yay": "bar"}' | opa eval --format pretty --bundle o0.tar.gz -I data.test.result --fail +opa build --optimize 1 --output o1.tar.gz v1/test/cli/smoke/data.yaml v1/test/cli/smoke/test.rego +echo '{"yay": "bar"}' | opa eval --format pretty --bundle o1.tar.gz -I data.test.result --fail +opa build --optimize 2 --output o2.tar.gz v1/test/cli/smoke/data.yaml v1/test/cli/smoke/test.rego +echo '{"yay": "bar"}' | opa eval --format pretty --bundle o2.tar.gz -I data.test.result --fail + +# Tar paths +opa build --output o3.tar.gz v1/test/cli/smoke +github_actions_group assert_contains '/v1/test/cli/smoke/test.rego' "$(tar -tf o3.tar.gz /v1/test/cli/smoke/test.rego)" + +# Data files - correct namespaces +echo "::group:: Data files - correct namespaces" +assert_contains "data.namespace | v1${PATH_SEPARATOR}test${PATH_SEPARATOR}cli${PATH_SEPARATOR}smoke${PATH_SEPARATOR}namespace${PATH_SEPARATOR}data.json" "$(opa inspect v1/test/cli/smoke)" +echo "::endgroup::" + +# Data files - correct root path +echo "::group:: Data files - correct root path" +assert_contains "${TEST_PATH}" "$(opa inspect ${BASE_PATH}/v1/test/cli/smoke -f json)" +assert_not_contains "\\\\${TEST_PATH}" "$(opa inspect ${BASE_PATH}/v1/test/cli/smoke -f json)" +echo "::endgroup::" \ No newline at end of file diff --git a/third_party/opa/build/build-release.sh b/third_party/opa/build/build-release.sh new file mode 100755 index 000000000000..86f8ca231133 --- /dev/null +++ b/third_party/opa/build/build-release.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +# Script to build OPA releases. Assumes execution environment is golang Docker container. + +set -e + +OPA_DIR=/go/src/github.com/open-policy-agent/opa +BUILD_DIR=$OPA_DIR/build + +usage() { + echo "build-release.sh --output-dir=" + echo " --source-url=" + echo " [--version=]" +} + +for i in "$@"; do + case $i in + --source-url=*) + SOURCE_URL="${i#*=}" + shift + ;; + --output-dir=*) + OUTPUT_DIR="${i#*=}" + shift + ;; + --version=*) + VERSION="${i#*=}" + shift + ;; + *) + usage + exit 1 + ;; + esac +done + +if [ -z "$OUTPUT_DIR" ]; then + usage + exit 1 +elif [ -z "$SOURCE_URL" ]; then + usage + exit 1 +fi + +build_release() { + make build-all-platforms RELEASE_DIR="${OUTPUT_DIR}" +} + +clone_repo() { + git clone $SOURCE_URL /go/src/github.com/open-policy-agent/opa + cd /go/src/github.com/open-policy-agent/opa + if [ -n "$VERSION" ]; then + git checkout v${VERSION} + fi +} + +main() { + clone_repo + build_release +} + +main diff --git a/third_party/opa/build/changelog.py b/third_party/opa/build/changelog.py new file mode 100755 index 000000000000..75195a0e45b9 --- /dev/null +++ b/third_party/opa/build/changelog.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python3 +""" +changelog.py helps generate the CHANGELOG.md message for a particular release. +""" + +import argparse +import os +import subprocess +import shlex +import re +import urllib.request, urllib.error, urllib.parse +import sys +import json + + +def run(cmd, *args, **kwargs): + return subprocess.check_output(shlex.split(cmd), *args, **kwargs).decode('utf-8') + + +def get_commit_ids(from_commit, to_commit): + cmd = "git log --format=%H --no-merges {from_commit}..{to_commit}" + commit_ids = run(cmd.format(from_commit=from_commit, + to_commit=to_commit)).splitlines() + return commit_ids + + +def get_commit_message(commit_id): + cmd = "git log --format=%B --max-count=1 {commit_id}".format( + commit_id=commit_id) + return run(cmd) + + +def fetch(url, token): + req = urllib.request.Request(url) + if token: + req.add_header('Authorization', "token {}".format(token)) + try: + rsp = urllib.request.urlopen(req) + result = json.loads(rsp.read()) + except Exception as e: + if hasattr(e, 'reason'): + print('Failed to fetch URL {}: {}'.format(url, e.reason), file=sys.stderr) + elif hasattr(e, 'code'): + print('Failed to fetch URL {}: Code {}'.format(url, e.code), file=sys.stderr) + return {} + else: + return result + +org_members_usernames = [] +def get_org_members(token): + url = "https://api.github.com/orgs/open-policy-agent/members?per_page=100" + r = fetch(url, token) + for m in r: + user_url = m.get('url', '') + user_info = fetch(user_url, token) + email = user_info.get('email', '') + login = user_info.get('login', '') + if login: + org_members_usernames.append(str(login)) + if email: + github_ids[email]=login + +def author_email(commit_message): + match = re.search(r"<(.*@.*)>", commit_message) + if match: + author = match.group(1) + return str(author) + return "" + +github_ids = {} +def get_github_id(commit_message, commit_id, token): + email = author_email(commit_message) + if github_ids.get(email, ""): + return github_ids[email] + url = "https://api.github.com/repos/open-policy-agent/opa/commits/{}".format(commit_id) + r = fetch(url, token) + author = r.get('author', {}) + if author is None: + return "" + login = author.get('login', '') + if login: + github_ids[email]=login + return login + return "" + + +def mention_author(commit_message, commit_id, token): + username = get_github_id(commit_message, commit_id, token) + return "authored by @{author}".format(author=username) + +def get_issue_reporter(issue_id, token): + url = "https://api.github.com/repos/open-policy-agent/opa/issues/{issue_id}".format(issue_id=issue_id) + issue_data = fetch(url, token) + username = issue_data.get("user", "").get("login", "") + if username not in org_members_usernames: + return "reported by @{reporter}".format(reporter=username) + return "" + +def fixes_issue_id(commit_message): + match = re.search(r"Fixes:?\s*#(\d+)", commit_message) + if match: + return match.group(1) + + +def get_subject(commit_message): + return commit_message.splitlines()[0] + +def get_changelog_message(commit_message, issue_id, mention, reporter, repo_url): + subject = get_subject(commit_message) + if issue_id: + if mention: + mention = " "+mention + if reporter: + reporter = " "+reporter + return "Fixes", "{subject} ([#{issue_id}]({repo_url}/issues/{issue_id})){mention}{reporter}".format(subject=subject, issue_id=issue_id, repo_url=repo_url, mention=mention, reporter=reporter) + if mention: + mention = " (" + mention + ")" + return None, "{subject}{mention}".format(subject=subject, mention=mention) + + +def get_latest_tag(): + cmd = "git describe --tags --first-parent" + return run(cmd).split('-')[0] + + +def parse_args(): + if "GITHUB_TOKEN" in os.environ: + default_token = os.environ["GITHUB_TOKEN"] + parser = argparse.ArgumentParser() + parser.add_argument( + "--repo_url", default="https://github.com/open-policy-agent/opa") + parser.add_argument("--token", default=default_token, help="GitHub API token") + parser.add_argument("from_version", nargs="?", + default=get_latest_tag(), help="start of changes") + parser.add_argument("to_commit", nargs="?", + default="HEAD", help="end of changes") + return parser.parse_args() + + +def main(): + + args = parse_args() + changelog = {} + get_org_members(args.token) + for commit_id in get_commit_ids(args.from_version, args.to_commit): + mention = "" + reporter = "" + commit_message = get_commit_message(commit_id) + mention = mention_author(commit_message, commit_id, args.token) + issue_id = fixes_issue_id(commit_message) + if issue_id: + reporter = get_issue_reporter(issue_id, args.token) + if mention.split("/")[-1] == reporter.split("/")[-1]: + reporter = "" + group, line = get_changelog_message(commit_message, issue_id, mention, reporter, args.repo_url) + changelog.setdefault(group, []).append(line) + + if "Fixes" in changelog: + print("### Fixes") + print("") + for line in sorted(changelog["Fixes"]): + print("- {}".format(line)) + print("") + + if None in changelog: + print("### Miscellaneous") + print("") + for line in sorted(changelog[None]): + print("- {}".format(line)) + + +if __name__ == "__main__": + main() diff --git a/third_party/opa/build/check-working-copy.sh b/third_party/opa/build/check-working-copy.sh new file mode 100755 index 000000000000..c4bff64ca16e --- /dev/null +++ b/third_party/opa/build/check-working-copy.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +EXCEPTIONS=( + "internal/compiler/wasm/opa/opa.wasm" + "internal/compiler/wasm/opa/callgraph.csv" +) + +STATUS=$(git status --porcelain) + +HAS_CHANGES=0 + +if [[ -z "${STATUS}" ]]; then + exit 0 +else + for file in $(echo -E "${STATUS}" | awk '{print $2}'); do + if [[ "${EXCEPTIONS[@]}" =~ "${file}" ]]; then + echo "Ignoring changed file: ${file}" + else + HAS_CHANGES=1 + fi + done +fi + +if [[ "${HAS_CHANGES}" == "1" ]]; then + echo "" + echo "git status" + git status + echo "git diff" + git diff + exit 1 +fi diff --git a/third_party/opa/build/commit-cli-docs.sh b/third_party/opa/build/commit-cli-docs.sh new file mode 100755 index 000000000000..a1c00e8f3d88 --- /dev/null +++ b/third_party/opa/build/commit-cli-docs.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +OPA_DIR=$(dirname "${BASH_SOURCE}")/.. + +cd "${OPA_DIR}" + +git add docs/content/cli.md + +if [[ -z "$(git diff --name-only --cached)" ]]; then + echo "No CLI doc changes to commit" + exit 1 +fi + +git commit -m "docs: Update generated CLI docs" + +echo "" +echo "Committed changes for files:" +git diff-tree --no-commit-id --name-only -r HEAD +echo "" diff --git a/third_party/opa/build/commit-wasm-bins.sh b/third_party/opa/build/commit-wasm-bins.sh new file mode 100755 index 000000000000..af138513b93d --- /dev/null +++ b/third_party/opa/build/commit-wasm-bins.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +OPA_DIR=$(dirname "${BASH_SOURCE}")/.. + +cd ${OPA_DIR} + +WASMFILES=( + "internal/compiler/wasm/opa/opa.go" + "internal/compiler/wasm/opa/opa.wasm" + "internal/compiler/wasm/opa/callgraph.csv" +) + +for file in "${WASMFILES[@]}"; do + git add ${file} +done + +if [[ -z "$(git diff --name-only --cached)" ]]; then + echo "No Wasm changes to commit!" + exit 1 +fi + +git commit -m "wasm: Update generated binaries" + +echo "" +echo "Committed changes for files:" +git diff-tree --no-commit-id --name-only -r HEAD +echo "" diff --git a/third_party/opa/build/ensure-linux-toolchain.sh b/third_party/opa/build/ensure-linux-toolchain.sh new file mode 100755 index 000000000000..ee687ffb3f3f --- /dev/null +++ b/third_party/opa/build/ensure-linux-toolchain.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +set -eo pipefail + +case "$(uname -m | tr '[:upper:]' '[:lower:]')" in + amd64 | x86_64 | x64) + HOST_ARCH=amd64 + ;; + arm64 | aarch64) + HOST_ARCH=arm64 + ;; + *) + echo "Error: Host architecture not supported." >&2 + exit 1 + ;; +esac + +# Native build +if [ "${GOARCH}" = "${HOST_ARCH}" ]; then + if ! [ -x "$(command -v gcc)" ]; then + echo "Error: gcc not found." >&2 + exit 1 + fi + exit 0 +fi + +# Cross-compile +case "${GOARCH}" in + amd64) + PKG=gcc-x86-64-linux-gnu + CC=x86_64-linux-gnu-gcc + ;; + arm64) + PKG=gcc-aarch64-linux-gnu + CC=aarch64-linux-gnu-gcc + ;; + *) + echo "Error: Target architecture ${GOARCH} not supported." >&2 + exit 1 + ;; +esac + +type -f ${CC} 2>/dev/null && exit 0 + +if ! [ -x "$(command -v apt-get)" ]; then + echo "Error: apt-get not found. Could not install missing toolchain." >&2 + exit 1 +fi + +apt-get update >/dev/null && \ + apt-get install -y ${PKG} >/dev/null + +echo ${CC} diff --git a/third_party/opa/build/ensure-windows-toolchain.sh b/third_party/opa/build/ensure-windows-toolchain.sh new file mode 100755 index 000000000000..e3ad5549d509 --- /dev/null +++ b/third_party/opa/build/ensure-windows-toolchain.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -exo pipefail +CC=x86_64-w64-mingw32-gcc +PKG=gcc-mingw-w64-x86-64 + +type -f ${CC} 2>/dev/null && exit 0 + +apt-get update && \ + apt-get install --no-install-recommends -y ${PKG} diff --git a/third_party/opa/build/gen-cli-docs.sh b/third_party/opa/build/gen-cli-docs.sh new file mode 100755 index 000000000000..1412b4f77cac --- /dev/null +++ b/third_party/opa/build/gen-cli-docs.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) + +GOOS="" GOARCH="" go run "$SCRIPT_DIR"/generate-cli-docs/generate.go "$@" diff --git a/third_party/opa/build/gen-deb.sh b/third_party/opa/build/gen-deb.sh new file mode 100755 index 000000000000..9a747c9b41b0 --- /dev/null +++ b/third_party/opa/build/gen-deb.sh @@ -0,0 +1,63 @@ +set -e + +if [ ! -f "opa_linux_amd64" ]; then + echo "ERROR: File 'opa_linux_amd64' not found. First build it 'make build-linux'." + exit 1 +fi + +if [ ! -d "man" ]; then + echo "ERROR: The man pages not found. First build them 'make man'." + exit 1 +fi + +if [ -z "$VERSION" ]; then + echo "ERROR: Need to have VERSION environment variable set." + exit 1 +fi + +if ! command -v dpkg-deb >/dev/null 2>/dev/null; then + echo "ERROR: 'dpkg-deb' was not found and is required." + exit 1 +fi + +rm -rf tmp_working_dir_opa +mkdir tmp_working_dir_opa +cd tmp_working_dir_opa + +mkdir -p ./usr/bin/ +cp ../opa_linux_amd64 ./usr/bin/opa +chmod +x ./usr/bin/opa + +mkdir -p ./usr/share/man/man1/ +for MAN_PAGE in ../man/*.1; do + gzip --keep --best $MAN_PAGE +done +mv ../man/*.1.gz ./usr/share/man/man1/ + +echo "Package: opa" > control +echo "Version: $VERSION" >> control +cat << 'EOF' >> control +Architecture: amd64 +Maintainer: OPA Maintainers +Depends: libc6 (>= 2.2.5) +Section: admin +Priority: optional +Homepage: https://openpolicyagent.org +Description: An open source, general-purpose policy engine. + The Open Policy Agent (OPA) is an open source, general-purpose + policy engine that enables unified, context-aware policy + enforcement across the entire stack. +EOF + +md5sum ../opa_linux_amd64 > md5sums + +mkdir -p opa_$VERSION/DEBIAN +mv control opa_$VERSION/DEBIAN/control +mv md5sums opa_$VERSION/DEBIAN/md5sums +mv ./usr opa_$VERSION/usr + +dpkg-deb -b opa_$VERSION/ + +mv opa_$VERSION.deb ../ +cd .. +rm -rf tmp_working_dir_opa diff --git a/third_party/opa/build/gen-dev-patch.sh b/third_party/opa/build/gen-dev-patch.sh new file mode 100755 index 000000000000..e8ff007fce19 --- /dev/null +++ b/third_party/opa/build/gen-dev-patch.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +stty -onlcr # don't translate newline to carriage return-newline, as these break patch tool +set -e + +OPA_DIR=/go/src/github.com/open-policy-agent/opa + +usage() { + echo "gen-dev-patch.sh --source-url=" + echo " --version=" +} + +for i in "$@"; do + case $i in + --source-url=*) + SOURCE_URL="${i#*=}" + shift + ;; + --version=*) + VERSION="${i#*=}" + shift + ;; + *) + usage + exit 1 + ;; + esac +done + +if [ -z "$SOURCE_URL" ]; then + usage + exit 1 +elif [ -z "$VERSION" ]; then + usage + exit 1 +fi + +git clone $SOURCE_URL $OPA_DIR +cd $OPA_DIR + +LAST_VERSION=$(git describe --abbrev=0 --tags | cut -c 2-) + +update_version() { + ./build/update-version.sh "$VERSION-dev" +} + +update_changelog() { + cat >_CHANGELOG.md <" + echo " --version=" +} + +for i in "$@"; do + case $i in + --source-url=*) + SOURCE_URL="${i#*=}" + shift + ;; + --version=*) + VERSION="${i#*=}" + shift + ;; + *) + usage + exit 1 + ;; + esac +done + +if [ -z "$SOURCE_URL" ]; then + usage + exit 1 +elif [ -z "$VERSION" ]; then + usage + exit 1 +fi + +git clone $SOURCE_URL $OPA_DIR +cd $OPA_DIR + +if [ -z "$LAST_VERSION" ]; then + LAST_VERSION=$(git describe --abbrev=0 --tags) +fi + +update_version() { + ./build/update-version.sh "$VERSION" +} + +update_changelog() { + if $(grep -q '## Unreleased' CHANGELOG.md) ; then + cat >_CHANGELOG.md <_CHANGELOG.md < /dev/null; then + # If goversioninfo isn't on the path, print an error message + echo "Error: goversioninfo command not found" >&2 + exit 1 +fi + +goversioninfo "${FLAGS[@]}" \ + -product-name "$NAME" \ + -product-version "$VERSION" \ + -skip-versioninfo \ + -icon=logo/logo.ico \ + -64=true \ + -o resource.syso \ No newline at end of file diff --git a/third_party/opa/build/generate-cli-docs/generate.go b/third_party/opa/build/generate-cli-docs/generate.go new file mode 100644 index 000000000000..54f4c8dfbfe0 --- /dev/null +++ b/third_party/opa/build/generate-cli-docs/generate.go @@ -0,0 +1,98 @@ +package main + +import ( + "encoding/json" + "log" + "os" + "strings" + + "github.com/spf13/cobra" + "github.com/spf13/pflag" + + "github.com/open-policy-agent/opa/cmd" +) + +func main() { + command := cmd.Command(nil, "opa") + command.Use = "opa [command]" + command.DisableAutoGenTag = true + + cmdData := make([]map[string]any, 0) + + for _, c := range command.Commands() { + if !showCommand(c) { + continue + } + + cmdData = append(cmdData, cmdToData(c)) + } + + err := json.NewEncoder(os.Stdout).Encode(cmdData) + if err != nil { + log.Fatal(err) + } +} + +func showCommand(c *cobra.Command) bool { + if !c.IsAvailableCommand() || + c.IsAdditionalHelpTopicCommand() || + c.Hidden { + return false + } + + return true +} + +func cmdToID(c *cobra.Command) string { + parts := strings.Split(c.Use, " ") + + if len(parts) == 0 { + return "" + } + + return parts[0] +} + +func extractFlags(flagSet *pflag.FlagSet) []map[string]any { + var result []map[string]any + + flagSet.VisitAll(func(f *pflag.Flag) { + flagInfo := map[string]any{ + "name": "--" + f.Name, + "shorthand": "", + "type": f.Value.Type(), + "default": f.DefValue, + "description": f.Usage, + } + + if f.Shorthand != "" { + flagInfo["shorthand"] = "-" + f.Shorthand + } + + result = append(result, flagInfo) + }) + + return result +} + +func cmdToData(c *cobra.Command) map[string]any { + childData := make([]map[string]any, 0) + for _, childCmd := range c.Commands() { + if !showCommand(childCmd) { + continue + } + childData = append(childData, cmdToData(childCmd)) + } + + return map[string]any{ + "id": cmdToID(c), + "use": c.Use, + "useline": c.UseLine(), + "short": c.Short, + "long": c.Long, + "example": c.Example, + "flags": extractFlags(c.NonInheritedFlags()), + "parent_flags": extractFlags(c.InheritedFlags()), + "children": childData, + } +} diff --git a/third_party/opa/build/generate-man/generate.go b/third_party/opa/build/generate-man/generate.go new file mode 100644 index 000000000000..cc14db0c3431 --- /dev/null +++ b/third_party/opa/build/generate-man/generate.go @@ -0,0 +1,40 @@ +// Copyright 2020 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package main + +import ( + "log" + "os" + + "github.com/spf13/cobra/doc" + + "github.com/open-policy-agent/opa/cmd" +) + +func main() { + if len(os.Args) != 2 { + log.Fatal("Required argument: man pages output directory") + } + out := os.Args[1] + err := os.MkdirAll(out, os.ModePerm) + if err != nil { + log.Fatal(err) + } + + cmd := cmd.RootCommand + cmd.Use = "opa [command]" + cmd.DisableAutoGenTag = true + + header := &doc.GenManHeader{ + Title: "Open Policy Agent", + Section: "1", + Source: " ", + } + + err = doc.GenManTree(cmd, header, out) + if err != nil { + log.Fatal(err) + } +} diff --git a/third_party/opa/build/get-build-hostname.sh b/third_party/opa/build/get-build-hostname.sh new file mode 100755 index 000000000000..0ed5c926ceda --- /dev/null +++ b/third_party/opa/build/get-build-hostname.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +hostname -f diff --git a/third_party/opa/build/get-build-version.sh b/third_party/opa/build/get-build-version.sh new file mode 100755 index 000000000000..50b9d73d32e8 --- /dev/null +++ b/third_party/opa/build/get-build-version.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +awk -F'"' '/^var Version/{print $2}' v1/version/version.go \ No newline at end of file diff --git a/third_party/opa/build/github-release.sh b/third_party/opa/build/github-release.sh new file mode 100755 index 000000000000..b46962f2b5f3 --- /dev/null +++ b/third_party/opa/build/github-release.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# Script to draft and edit OPA GitHub releases. Assumes execution environment is Github Action runner. + +set -x + +usage() { + echo "github-release.sh [--asset-dir=] [--tag=]" + echo " Default --asset-dir is $PWD and --tag $TAG_NAME " +} + +TAG_NAME=${TAG_NAME} +ASSET_DIR=${PWD:-"./"} + +for i in "$@"; do + case $i in + --asset-dir=*) + ASSET_DIR="${i#*=}" + shift + ;; + --tag=*) + TAG_NAME="${i#*=}" + shift + ;; + *) + usage + exit 1 + ;; + esac +done + +# Collect a list of opa binaries (expect binaries in the form: opa__[extension]) +ASSETS=() +for asset in "${ASSET_DIR}"/opa_*_*; do + ASSETS+=("$asset") +done + +# Gather the release notes from the CHANGELOG for the latest version +RELEASE_NOTES="release-notes.md" + +# The hub CLI expects the first line to be the title +echo -e "${TAG_NAME}\n" > "${RELEASE_NOTES}" + +# Fill in the description +./build/latest-release-notes.sh --output="${RELEASE_NOTES}" + +# Update or create a release on github +if gh release view "${TAG_NAME}" --repo open-policy-agent/opa > /dev/null; then + # Occurs when the tag is created via GitHub UI w/ a release + gh release upload "${TAG_NAME}" "${ASSETS[@]}" --repo open-policy-agent/opa +else + # Create a draft release + gh release create "${TAG_NAME}" "${ASSETS[@]}" -F ${RELEASE_NOTES} --draft --title "${TAG_NAME}" --repo open-policy-agent/opa +fi diff --git a/third_party/opa/build/latest-release-notes.sh b/third_party/opa/build/latest-release-notes.sh new file mode 100755 index 000000000000..999021cf5c15 --- /dev/null +++ b/third_party/opa/build/latest-release-notes.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +set -e + +OPA_DIR=$(dirname "${BASH_SOURCE}")/.. +CHANGELOG="${OPA_DIR}/CHANGELOG.md" + +usage() { + echo "latest-release-notes.sh --output=" +} + +OUTPUT="" + +for i in "$@"; do + case $i in + --output=*) + OUTPUT="${i#*=}" + shift + ;; + *) + usage + exit 1 + ;; + esac +done + +if [ -z "${OUTPUT}" ]; then + usage + exit 1 +fi + +# Versions start with a h2 (## ), find the latest two for start and stop +# positions in the CHANGELOG +LATEST_VERSION=$(grep '## [0-9]' "${CHANGELOG}" | head -n 1) +STOP_VERSION=$(grep '## [0-9]' "${CHANGELOG}" | head -n 2 | tail -n 1) + +STARTED=false + +while IFS= read -r line +do + # Skip lines until the first version header is found + if [[ "${STARTED}" == false ]]; then + if [[ "${line}" == "${LATEST_VERSION}" ]]; then + STARTED=true + fi + continue + fi + + # Stop reading after we see the stopping point + if [[ "${line}" == "${STOP_VERSION}" ]]; then + break + fi + + # Append each line between the two onto the release notes + echo -e "${line}" >> "${OUTPUT}" + +done < "${CHANGELOG}" + +# Delete all leading blank lines at top of file +sed -i.bak '/./,$!d' "${OUTPUT}" +rm "${OUTPUT}.bak" diff --git a/third_party/opa/build/policy/files/files.rego b/third_party/opa/build/policy/files/files.rego new file mode 100644 index 000000000000..16883264c38f --- /dev/null +++ b/third_party/opa/build/policy/files/files.rego @@ -0,0 +1,68 @@ +# METADATA +# description: | +# Expects policy input as provided by: +# https://api.github.com/repos/open-policy-agent/opa/pulls/${PR_ID}/files +# +# Note that the "filename" here refers to the full, relative path of the file, +# like docs/foo/bar.yaml - since that's how it's named in the input we'll use +# the same convention here. +# schemas: +# - input: schema.files +package files + +# METADATA +# entrypoint: true +deny contains sprintf("%s is an invalid YAML file: %s", [filename, content]) if { + some filename, content in yaml_file_contents + changes[filename].status in {"added", "modified"} + not yaml.is_valid(content) +} + +deny contains sprintf("%s is an invalid JSON file: %s", [filename, content]) if { + some filename, content in json_file_contents + changes[filename].status in {"added", "modified"} + not json.is_valid(content) +} + +yaml_file_contents[filename] := file_in_pr(filename) if { + some filename in filenames + extension(filename) in {"yml", "yaml"} +} + +json_file_contents[filename] := file_in_pr(filename) if { + some filename in filenames + extension(filename) == "json" +} + +filenames contains f.filename if some f in input + +changes[filename] := attributes if { + some change in input + filename := change.filename + attributes := object.remove(change, ["filename"]) +} + +http_error(response) if response.status_code == 0 +http_error(response) if response.status_code >= 400 + +dump_response_on_error(response) := response if { + http_error(response) + print("unexpected error in response", response) # regal ignore:print-or-trace-call +} + +dump_response_on_error(response) := response if not http_error(response) + +file_in_pr(filename) := dump_response_on_error(http.send({ + "url": changes[filename].raw_url, + "method": "GET", + "headers": {"Authorization": sprintf("Bearer %v", [opa.runtime().env.GITHUB_TOKEN])}, + "cache": true, + "enable_redirect": true, + "raise_error": false, +})).raw_body + +default last_indexof(_, _) := -1 + +last_indexof(string, search) := indices[count(indices) - 1] if indices := indexof_n(string, search) + +extension(filename) := substring(filename, last_indexof(filename, ".") + 1, count(filename) - 1) diff --git a/third_party/opa/build/policy/files/files_test.rego b/third_party/opa/build/policy/files/files_test.rego new file mode 100644 index 000000000000..009135c1ce23 --- /dev/null +++ b/third_party/opa/build/policy/files/files_test.rego @@ -0,0 +1,25 @@ +package files_test + +import data.files + +test_deny_invalid_yaml_file if { + expected := "invalid.yaml is an invalid YAML file: {null{}}" + expected in files.deny with files.yaml_file_contents as {"invalid.yaml": "{null{}}"} + with files.changes as {"invalid.yaml": {"status": "modified"}} +} + +test_allow_valid_yaml_file if { + count(files.deny) == 0 with files.yaml_file_contents as {"valid.yaml": "foo: bar"} + with files.changes as {"valid.yaml": {"status": "modified"}} +} + +test_deny_invalid_json_file if { + expected := "invalid.json is an invalid JSON file: }}}" + expected in files.deny with files.json_file_contents as {"invalid.json": "}}}"} + with files.changes as {"invalid.json": {"status": "modified"}} +} + +test_allow_valid_json_file if { + count(files.deny) == 0 with files.json_file_contents as {"valid.json": "{\"foo\": \"bar\"}"} + with files.changes as {"valid.json": {"status": "modified"}} +} diff --git a/third_party/opa/build/policy/schema/files.json b/third_party/opa/build/policy/schema/files.json new file mode 100644 index 000000000000..26102ecdb29a --- /dev/null +++ b/third_party/opa/build/policy/schema/files.json @@ -0,0 +1,84 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "files", + "$ref": "#/$defs/files", + "$defs": { + "files": { + "type": "array", + "items": { + "title": "Diff Entry", + "description": "Diff Entry", + "type": "object", + "properties": { + "sha": { + "type": "string", + "example": "bbcd538c8e72b8c175046e27cc8f907076331401" + }, + "filename": { + "type": "string", + "example": "file1.txt" + }, + "status": { + "type": "string", + "enum": [ + "added", + "removed", + "modified", + "renamed", + "copied", + "changed", + "unchanged" + ], + "example": "added" + }, + "additions": { + "type": "integer", + "example": 103 + }, + "deletions": { + "type": "integer", + "example": 21 + }, + "changes": { + "type": "integer", + "example": 124 + }, + "blob_url": { + "type": "string", + "format": "uri", + "example": "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt" + }, + "raw_url": { + "type": "string", + "format": "uri", + "example": "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt" + }, + "contents_url": { + "type": "string", + "format": "uri", + "example": "https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e" + }, + "patch": { + "type": "string", + "example": "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test" + }, + "previous_filename": { + "type": "string", + "example": "file.txt" + } + }, + "required": [ + "additions", + "blob_url", + "changes", + "contents_url", + "deletions", + "filename", + "raw_url", + "sha", + "status" + ] + } + } + } +} diff --git a/third_party/opa/build/run-wasm-rego-tests.sh b/third_party/opa/build/run-wasm-rego-tests.sh new file mode 100755 index 000000000000..51bbdaf3f86b --- /dev/null +++ b/third_party/opa/build/run-wasm-rego-tests.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +# This script executes the Wasm Rego test cases. The script uses Docker to run +# the test generation program and then again to run the test cases inside of a +# Node JS container. The script caches the test generation program build +# results in the $PWD/.go directory so that it can be re-used across runs. The +# volumes from the test generation container are shared with the Node JS +# container to avoid copying the generated test cases more than necessary. + +set -ex + +GOVERSION=${GOVERSION:?"You must set the GOVERSION environment variable."} +DOCKER_UID=${DOCKER_UID:-$(id -u)} +DOCKER_GID=${DOCKER_GID:-$(id -g)} +ASSETS=${ASSETS:-"$PWD/v1/test/wasm/assets"} +VERBOSE=${VERBOSE:-"0"} +TESTGEN_CONTAINER_NAME="opa-wasm-testgen-container" +TESTRUN_CONTAINER_NAME="opa-wasm-testrun-container" +WASM_BUILD_ONLY=${WASM_BUILD_ONLY:-"false"} + +function main { + trap interrupt SIGINT SIGTERM + mkdir -p $PWD/.go/cache/go-build + mkdir -p $PWD/.go/bin + generate_testcases + if [[ "${WASM_BUILD_ONLY}" != "true" ]]; then + run_testcases + else + echo "Running wasm tests disabled by environment variable." + fi +} + +function interrupt { + echo "caught interrupt: exiting" + purge_testgen_container + purge_testrun_container + exit 1 +} + +function purge_testgen_container { + docker kill $TESTGEN_CONTAINER_NAME >/dev/null 2>&1 || true + docker rm $TESTGEN_CONTAINER_NAME >/dev/null 2>&1 || true +} + +function purge_testrun_container { + docker kill $TESTRUN_CONTAINER_NAME >/dev/null 2>&1 || true + docker rm $TESTRUN_CONTAINER_NAME >/dev/null 2>&1 || true +} + +function generate_testcases { + purge_testgen_container + docker run \ + --name $TESTGEN_CONTAINER_NAME \ + -u $DOCKER_UID:$DOCKER_GID \ + -v $PWD/.go/bin:/go/bin:Z \ + -v $PWD:/src:z \ + -v $ASSETS:/assets:Z \ + -e GOCACHE=/src/.go/cache \ + -w /src \ + golang:$GOVERSION \ + sh -c 'git config --global --add safe.directory /src && make wasm-rego-testgen-install \ + && wasm-rego-testgen \ + --input-dir=/assets \ + --runner=/src/v1/test/wasm/assets/test.js \ + --output=/src/.go/cache/testcases.tar.gz' +} + +function run_testcases { + # NOTE(tsandall): background the container because the interrupt trap does + # not run otherwise. + purge_testrun_container + docker run \ + --rm \ + --name $TESTRUN_CONTAINER_NAME \ + --volumes-from $TESTGEN_CONTAINER_NAME:z \ + -e VERBOSE=$VERBOSE \ + -w /scratch \ + node:14 \ + sh -c 'tar xzf \ + /src/.go/cache/testcases.tar.gz \ + && node test.js opa.wasm' & + wait $! +} + +main diff --git a/third_party/opa/build/time-bound.sh b/third_party/opa/build/time-bound.sh new file mode 100755 index 000000000000..bd6b788631af --- /dev/null +++ b/third_party/opa/build/time-bound.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +usage() { + echo "time-bound.sh