serviceresources

package
v0.3.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Discover added in v0.3.1

func Discover(
	ctx context.Context,
	op optypes.Operator,
	modelClient model.ClientSet,
	candidates []*model.ServiceResource,
) ([]*model.ServiceResource, error)

Discover discovers the components of the given model.ServiceResource with by the given operator.Operator, and returns all the discovered model.ServiceResource items.

The given model.ServiceResource item must be instance shape and managed mode.

The given model.ServiceResource item must specify the following fields: Shape, Mode, ID, DeployerType, Type, Name, ProjectID, EnvironmentID, ServiceID and ConnectorID.

func GetGraphVertexType

func GetGraphVertexType(m *model.ServiceResource) string

func GetVerticesAndEdges

func GetVerticesAndEdges(
	entities model.ServiceResources,
	vertices []types.GraphVertex,
	edges []types.GraphEdge,
) ([]types.GraphVertex, []types.GraphEdge)

GetVerticesAndEdges constructs a graph of the given model.ServiceResource entities with DFS algorithm, and appends the vertices and edges to the given slices.

func Label

func Label(
	ctx context.Context,
	op optypes.Operator,
	candidates []*model.ServiceResource,
) error

Label labels the given model.ServiceResource list with the given operator.Operator.

The given model.ServiceResource item must be instance shape and managed mode.

The given model.ServiceResource item must specify the following fields: Shape, Mode, ID, DeployerType, Type and Name, and the following edges: Project, Environment and Service.

func SetKeys

func SetKeys(
	ctx context.Context,
	logger log.Logger,
	modelClient model.ClientSet,
	candidates []*model.ServiceResource,
	operators map[object.ID]optypes.Operator,
)

SetKeys sets the keys of the resources for operations like log and exec.

The given model.ServiceResource item must specify the following fields: Shape, Mode, ID, DeployerType, Type, Name and ConnectorID.

Types

type StateResult

type StateResult struct {
	Error         bool
	Transitioning bool
}

func State

func State(
	ctx context.Context,
	op optypes.Operator,
	modelClient model.ClientSet,
	candidates []*model.ServiceResource,
) (StateResult, error)

State gets status of the given model.ServiceResource list with the given operator.Operator, and represents is ready if both `Error` and `Transitioning` of StateResult are false.

The given model.ServiceResource item must be instance shape and not data mode.

The given model.ServiceResource item must specify the following fields: Shape, Mode, Status, ID, DeployerType, Type and Name.

func (*StateResult) Merge

func (r *StateResult) Merge(s StateResult)

Jump to

Keyboard shortcuts

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