2015-02-21 20:52:55 +01:00
|
|
|
package remote
|
|
|
|
|
2015-02-22 00:13:28 +01:00
|
|
|
import (
|
2021-05-17 21:43:35 +02:00
|
|
|
"github.com/hashicorp/terraform/internal/states/statemgr"
|
2015-02-22 00:13:28 +01:00
|
|
|
)
|
|
|
|
|
2015-02-21 20:52:55 +01:00
|
|
|
// Client is the interface that must be implemented for a remote state
|
|
|
|
// driver. It supports dumb put/get/delete, and the higher level structs
|
|
|
|
// handle persisting the state properly here.
|
|
|
|
type Client interface {
|
|
|
|
Get() (*Payload, error)
|
|
|
|
Put([]byte) error
|
|
|
|
Delete() error
|
|
|
|
}
|
|
|
|
|
2020-04-15 22:54:03 +02:00
|
|
|
// ClientForcePusher is an optional interface that allows a remote
|
|
|
|
// state to force push by managing a flag on the client that is
|
|
|
|
// toggled on by a call to EnableForcePush.
|
|
|
|
type ClientForcePusher interface {
|
|
|
|
Client
|
|
|
|
EnableForcePush()
|
|
|
|
}
|
|
|
|
|
2017-02-15 23:20:59 +01:00
|
|
|
// ClientLocker is an optional interface that allows a remote state
|
|
|
|
// backend to enable state lock/unlock.
|
|
|
|
type ClientLocker interface {
|
|
|
|
Client
|
2020-08-11 17:43:01 +02:00
|
|
|
statemgr.Locker
|
2017-02-15 23:20:59 +01:00
|
|
|
}
|
|
|
|
|
2015-02-21 20:52:55 +01:00
|
|
|
// Payload is the return value from the remote state storage.
|
|
|
|
type Payload struct {
|
|
|
|
MD5 []byte
|
|
|
|
Data []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
// Factory is the factory function to create a remote client.
|
|
|
|
type Factory func(map[string]string) (Client, error)
|