Documentation ¶
Index ¶
Constants ¶
View Source
const KusionState = "kusion_state.json"
Variables ¶
View Source
var Backends = make(map[string]func() StateStorage)
View Source
var ErrOSSNoExist = errors.New("oss: key not exist")
View Source
var ErrS3NoExist = errors.New("s3: key not exist")
Functions ¶
func AddToBackends ¶
func AddToBackends(name string, storage func() StateStorage)
Types ¶
type DBState ¶
func (*DBState) ConfigSchema ¶
func (*DBState) GetLatestState ¶
func (s *DBState) GetLatestState(q *StateQuery) (*State, error)
type FileSystemState ¶
type FileSystemState struct { // state Path is in the same dir where command line is invoked Path string }
func (*FileSystemState) Apply ¶
func (f *FileSystemState) Apply(state *State) error
func (*FileSystemState) ConfigSchema ¶
func (f *FileSystemState) ConfigSchema() cty.Type
func (*FileSystemState) Delete ¶
func (f *FileSystemState) Delete(id string) error
func (*FileSystemState) GetLatestState ¶
func (f *FileSystemState) GetLatestState(query *StateQuery) (*State, error)
type OssState ¶
type OssState struct {
// contains filtered or unexported fields
}
func NewOSSState ¶
func (*OssState) GetLatestState ¶
func (s *OssState) GetLatestState(query *StateQuery) (*State, error)
type S3State ¶
type S3State struct {
// contains filtered or unexported fields
}
func NewS3State ¶
func (*S3State) GetLatestState ¶
func (s *S3State) GetLatestState(query *StateQuery) (*State, error)
type State ¶
type State struct { ID int64 `json:"id"` Tenant string `json:"tenant"` Stack string `json:"stack"` Project string `json:"project"` Version int `json:"version"` KusionVersion string `json:"kusionVersion"` Serial uint64 `json:"serial"` Operator string `json:"operator"` Resources models.Resources `json:"resources"` CreatTime time.Time `json:"creatTime"` ModifiedTime time.Time `json:"modifiedTime,omitempty"` }
State represent all resources state in one apply operation.
type StateQuery ¶
type StateStorage ¶
type StateStorage interface { // ConfigSchema returns a description of the expected configuration // structure for the receiving backend. ConfigSchema() cty.Type // Configure uses the provided configuration to set configuration fields // within the backend. Configure(obj cty.Value) error // GetLatestState return nil if state not exists GetLatestState(query *StateQuery) (*State, error) // Apply means update this state if it already exists or create a new one Apply(state *State) error // Delete State by id Delete(id string) error }
StateStorage represents the set of methods required for a State backend
func NewDBState ¶
func NewDBState() StateStorage
func NewFileSystemState ¶
func NewFileSystemState() StateStorage
Click to show internal directories.
Click to hide internal directories.