-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathproblem_details.go
More file actions
49 lines (42 loc) · 1.09 KB
/
problem_details.go
File metadata and controls
49 lines (42 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package openapi
import (
"net/http"
"github.com/free5gc/openapi/models"
)
func ProblemDetailsSystemFailure(detail string) *models.ProblemDetails {
return &models.ProblemDetails{
Title: "System failure",
Status: http.StatusInternalServerError,
Detail: detail,
Cause: "SYSTEM_FAILURE",
}
}
func ProblemDetailsOperationNotSupported() *models.ProblemDetails {
return &models.ProblemDetails{
Title: "Operation not supported",
Status: http.StatusNotImplemented,
Cause: "OPERATION_NOT_SUPPORTED",
}
}
func ProblemDetailsMalformedReqSyntax(detail string) *models.ProblemDetails {
return &models.ProblemDetails{
Title: "Malformed request syntax",
Status: http.StatusBadRequest,
Detail: detail,
}
}
func ProblemDetailsDataNotFound(detail string) *models.ProblemDetails {
return &models.ProblemDetails{
Title: "Data not found",
Status: http.StatusNotFound,
Detail: detail,
}
}
func ProblemDetailsForbidden(detail, cause string) *models.ProblemDetails {
return &models.ProblemDetails{
Title: "Forbidden",
Status: http.StatusForbidden,
Detail: detail,
Cause: cause,
}
}