fix: handle "every" when defined inside of flux (#460)

This commit is contained in:
Jeffrey Smith II 2022-11-29 12:41:43 -05:00 committed by GitHub
parent 11859bdaf6
commit ac1eb0b620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,11 +93,16 @@ func (c Client) Create(ctx context.Context, params *CreateParams) error {
OrgID: org.IDOrNil(),
Org: org.NameOrNil(),
Name: &params.Name,
Every: &params.Every,
Cron: &params.Cron,
ScriptID: scriptID,
ScriptParameters: scriptParams,
}
// The FluxQuery can also contain the "every" field, so we only want to override if it is actually defined.
if params.Every != "" {
createRequest.Every = &params.Every
}
task, err := c.PostTasks(ctx).TaskCreateRequest(createRequest).Execute()
if err != nil {
return err