Skip to content

Commit

Permalink
feat: stoptime in firehose start
Browse files Browse the repository at this point in the history
- will receive an optional field stop_time in body
- if received, it will set the value to stoptime to this value
  • Loading branch information
ishanarya0 committed Jul 18, 2023
1 parent 1538c02 commit f0f53f4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/firehose/driver_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package firehose
import (
"context"
"encoding/json"
"time"

"github.com/goto/entropy/core/module"
"github.com/goto/entropy/core/resource"
Expand Down Expand Up @@ -62,7 +63,16 @@ func (fd *firehoseDriver) planChange(exr module.ExpandedResource, act module.Act
curConf.Replicas = scaleParams.Replicas

case StartAction:
var startParams struct {
StopTime *time.Time `json:"stop_time"`
}
if err := json.Unmarshal(act.Params, &startParams); err != nil {
return nil, errors.ErrInvalid.WithMsgf("invalid params for start action").WithCausef(err.Error())
}
curConf.Stopped = false
if startParams.StopTime != nil {
curConf.StopTime = startParams.StopTime
}

case StopAction:
curConf.Stopped = true
Expand Down

0 comments on commit f0f53f4

Please sign in to comment.