Skip to content

Commit 2cb0ea0

Browse files
authored
Upgrade to go-provider 1.0 (#763)
* Upgrades go-provider to 1.0. * Modifies tests to use `property.Map` instead of `resource.PropertyMap`. * Updates command outputs to use `AssetOrArchive`.
1 parent 79f663e commit 2cb0ea0

File tree

16 files changed

+307
-271
lines changed

16 files changed

+307
-271
lines changed

provider/cmd/pulumi-resource-command/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
package main
1616

1717
import (
18+
"context"
1819
"fmt"
1920
"os"
2021
"strings"
2122

22-
p "github.com/pulumi/pulumi-go-provider"
23-
2423
command "github.com/pulumi/pulumi-command/provider/pkg/provider"
2524
"github.com/pulumi/pulumi-command/provider/pkg/version"
2625
)
@@ -34,7 +33,7 @@ func main() {
3433
commandProvider := command.NewProvider()
3534

3635
// This method starts serving requests using the Command provider.
37-
err := p.RunProvider("command", version, commandProvider)
36+
err := commandProvider.Run(context.Background(), "command", version)
3837
if err != nil {
3938
fmt.Fprintf(os.Stderr, "Error: %s", err.Error())
4039
os.Exit(1)

provider/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/gobwas/glob v0.2.3
1111
github.com/pkg/sftp v1.13.6
1212
github.com/pulumi/providertest v0.3.1
13-
github.com/pulumi/pulumi-go-provider v0.26.0
13+
github.com/pulumi/pulumi-go-provider v1.0.1
1414
github.com/pulumi/pulumi/sdk/v3 v3.171.0
1515
github.com/stretchr/testify v1.10.0
1616
golang.org/x/crypto v0.37.0
@@ -48,6 +48,7 @@ require (
4848
github.com/gogo/protobuf v1.3.2 // indirect
4949
github.com/golang/glog v1.2.4 // indirect
5050
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
51+
github.com/golang/protobuf v1.5.4 // indirect
5152
github.com/google/uuid v1.6.0 // indirect
5253
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
5354
github.com/hashicorp/errwrap v1.1.0 // indirect
@@ -64,7 +65,6 @@ require (
6465
github.com/mattn/go-runewidth v0.0.16 // indirect
6566
github.com/mitchellh/go-ps v1.0.0 // indirect
6667
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
67-
github.com/mitchellh/mapstructure v1.5.0 // indirect
6868
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
6969
github.com/muesli/cancelreader v0.2.2 // indirect
7070
github.com/muesli/termenv v0.16.0 // indirect

provider/go.sum

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
109109
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
110110
github.com/hashicorp/hcl/v2 v2.23.0 h1:Fphj1/gCylPxHutVSEOf2fBOh1VE4AuLV7+kbJf3qos=
111111
github.com/hashicorp/hcl/v2 v2.23.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA=
112+
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
113+
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
112114
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
113115
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
114116
github.com/iwdgo/sigintwindows v0.2.2 h1:P6oWzpvV7MrEAmhUgs+zmarrWkyL77ycZz4v7+1gYAE=
@@ -147,8 +149,6 @@ github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc
147149
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
148150
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
149151
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
150-
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
151-
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
152152
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
153153
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
154154
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
@@ -184,10 +184,12 @@ github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 h1:vkHw5I/plNdTr435
184184
github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231/go.mod h1:murToZ2N9hNJzewjHBgfFdXhZKjY3z5cYC1VXk+lbFE=
185185
github.com/pulumi/esc v0.14.2 h1:xHpjJXzKs1hk/QPpgwe1Rmif3VWA0QcZ7jDvTFYX/jM=
186186
github.com/pulumi/esc v0.14.2/go.mod h1:0dNzCWIiRUmdfFrhHdeBzU4GiDPBhSfpeWDNApZwZ08=
187+
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
188+
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
187189
github.com/pulumi/providertest v0.3.1 h1:vlftr7TZlObh81mL88IhhF0/9ZbLrZZos4NAvR4HUUw=
188190
github.com/pulumi/providertest v0.3.1/go.mod h1:fFHUP4/9DRyYnHWiRnwcynMtM/a7hHR/QcJfcuZKO3A=
189-
github.com/pulumi/pulumi-go-provider v0.26.0 h1:3ia10+irvv7qPph2NZ2YwUGI/KCf6li8Frlc1luv7D4=
190-
github.com/pulumi/pulumi-go-provider v0.26.0/go.mod h1:zJiGxY5xnodPzLulpRS+fsS960MzeCdlsdiVCZ5TMRA=
191+
github.com/pulumi/pulumi-go-provider v1.0.1 h1:MoTVvEn1iG9vi/Uf9a5kodRrqEYAMb469SDKc7mCYW0=
192+
github.com/pulumi/pulumi-go-provider v1.0.1/go.mod h1:bWvFWytb2ULBefjDW/YG+GcjHbzVojwtl1RW5afMvR0=
191193
github.com/pulumi/pulumi/pkg/v3 v3.171.0 h1:cukcwAopjK6WaVMR5suVcEAtyrJHndZFvoKYJf+rS68=
192194
github.com/pulumi/pulumi/pkg/v3 v3.171.0/go.mod h1:BDjFxpyeqoZcv6dLj6kFN4NhGkhln502ZuwFwepjGl4=
193195
github.com/pulumi/pulumi/sdk/v3 v3.171.0 h1:YoSsza9vHnH1HenX/LW9utFsol2JpiLBj0DX8WV/QYY=
@@ -211,6 +213,8 @@ github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG
211213
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
212214
github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8=
213215
github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY=
216+
github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=
217+
github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
214218
github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA=
215219
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
216220
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=

provider/pkg/provider/local/base.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package local
1616

1717
import (
1818
"github.com/pulumi/pulumi-go-provider/infer"
19+
"github.com/pulumi/pulumi-go-provider/infer/types"
1920
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
2021
)
2122

@@ -127,10 +128,10 @@ Defaults to true.`)
127128
}
128129

129130
type BaseOutputs struct {
130-
Stdout string `pulumi:"stdout"`
131-
Stderr string `pulumi:"stderr"`
132-
Assets *map[string]*resource.Asset `pulumi:"assets,optional"`
133-
Archive *resource.Archive `pulumi:"archive,optional"`
131+
Stdout string `pulumi:"stdout"`
132+
Stderr string `pulumi:"stderr"`
133+
Assets *map[string]*types.AssetOrArchive `pulumi:"assets,optional"`
134+
Archive *resource.Archive `pulumi:"archive,optional"`
134135
}
135136

136137
// Implementing Annotate lets you provide descriptions and default values for fields and they will

provider/pkg/provider/local/commandController.go

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,26 @@ var _ = (infer.CustomUpdate[CommandInputs, CommandOutputs])((*Command)(nil))
3030
var _ = (infer.CustomDelete[CommandOutputs])((*Command)(nil))
3131

3232
// This is the Create method. This will be run on every Command resource creation.
33-
func (c *Command) Create(ctx context.Context, name string, input CommandInputs, preview bool) (string, CommandOutputs, error) {
33+
func (c *Command) Create(ctx context.Context, req infer.CreateRequest[CommandInputs]) (infer.CreateResponse[CommandOutputs], error) {
34+
name := req.Name
35+
input := req.Inputs
36+
preview := req.DryRun
3437
state := CommandOutputs{CommandInputs: input}
3538
id, err := resource.NewUniqueHex(name, 8, 0)
3639
if err != nil {
37-
return id, state, err
40+
return infer.CreateResponse[CommandOutputs]{ID: id, Output: state}, err
3841
}
3942

4043
// If in preview, don't run the command.
4144
if preview {
42-
return id, state, nil
45+
return infer.CreateResponse[CommandOutputs]{ID: id, Output: state}, nil
4346
}
4447
if input.Create == nil {
45-
return id, state, nil
48+
return infer.CreateResponse[CommandOutputs]{ID: id, Output: state}, nil
4649
}
4750
cmd := *input.Create
4851
err = run(ctx, cmd, state.BaseInputs, &state.BaseOutputs, input.Logging)
49-
return id, state, err
52+
return infer.CreateResponse[CommandOutputs]{ID: id, Output: state}, err
5053
}
5154

5255
// WireDependencies controls how secrets and unknowns flow through a resource.
@@ -57,11 +60,14 @@ func (c *Command) Create(ctx context.Context, name string, input CommandInputs,
5760
// Because we want every output to depend on every input, we can leave the default behavior.
5861

5962
// The Update method will be run on every update.
60-
func (c *Command) Update(ctx context.Context, id string, olds CommandOutputs, news CommandInputs, preview bool) (CommandOutputs, error) {
63+
func (c *Command) Update(ctx context.Context, req infer.UpdateRequest[CommandInputs, CommandOutputs]) (infer.UpdateResponse[CommandOutputs], error) {
64+
olds := req.State
65+
news := req.Inputs
66+
preview := req.DryRun
6167
state := CommandOutputs{CommandInputs: news, BaseOutputs: olds.BaseOutputs}
6268
// If in preview, don't run the command.
6369
if preview {
64-
return state, nil
70+
return infer.UpdateResponse[CommandOutputs]{Output: state}, nil
6571
}
6672
// Use Create command if Update is unspecified.
6773
cmd := news.Create
@@ -70,16 +76,17 @@ func (c *Command) Update(ctx context.Context, id string, olds CommandOutputs, ne
7076
}
7177
// If neither are specified, do nothing.
7278
if cmd == nil {
73-
return state, nil
79+
return infer.UpdateResponse[CommandOutputs]{Output: state}, nil
7480
}
7581
err := run(ctx, *cmd, state.BaseInputs, &state.BaseOutputs, news.Logging)
76-
return state, err
82+
return infer.UpdateResponse[CommandOutputs]{Output: state}, err
7783
}
7884

7985
// The Delete method will run when the resource is deleted.
80-
func (c *Command) Delete(ctx context.Context, id string, props CommandOutputs) error {
86+
func (c *Command) Delete(ctx context.Context, req infer.DeleteRequest[CommandOutputs]) (infer.DeleteResponse, error) {
87+
props := req.State
8188
if props.Delete == nil {
82-
return nil
89+
return infer.DeleteResponse{}, nil
8390
}
84-
return run(ctx, *props.Delete, props.BaseInputs, &props.BaseOutputs, props.Logging)
91+
return infer.DeleteResponse{}, run(ctx, *props.Delete, props.BaseInputs, &props.BaseOutputs, props.Logging)
8592
}

provider/pkg/provider/local/commandController_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ import (
2121

2222
"github.com/pulumi/pulumi-command/provider/pkg/provider/common"
2323
"github.com/pulumi/pulumi-command/provider/pkg/provider/util/testutil"
24+
"github.com/pulumi/pulumi-go-provider/infer"
2425
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
2526
"github.com/stretchr/testify/require"
2627
)
2728

2829
func TestOptionalLogging(t *testing.T) {
2930
for _, logMode := range Logging.Values(LogStdoutAndStderr) {
30-
3131
t.Run(logMode.Name, func(t *testing.T) {
3232
cmd := Command{}
3333

34-
ctx := testutil.TestContext{Context: context.Background()}
34+
ctx := &testutil.TestContext{Context: context.Background()}
3535
input := CommandInputs{
3636
BaseInputs: BaseInputs{
3737
Logging: &logMode.Value,
@@ -41,7 +41,7 @@ func TestOptionalLogging(t *testing.T) {
4141
},
4242
}
4343

44-
_, _, err := cmd.Create(&ctx, "name", input, false /* preview */)
44+
_, err := cmd.Create(ctx, infer.CreateRequest[CommandInputs]{Name: "name", Inputs: input, DryRun: false})
4545
require.NoError(t, err)
4646

4747
log := ctx.Output.String()

provider/pkg/provider/local/commandOutputs.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"strings"
2828

2929
"github.com/gobwas/glob"
30+
"github.com/pulumi/pulumi-go-provider/infer/types"
3031
"github.com/pulumi/pulumi/sdk/v3/go/common/diag"
3132
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
3233
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
@@ -119,14 +120,14 @@ func run(ctx context.Context, command string, in BaseInputs, out *BaseOutputs, l
119120
}
120121

121122
if in.ArchivePaths != nil {
122-
archiveAssets := map[string]interface{}{}
123+
archiveAssets := map[string]any{}
123124
assets, err := globAssets(cmd.Dir, *in.ArchivePaths)
124125
if err != nil {
125126
return err
126127
}
127128

128129
for path, asset := range assets {
129-
archiveAssets[path] = asset
130+
archiveAssets[path] = asset.Asset
130131
}
131132

132133
archive, err := resource.NewAssetArchive(archiveAssets)
@@ -142,8 +143,8 @@ func run(ctx context.Context, command string, in BaseInputs, out *BaseOutputs, l
142143
return nil
143144
}
144145

145-
func globAssets(dir string, globs []string) (map[string]*resource.Asset, error) {
146-
assets := map[string]*resource.Asset{}
146+
func globAssets(dir string, globs []string) (map[string]*types.AssetOrArchive, error) {
147+
assets := map[string]*types.AssetOrArchive{}
147148
compiledGlobs := make([]glob.Glob, len(globs))
148149
isGlobExclude := make([]bool, len(globs))
149150
for i, g := range globs {
@@ -172,10 +173,11 @@ func globAssets(dir string, globs []string) (map[string]*resource.Asset, error)
172173
if isGlobExclude[i] {
173174
delete(assets, p)
174175
} else {
175-
assets[p], err = resource.NewPathAsset(path.Join(dir, p))
176+
asset, err := resource.NewPathAsset(path.Join(dir, p))
176177
if err != nil {
177178
return err
178179
}
180+
assets[p] = &types.AssetOrArchive{Asset: asset}
179181
}
180182
}
181183
return nil

provider/pkg/provider/local/runController.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@
1414

1515
package local
1616

17-
import "context"
17+
import (
18+
"context"
1819

19-
// This is the Call method. It takes a RunInputs parameter and runs the command specified in
20+
"github.com/pulumi/pulumi-go-provider/infer"
21+
)
22+
23+
// Invoke takes a RunInputs parameter and runs the command specified in
2024
// it.
21-
func (*Run) Call(ctx context.Context, input RunInputs) (RunOutputs, error) {
25+
func (*Run) Invoke(ctx context.Context, req infer.FunctionRequest[RunInputs]) (infer.FunctionResponse[RunOutputs], error) {
26+
input := req.Input
2227
r := RunOutputs{RunInputs: input}
2328
err := run(ctx, input.Command, r.RunInputs.BaseInputs, &r.BaseOutputs, input.Logging)
24-
return r, err
29+
return infer.FunctionResponse[RunOutputs]{Output: r}, err
2530
}

provider/pkg/provider/provider.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,15 @@ func NewProvider() p.Provider {
8181
// A list of `infer.Resource` that are provided by the provider.
8282
Resources: []infer.InferredResource{
8383
// The Command resource implementation is commented extensively for new pulumi-go-provider developers.
84-
infer.Resource[
85-
// 1. This type is an interface that implements the logic for the Resource
86-
// these methods include `Create`, `Update`, `Delete`, and `WireDependencies`.
87-
// `WireDependencies` should be implemented to preserve the secretness of an input
88-
*local.Command,
89-
// 2. The type of the Inputs/Arguments to supply to the Resource.
90-
local.CommandInputs,
91-
// 3. The type of the Output/Properties/Fields of a created Resource.
92-
local.CommandOutputs,
93-
](),
94-
infer.Resource[*remote.Command, remote.CommandInputs, remote.CommandOutputs](),
95-
infer.Resource[*remote.CopyToRemote, remote.CopyToRemoteInputs, remote.CopyToRemoteOutputs](),
96-
infer.Resource[*remote.CopyFile, remote.CopyFileInputs, remote.CopyFileOutputs](),
84+
infer.Resource(&local.Command{}),
85+
infer.Resource(&remote.Command{}),
86+
infer.Resource(&remote.CopyToRemote{}),
87+
infer.Resource(&remote.CopyFile{}),
9788
},
9889
// Functions or invokes that are provided by the provider.
9990
Functions: []infer.InferredFunction{
10091
// The Run function is commented extensively for new pulumi-go-provider developers.
101-
infer.Function[*local.Run, local.RunInputs, local.RunOutputs](),
92+
infer.Function(&local.Run{}),
10293
},
10394
})
10495
}

provider/pkg/provider/remote/commandController.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,22 @@ var _ = (infer.CustomUpdate[CommandInputs, CommandOutputs])((*Command)(nil))
2828
var _ = (infer.CustomDelete[CommandOutputs])((*Command)(nil))
2929

3030
// This is the Create method. This will be run on every Command resource creation.
31-
func (*Command) Create(ctx context.Context, name string, input CommandInputs, preview bool) (string, CommandOutputs, error) {
31+
func (*Command) Create(ctx context.Context, req infer.CreateRequest[CommandInputs]) (infer.CreateResponse[CommandOutputs], error) {
32+
name := req.Name
33+
input := req.Inputs
34+
preview := req.DryRun
3235
state := CommandOutputs{CommandInputs: input}
3336
var err error
3437
id, err := resource.NewUniqueHex(name, 8, 0)
3538
if err != nil {
36-
return "", state, err
39+
return infer.CreateResponse[CommandOutputs]{ID: "", Output: state}, err
3740
}
3841
if preview {
39-
return id, state, nil
42+
return infer.CreateResponse[CommandOutputs]{ID: id, Output: state}, nil
4043
}
4144

4245
if state.Create == nil {
43-
return id, state, nil
46+
return infer.CreateResponse[CommandOutputs]{ID: id, Output: state}, nil
4447
}
4548
cmd := ""
4649
if state.Create != nil {
@@ -50,14 +53,17 @@ func (*Command) Create(ctx context.Context, name string, input CommandInputs, pr
5053
if !preview {
5154
err = state.run(ctx, cmd, input.Logging)
5255
}
53-
return id, state, err
56+
return infer.CreateResponse[CommandOutputs]{ID: id, Output: state}, err
5457
}
5558

5659
// The Update method will be run on every update.
57-
func (*Command) Update(ctx context.Context, id string, olds CommandOutputs, news CommandInputs, preview bool) (CommandOutputs, error) {
60+
func (*Command) Update(ctx context.Context, req infer.UpdateRequest[CommandInputs, CommandOutputs]) (infer.UpdateResponse[CommandOutputs], error) {
61+
olds := req.State
62+
news := req.Inputs
63+
preview := req.DryRun
5864
state := CommandOutputs{CommandInputs: news, BaseOutputs: olds.BaseOutputs}
5965
if preview {
60-
return state, nil
66+
return infer.UpdateResponse[CommandOutputs]{Output: state}, nil
6167
}
6268
var err error
6369
if !preview {
@@ -67,13 +73,14 @@ func (*Command) Update(ctx context.Context, id string, olds CommandOutputs, news
6773
err = state.run(ctx, *news.Create, news.Logging)
6874
}
6975
}
70-
return state, err
76+
return infer.UpdateResponse[CommandOutputs]{Output: state}, err
7177
}
7278

7379
// The Delete method will run when the resource is deleted.
74-
func (*Command) Delete(ctx context.Context, id string, props CommandOutputs) error {
80+
func (*Command) Delete(ctx context.Context, req infer.DeleteRequest[CommandOutputs]) (infer.DeleteResponse, error) {
81+
props := req.State
7582
if props.Delete == nil {
76-
return nil
83+
return infer.DeleteResponse{}, nil
7784
}
78-
return props.run(ctx, *props.Delete, props.Logging)
85+
return infer.DeleteResponse{}, props.run(ctx, *props.Delete, props.Logging)
7986
}

0 commit comments

Comments
 (0)