From 40324d6c13c0a85ad128d661226387eafb7fe89f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 25 Jun 2024 23:32:37 +0000 Subject: [PATCH 1/7] chore: Update module github.com/aws/aws-sdk-go to v1.54.8 (#470) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/aws/aws-sdk-go](https://togithub.com/aws/aws-sdk-go) | `v1.54.7` -> `v1.54.8` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go/v1.54.8?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go/v1.54.8?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go/v1.54.7/v1.54.8?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go/v1.54.7/v1.54.8?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
aws/aws-sdk-go (github.com/aws/aws-sdk-go) ### [`v1.54.8`](https://togithub.com/aws/aws-sdk-go/blob/HEAD/CHANGELOG.md#Release-v1548-2024-06-25) [Compare Source](https://togithub.com/aws/aws-sdk-go/compare/v1.54.7...v1.54.8) \=== ##### Service Client Updates - `service/autoscaling`: Updates service API and documentation - Doc only update for Auto Scaling's TargetTrackingMetricDataQuery - `service/ec2`: Updates service API - This release is for the launch of the new u7ib-12tb.224xlarge, R8g, c7gn.metal and mac2-m1ultra.metal instance types - `service/networkmanager`: Updates service API and documentation - `service/workspaces-thin-client`: Updates service API and documentation
--- ### Configuration 📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/nobl9/nobl9-go). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index eca2bec6..d441b585 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/BurntSushi/toml v1.4.0 github.com/MicahParks/jwkset v0.5.18 github.com/MicahParks/keyfunc/v3 v3.3.3 - github.com/aws/aws-sdk-go v1.54.7 + github.com/aws/aws-sdk-go v1.54.8 github.com/bmatcuk/doublestar/v4 v4.6.1 github.com/goccy/go-yaml v1.11.3 github.com/golang-jwt/jwt/v5 v5.2.1 diff --git a/go.sum b/go.sum index 2cc59f62..21efab43 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/MicahParks/jwkset v0.5.18 h1:WLdyMngF7rCrnstQxA7mpRoxeaWqGzPM/0z40PJU github.com/MicahParks/jwkset v0.5.18/go.mod h1:q8ptTGn/Z9c4MwbcfeCDssADeVQb3Pk7PnVxrvi+2QY= github.com/MicahParks/keyfunc/v3 v3.3.3 h1:c6j9oSu1YUo0k//KwF1miIQlEMtqNlj7XBFLB8jtEmY= github.com/MicahParks/keyfunc/v3 v3.3.3/go.mod h1:f/UMyXdKfkZzmBeBFUeYk+zu066J1Fcl48f7Wnl5Z48= -github.com/aws/aws-sdk-go v1.54.7 h1:k1wJ+NMOsXgq/Lsa0y1mS0DFoDeHFPcz2OjCq5H5Mjg= -github.com/aws/aws-sdk-go v1.54.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.54.8 h1:+soIjaRsuXfEJ9ts9poJD2fIIzSSRwfx+T69DrTtL2M= +github.com/aws/aws-sdk-go v1.54.8/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From 7d704bedbb633bb3d6529417b721f5b811b3b0cb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 01:56:41 +0000 Subject: [PATCH 2/7] chore: Update module github.com/aws/aws-sdk-go to v1.54.9 (#472) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/aws/aws-sdk-go](https://togithub.com/aws/aws-sdk-go) | `v1.54.8` -> `v1.54.9` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go/v1.54.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go/v1.54.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go/v1.54.8/v1.54.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go/v1.54.8/v1.54.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
aws/aws-sdk-go (github.com/aws/aws-sdk-go) ### [`v1.54.9`](https://togithub.com/aws/aws-sdk-go/blob/HEAD/CHANGELOG.md#Release-v1549-2024-06-26) [Compare Source](https://togithub.com/aws/aws-sdk-go/compare/v1.54.8...v1.54.9) \=== ##### Service Client Updates - `service/controltower`: Updates service API, documentation, and paginators - `service/eks`: Updates service API and documentation - `service/ivs-realtime`: Updates service API, documentation, and paginators - `service/kinesisanalyticsv2`: Updates service API, documentation, and paginators - `service/opensearch`: Updates service API and documentation
--- ### Configuration 📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/nobl9/nobl9-go). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d441b585..22f07112 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/BurntSushi/toml v1.4.0 github.com/MicahParks/jwkset v0.5.18 github.com/MicahParks/keyfunc/v3 v3.3.3 - github.com/aws/aws-sdk-go v1.54.8 + github.com/aws/aws-sdk-go v1.54.9 github.com/bmatcuk/doublestar/v4 v4.6.1 github.com/goccy/go-yaml v1.11.3 github.com/golang-jwt/jwt/v5 v5.2.1 diff --git a/go.sum b/go.sum index 21efab43..8410ed77 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/MicahParks/jwkset v0.5.18 h1:WLdyMngF7rCrnstQxA7mpRoxeaWqGzPM/0z40PJU github.com/MicahParks/jwkset v0.5.18/go.mod h1:q8ptTGn/Z9c4MwbcfeCDssADeVQb3Pk7PnVxrvi+2QY= github.com/MicahParks/keyfunc/v3 v3.3.3 h1:c6j9oSu1YUo0k//KwF1miIQlEMtqNlj7XBFLB8jtEmY= github.com/MicahParks/keyfunc/v3 v3.3.3/go.mod h1:f/UMyXdKfkZzmBeBFUeYk+zu066J1Fcl48f7Wnl5Z48= -github.com/aws/aws-sdk-go v1.54.8 h1:+soIjaRsuXfEJ9ts9poJD2fIIzSSRwfx+T69DrTtL2M= -github.com/aws/aws-sdk-go v1.54.8/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.54.9 h1:e0Czh9AhrCVPuyaIUnibYmih3cYexJKlqlHSJ2eMKbI= +github.com/aws/aws-sdk-go v1.54.9/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From 4e54bd72d58b49c4bf065b04814274c5d80f065a Mon Sep 17 00:00:00 2001 From: Mateusz Hawrus <48822818+nieomylnieja@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:13:50 +0200 Subject: [PATCH 3/7] fix: Double quoted JSON handling (#471) ## Motivation The issue is extensively covered in this issue: https://github.com/goccy/go-yaml/issues/455 ## Summary Added test case and replaced `goccy/go-yaml` with our fork. For now I'm pinning the commit SHA from the PR branch. I'm not sure if the upstream is actively maintained anymore, we might just want to go further with the fork instead of the replace clause. ## Related changes - https://github.com/goccy/go-yaml/pull/457 - https://github.com/nobl9/go-yaml/pull/3 ## Testing Test case was supplied. ## Release Notes Fixed incorrect handling of double quoted JSON literals which caused errors when unmarshaling CloudWatch v1alpha SLOs with certain `json` queries. --- go.mod | 3 ++ go.sum | 4 +-- manifest/v1alpha/parser/parser_test.go | 9 ++++++ .../parser/test_data/cloudwatch_slo.yaml | 29 +++++++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 manifest/v1alpha/parser/test_data/cloudwatch_slo.yaml diff --git a/go.mod b/go.mod index 22f07112..d4990362 100644 --- a/go.mod +++ b/go.mod @@ -31,3 +31,6 @@ require ( golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +// We might in the end decide to just go with the fork direcly. +replace github.com/goccy/go-yaml => github.com/nobl9/go-yaml v0.0.0-20240626115914-6b82fd0d61b9 diff --git a/go.sum b/go.sum index 8410ed77..9343bf24 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,6 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/goccy/go-yaml v1.11.3 h1:B3W9IdWbvrUu2OYQGwvU1nZtvMQJPBKgBUuweJjLj6I= -github.com/goccy/go-yaml v1.11.3/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -42,6 +40,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 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/nobl9/go-yaml v0.0.0-20240626115914-6b82fd0d61b9 h1:HWAY7k8zA8T3dgQRg6llwyWshguD6bIeaVXukNrnen4= +github.com/nobl9/go-yaml v0.0.0-20240626115914-6b82fd0d61b9/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/manifest/v1alpha/parser/parser_test.go b/manifest/v1alpha/parser/parser_test.go index 5d091c58..82785287 100644 --- a/manifest/v1alpha/parser/parser_test.go +++ b/manifest/v1alpha/parser/parser_test.go @@ -136,6 +136,15 @@ func Test_ParseObject_EnsureAllKindsAreParsed(t *testing.T) { } } +// References: +// - https://github.com/nobl9/go-yaml/pull/3 (fork) +// - https://github.com/nobl9/go-yaml/pull/457 (upstream) +func Test_ParseObject_DoubleQuotedJSONHandling(t *testing.T) { + data, format := readParserTestFile(t, "cloudwatch_slo.yaml") + _, err := ParseObject(data, manifest.KindSLO, format) + require.NoError(t, err) +} + func readParserTestFile(t *testing.T, filename string) ([]byte, manifest.ObjectFormat) { t.Helper() data, err := parserTestData.ReadFile(filepath.Join("test_data", filename)) diff --git a/manifest/v1alpha/parser/test_data/cloudwatch_slo.yaml b/manifest/v1alpha/parser/test_data/cloudwatch_slo.yaml new file mode 100644 index 00000000..90780895 --- /dev/null +++ b/manifest/v1alpha/parser/test_data/cloudwatch_slo.yaml @@ -0,0 +1,29 @@ +apiVersion: n9/v1alpha +kind: SLO +metadata: + name: cloudwatch-json + project: cloudwatch +spec: + budgetingMethod: Occurrences + description: "" + indicator: + metricSource: + kind: Agent + name: cloudwatch + project: cloudwatch + objectives: + - displayName: "" + op: lte + rawMetric: + query: + cloudWatch: + json: "[{\"Id\": \"e1\",\"Expression\": \"MAX(FILL(METRICS(), 0))\",\"Period\": 60},{\"Id\": \"m1\",\"MetricStat\": {\"Metric\": {\"Namespace\": \"AWS/ApplicationELB\",\"MetricName\": \"TargetResponseTime\",\"Dimensions\": [{\"Name\": \"LoadBalancer\",\"Value\": \"app/123/123\"},{\"Name\": \"TargetGroup\",\"Value\": \"targetgroup/123/123\"}]},\"Period\": 60,\"Stat\": \"Average\"},\"ReturnData\": false}]" + region: eu-central-1 + target: 0.8 + value: 0.9 + name: objective-1 + service: cloudwatch-service + timeWindows: + - count: 1 + isRolling: true + unit: Hour \ No newline at end of file From d0c7cfc4db39fbcfcd81632857a2a12865bd5953 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2024 01:41:46 +0000 Subject: [PATCH 4/7] chore: Update module github.com/aws/aws-sdk-go to v1.54.10 (#473) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/aws/aws-sdk-go](https://togithub.com/aws/aws-sdk-go) | `v1.54.9` -> `v1.54.10` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go/v1.54.10?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go/v1.54.10?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go/v1.54.9/v1.54.10?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go/v1.54.9/v1.54.10?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
aws/aws-sdk-go (github.com/aws/aws-sdk-go) ### [`v1.54.10`](https://togithub.com/aws/aws-sdk-go/blob/HEAD/CHANGELOG.md#Release-v15410-2024-06-27) [Compare Source](https://togithub.com/aws/aws-sdk-go/compare/v1.54.9...v1.54.10) \=== ##### Service Client Updates - `service/application-autoscaling`: Updates service API and documentation - `service/chime-sdk-media-pipelines`: Updates service API and documentation - `service/cloudfront`: Updates service API and documentation - Doc only update for CloudFront that fixes customer-reported issue - `service/datazone`: Updates service API, documentation, and paginators - `service/elasticache`: Updates service API - Add v2 smoke tests and smithy smokeTests trait for SDK testing. - `service/mq`: Updates service API and documentation - This release makes the EngineVersion field optional for both broker and configuration and uses the latest available version by default. The AutoMinorVersionUpgrade field is also now optional for broker creation and defaults to 'true'. - `service/qconnect`: Updates service API, documentation, and paginators - `service/quicksight`: Updates service API and documentation - Adding support for Repeating Sections, Nested Filters - `service/rds`: Updates service API, documentation, waiters, paginators, and examples - Updates Amazon RDS documentation for TAZ export to S3. - `service/sagemaker`: Updates service API and documentation - Add capability for Admins to customize Studio experience for the user by showing or hiding Apps and MLTools. - `service/workspaces`: Updates service API and documentation - Added support for WorkSpaces Pools.
--- ### Configuration 📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/nobl9/nobl9-go). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d4990362..c38d3cd2 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/BurntSushi/toml v1.4.0 github.com/MicahParks/jwkset v0.5.18 github.com/MicahParks/keyfunc/v3 v3.3.3 - github.com/aws/aws-sdk-go v1.54.9 + github.com/aws/aws-sdk-go v1.54.10 github.com/bmatcuk/doublestar/v4 v4.6.1 github.com/goccy/go-yaml v1.11.3 github.com/golang-jwt/jwt/v5 v5.2.1 diff --git a/go.sum b/go.sum index 9343bf24..6dc3107c 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/MicahParks/jwkset v0.5.18 h1:WLdyMngF7rCrnstQxA7mpRoxeaWqGzPM/0z40PJU github.com/MicahParks/jwkset v0.5.18/go.mod h1:q8ptTGn/Z9c4MwbcfeCDssADeVQb3Pk7PnVxrvi+2QY= github.com/MicahParks/keyfunc/v3 v3.3.3 h1:c6j9oSu1YUo0k//KwF1miIQlEMtqNlj7XBFLB8jtEmY= github.com/MicahParks/keyfunc/v3 v3.3.3/go.mod h1:f/UMyXdKfkZzmBeBFUeYk+zu066J1Fcl48f7Wnl5Z48= -github.com/aws/aws-sdk-go v1.54.9 h1:e0Czh9AhrCVPuyaIUnibYmih3cYexJKlqlHSJ2eMKbI= -github.com/aws/aws-sdk-go v1.54.9/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.54.10 h1:dvkMlAttUsyacKj2L4poIQBLzOSWL2JG2ty+yWrqets= +github.com/aws/aws-sdk-go v1.54.10/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From 47439ff52dd50c48aaede661ca5e32b4f1a3a887 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 29 Jun 2024 01:07:56 +0000 Subject: [PATCH 5/7] chore: Update module github.com/aws/aws-sdk-go to v1.54.11 (#474) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/aws/aws-sdk-go](https://togithub.com/aws/aws-sdk-go) | `v1.54.10` -> `v1.54.11` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2faws%2faws-sdk-go/v1.54.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2faws%2faws-sdk-go/v1.54.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2faws%2faws-sdk-go/v1.54.10/v1.54.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2faws%2faws-sdk-go/v1.54.10/v1.54.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
aws/aws-sdk-go (github.com/aws/aws-sdk-go) ### [`v1.54.11`](https://togithub.com/aws/aws-sdk-go/blob/HEAD/CHANGELOG.md#Release-v15411-2024-06-28) [Compare Source](https://togithub.com/aws/aws-sdk-go/compare/v1.54.10...v1.54.11) \=== ##### Service Client Updates - `service/acm-pca`: Updates service API - `service/cloudhsmv2`: Updates service API and documentation - Added 3 new APIs to support backup sharing: GetResourcePolicy, PutResourcePolicy, and DeleteResourcePolicy. Added BackupArn to the output of the DescribeBackups API. Added support for BackupArn in the CreateCluster API. - `service/connect`: Updates service API and documentation - `service/elasticmapreduce`: Updates service API and documentation - This release provides the support for new allocation strategies i.e. CAPACITY_OPTIMIZED_PRIORITIZED for Spot and PRIORITIZED for On-Demand by taking input of priority value for each instance type for instance fleet clusters. - `service/glue`: Updates service API and documentation - Added AttributesToGet parameter to Glue GetDatabases, allowing caller to limit output to include only the database name. - `service/kinesisanalyticsv2`: Updates service API and documentation - `service/opensearch`: Updates service API and documentation - `service/pi`: Updates service API and documentation - `service/workspaces`: Updates service API and documentation - Added support for Red Hat Enterprise Linux 8 on Amazon WorkSpaces Personal.
--- ### Configuration 📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/nobl9/nobl9-go). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c38d3cd2..b157d71b 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/BurntSushi/toml v1.4.0 github.com/MicahParks/jwkset v0.5.18 github.com/MicahParks/keyfunc/v3 v3.3.3 - github.com/aws/aws-sdk-go v1.54.10 + github.com/aws/aws-sdk-go v1.54.11 github.com/bmatcuk/doublestar/v4 v4.6.1 github.com/goccy/go-yaml v1.11.3 github.com/golang-jwt/jwt/v5 v5.2.1 diff --git a/go.sum b/go.sum index 6dc3107c..b2898d87 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/MicahParks/jwkset v0.5.18 h1:WLdyMngF7rCrnstQxA7mpRoxeaWqGzPM/0z40PJU github.com/MicahParks/jwkset v0.5.18/go.mod h1:q8ptTGn/Z9c4MwbcfeCDssADeVQb3Pk7PnVxrvi+2QY= github.com/MicahParks/keyfunc/v3 v3.3.3 h1:c6j9oSu1YUo0k//KwF1miIQlEMtqNlj7XBFLB8jtEmY= github.com/MicahParks/keyfunc/v3 v3.3.3/go.mod h1:f/UMyXdKfkZzmBeBFUeYk+zu066J1Fcl48f7Wnl5Z48= -github.com/aws/aws-sdk-go v1.54.10 h1:dvkMlAttUsyacKj2L4poIQBLzOSWL2JG2ty+yWrqets= -github.com/aws/aws-sdk-go v1.54.10/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.54.11 h1:Zxuv/R+IVS0B66yz4uezhxH9FN9/G2nbxejYqAMFjxk= +github.com/aws/aws-sdk-go v1.54.11/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From 4bf666a7cf6241e7df49aa01d9dafc6e1c708b8b Mon Sep 17 00:00:00 2001 From: Mateusz Hawrus <48822818+nieomylnieja@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:23:51 +0200 Subject: [PATCH 6/7] feat: Add Alert Method types (#475) ## Motivation Similar to `Agent` or `Direct`, `AlertMethod` has different types based on its `spec` contents. Each type corresponds to the method's integration provider. It would be beneficial to be able to quickly tell what type of integration does given method support, just like `Agent.Spec.GetType`. ## Release Notes Added `AlertMethod.Spec.GetType()` function and `v1alpha.AlertMethodType` enum to help discern different types of alert methods. --- .github/workflows/checks.yml | 4 +- manifest/v1alpha/agent/agent.go | 56 +++++----- manifest/v1alpha/alert_methods.go | 18 ++++ manifest/v1alpha/alert_methods_enum.go | 100 ++++++++++++++++++ manifest/v1alpha/alertmethod/alert_method.go | 27 +++++ .../v1alpha/alertmethod/alert_method_test.go | 35 ++++++ 6 files changed, 210 insertions(+), 30 deletions(-) create mode 100644 manifest/v1alpha/alert_methods.go create mode 100644 manifest/v1alpha/alert_methods_enum.go create mode 100644 manifest/v1alpha/alertmethod/alert_method_test.go diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 348eb139..dbd9634d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -32,10 +32,10 @@ jobs: ${{ runner.os }}-yarn- - name: Run spell and markdown checkers run: make check/spell check/trailing check/markdown - - name: Check generated code - run: make check/generate - name: Check formatting run: make check/format + - name: Check generated code + run: make check/generate - name: Run go vet run: make check/vet - name: Run golangci-lint diff --git a/manifest/v1alpha/agent/agent.go b/manifest/v1alpha/agent/agent.go index ecc04568..f3065c2e 100644 --- a/manifest/v1alpha/agent/agent.go +++ b/manifest/v1alpha/agent/agent.go @@ -86,61 +86,61 @@ type Status struct { NewestBetaAgentVersion string `json:"newestBetaAgentVersion,omitempty"` } -func (spec Spec) GetType() (v1alpha.DataSourceType, error) { +func (s Spec) GetType() (v1alpha.DataSourceType, error) { switch { - case spec.Prometheus != nil: + case s.Prometheus != nil: return v1alpha.Prometheus, nil - case spec.Datadog != nil: + case s.Datadog != nil: return v1alpha.Datadog, nil - case spec.NewRelic != nil: + case s.NewRelic != nil: return v1alpha.NewRelic, nil - case spec.AppDynamics != nil: + case s.AppDynamics != nil: return v1alpha.AppDynamics, nil - case spec.Splunk != nil: + case s.Splunk != nil: return v1alpha.Splunk, nil - case spec.Lightstep != nil: + case s.Lightstep != nil: return v1alpha.Lightstep, nil - case spec.SplunkObservability != nil: + case s.SplunkObservability != nil: return v1alpha.SplunkObservability, nil - case spec.Dynatrace != nil: + case s.Dynatrace != nil: return v1alpha.Dynatrace, nil - case spec.Elasticsearch != nil: + case s.Elasticsearch != nil: return v1alpha.Elasticsearch, nil - case spec.ThousandEyes != nil: + case s.ThousandEyes != nil: return v1alpha.ThousandEyes, nil - case spec.Graphite != nil: + case s.Graphite != nil: return v1alpha.Graphite, nil - case spec.BigQuery != nil: + case s.BigQuery != nil: return v1alpha.BigQuery, nil - case spec.OpenTSDB != nil: + case s.OpenTSDB != nil: return v1alpha.OpenTSDB, nil - case spec.GrafanaLoki != nil: + case s.GrafanaLoki != nil: return v1alpha.GrafanaLoki, nil - case spec.CloudWatch != nil: + case s.CloudWatch != nil: return v1alpha.CloudWatch, nil - case spec.Pingdom != nil: + case s.Pingdom != nil: return v1alpha.Pingdom, nil - case spec.AmazonPrometheus != nil: + case s.AmazonPrometheus != nil: return v1alpha.AmazonPrometheus, nil - case spec.Redshift != nil: + case s.Redshift != nil: return v1alpha.Redshift, nil - case spec.SumoLogic != nil: + case s.SumoLogic != nil: return v1alpha.SumoLogic, nil - case spec.Instana != nil: + case s.Instana != nil: return v1alpha.Instana, nil - case spec.InfluxDB != nil: + case s.InfluxDB != nil: return v1alpha.InfluxDB, nil - case spec.GCM != nil: + case s.GCM != nil: return v1alpha.GCM, nil - case spec.AzureMonitor != nil: + case s.AzureMonitor != nil: return v1alpha.AzureMonitor, nil - case spec.Generic != nil: + case s.Generic != nil: return v1alpha.Generic, nil - case spec.Honeycomb != nil: + case s.Honeycomb != nil: return v1alpha.Honeycomb, nil - case spec.LogicMonitor != nil: + case s.LogicMonitor != nil: return v1alpha.LogicMonitor, nil - case spec.AzurePrometheus != nil: + case s.AzurePrometheus != nil: return v1alpha.AzurePrometheus, nil } return 0, errors.New("unknown agent type") diff --git a/manifest/v1alpha/alert_methods.go b/manifest/v1alpha/alert_methods.go new file mode 100644 index 00000000..675d0efb --- /dev/null +++ b/manifest/v1alpha/alert_methods.go @@ -0,0 +1,18 @@ +package v1alpha + +//go:generate ../../bin/go-enum --values --noprefix + +// DataSourceType represents the specific type of alert method. +// +/* ENUM( +Webhook = 1 +PagerDuty +Slack +Discord +Opsgenie +ServiceNow +Jira +Teams +Email +)*/ +type AlertMethodType int diff --git a/manifest/v1alpha/alert_methods_enum.go b/manifest/v1alpha/alert_methods_enum.go new file mode 100644 index 00000000..b1591485 --- /dev/null +++ b/manifest/v1alpha/alert_methods_enum.go @@ -0,0 +1,100 @@ +// Code generated by go-enum DO NOT EDIT. +// Version: 0.6.0 +// Revision: 919e61c0174b91303753ee3898569a01abb32c97 +// Build Date: 2023-12-18T15:54:43Z +// Built By: goreleaser + +package v1alpha + +import ( + "fmt" + + "github.com/pkg/errors" +) + +const ( + // Webhook is a AlertMethodType of type Webhook. + Webhook AlertMethodType = iota + 1 + // PagerDuty is a AlertMethodType of type PagerDuty. + PagerDuty + // Slack is a AlertMethodType of type Slack. + Slack + // Discord is a AlertMethodType of type Discord. + Discord + // Opsgenie is a AlertMethodType of type Opsgenie. + Opsgenie + // ServiceNow is a AlertMethodType of type ServiceNow. + ServiceNow + // Jira is a AlertMethodType of type Jira. + Jira + // Teams is a AlertMethodType of type Teams. + Teams + // Email is a AlertMethodType of type Email. + Email +) + +var ErrInvalidAlertMethodType = errors.New("not a valid AlertMethodType") + +const _AlertMethodTypeName = "WebhookPagerDutySlackDiscordOpsgenieServiceNowJiraTeamsEmail" + +// AlertMethodTypeValues returns a list of the values for AlertMethodType +func AlertMethodTypeValues() []AlertMethodType { + return []AlertMethodType{ + Webhook, + PagerDuty, + Slack, + Discord, + Opsgenie, + ServiceNow, + Jira, + Teams, + Email, + } +} + +var _AlertMethodTypeMap = map[AlertMethodType]string{ + Webhook: _AlertMethodTypeName[0:7], + PagerDuty: _AlertMethodTypeName[7:16], + Slack: _AlertMethodTypeName[16:21], + Discord: _AlertMethodTypeName[21:28], + Opsgenie: _AlertMethodTypeName[28:36], + ServiceNow: _AlertMethodTypeName[36:46], + Jira: _AlertMethodTypeName[46:50], + Teams: _AlertMethodTypeName[50:55], + Email: _AlertMethodTypeName[55:60], +} + +// String implements the Stringer interface. +func (x AlertMethodType) String() string { + if str, ok := _AlertMethodTypeMap[x]; ok { + return str + } + return fmt.Sprintf("AlertMethodType(%d)", x) +} + +// IsValid provides a quick way to determine if the typed value is +// part of the allowed enumerated values +func (x AlertMethodType) IsValid() bool { + _, ok := _AlertMethodTypeMap[x] + return ok +} + +var _AlertMethodTypeValue = map[string]AlertMethodType{ + _AlertMethodTypeName[0:7]: Webhook, + _AlertMethodTypeName[7:16]: PagerDuty, + _AlertMethodTypeName[16:21]: Slack, + _AlertMethodTypeName[21:28]: Discord, + _AlertMethodTypeName[28:36]: Opsgenie, + _AlertMethodTypeName[36:46]: ServiceNow, + _AlertMethodTypeName[46:50]: Jira, + _AlertMethodTypeName[50:55]: Teams, + _AlertMethodTypeName[55:60]: Email, +} + +// ParseAlertMethodType attempts to convert a string to a AlertMethodType. +func ParseAlertMethodType(name string) (AlertMethodType, error) { + if x, ok := _AlertMethodTypeValue[name]; ok { + return x, nil + } + return AlertMethodType(0), fmt.Errorf("%s is %w", name, ErrInvalidAlertMethodType) +} diff --git a/manifest/v1alpha/alertmethod/alert_method.go b/manifest/v1alpha/alertmethod/alert_method.go index 494979ff..f1aae016 100644 --- a/manifest/v1alpha/alertmethod/alert_method.go +++ b/manifest/v1alpha/alertmethod/alert_method.go @@ -1,7 +1,10 @@ package alertmethod import ( + "github.com/pkg/errors" + "github.com/nobl9/nobl9-go/manifest" + "github.com/nobl9/nobl9-go/manifest/v1alpha" ) //go:generate go run ../../../internal/cmd/objectimpl AlertMethod @@ -56,6 +59,30 @@ type Spec struct { Email *EmailAlertMethod `json:"email,omitempty"` } +func (s Spec) GetType() (v1alpha.AlertMethodType, error) { + switch { + case s.Webhook != nil: + return v1alpha.Webhook, nil + case s.PagerDuty != nil: + return v1alpha.PagerDuty, nil + case s.Slack != nil: + return v1alpha.Slack, nil + case s.Discord != nil: + return v1alpha.Discord, nil + case s.Opsgenie != nil: + return v1alpha.Opsgenie, nil + case s.ServiceNow != nil: + return v1alpha.ServiceNow, nil + case s.Jira != nil: + return v1alpha.Jira, nil + case s.Teams != nil: + return v1alpha.Teams, nil + case s.Email != nil: + return v1alpha.Email, nil + } + return 0, errors.New("unknown alert method type") +} + type WebhookAlertMethod struct { URL string `json:"url"` // Field required when AlertMethod is created. Template *string `json:"template,omitempty"` diff --git a/manifest/v1alpha/alertmethod/alert_method_test.go b/manifest/v1alpha/alertmethod/alert_method_test.go new file mode 100644 index 00000000..ad79afa4 --- /dev/null +++ b/manifest/v1alpha/alertmethod/alert_method_test.go @@ -0,0 +1,35 @@ +package alertmethod + +import ( + "reflect" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/nobl9/nobl9-go/manifest/v1alpha" +) + +func TestAlertMethod_Spec_GetType(t *testing.T) { + for _, method := range v1alpha.AlertMethodTypeValues() { + t.Run(method.String(), func(t *testing.T) { + spec := Spec{} + methodTypeStr := method.String() + setZeroValue(t, &spec, methodTypeStr) + typ, err := spec.GetType() + require.NoError(t, err) + assert.Equal(t, typ.String(), method.String()) + }) + } +} + +// setZeroValue sets a zero value of a pointer field in a struct using reflection. +func setZeroValue(t *testing.T, obj interface{}, fieldName string) { + t.Helper() + objValue := reflect.ValueOf(obj).Elem() + fieldValue := objValue.FieldByName(fieldName) + if !fieldValue.IsValid() || !fieldValue.CanSet() { + t.Fatalf("cannot set value for field: %s", fieldName) + } + fieldValue.Set(reflect.New(fieldValue.Type().Elem())) +} From f08abc783c5e74b2349d1a1d1b0c104c88233cb3 Mon Sep 17 00:00:00 2001 From: Mateusz Hawrus <48822818+nieomylnieja@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:49:41 +0200 Subject: [PATCH 7/7] chore: Correct Alert Method type names (#476) ## Motivation Having sth like `v1alpha.Email` in the namespace is way too vague, we need more specific naming, that's why we need a prefix. --- manifest/v1alpha/alert_methods.go | 4 +- manifest/v1alpha/alert_methods_enum.go | 90 ++++++++++---------- manifest/v1alpha/alertmethod/alert_method.go | 18 ++-- 3 files changed, 56 insertions(+), 56 deletions(-) diff --git a/manifest/v1alpha/alert_methods.go b/manifest/v1alpha/alert_methods.go index 675d0efb..efdd5ce6 100644 --- a/manifest/v1alpha/alert_methods.go +++ b/manifest/v1alpha/alert_methods.go @@ -1,8 +1,8 @@ package v1alpha -//go:generate ../../bin/go-enum --values --noprefix +//go:generate ../../bin/go-enum --values -// DataSourceType represents the specific type of alert method. +// AlertMethodType represents the specific type of alert method. // /* ENUM( Webhook = 1 diff --git a/manifest/v1alpha/alert_methods_enum.go b/manifest/v1alpha/alert_methods_enum.go index b1591485..921f172e 100644 --- a/manifest/v1alpha/alert_methods_enum.go +++ b/manifest/v1alpha/alert_methods_enum.go @@ -13,24 +13,24 @@ import ( ) const ( - // Webhook is a AlertMethodType of type Webhook. - Webhook AlertMethodType = iota + 1 - // PagerDuty is a AlertMethodType of type PagerDuty. - PagerDuty - // Slack is a AlertMethodType of type Slack. - Slack - // Discord is a AlertMethodType of type Discord. - Discord - // Opsgenie is a AlertMethodType of type Opsgenie. - Opsgenie - // ServiceNow is a AlertMethodType of type ServiceNow. - ServiceNow - // Jira is a AlertMethodType of type Jira. - Jira - // Teams is a AlertMethodType of type Teams. - Teams - // Email is a AlertMethodType of type Email. - Email + // AlertMethodTypeWebhook is a AlertMethodType of type Webhook. + AlertMethodTypeWebhook AlertMethodType = iota + 1 + // AlertMethodTypePagerDuty is a AlertMethodType of type PagerDuty. + AlertMethodTypePagerDuty + // AlertMethodTypeSlack is a AlertMethodType of type Slack. + AlertMethodTypeSlack + // AlertMethodTypeDiscord is a AlertMethodType of type Discord. + AlertMethodTypeDiscord + // AlertMethodTypeOpsgenie is a AlertMethodType of type Opsgenie. + AlertMethodTypeOpsgenie + // AlertMethodTypeServiceNow is a AlertMethodType of type ServiceNow. + AlertMethodTypeServiceNow + // AlertMethodTypeJira is a AlertMethodType of type Jira. + AlertMethodTypeJira + // AlertMethodTypeTeams is a AlertMethodType of type Teams. + AlertMethodTypeTeams + // AlertMethodTypeEmail is a AlertMethodType of type Email. + AlertMethodTypeEmail ) var ErrInvalidAlertMethodType = errors.New("not a valid AlertMethodType") @@ -40,28 +40,28 @@ const _AlertMethodTypeName = "WebhookPagerDutySlackDiscordOpsgenieServiceNowJira // AlertMethodTypeValues returns a list of the values for AlertMethodType func AlertMethodTypeValues() []AlertMethodType { return []AlertMethodType{ - Webhook, - PagerDuty, - Slack, - Discord, - Opsgenie, - ServiceNow, - Jira, - Teams, - Email, + AlertMethodTypeWebhook, + AlertMethodTypePagerDuty, + AlertMethodTypeSlack, + AlertMethodTypeDiscord, + AlertMethodTypeOpsgenie, + AlertMethodTypeServiceNow, + AlertMethodTypeJira, + AlertMethodTypeTeams, + AlertMethodTypeEmail, } } var _AlertMethodTypeMap = map[AlertMethodType]string{ - Webhook: _AlertMethodTypeName[0:7], - PagerDuty: _AlertMethodTypeName[7:16], - Slack: _AlertMethodTypeName[16:21], - Discord: _AlertMethodTypeName[21:28], - Opsgenie: _AlertMethodTypeName[28:36], - ServiceNow: _AlertMethodTypeName[36:46], - Jira: _AlertMethodTypeName[46:50], - Teams: _AlertMethodTypeName[50:55], - Email: _AlertMethodTypeName[55:60], + AlertMethodTypeWebhook: _AlertMethodTypeName[0:7], + AlertMethodTypePagerDuty: _AlertMethodTypeName[7:16], + AlertMethodTypeSlack: _AlertMethodTypeName[16:21], + AlertMethodTypeDiscord: _AlertMethodTypeName[21:28], + AlertMethodTypeOpsgenie: _AlertMethodTypeName[28:36], + AlertMethodTypeServiceNow: _AlertMethodTypeName[36:46], + AlertMethodTypeJira: _AlertMethodTypeName[46:50], + AlertMethodTypeTeams: _AlertMethodTypeName[50:55], + AlertMethodTypeEmail: _AlertMethodTypeName[55:60], } // String implements the Stringer interface. @@ -80,15 +80,15 @@ func (x AlertMethodType) IsValid() bool { } var _AlertMethodTypeValue = map[string]AlertMethodType{ - _AlertMethodTypeName[0:7]: Webhook, - _AlertMethodTypeName[7:16]: PagerDuty, - _AlertMethodTypeName[16:21]: Slack, - _AlertMethodTypeName[21:28]: Discord, - _AlertMethodTypeName[28:36]: Opsgenie, - _AlertMethodTypeName[36:46]: ServiceNow, - _AlertMethodTypeName[46:50]: Jira, - _AlertMethodTypeName[50:55]: Teams, - _AlertMethodTypeName[55:60]: Email, + _AlertMethodTypeName[0:7]: AlertMethodTypeWebhook, + _AlertMethodTypeName[7:16]: AlertMethodTypePagerDuty, + _AlertMethodTypeName[16:21]: AlertMethodTypeSlack, + _AlertMethodTypeName[21:28]: AlertMethodTypeDiscord, + _AlertMethodTypeName[28:36]: AlertMethodTypeOpsgenie, + _AlertMethodTypeName[36:46]: AlertMethodTypeServiceNow, + _AlertMethodTypeName[46:50]: AlertMethodTypeJira, + _AlertMethodTypeName[50:55]: AlertMethodTypeTeams, + _AlertMethodTypeName[55:60]: AlertMethodTypeEmail, } // ParseAlertMethodType attempts to convert a string to a AlertMethodType. diff --git a/manifest/v1alpha/alertmethod/alert_method.go b/manifest/v1alpha/alertmethod/alert_method.go index f1aae016..66427852 100644 --- a/manifest/v1alpha/alertmethod/alert_method.go +++ b/manifest/v1alpha/alertmethod/alert_method.go @@ -62,23 +62,23 @@ type Spec struct { func (s Spec) GetType() (v1alpha.AlertMethodType, error) { switch { case s.Webhook != nil: - return v1alpha.Webhook, nil + return v1alpha.AlertMethodTypeWebhook, nil case s.PagerDuty != nil: - return v1alpha.PagerDuty, nil + return v1alpha.AlertMethodTypePagerDuty, nil case s.Slack != nil: - return v1alpha.Slack, nil + return v1alpha.AlertMethodTypeSlack, nil case s.Discord != nil: - return v1alpha.Discord, nil + return v1alpha.AlertMethodTypeDiscord, nil case s.Opsgenie != nil: - return v1alpha.Opsgenie, nil + return v1alpha.AlertMethodTypeOpsgenie, nil case s.ServiceNow != nil: - return v1alpha.ServiceNow, nil + return v1alpha.AlertMethodTypeServiceNow, nil case s.Jira != nil: - return v1alpha.Jira, nil + return v1alpha.AlertMethodTypeJira, nil case s.Teams != nil: - return v1alpha.Teams, nil + return v1alpha.AlertMethodTypeTeams, nil case s.Email != nil: - return v1alpha.Email, nil + return v1alpha.AlertMethodTypeEmail, nil } return 0, errors.New("unknown alert method type") }