Skip to content

Commit c9deb5f

Browse files
committed
States
1 parent a09d652 commit c9deb5f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

cmd/gendoc/docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func NewOpenApiGenerator(version string) *Generator {
6969
openapi3.SchemaOrRef{
7070
Schema: &openapi3.Schema{
7171
UniqueItems: f.Ptr(true),
72-
Enum: f.Map(orchestrator.State("").AllowedStatuses(), func(v orchestrator.State) interface{} { return v }),
72+
Enum: f.Map(orchestrator.State("").AllowedStates(), func(v orchestrator.State) interface{} { return v }),
7373
Type: f.Ptr(openapi3.SchemaTypeString),
7474
Description: f.Ptr("Application status"),
7575
ReflectType: reflect.TypeOf(orchestrator.State("")),

internal/api/handlers/app_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func HandleAppList(
5353

5454
var stateFilter orchestrator.State
5555
if status := queryParams.Get("status"); status != "" {
56-
status, err := orchestrator.ParseStatus(status)
56+
status, err := orchestrator.ParseStates(status)
5757
if err != nil {
5858
render.EncodeResponse(w, http.StatusBadRequest, models.ErrorResponse{Details: "invalid status filter"})
5959
return

internal/orchestrator/status.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func StatusFromDockerState(s container.ContainerState) State {
4848
}
4949
}
5050

51-
func ParseStatus(s string) (State, error) {
51+
func ParseStates(s string) (State, error) {
5252
s1 := State(s)
5353
return s1, s1.Validate()
5454
}
@@ -58,10 +58,10 @@ func (s State) Validate() error {
5858
case StatusStarting, StatusRunning, StatusStopping, StatusStopped, StatusFailed:
5959
return nil
6060
default:
61-
return fmt.Errorf("status should be one of %v", s.AllowedStatuses())
61+
return fmt.Errorf("status should be one of %v", s.AllowedStates())
6262
}
6363
}
6464

65-
func (s State) AllowedStatuses() []State {
65+
func (s State) AllowedStates() []State {
6666
return []State{StatusStarting, StatusRunning, StatusStopping, StatusStopped, StatusFailed}
6767
}

0 commit comments

Comments
 (0)