remote

package
v0.5.4-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ParamsCounts = 4

Variables

View Source
var ErrOSSNoExist = errors.New("oss: key not exist")
View Source
var ErrS3NoExist = errors.New("s3: key not exist")

Functions

func NewDBState

func NewDBState() states.StateStorage

Types

type DBState

type DBState struct {
	DB *sql.DB
}

func (*DBState) Apply

func (s *DBState) Apply(state *states.State) error

Apply save state in DB by add-only strategy.

func (*DBState) ConfigSchema

func (s *DBState) ConfigSchema() cty.Type

func (*DBState) Configure

func (s *DBState) Configure(obj cty.Value) error

func (*DBState) Delete

func (s *DBState) Delete(id string) error

func (*DBState) GetLatestState

func (s *DBState) GetLatestState(q *states.StateQuery) (*states.State, error)

type HTTPState

type HTTPState struct {
	// contains filtered or unexported fields
}

HTTPState represent a remote state that can be requested by HTTP. This state is designed to provide a generic way to manipulate State in third-party services

Some url formats are given to bring relative flexibility for third-party services to implement their own State HTTP service and these formats MUST contain 4 "%s" placeholders for tenant, project and stack, since we will replace this format with fmt.Sprintf() Let's get applyURLFormat as an example to demonstrate how this suffix format works.

 Example:

	urlPrefix = "http://kusionstack.io"
	applyURLFormat = "/apis/v1/tenants/%s/projects/%s/stacks/%s/clusters/%s/states/"
	tenant = "t"
	project = "p"
	stack = "s"
 cluster = "c"
	the final request URL = "http://kusionstack.io/apis/v1/tenants/t/projects/p/stacks/s/clusters/c/states"

func NewHTTPState

func NewHTTPState(params map[string]interface{}) (*HTTPState, error)

NewHTTPState builds a new HTTPState with ConfigSchema() and validates params with Configure()

func (*HTTPState) Apply

func (s *HTTPState) Apply(state *states.State) error

Apply is an implementation of StateStorage.Apply

func (*HTTPState) ConfigSchema

func (s *HTTPState) ConfigSchema() cty.Type

ConfigSchema is an implementation of StateStorage.ConfigSchema

func (*HTTPState) Configure

func (s *HTTPState) Configure(obj cty.Value) error

Configure is an implementation of StateStorage.Configure

func (*HTTPState) Delete

func (s *HTTPState) Delete(id string) error

Delete is not support now

func (*HTTPState) GetLatestState

func (s *HTTPState) GetLatestState(query *states.StateQuery) (*states.State, error)

GetLatestState is an implementation of StateStorage.GetLatestState

type OssState

type OssState struct {
	// contains filtered or unexported fields
}

func NewOSSState

func NewOSSState(endPoint, accessKeyID, accessKeySecret, bucketName string) (*OssState, error)

func (*OssState) Apply

func (s *OssState) Apply(state *states.State) error

func (*OssState) ConfigSchema

func (s *OssState) ConfigSchema() cty.Type

ConfigSchema returns a description of the expected configuration structure for the receiving backend.

func (*OssState) Configure

func (s *OssState) Configure(obj cty.Value) error

Configure uses the provided configuration to set configuration fields within the OssState backend.

func (*OssState) Delete

func (s *OssState) Delete(id string) error

func (*OssState) GetLatestState

func (s *OssState) GetLatestState(query *states.StateQuery) (*states.State, error)

type S3State

type S3State struct {
	// contains filtered or unexported fields
}

func NewS3State

func NewS3State(endPoint, accessKeyID, accessKeySecret, bucketName string, region string) (*S3State, error)

func (*S3State) Apply

func (s *S3State) Apply(state *states.State) error

func (*S3State) ConfigSchema

func (s *S3State) ConfigSchema() cty.Type

ConfigSchema returns a description of the expected configuration structure for the receiving backend.

func (*S3State) Configure

func (s *S3State) Configure(obj cty.Value) error

Configure uses the provided configuration to set configuration fields within the S3State backend.

func (*S3State) Delete

func (s *S3State) Delete(id string) error

func (*S3State) GetLatestState

func (s *S3State) GetLatestState(query *states.StateQuery) (*states.State, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL