Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

chore: Moved common models from shipyard to go-utils #412

Merged
merged 6 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions pkg/api/models/sequencecancellation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package models

type SequenceTimeout struct {
RealAnna marked this conversation as resolved.
Show resolved Hide resolved
KeptnContext string
LastEvent KeptnContextExtendedCE
}

type SequenceControlState string
RealAnna marked this conversation as resolved.
Show resolved Hide resolved

const (
PauseSequence SequenceControlState = "pause"
RealAnna marked this conversation as resolved.
Show resolved Hide resolved
ResumeSequence SequenceControlState = "resume"
AbortSequence SequenceControlState = "abort"
)

type SequenceControl struct {
RealAnna marked this conversation as resolved.
Show resolved Hide resolved
State SequenceControlState
KeptnContext string
Stage string
Project string
}
9 changes: 9 additions & 0 deletions pkg/api/models/sequencecontrol.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package models

type SequenceControlCommand struct {
RealAnna marked this conversation as resolved.
Show resolved Hide resolved
State SequenceControlState `json:"state" binding:"required"`
Stage string `json:"stage"`
}

type SequenceControlResponse struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type SequenceControlResponse should have comment or be unexported

}
103 changes: 103 additions & 0 deletions pkg/api/models/state.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package models

const (
SequenceTriggeredState = "triggered"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported const SequenceTriggeredState should have comment (or a comment on this block) or be unexported

SequenceStartedState = "started"
SequenceWaitingState = "waiting"
SequenceWaitingForApprovalState = "waitingForApproval"
SequenceFinished = "finished"
TimedOut = "timedOut"
SequencePaused = "paused"
SequenceAborted = "aborted"
)

type GetSequenceStateParams struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type GetSequenceStateParams should have comment or be unexported

/*Pointer to the next set of items
In: query
*/
NextPageKey int64 `form:"nextPageKey" json:"nextPageKey"`
/*The number of items to return
Maximum: 50
Minimum: 1
In: query
Default: 20
*/
PageSize int64 `form:"pageSize" json:"pageSize"`
/*Project name
In: query
*/
Project string `form:"project" json:"project"`

/*Sequence name
In: query
*/
Name string `form:"name" json:"name"`

/*Sequence status
In: query
*/
State string `form:"state" json:"state"`

/*From time to fetch sequence states
In: query
*/
FromTime string `form:"fromTime" json:"fromTime"`

/*Before time to fetch sequence states
In: query
*/
BeforeTime string `form:"beforeTime" json:"beforeTime"`

/** Keptn context
In: query
*/
KeptnContext string `form:"keptnContext" json:"keptnContext"`
}

type StateFilter struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported type StateFilter should have comment or be unexported

GetSequenceStateParams
}

type SequenceStateEvaluation struct {
RealAnna marked this conversation as resolved.
Show resolved Hide resolved
Result string `json:"result" bson:"result"`
Score float64 `json:"score" bson:"score"`
}

type SequenceStateEvent struct {
RealAnna marked this conversation as resolved.
Show resolved Hide resolved
Type string `json:"type" bson:"type"`
ID string `json:"id" bson:"id"`

Time string `json:"time" bson:"time"`
}

type SequenceStateStage struct {
RealAnna marked this conversation as resolved.
Show resolved Hide resolved
Name string `json:"name" bson:"name"`
Image string `json:"image,omitempty" bson:"image"`
State string `json:"state" bson:"state"`
LatestEvaluation *SequenceStateEvaluation `json:"latestEvaluation,omitempty" bson:"latestEvaluation"`
LatestEvent *SequenceStateEvent `json:"latestEvent,omitempty" bson:"latestEvent"`
LatestFailedEvent *SequenceStateEvent `json:"latestFailedEvent,omitempty" bson:"latestFailedEvent"`
}

type SequenceState struct {
RealAnna marked this conversation as resolved.
Show resolved Hide resolved
Name string `json:"name" bson:"name"`
Service string `json:"service" bson:"service"`
Project string `json:"project" bson:"project"`
Time string `json:"time" bson:"time"`
Shkeptncontext string `json:"shkeptncontext" bson:"shkeptncontext"`
State string `json:"state" bson:"state"`
Stages []SequenceStateStage `json:"stages" bson:"stages"`
ProblemTitle string `json:"problemTitle,omitempty" bson:"problemTitle"`
}

type SequenceStates struct {
RealAnna marked this conversation as resolved.
Show resolved Hide resolved
States []SequenceState `json:"states"`
// Pointer to next page
NextPageKey int64 `json:"nextPageKey,omitempty"`

// Size of returned page
PageSize int64 `json:"pageSize,omitempty"`

// Total number of events
TotalCount int64 `json:"totalCount,omitempty"`
}