From 733f8982d392fcfc5e42bf39e3a3850eb1aadc9c Mon Sep 17 00:00:00 2001 From: kruskall <99559985+kruskall@users.noreply.github.com> Date: Wed, 10 Jul 2024 10:57:22 +0200 Subject: [PATCH] refactor: bump github.com/awslabs/goformation/v4 to current major version (#40160) * refactor: bump github.com/awslabs/goformation/v4 to current major version github.com/awslabs/goformation/v4 was released in 2019 and is no longer supported. It also depends on v3 and has more dependencies compared to v7. Bump the dependency to v7 to use a supported version. * lint: fix linting issues --- NOTICE.txt | 285 +----------------- go.mod | 4 +- go.sum | 25 +- .../functionbeat/manager/aws/cli_manager.go | 13 +- .../functionbeat/manager/aws/policies_test.go | 4 +- .../manager/aws/template_builder.go | 56 ++-- .../provider/aws/aws/cloudwatch_kinesis.go | 4 +- .../provider/aws/aws/cloudwatch_logs.go | 10 +- .../functionbeat/provider/aws/aws/kinesis.go | 14 +- x-pack/functionbeat/provider/aws/aws/sqs.go | 10 +- 10 files changed, 69 insertions(+), 356 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index b09a41fbbc8..6317fac080f 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -9468,12 +9468,12 @@ Contents of probable licence file $GOMODCACHE/github.com/aws/smithy-go@v1.20.2/L -------------------------------------------------------------------------------- -Dependency : github.com/awslabs/goformation/v4 -Version: v4.1.0 +Dependency : github.com/awslabs/goformation/v7 +Version: v7.14.9 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/awslabs/goformation/v4@v4.1.0/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/awslabs/goformation/v7@v7.14.9/LICENSE: Apache License Version 2.0, January 2004 @@ -48746,11 +48746,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- Dependency : github.com/onsi/ginkgo/v2 -Version: v2.13.0 +Version: v2.17.1 Licence type (autodetected): MIT -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/onsi/ginkgo/v2@v2.13.0/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/onsi/ginkgo/v2@v2.17.1/LICENSE: Copyright (c) 2013-2014 Onsi Fakhouri @@ -48776,11 +48776,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- Dependency : github.com/onsi/gomega -Version: v1.29.0 +Version: v1.33.0 Licence type (autodetected): MIT -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/onsi/gomega@v1.29.0/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/onsi/gomega@v1.33.0/LICENSE: Copyright (c) 2013-2014 Onsi Fakhouri @@ -50045,277 +50045,6 @@ Licence type (autodetected): BSD-3-Clause No licence file provided. --------------------------------------------------------------------------------- -Dependency : github.com/sanathkr/go-yaml -Version: v0.0.0-20170819195128-ed9d249f429b -Licence type (autodetected): Apache-2.0 --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/github.com/sanathkr/go-yaml@v0.0.0-20170819195128-ed9d249f429b/LICENSE: - - 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. - - --------------------------------------------------------------------------------- -Dependency : github.com/sanathkr/yaml -Version: v1.0.1-0.20170819201035-0056894fa522 -Licence type (autodetected): MIT --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/github.com/sanathkr/yaml@v1.0.1-0.20170819201035-0056894fa522/LICENSE: - -The MIT License (MIT) - -Copyright (c) 2014 Sam Ghods - -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. - - -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. 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 -OWNER 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. - - -------------------------------------------------------------------------------- Dependency : github.com/sergi/go-diff Version: v1.3.1 diff --git a/go.mod b/go.mod index ccdfe7efd37..f03f5dfad81 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 github.com/aws/aws-sdk-go-v2/service/sqs v1.31.4 github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 - github.com/awslabs/goformation/v4 v4.1.0 github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2 github.com/bsm/sarama-cluster v2.1.14-0.20180625083203-7e67d87a6b3f+incompatible github.com/cavaliercoder/badio v0.0.0-20160213150051-ce5280129e9e // indirect @@ -134,7 +133,6 @@ require ( github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 github.com/samuel/go-parser v0.0.0-20130731160455-ca8abbf65d0e // indirect github.com/samuel/go-thrift v0.0.0-20140522043831-2187045faa54 - github.com/sanathkr/yaml v1.0.1-0.20170819201035-0056894fa522 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 @@ -195,6 +193,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/health v1.24.4 github.com/aws/aws-sdk-go-v2/service/kinesis v1.27.4 github.com/aws/smithy-go v1.20.2 + github.com/awslabs/goformation/v7 v7.14.9 github.com/awslabs/kinesis-aggregation/go/v2 v2.0.0-20220623125934-28468a6701b5 github.com/elastic/bayeux v1.0.5 github.com/elastic/ebpfevents v0.6.0 @@ -351,7 +350,6 @@ require ( github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/prometheus/client_golang v1.11.1 // indirect github.com/rootless-containers/rootlesskit v1.1.0 // indirect - github.com/sanathkr/go-yaml v0.0.0-20170819195128-ed9d249f429b // indirect github.com/sergi/go-diff v1.3.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/stoewer/go-strcase v1.2.0 // indirect diff --git a/go.sum b/go.sum index a0789be18f4..c11afd8afdc 100644 --- a/go.sum +++ b/go.sum @@ -376,9 +376,8 @@ github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAm github.com/aws/smithy-go v1.13.3/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/awslabs/goformation/v3 v3.1.0/go.mod h1:hQ5RXo3GNm2laHWKizDzU5DsDy+yNcenSca2UxN0850= -github.com/awslabs/goformation/v4 v4.1.0 h1:JRxIW0IjhYpYDrIZOTJGMu2azXKI+OK5dP56ubpywGU= -github.com/awslabs/goformation/v4 v4.1.0/go.mod h1:MBDN7u1lMNDoehbFuO4uPvgwPeolTMA2TzX1yO6KlxI= +github.com/awslabs/goformation/v7 v7.14.9 h1:sZjjpTqXrcBDz4Fi07JWTT7zKM68XsQkW/7iLAJbA/M= +github.com/awslabs/goformation/v7 v7.14.9/go.mod h1:7obldQ8NQ/AkMsgL5K3l4lRMDFB6kCGUloz5dURcXIs= github.com/awslabs/kinesis-aggregation/go/v2 v2.0.0-20220623125934-28468a6701b5 h1:lxW5Q6K2IisyF5tlr6Ts0W4POGWQZco05MJjFmoeIHs= github.com/awslabs/kinesis-aggregation/go/v2 v2.0.0-20220623125934-28468a6701b5/go.mod h1:0Qr1uMHFmHsIYMcG4T7BJ9yrJtWadhOmpABCX69dwuc= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -1100,7 +1099,6 @@ github.com/icholy/digest v0.1.22 h1:dRIwCjtAcXch57ei+F0HSb5hmprL873+q7PoVojdMzM= github.com/icholy/digest v0.1.22/go.mod h1:uLAeDdWKIWNFMH0wqbwchbTQOmJWhzSnL7zmqSPqEEc= github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -1363,20 +1361,18 @@ github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:v github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.5.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= -github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8= +github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.2.0/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= -github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/gomega v1.33.0 h1:snPCflnZrpMsy94p4lXVEkHo12lmPnc3vY5XBbreexE= +github.com/onsi/gomega v1.33.0/go.mod h1:+925n5YtiFsLzzafLUHzVMBpvvRAzrydIBiSIxjX3wY= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= @@ -1532,11 +1528,6 @@ github.com/samuel/go-parser v0.0.0-20130731160455-ca8abbf65d0e/go.mod h1:Sb6li54 github.com/samuel/go-thrift v0.0.0-20140522043831-2187045faa54 h1:jbchLJWyhKcmOjkbC4zDvT/n5EEd7g6hnnF760rEyRA= github.com/samuel/go-thrift v0.0.0-20140522043831-2187045faa54/go.mod h1:Vrkh1pnjV9Bl8c3P9zH0/D4NlOHWP5d4/hF4YTULaec= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sanathkr/go-yaml v0.0.0-20170819195128-ed9d249f429b h1:jUK33OXuZP/l6babJtnLo1qsGvq6G9so9KMflGAm4YA= -github.com/sanathkr/go-yaml v0.0.0-20170819195128-ed9d249f429b/go.mod h1:8458kAagoME2+LN5//WxE71ysZ3B7r22fdgb7qVmXSY= -github.com/sanathkr/yaml v0.0.0-20170819201035-0056894fa522/go.mod h1:tQTYKOQgxoH3v6dEmdHiz4JG+nbxWwM5fgPQUpSZqVQ= -github.com/sanathkr/yaml v1.0.1-0.20170819201035-0056894fa522 h1:39BJIaZIhIBmXATIhdlTBlTQpAiGXHnz17CrO7vF2Ss= -github.com/sanathkr/yaml v1.0.1-0.20170819201035-0056894fa522/go.mod h1:tQTYKOQgxoH3v6dEmdHiz4JG+nbxWwM5fgPQUpSZqVQ= github.com/satori/go.uuid v0.0.0-20160603004225-b111a074d5ef/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210223165440-c65ae3540d44/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8= @@ -1659,9 +1650,6 @@ github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhe github.com/xdg/scram v1.0.3/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.3/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v0.0.0-20181112162635-ac52e6811b56/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= @@ -1889,7 +1877,6 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= diff --git a/x-pack/functionbeat/manager/aws/cli_manager.go b/x-pack/functionbeat/manager/aws/cli_manager.go index 0d70235bb36..3bdb5ffa1ad 100644 --- a/x-pack/functionbeat/manager/aws/cli_manager.go +++ b/x-pack/functionbeat/manager/aws/cli_manager.go @@ -7,15 +7,14 @@ package aws import ( "context" "fmt" - "io/ioutil" "os" "strings" "github.com/aws/aws-sdk-go-v2/aws" cf "github.com/aws/aws-sdk-go-v2/service/cloudformation" - "github.com/awslabs/goformation/v4/cloudformation" - "github.com/awslabs/goformation/v4/cloudformation/iam" - "github.com/awslabs/goformation/v4/cloudformation/lambda" + "github.com/awslabs/goformation/v7/cloudformation" + "github.com/awslabs/goformation/v7/cloudformation/iam" + "github.com/awslabs/goformation/v7/cloudformation/lambda" "github.com/elastic/beats/v7/x-pack/functionbeat/function/provider" "github.com/elastic/beats/v7/x-pack/functionbeat/manager/core" @@ -113,7 +112,7 @@ func (c *CLIManager) deployTemplate(update bool, name string) error { ctx := newStackContext() if err := executer.Execute(ctx); err != nil { if rollbackErr := executer.Rollback(ctx); rollbackErr != nil { - return fmt.Errorf("could not rollback, error: %s, %w", rollbackErr, err) + return fmt.Errorf("could not rollback, error: %s, %w", rollbackErr.Error(), err) } return err } @@ -163,7 +162,7 @@ func (c *CLIManager) Remove(name string) error { ctx := newStackContext() if err := executer.Execute(ctx); err != nil { if rollbackErr := executer.Rollback(ctx); rollbackErr != nil { - return fmt.Errorf("could not rollback, error: %s, %w", rollbackErr, err) + return fmt.Errorf("could not rollback, error: %s, %w", rollbackErr.Error(), err) } return err } @@ -191,7 +190,7 @@ func (c *CLIManager) Package(outputPattern string) error { } output := strings.ReplaceAll(outputPattern, "{{.Provider}}", "aws") - err = ioutil.WriteFile(output, content, 0644) + err = os.WriteFile(output, content, 0644) if err != nil { return err } diff --git a/x-pack/functionbeat/manager/aws/policies_test.go b/x-pack/functionbeat/manager/aws/policies_test.go index abade9a06c5..30b484d0b35 100644 --- a/x-pack/functionbeat/manager/aws/policies_test.go +++ b/x-pack/functionbeat/manager/aws/policies_test.go @@ -7,8 +7,8 @@ package aws import ( "testing" - "github.com/awslabs/goformation/v4/cloudformation" - "github.com/awslabs/goformation/v4/cloudformation/iam" + "github.com/awslabs/goformation/v7/cloudformation" + "github.com/awslabs/goformation/v7/cloudformation/iam" "github.com/stretchr/testify/assert" "github.com/elastic/beats/v7/x-pack/functionbeat/function/provider" diff --git a/x-pack/functionbeat/manager/aws/template_builder.go b/x-pack/functionbeat/manager/aws/template_builder.go index 206f8acdf45..d988f60d708 100644 --- a/x-pack/functionbeat/manager/aws/template_builder.go +++ b/x-pack/functionbeat/manager/aws/template_builder.go @@ -10,11 +10,11 @@ import ( "errors" "fmt" - "github.com/awslabs/goformation/v4/cloudformation" - "github.com/awslabs/goformation/v4/cloudformation/iam" - "github.com/awslabs/goformation/v4/cloudformation/lambda" - "github.com/awslabs/goformation/v4/cloudformation/logs" - "github.com/awslabs/goformation/v4/cloudformation/tags" + "github.com/awslabs/goformation/v7/cloudformation" + "github.com/awslabs/goformation/v7/cloudformation/iam" + "github.com/awslabs/goformation/v7/cloudformation/lambda" + "github.com/awslabs/goformation/v7/cloudformation/logs" + "github.com/awslabs/goformation/v7/cloudformation/tags" "github.com/elastic/beats/v7/x-pack/functionbeat/function/provider" "github.com/elastic/beats/v7/x-pack/functionbeat/manager/core" @@ -164,7 +164,7 @@ func (d *defaultTemplateBuilder) template(function installer, name, codeLoc stri var dlc *lambda.Function_DeadLetterConfig if lambdaConfig.DeadLetterConfig != nil && len(lambdaConfig.DeadLetterConfig.TargetArn) != 0 { dlc = &lambda.Function_DeadLetterConfig{ - TargetArn: lambdaConfig.DeadLetterConfig.TargetArn, + TargetArn: cloudformation.String(lambdaConfig.DeadLetterConfig.TargetArn), } } @@ -177,7 +177,7 @@ func (d *defaultTemplateBuilder) template(function installer, name, codeLoc stri } } - var ts []tags.Tag + ts := make([]tags.Tag, 0, len(lambdaConfig.Tags)) for name, val := range lambdaConfig.Tags { tag := tags.Tag{ Key: name, @@ -191,10 +191,10 @@ func (d *defaultTemplateBuilder) template(function installer, name, codeLoc stri template.Resources[prefix("")] = &AWSLambdaFunction{ Function: &lambda.Function{ Code: &lambda.Function_Code{ - S3Bucket: d.bucket, - S3Key: codeLoc, + S3Bucket: cloudformation.String(d.bucket), + S3Key: cloudformation.String(codeLoc), }, - Description: lambdaConfig.Description, + Description: cloudformation.String(lambdaConfig.Description), Environment: &lambda.Function_Environment{ // Configure which function need to be run by the lambda function. Variables: map[string]string{ @@ -204,13 +204,13 @@ func (d *defaultTemplateBuilder) template(function installer, name, codeLoc stri }, DeadLetterConfig: dlc, VpcConfig: vcpConf, - FunctionName: name, + FunctionName: cloudformation.String(name), Role: role, - Runtime: runtime, - Handler: handlerName, - MemorySize: lambdaConfig.MemorySize.Megabytes(), - ReservedConcurrentExecutions: lambdaConfig.Concurrency, - Timeout: int(lambdaConfig.Timeout.Seconds()), + Runtime: cloudformation.String(runtime), + Handler: cloudformation.String(handlerName), + MemorySize: cloudformation.Int(lambdaConfig.MemorySize.Megabytes()), + ReservedConcurrentExecutions: cloudformation.Int(lambdaConfig.Concurrency), + Timeout: cloudformation.Int(int(lambdaConfig.Timeout.Seconds())), Tags: ts, }, DependsOn: dependsOn, @@ -218,7 +218,7 @@ func (d *defaultTemplateBuilder) template(function installer, name, codeLoc stri // Create the log group for the specific function lambda. template.Resources[prefix("LogGroup")] = &logs.LogGroup{ - LogGroupName: "/aws/lambda/" + name, + LogGroupName: cloudformation.String("/aws/lambda/" + name), } return template @@ -263,8 +263,8 @@ func (d *defaultTemplateBuilder) roleTemplate(function installer, name string) * }, }, }, - Path: "/", - RoleName: "functionbeat-lambda-" + name + "-" + cloudformation.Ref("AWS::Region"), + Path: cloudformation.String("/"), + RoleName: cloudformation.String("functionbeat-lambda-" + name + "-" + cloudformation.Ref("AWS::Region")), // Allow the lambda to write log to cloudwatch logs. // doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html Policies: policies, @@ -277,18 +277,18 @@ func (d *defaultTemplateBuilder) RawTemplate(name string) (string, error) { return string(data.json), err } -// mergeTemplate takes two cloudformation and merge them, if a key already exist we return an error. -func mergeTemplate(to, from *cloudformation.Template) error { - merge := func(m1 map[string]interface{}, m2 map[string]interface{}) error { - for k, v := range m2 { - if _, ok := m1[k]; ok { - return fmt.Errorf("key %s already exist in the template map", k) - } - m1[k] = v +func merge[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](m1 M1, m2 M2) error { + for k, v := range m2 { + if _, ok := m1[k]; ok { + return fmt.Errorf("key %v already exist in the template map", k) } - return nil + m1[k] = v } + return nil +} +// mergeTemplate takes two cloudformation and merge them, if a key already exist we return an error. +func mergeTemplate(to, from *cloudformation.Template) error { err := merge(to.Parameters, from.Parameters) if err != nil { return err diff --git a/x-pack/functionbeat/provider/aws/aws/cloudwatch_kinesis.go b/x-pack/functionbeat/provider/aws/aws/cloudwatch_kinesis.go index 8db930d0294..adde8793ec5 100644 --- a/x-pack/functionbeat/provider/aws/aws/cloudwatch_kinesis.go +++ b/x-pack/functionbeat/provider/aws/aws/cloudwatch_kinesis.go @@ -9,8 +9,8 @@ import ( "github.com/aws/aws-lambda-go/events" lambdarunner "github.com/aws/aws-lambda-go/lambda" - "github.com/awslabs/goformation/v4/cloudformation" - "github.com/awslabs/goformation/v4/cloudformation/iam" + "github.com/awslabs/goformation/v7/cloudformation" + "github.com/awslabs/goformation/v7/cloudformation/iam" "github.com/elastic/beats/v7/libbeat/feature" "github.com/elastic/beats/v7/libbeat/publisher/pipeline" diff --git a/x-pack/functionbeat/provider/aws/aws/cloudwatch_logs.go b/x-pack/functionbeat/provider/aws/aws/cloudwatch_logs.go index e2a05023db1..83f8f011704 100644 --- a/x-pack/functionbeat/provider/aws/aws/cloudwatch_logs.go +++ b/x-pack/functionbeat/provider/aws/aws/cloudwatch_logs.go @@ -14,10 +14,10 @@ import ( "github.com/aws/aws-lambda-go/events" lambdarunner "github.com/aws/aws-lambda-go/lambda" - "github.com/awslabs/goformation/v4/cloudformation" - "github.com/awslabs/goformation/v4/cloudformation/iam" - "github.com/awslabs/goformation/v4/cloudformation/lambda" - "github.com/awslabs/goformation/v4/cloudformation/policies" + "github.com/awslabs/goformation/v7/cloudformation" + "github.com/awslabs/goformation/v7/cloudformation/iam" + "github.com/awslabs/goformation/v7/cloudformation/lambda" + "github.com/awslabs/goformation/v7/cloudformation/policies" "github.com/elastic/beats/v7/libbeat/feature" "github.com/elastic/beats/v7/libbeat/publisher/pipeline" @@ -193,7 +193,7 @@ func (c *CloudwatchLogs) Template() *cloudformation.Template { ".", cloudformation.Ref("AWS::URLSuffix"), // awsamazon.com or .com.ch }), - SourceArn: cloudformation.Join( + SourceArn: cloudformation.JoinPtr( "", []string{ "arn:", diff --git a/x-pack/functionbeat/provider/aws/aws/kinesis.go b/x-pack/functionbeat/provider/aws/aws/kinesis.go index 1d1d749bebd..b286ab214d9 100644 --- a/x-pack/functionbeat/provider/aws/aws/kinesis.go +++ b/x-pack/functionbeat/provider/aws/aws/kinesis.go @@ -13,9 +13,9 @@ import ( "github.com/aws/aws-lambda-go/events" lambdarunner "github.com/aws/aws-lambda-go/lambda" - "github.com/awslabs/goformation/v4/cloudformation" - "github.com/awslabs/goformation/v4/cloudformation/iam" - "github.com/awslabs/goformation/v4/cloudformation/lambda" + "github.com/awslabs/goformation/v7/cloudformation" + "github.com/awslabs/goformation/v7/cloudformation/iam" + "github.com/awslabs/goformation/v7/cloudformation/lambda" "github.com/elastic/beats/v7/libbeat/feature" "github.com/elastic/beats/v7/libbeat/publisher/pipeline" @@ -181,11 +181,11 @@ func (k *Kinesis) Template() *cloudformation.Template { for _, trigger := range k.config.Triggers { resourceName := prefix(k.Name() + trigger.EventSourceArn) template.Resources[resourceName] = &lambda.EventSourceMapping{ - BatchSize: trigger.BatchSize, - ParallelizationFactor: trigger.ParallelizationFactor, - EventSourceArn: trigger.EventSourceArn, + BatchSize: cloudformation.Int(trigger.BatchSize), + ParallelizationFactor: cloudformation.Int(trigger.ParallelizationFactor), + EventSourceArn: cloudformation.String(trigger.EventSourceArn), FunctionName: cloudformation.GetAtt(prefix(""), "Arn"), - StartingPosition: trigger.StartingPosition.String(), + StartingPosition: cloudformation.String(trigger.StartingPosition.String()), } } diff --git a/x-pack/functionbeat/provider/aws/aws/sqs.go b/x-pack/functionbeat/provider/aws/aws/sqs.go index a8955214bff..adf5f5a16de 100644 --- a/x-pack/functionbeat/provider/aws/aws/sqs.go +++ b/x-pack/functionbeat/provider/aws/aws/sqs.go @@ -11,9 +11,9 @@ import ( "github.com/aws/aws-lambda-go/events" lambdarunner "github.com/aws/aws-lambda-go/lambda" - "github.com/awslabs/goformation/v4/cloudformation" - "github.com/awslabs/goformation/v4/cloudformation/iam" - "github.com/awslabs/goformation/v4/cloudformation/lambda" + "github.com/awslabs/goformation/v7/cloudformation" + "github.com/awslabs/goformation/v7/cloudformation/iam" + "github.com/awslabs/goformation/v7/cloudformation/lambda" "github.com/elastic/beats/v7/libbeat/feature" "github.com/elastic/beats/v7/libbeat/publisher/pipeline" @@ -106,8 +106,8 @@ func (s *SQS) Template() *cloudformation.Template { for _, trigger := range s.config.Triggers { resourceName := prefix("SQS") + NormalizeResourceName(trigger.EventSourceArn) template.Resources[resourceName] = &lambda.EventSourceMapping{ - BatchSize: batchSize, - EventSourceArn: trigger.EventSourceArn, + BatchSize: cloudformation.Int(batchSize), + EventSourceArn: cloudformation.String(trigger.EventSourceArn), FunctionName: cloudformation.GetAtt(prefix(""), "Arn"), } }