Documentation ¶
Index ¶
- func Discover(ctx context.Context, op optypes.Operator, modelClient model.ClientSet, ...) ([]*model.ResourceComponent, error)
- func FilterResourceComponentChange(ctx context.Context, mc model.ClientSet, resourceID object.ID, ...) ([]*types.ResourceComponentChange, error)
- func GetGraphVertexType(m *model.ResourceComponent) string
- func GetVerticesAndEdges(entities model.ResourceComponents, vertices []types.GraphVertex, ...) ([]types.GraphVertex, []types.GraphEdge)
- func Label(ctx context.Context, op optypes.Operator, ...) error
- func SetKeys(ctx context.Context, logger log.Logger, modelClient model.ClientSet, ...)
- type StateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Discover ¶
func Discover( ctx context.Context, op optypes.Operator, modelClient model.ClientSet, candidates []*model.ResourceComponent, ) ([]*model.ResourceComponent, error)
Discover discovers the components of the given model.ResourceComponent with by the given operator.Operator, and returns all the discovered model.ResourceComponent items.
The given model.ResourceComponent item must be instance shape and managed mode.
The given model.ResourceComponent item must specify the following fields: Shape, Mode, ID, DeployerType, Type, Name, ProjectID, EnvironmentID, ResourceID and ConnectorID.
func FilterResourceComponentChange ¶ added in v0.6.0
func FilterResourceComponentChange( ctx context.Context, mc model.ClientSet, resourceID object.ID, changes []*types.ResourceComponentChange, ) ([]*types.ResourceComponentChange, error)
FilterResourceComponentChange filters the given types.ResourceComponentChange items with current resource's model.ResourceComponents.
func GetGraphVertexType ¶
func GetGraphVertexType(m *model.ResourceComponent) string
func GetVerticesAndEdges ¶
func GetVerticesAndEdges( entities model.ResourceComponents, vertices []types.GraphVertex, edges []types.GraphEdge, ) ([]types.GraphVertex, []types.GraphEdge)
GetVerticesAndEdges constructs a graph of the given model.ResourceComponent 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.ResourceComponent, ) error
Label labels the given model.ResourceComponent list with the given operator.Operator.
The given model.ResourceComponent item must be instance shape and managed mode.
The given model.ResourceComponent item must specify the following fields: Shape, Mode, ID, DeployerType, Type and Name, and the following edges: Project, Environment and Resource.
func SetKeys ¶
func SetKeys( ctx context.Context, logger log.Logger, modelClient model.ClientSet, candidates []*model.ResourceComponent, operators map[object.ID]optypes.Operator, )
SetKeys sets the keys of the resources for operations like log and exec.
The given model.ResourceComponent item must specify the following fields: Shape, Mode, ID, DeployerType, Type, Name and ConnectorID.
Types ¶
type StateResult ¶
func State ¶
func State( ctx context.Context, op optypes.Operator, modelClient model.ClientSet, candidates []*model.ResourceComponent, ) (StateResult, error)
State gets status of the given model.ResourceComponent list with the given operator.Operator, and represents is ready if both `Error` and `Transitioning` of StateResult are false.
The given model.ResourceComponent item must be instance shape and not data mode.
The given model.ResourceComponent item must specify the following fields: Shape, Mode, Status, ID, DeployerType, Type and Name.
func (*StateResult) Merge ¶
func (r *StateResult) Merge(s StateResult)