2017-08-30 03:24:12 +02:00
|
|
|
// Copyright 2017, Pulumi Corporation. All rights reserved.
|
|
|
|
|
2017-08-23 01:56:15 +02:00
|
|
|
package engine
|
|
|
|
|
2017-10-02 20:14:27 +02:00
|
|
|
import (
|
2017-10-03 01:37:12 +02:00
|
|
|
"github.com/pulumi/pulumi/pkg/util/contract"
|
2017-10-02 20:14:27 +02:00
|
|
|
)
|
2017-08-23 01:56:15 +02:00
|
|
|
|
2018-01-20 21:07:03 +01:00
|
|
|
func Destroy(update Update, events chan<- Event, opts UpdateOptions) (ResourceChanges, error) {
|
2018-01-08 22:01:40 +01:00
|
|
|
contract.Require(update != nil, "update")
|
2017-10-03 01:37:12 +02:00
|
|
|
|
2017-10-23 00:52:00 +02:00
|
|
|
defer func() { events <- cancelEvent() }()
|
|
|
|
|
2018-01-08 23:20:51 +01:00
|
|
|
info, err := planContextFromUpdate(update)
|
2017-08-23 01:56:15 +02:00
|
|
|
if err != nil {
|
2018-01-20 21:07:03 +01:00
|
|
|
return nil, err
|
2017-08-23 01:56:15 +02:00
|
|
|
}
|
2017-11-09 02:08:51 +01:00
|
|
|
defer info.Close()
|
2017-08-23 01:56:15 +02:00
|
|
|
|
2018-01-08 23:20:51 +01:00
|
|
|
return deployLatest(info, deployOptions{
|
2018-01-18 20:10:15 +01:00
|
|
|
UpdateOptions: opts,
|
|
|
|
|
|
|
|
Destroy: true,
|
|
|
|
|
|
|
|
Events: events,
|
2018-01-31 18:41:42 +01:00
|
|
|
Diag: newEventSink(events),
|
2017-08-23 01:56:15 +02:00
|
|
|
})
|
|
|
|
}
|