resources

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	State_STARTED  State = "started"
	State_STOPPED  State = "stopped"
	State_ENABLED  State = "enabled"
	State_DISABLED State = "disabled"
	State_IGNORED  State = "ignored"

	Type_CT Type = "ct"
	Type_VM Type = "vm"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(c HTTPClient) *Client

func (*Client) Create

func (c *Client) Create(ctx context.Context, req CreateRequest) error

Create Create a new HA resource.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, req DeleteRequest) error

Delete Delete resource configuration.

func (*Client) Find

func (c *Client) Find(ctx context.Context, req FindRequest) (FindResponse, error)

Find Read resource configuration.

func (*Client) Index

func (c *Client) Index(ctx context.Context, req IndexRequest) ([]IndexResponse, error)

Index List HA resources.

func (*Client) Migrate

func (c *Client) Migrate(ctx context.Context, req MigrateRequest) error

Migrate Request resource migration (online) to another node.

func (*Client) Relocate

func (c *Client) Relocate(ctx context.Context, req RelocateRequest) error

Relocate Request resource relocatzion to another node. This stops the service on the old node, and restarts it on the target node.

func (*Client) Update

func (c *Client) Update(ctx context.Context, req UpdateRequest) error

Update Update resource configuration.

type CreateRequest

type CreateRequest struct {
	Sid string `url:"sid" json:"sid"` // HA resource ID. This consists of a resource type followed by a resource specific name, separated with colon (example: vm:100 / ct:100). For virtual machines and containers, you can simply use the VM or CT id as a shortcut (example: 100).

	// The following parameters are optional
	Comment     *string `url:"comment,omitempty" json:"comment,omitempty"`           // Description.
	Group       *string `url:"group,omitempty" json:"group,omitempty"`               // The HA group identifier.
	MaxRelocate *int    `url:"max_relocate,omitempty" json:"max_relocate,omitempty"` // Maximal number of service relocate tries when a service failes to start.
	MaxRestart  *int    `url:"max_restart,omitempty" json:"max_restart,omitempty"`   // Maximal number of tries to restart the service on a node after its start failed.
	State       *State  `url:"state,omitempty" json:"state,omitempty"`               // Requested resource state.
	Type        *Type   `url:"type,omitempty" json:"type,omitempty"`                 // Resource type.
}

type DeleteRequest

type DeleteRequest struct {
	Sid string `url:"sid" json:"sid"` // HA resource ID. This consists of a resource type followed by a resource specific name, separated with colon (example: vm:100 / ct:100). For virtual machines and containers, you can simply use the VM or CT id as a shortcut (example: 100).

}

type FindRequest

type FindRequest struct {
	Sid string `url:"sid" json:"sid"` // HA resource ID. This consists of a resource type followed by a resource specific name, separated with colon (example: vm:100 / ct:100). For virtual machines and containers, you can simply use the VM or CT id as a shortcut (example: 100).

}

type FindResponse

type FindResponse struct {
	Digest string `url:"digest" json:"digest"` // Can be used to prevent concurrent modifications.
	Sid    string `url:"sid" json:"sid"`       // HA resource ID. This consists of a resource type followed by a resource specific name, separated with colon (example: vm:100 / ct:100). For virtual machines and containers, you can simply use the VM or CT id as a shortcut (example: 100).
	Type   string `url:"type" json:"type"`     // The type of the resources.

	// The following parameters are optional
	Comment     *string `url:"comment,omitempty" json:"comment,omitempty"`           // Description.
	Group       *string `url:"group,omitempty" json:"group,omitempty"`               // The HA group identifier.
	MaxRelocate *int    `url:"max_relocate,omitempty" json:"max_relocate,omitempty"` // Maximal number of service relocate tries when a service failes to start.
	MaxRestart  *int    `url:"max_restart,omitempty" json:"max_restart,omitempty"`   // Maximal number of tries to restart the service on a node after its start failed.
	State       *State  `url:"state,omitempty" json:"state,omitempty"`               // Requested resource state.
}

type HTTPClient

type HTTPClient interface {
	Do(context.Context, string, string, interface{}, interface{}) error
}

type IndexRequest

type IndexRequest struct {

	// The following parameters are optional
	Type *Type `url:"type,omitempty" json:"type,omitempty"` // Only list resources of specific type
}

type IndexResponse

type IndexResponse struct {
	Sid string `url:"sid" json:"sid"`
}

type MigrateRequest

type MigrateRequest struct {
	Node string `url:"node" json:"node"` // Target node.
	Sid  string `url:"sid" json:"sid"`   // HA resource ID. This consists of a resource type followed by a resource specific name, separated with colon (example: vm:100 / ct:100). For virtual machines and containers, you can simply use the VM or CT id as a shortcut (example: 100).

}

type RelocateRequest

type RelocateRequest struct {
	Node string `url:"node" json:"node"` // Target node.
	Sid  string `url:"sid" json:"sid"`   // HA resource ID. This consists of a resource type followed by a resource specific name, separated with colon (example: vm:100 / ct:100). For virtual machines and containers, you can simply use the VM or CT id as a shortcut (example: 100).

}

type State added in v0.0.15

type State string

func PtrState added in v0.0.15

func PtrState(i State) *State

type Type added in v0.0.15

type Type string

func PtrType added in v0.0.15

func PtrType(i Type) *Type

type UpdateRequest

type UpdateRequest struct {
	Sid string `url:"sid" json:"sid"` // HA resource ID. This consists of a resource type followed by a resource specific name, separated with colon (example: vm:100 / ct:100). For virtual machines and containers, you can simply use the VM or CT id as a shortcut (example: 100).

	// The following parameters are optional
	Comment     *string `url:"comment,omitempty" json:"comment,omitempty"`           // Description.
	Delete      *string `url:"delete,omitempty" json:"delete,omitempty"`             // A list of settings you want to delete.
	Digest      *string `url:"digest,omitempty" json:"digest,omitempty"`             // Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.
	Group       *string `url:"group,omitempty" json:"group,omitempty"`               // The HA group identifier.
	MaxRelocate *int    `url:"max_relocate,omitempty" json:"max_relocate,omitempty"` // Maximal number of service relocate tries when a service failes to start.
	MaxRestart  *int    `url:"max_restart,omitempty" json:"max_restart,omitempty"`   // Maximal number of tries to restart the service on a node after its start failed.
	State       *State  `url:"state,omitempty" json:"state,omitempty"`               // Requested resource state.
}

Jump to

Keyboard shortcuts

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