Skip to content

Commit

Permalink
correct names
Browse files Browse the repository at this point in the history
  • Loading branch information
nieomylnieja committed Jul 1, 2024
1 parent 208796f commit e4adf41
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
20 changes: 10 additions & 10 deletions internal/manifest/v1alpha/examples/alert_method.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
var standardAlertMethods = []v1alpha.AlertMethodType{}

var customAlertMethods = map[v1alpha.AlertMethodType][]alertMethodVariant{
v1alpha.Webhook: {
v1alpha.AlertMethodTypeWebhook: {
alertMethodVariantWebhookTemplate,
alertMethodVariantWebhookTemplateFields,
},
Expand Down Expand Up @@ -69,7 +69,7 @@ func (a AlertMethodVariant) Generate() v1alphaAlertMethod.AlertMethod {

func (a AlertMethodVariant) generateVariant(am v1alphaAlertMethod.AlertMethod) v1alphaAlertMethod.AlertMethod {
switch a.Type {
case v1alpha.Email:
case v1alpha.AlertMethodTypeEmail:
am.Spec.Email = &v1alphaAlertMethod.EmailAlertMethod{
To: []string{"[email protected]"},
Cc: []string{"[email protected]"},
Expand All @@ -83,44 +83,44 @@ func (a AlertMethodVariant) generateVariant(am v1alphaAlertMethod.AlertMethod) v
Service: $service_name
Organization: $organization`,
}
case v1alpha.Discord:
case v1alpha.AlertMethodTypeDiscord:
am.Spec.Discord = &v1alphaAlertMethod.DiscordAlertMethod{
URL: "https://discord.com/api/webhooks/123/secret",
}
case v1alpha.Jira:
case v1alpha.AlertMethodTypeJira:
am.Spec.Jira = &v1alphaAlertMethod.JiraAlertMethod{
URL: "https://nobl9.atlassian.net/",
Username: "[email protected]",
APIToken: "123456789",
ProjectKey: "AL",
}
case v1alpha.Opsgenie:
case v1alpha.AlertMethodTypeOpsgenie:
am.Spec.Opsgenie = &v1alphaAlertMethod.OpsgenieAlertMethod{
Auth: "GenieKey 123",
URL: "https://api.opsgenie.com",
}
case v1alpha.PagerDuty:
case v1alpha.AlertMethodTypePagerDuty:
am.Spec.PagerDuty = &v1alphaAlertMethod.PagerDutyAlertMethod{
IntegrationKey: "123456789",
SendResolution: &v1alphaAlertMethod.SendResolution{
Message: ptr("Alert is now resolved"),
},
}
case v1alpha.ServiceNow:
case v1alpha.AlertMethodTypeServiceNow:
am.Spec.ServiceNow = &v1alphaAlertMethod.ServiceNowAlertMethod{
Username: "user",
Password: "super-strong-password",
InstanceName: "vm123",
}
case v1alpha.Slack:
case v1alpha.AlertMethodTypeSlack:
am.Spec.Slack = &v1alphaAlertMethod.SlackAlertMethod{
URL: "https://hooks.slack.com/services/321/123/secret",
}
case v1alpha.Teams:
case v1alpha.AlertMethodTypeTeams:
am.Spec.Teams = &v1alphaAlertMethod.TeamsAlertMethod{
URL: "https://meshmark.webhook.office.com/webhookb2/123@321/IncomingWebhook/123/321",
}
case v1alpha.Webhook:
case v1alpha.AlertMethodTypeWebhook:
am.Spec.Webhook = &v1alphaAlertMethod.WebhookAlertMethod{
URL: "https://123.execute-api.eu-central-1.amazonaws.com/default/putReq2S3",
Headers: []v1alphaAlertMethod.WebhookHeader{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/goccy/go-yaml"
"github.com/stretchr/testify/require"

"github.com/nobl9/nobl9-go/internal/pathutils"
"github.com/nobl9/nobl9-go/internal/testutils"
"github.com/nobl9/nobl9-go/internal/validation"
"github.com/nobl9/nobl9-go/manifest"
Expand Down Expand Up @@ -37,7 +38,7 @@ func GetMetadataAnnotationsTestCases[T manifest.Object](
t.Helper()

sourcedTestCases, err := os.ReadFile(filepath.Join(
testutils.FindModuleRoot(),
pathutils.FindModuleRoot(),
"manifest/v1alpha/metadata_annotations_examples.yaml"))
require.NoError(t, err)
var examples v1alpha.MetadataAnnotations
Expand Down

0 comments on commit e4adf41

Please sign in to comment.