diff --git a/go.mod b/go.mod index 22ad6cda3..e69323802 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/hashicorp/go-slug v0.16.0 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.7.0 - github.com/hashicorp/jsonapi v1.3.1 + github.com/hashicorp/jsonapi v1.3.2 github.com/stretchr/testify v1.9.0 go.uber.org/mock v0.4.0 golang.org/x/sync v0.8.0 diff --git a/go.sum b/go.sum index 1293b8565..da2eab7f2 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/jsonapi v1.3.1 h1:GtPvnmcWgYwCuDGvYT5VZBHcUyFdq9lSyCzDjn1DdPo= -github.com/hashicorp/jsonapi v1.3.1/go.mod h1:kWfdn49yCjQvbpnvY1dxxAuAFzISwrrMDQOcu6NsFoM= +github.com/hashicorp/jsonapi v1.3.2 h1:gP3fX2ZT7qXi+PbwieptzkspIohO2kCSiBUvUTBAbMs= +github.com/hashicorp/jsonapi v1.3.2/go.mod h1:kWfdn49yCjQvbpnvY1dxxAuAFzISwrrMDQOcu6NsFoM= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/run_trigger.go b/run_trigger.go index e002271fa..930528bac 100644 --- a/run_trigger.go +++ b/run_trigger.go @@ -121,6 +121,10 @@ func (s *runTriggers) List(ctx context.Context, workspaceID string, options *Run return nil, err } + for i := range rtl.Items { + backfillDeprecatedSourceable(rtl.Items[i]) + } + return rtl, nil } @@ -145,6 +149,8 @@ func (s *runTriggers) Create(ctx context.Context, workspaceID string, options Ru return nil, err } + backfillDeprecatedSourceable(rt) + return rt, nil } @@ -166,6 +172,8 @@ func (s *runTriggers) Read(ctx context.Context, runTriggerID string) (*RunTrigge return nil, err } + backfillDeprecatedSourceable(rt) + return rt, nil } @@ -203,6 +211,14 @@ func (o *RunTriggerListOptions) valid() error { return nil } +func backfillDeprecatedSourceable(runTrigger *RunTrigger) { + if runTrigger.Sourceable != nil || runTrigger.SourceableChoice == nil { + return + } + + runTrigger.Sourceable = runTrigger.SourceableChoice.Workspace +} + func validateRunTriggerFilterParam(filterParam RunTriggerFilterOp, includeParams []RunTriggerIncludeOpt) error { switch filterParam { case RunTriggerOutbound, RunTriggerInbound: