http

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ParamsCounts = 4

Variables

This section is empty.

Functions

func NewHTTPBackend

func NewHTTPBackend() states.Backend

Types

type HTTPBackend

type HTTPBackend struct {
	HTTPState
}

func (*HTTPBackend) ConfigSchema

func (b *HTTPBackend) ConfigSchema() cty.Type

ConfigSchema is an implementation of StateStorage.ConfigSchema

func (*HTTPBackend) Configure

func (b *HTTPBackend) Configure(obj cty.Value) error

Configure is an implementation of StateStorage.Configure

func (*HTTPBackend) StateStorage

func (b *HTTPBackend) StateStorage() states.StateStorage

StateStorage return a StateStorage to manage http State

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 (*HTTPState) Apply

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

Apply is an implementation of StateStorage.Apply

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

Jump to

Keyboard shortcuts

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