diff --git a/api/types/usertasks/object.go b/api/types/usertasks/object.go
index dd29d203f58ac..9ac05733ac969 100644
--- a/api/types/usertasks/object.go
+++ b/api/types/usertasks/object.go
@@ -19,9 +19,7 @@
package usertasks
import (
- "embed"
"encoding/binary"
- "fmt"
"slices"
"strconv"
"time"
@@ -156,21 +154,6 @@ const (
AutoDiscoverEC2IssueSSMInvocationFailure = "ec2-ssm-invocation-failure"
)
-//go:embed descriptions/*.md
-var descriptionsFS embed.FS
-
-// DescriptionForDiscoverEC2Issue returns the description of the issue and fixing steps.
-// The returned string contains a markdown document.
-// If issue type is not recognized or doesn't have a specific description, them an empty string is returned.
-func DescriptionForDiscoverEC2Issue(issueType string) string {
- filename := fmt.Sprintf("descriptions/%s.md", issueType)
- bs, err := descriptionsFS.ReadFile(filename)
- if err != nil {
- return ""
- }
- return string(bs)
-}
-
// DiscoverEC2IssueTypes is a list of issue types that can occur when trying to auto enroll EC2 instances.
var DiscoverEC2IssueTypes = []string{
AutoDiscoverEC2IssueSSMInstanceNotRegistered,
diff --git a/api/types/usertasks/object_test.go b/api/types/usertasks/object_test.go
index 1e09316e77351..396a18613502d 100644
--- a/api/types/usertasks/object_test.go
+++ b/api/types/usertasks/object_test.go
@@ -465,9 +465,3 @@ func TestNewDiscoverEKSUserTask(t *testing.T) {
})
}
}
-
-func TestAllDescriptions(t *testing.T) {
- for _, issueType := range usertasks.DiscoverEC2IssueTypes {
- require.NotEmpty(t, usertasks.DescriptionForDiscoverEC2Issue(issueType), "issue type %q is missing descriptions/%s.md file", issueType, issueType)
- }
-}
diff --git a/lib/usertasks/descriptions.go b/lib/usertasks/descriptions.go
new file mode 100644
index 0000000000000..eb1655fee5ea7
--- /dev/null
+++ b/lib/usertasks/descriptions.go
@@ -0,0 +1,39 @@
+/*
+ * Teleport
+ * Copyright (C) 2024 Gravitational, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package usertasks
+
+import (
+ "embed"
+ "fmt"
+)
+
+//go:embed descriptions/*.md
+var descriptionsFS embed.FS
+
+// DescriptionForDiscoverEC2Issue returns the description of the issue and fixing steps.
+// The returned string contains a markdown document.
+// If issue type is not recognized or doesn't have a specific description, them an empty string is returned.
+func DescriptionForDiscoverEC2Issue(issueType string) string {
+ filename := fmt.Sprintf("descriptions/%s.md", issueType)
+ bs, err := descriptionsFS.ReadFile(filename)
+ if err != nil {
+ return ""
+ }
+ return string(bs)
+}
diff --git a/api/types/usertasks/descriptions/ec2-ssm-agent-connection-lost.md b/lib/usertasks/descriptions/ec2-ssm-agent-connection-lost.md
similarity index 100%
rename from api/types/usertasks/descriptions/ec2-ssm-agent-connection-lost.md
rename to lib/usertasks/descriptions/ec2-ssm-agent-connection-lost.md
diff --git a/api/types/usertasks/descriptions/ec2-ssm-agent-not-registered.md b/lib/usertasks/descriptions/ec2-ssm-agent-not-registered.md
similarity index 100%
rename from api/types/usertasks/descriptions/ec2-ssm-agent-not-registered.md
rename to lib/usertasks/descriptions/ec2-ssm-agent-not-registered.md
diff --git a/api/types/usertasks/descriptions/ec2-ssm-invocation-failure.md b/lib/usertasks/descriptions/ec2-ssm-invocation-failure.md
similarity index 100%
rename from api/types/usertasks/descriptions/ec2-ssm-invocation-failure.md
rename to lib/usertasks/descriptions/ec2-ssm-invocation-failure.md
diff --git a/api/types/usertasks/descriptions/ec2-ssm-script-failure.md b/lib/usertasks/descriptions/ec2-ssm-script-failure.md
similarity index 100%
rename from api/types/usertasks/descriptions/ec2-ssm-script-failure.md
rename to lib/usertasks/descriptions/ec2-ssm-script-failure.md
diff --git a/api/types/usertasks/descriptions/ec2-ssm-unsupported-os.md b/lib/usertasks/descriptions/ec2-ssm-unsupported-os.md
similarity index 100%
rename from api/types/usertasks/descriptions/ec2-ssm-unsupported-os.md
rename to lib/usertasks/descriptions/ec2-ssm-unsupported-os.md
diff --git a/lib/usertasks/descriptions_test.go b/lib/usertasks/descriptions_test.go
new file mode 100644
index 0000000000000..30a358ae1ea9d
--- /dev/null
+++ b/lib/usertasks/descriptions_test.go
@@ -0,0 +1,33 @@
+/*
+ * Teleport
+ * Copyright (C) 2024 Gravitational, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package usertasks
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ usertasksapi "github.com/gravitational/teleport/api/types/usertasks"
+)
+
+func TestAllDescriptions(t *testing.T) {
+ for _, issueType := range usertasksapi.DiscoverEC2IssueTypes {
+ require.NotEmpty(t, DescriptionForDiscoverEC2Issue(issueType), "issue type %q is missing descriptions/%s.md file", issueType, issueType)
+ }
+}
diff --git a/lib/web/ui/usertask.go b/lib/web/ui/usertask.go
index 0d06827a74683..02b174aeb1782 100644
--- a/lib/web/ui/usertask.go
+++ b/lib/web/ui/usertask.go
@@ -24,7 +24,7 @@ import (
"github.com/gravitational/trace"
usertasksv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/usertasks/v1"
- "github.com/gravitational/teleport/api/types/usertasks"
+ "github.com/gravitational/teleport/lib/usertasks"
)
// UserTask describes UserTask fields.