Documentation
¶
Overview ¶
Package services, annotation specific
Package services, external connector specific ¶
Package services, image definition specific ¶
Package services, lab specific ¶
Package services, node definition specific ¶
Package services, smart annotation specific ¶
Package services, system specific ¶
Package services, system specific
Index ¶
- type AnnotationService
- func (s *AnnotationService) Create(ctx context.Context, labID models.UUID, in models.AnnotationCreate) (models.Annotation, error)
- func (s *AnnotationService) Delete(ctx context.Context, labID, annotationID models.UUID) error
- func (s *AnnotationService) Get(ctx context.Context, labID, annotationID models.UUID) (models.Annotation, error)
- func (s *AnnotationService) List(ctx context.Context, labID models.UUID) ([]models.Annotation, error)
- func (s *AnnotationService) Update(ctx context.Context, labID, annotationID models.UUID, ...) (models.Annotation, error)
- type AnnotationServiceInterface
- type ExtConnService
- type ExtConnServiceInterface
- type GroupService
- func (s *GroupService) ByName(ctx context.Context, name string) (models.Group, error)
- func (s *GroupService) Create(ctx context.Context, group models.Group) (result models.Group, err error)
- func (s *GroupService) Delete(ctx context.Context, id string) error
- func (s *GroupService) GetByID(ctx context.Context, id models.UUID) (group models.Group, err error)
- func (s *GroupService) Groups(ctx context.Context) (models.GroupList, error)
- func (s *GroupService) Update(ctx context.Context, group models.Group) (result models.Group, err error)
- type GroupServiceInterface
- type ImageDefinitionService
- type ImageDefinitionServiceInterface
- type InterfaceService
- func (s *InterfaceService) Create(ctx context.Context, labID, nodeID models.UUID, slot int) (models.Interface, error)
- func (s *InterfaceService) GetByID(ctx context.Context, labID, id models.UUID) (models.Interface, error)
- func (s *InterfaceService) GetInterfacesForNode(ctx context.Context, labID, id models.UUID) (models.InterfaceList, error)
- type InterfaceServiceInterface
- type LabService
- func (s *LabService) Create(ctx context.Context, lab models.LabCreateRequest) (models.Lab, error)
- func (s *LabService) Delete(ctx context.Context, id models.UUID) error
- func (s *LabService) GetByID(ctx context.Context, id models.UUID, deep bool) (models.Lab, error)
- func (s *LabService) GetByTitle(ctx context.Context, title string, deep bool) (models.Lab, error)
- func (s *LabService) HasConverged(ctx context.Context, id models.UUID) (converged bool, err error)
- func (s *LabService) Import(ctx context.Context, topology string) (models.Lab, error)
- func (s *LabService) Labs(ctx context.Context, showAll bool) (labs models.LabList, err error)
- func (s *LabService) LabsWithData(ctx context.Context) ([]models.LabResponse, error)
- func (s *LabService) Start(ctx context.Context, id models.UUID) error
- func (s *LabService) Stop(ctx context.Context, id models.UUID) error
- func (s *LabService) Update(ctx context.Context, id models.UUID, data models.LabUpdateRequest) (lab models.Lab, err error)
- func (s *LabService) Wipe(ctx context.Context, id models.UUID) error
- type LabServiceInterface
- type LinkService
- func (s *LinkService) Create(ctx context.Context, link models.Link) (models.Link, error)
- func (s *LinkService) Delete(ctx context.Context, labID, linkID models.UUID) error
- func (s *LinkService) DeleteCondition(ctx context.Context, labID, linkID models.UUID) error
- func (s *LinkService) GetByID(ctx context.Context, labID, linkID models.UUID) (models.Link, error)
- func (s *LinkService) GetCondition(ctx context.Context, labID, linkID models.UUID) (models.ConditionResponse, error)
- func (s *LinkService) GetLinksForLab(ctx context.Context, labID models.UUID) ([]models.Link, error)
- func (s *LinkService) SetCondition(ctx context.Context, labID, linkID models.UUID, ...) (models.ConditionResponse, error)
- type LinkServiceInterface
- type NodeDefinitionService
- type NodeDefinitionServiceInterface
- type NodeService
- func (s *NodeService) Create(ctx context.Context, node models.Node) (models.Node, error)
- func (s *NodeService) Delete(ctx context.Context, labID, nodeID models.UUID) error
- func (s *NodeService) GetByID(ctx context.Context, labID, id models.UUID) (models.Node, error)
- func (s *NodeService) GetNodesForLab(ctx context.Context, labID models.UUID) (models.NodeMap, error)
- func (s *NodeService) SetConfig(ctx context.Context, node *models.Node, configuration string) error
- func (s *NodeService) SetExcludeConfigurations(v *bool)
- func (s *NodeService) SetNamedConfigs(ctx context.Context, node *models.Node, configs []models.NodeConfig) error
- func (s *NodeService) Start(ctx context.Context, labID, nodeID models.UUID) error
- func (s *NodeService) Stop(ctx context.Context, labID, nodeID models.UUID) error
- func (s *NodeService) Update(ctx context.Context, node models.Node) (models.Node, error)
- func (s *NodeService) Wipe(ctx context.Context, labID, nodeID models.UUID) error
- type NodeServiceInterface
- type SmartAnnotationService
- func (s *SmartAnnotationService) Get(ctx context.Context, labID, id models.UUID) (models.SmartAnnotation, error)
- func (s *SmartAnnotationService) List(ctx context.Context, labID models.UUID) ([]models.SmartAnnotation, error)
- func (s *SmartAnnotationService) Update(ctx context.Context, labID, id models.UUID, in models.SmartAnnotationUpdate) (models.SmartAnnotation, error)
- type SmartAnnotationServiceInterface
- type SystemService
- type SystemServiceInterface
- type UserService
- func (s *UserService) Create(ctx context.Context, user models.UserCreateRequest) (models.User, error)
- func (s *UserService) Delete(ctx context.Context, id models.UUID) error
- func (s *UserService) GetByID(ctx context.Context, id models.UUID) (user models.User, err error)
- func (s *UserService) GetByName(ctx context.Context, name string) (models.User, error)
- func (s *UserService) Groups(ctx context.Context, id models.UUID) (models.GroupList, error)
- func (s *UserService) Update(ctx context.Context, id models.UUID, user models.UserUpdateRequest) (models.User, error)
- func (s *UserService) Users(ctx context.Context) (models.UserList, error)
- type UserServiceInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnotationService ¶
type AnnotationService struct {
// contains filtered or unexported fields
}
AnnotationService provides classic annotation operations.
func NewAnnotationService ¶
func NewAnnotationService(apiClient *api.Client) *AnnotationService
NewAnnotationService creates a new annotation service.
func (*AnnotationService) Create ¶
func (s *AnnotationService) Create(ctx context.Context, labID models.UUID, in models.AnnotationCreate) (models.Annotation, error)
Create creates a new annotation in a lab.
func (*AnnotationService) Get ¶
func (s *AnnotationService) Get(ctx context.Context, labID, annotationID models.UUID) (models.Annotation, error)
Get returns a single annotation by ID.
func (*AnnotationService) List ¶
func (s *AnnotationService) List(ctx context.Context, labID models.UUID) ([]models.Annotation, error)
List returns all annotations for a lab.
func (*AnnotationService) Update ¶
func (s *AnnotationService) Update(ctx context.Context, labID, annotationID models.UUID, in models.AnnotationUpdate) (models.Annotation, error)
Update updates an existing annotation.
type AnnotationServiceInterface ¶
type AnnotationServiceInterface interface {
List(ctx context.Context, labID models.UUID) ([]models.Annotation, error)
Create(ctx context.Context, labID models.UUID, in models.AnnotationCreate) (models.Annotation, error)
Get(ctx context.Context, labID, annotationID models.UUID) (models.Annotation, error)
Update(ctx context.Context, labID, annotationID models.UUID, in models.AnnotationUpdate) (models.Annotation, error)
Delete(ctx context.Context, labID, annotationID models.UUID) error
}
AnnotationServiceInterface defines methods needed by other services/clients.
type ExtConnService ¶
type ExtConnService struct {
// contains filtered or unexported fields
}
ExtConnService provides external connector-related operations
func NewExtConnService ¶
func NewExtConnService(apiClient *api.Client) *ExtConnService
NewExtConnService creates a new external connector service
type ExtConnServiceInterface ¶
type ExtConnServiceInterface interface {
Get(ctx context.Context, extConnID models.UUID) (models.ExtConn, error)
List(ctx context.Context) ([]*models.ExtConn, error)
}
ExtConnServiceInterface defines methods needed by other services/clients.
type GroupService ¶
type GroupService struct {
// contains filtered or unexported fields
}
GroupService provides group-related operations.
func NewGroupService ¶
func NewGroupService(apiClient *api.Client) *GroupService
NewGroupService creates a new group service.
func (*GroupService) Create ¶
func (s *GroupService) Create(ctx context.Context, group models.Group) (result models.Group, err error)
Create creates a new group on the controller based on the data provided in the passed group parameter.
func (*GroupService) Delete ¶
func (s *GroupService) Delete(ctx context.Context, id string) error
Delete removes the group identified by the `id` (a UUIDv4).
type GroupServiceInterface ¶
type GroupServiceInterface interface {
GetByID(ctx context.Context, id models.UUID) (models.Group, error)
}
GroupServiceInterface defines methods needed by other services.
type ImageDefinitionService ¶
type ImageDefinitionService struct {
// contains filtered or unexported fields
}
ImageDefinitionService provides image definition-related operations
func NewImageDefinitionService ¶
func NewImageDefinitionService(apiClient *api.Client) *ImageDefinitionService
NewImageDefinitionService creates a new image definition service
func (*ImageDefinitionService) ImageDefinitions ¶
func (s *ImageDefinitionService) ImageDefinitions(ctx context.Context) ([]models.ImageDefinition, error)
ImageDefinitions returns a list of image definitions known to the controller.
type ImageDefinitionServiceInterface ¶
type ImageDefinitionServiceInterface interface {
ImageDefinitions(ctx context.Context) ([]models.ImageDefinition, error)
}
ImageDefinitionServiceInterface defines methods needed by other services/clients.
type InterfaceService ¶
type InterfaceService struct {
// contains filtered or unexported fields
}
InterfaceService provides interface-related operations
func NewInterfaceService ¶
func NewInterfaceService(apiClient *api.Client) *InterfaceService
NewInterfaceService creates a new lab service
func (*InterfaceService) Create ¶
func (s *InterfaceService) Create(ctx context.Context, labID, nodeID models.UUID, slot int) (models.Interface, error)
Create creates an interface in the given lab and node. If the slot is >= 0, the request creates all unallocated slots up to and including that slot. Conversely, if the slot is < 0 (e.g. -1), the next free slot is used.
func (*InterfaceService) GetByID ¶
func (s *InterfaceService) GetByID(ctx context.Context, labID, id models.UUID) (models.Interface, error)
GetByID returns the interface identified by its `ID` (iface.ID).
func (*InterfaceService) GetInterfacesForNode ¶
func (s *InterfaceService) GetInterfacesForNode(ctx context.Context, labID, id models.UUID) (models.InterfaceList, error)
GetInterfacesForNode returns all interfaces for a specific node.
type InterfaceServiceInterface ¶
type InterfaceServiceInterface interface {
Create(ctx context.Context, labID, nodeID models.UUID, slot int) (models.Interface, error)
GetByID(ctx context.Context, labID, id models.UUID) (models.Interface, error)
GetInterfacesForNode(ctx context.Context, labID, id models.UUID) (models.InterfaceList, error)
}
InterfaceServiceInterface defines methods needed by other services
type LabService ¶
type LabService struct {
User UserServiceInterface
Link LinkServiceInterface
Interface InterfaceServiceInterface
Node NodeServiceInterface
// contains filtered or unexported fields
}
LabService provides lab-related operations
func NewLabService ¶
func NewLabService(apiClient *api.Client, iface InterfaceServiceInterface, link LinkServiceInterface, user UserServiceInterface, node NodeServiceInterface) *LabService
NewLabService creates a new lab service
func (*LabService) Create ¶
func (s *LabService) Create(ctx context.Context, lab models.LabCreateRequest) (models.Lab, error)
Create creates a new lab on the controller. Only certain fields from the full Lab model are accepted during creation. Use GetByID() to retrieve the complete lab object after successful creation.
func (*LabService) GetByTitle ¶
GetByTitle returns the lab identified by its `title`.
func (*LabService) HasConverged ¶
HasConverged checks if all nodes in the lab have converged (are in BOOTED state)
func (*LabService) LabsWithData ¶
func (s *LabService) LabsWithData(ctx context.Context) ([]models.LabResponse, error)
LabsWithData retrieves labs with data using the /populate_lab_tiles endpoint
type LabServiceInterface ¶
type LabServiceInterface interface {
Labs(ctx context.Context, showAll bool) (models.LabList, error)
LabsWithData(ctx context.Context) ([]models.LabResponse, error)
Create(ctx context.Context, lab models.LabCreateRequest) (models.Lab, error)
GetByID(ctx context.Context, id models.UUID, deep bool) (models.Lab, error)
GetByTitle(ctx context.Context, title string, deep bool) (models.Lab, error)
Update(ctx context.Context, labID models.UUID, lab models.LabUpdateRequest) (models.Lab, error)
Delete(ctx context.Context, id models.UUID) error
Import(ctx context.Context, topologyYAML string) (models.Lab, error)
Start(ctx context.Context, labID models.UUID) error
Stop(ctx context.Context, labID models.UUID) error
Wipe(ctx context.Context, labID models.UUID) error
HasConverged(ctx context.Context, id models.UUID) (bool, error)
}
LabServiceInterface defines methods needed by other services/clients.
type LinkService ¶
type LinkService struct {
Interface InterfaceServiceInterface
Node NodeServiceInterface
// contains filtered or unexported fields
}
LinkService provides link-related operations
func NewLinkService ¶
func NewLinkService(apiClient *api.Client) *LinkService
NewLinkService creates a new link service
func (*LinkService) Create ¶
Create creates a link based on the data passed in `link`. Required fields are the `LabID` and either a pair of interfaces `SrcID` / `DstID` or a pair of nodes `SrcNode` / `DstNode`. With nodes it's also possible to provide specific slots in `SrcSlot` / `DstSlot` where the link should be created. If one or both of the provided slots aren't available, then new interfaces will be created. If interface creation fails or the provided Interface IDs can't be found, the API returns an error, otherwise the returned Link variable has the updated link data. Node: -1 for a slot means: use next free slot. Specific slots run from 0 to the maximum slot number -1 per the node definition of the node type.
func (*LinkService) DeleteCondition ¶
DeleteCondition removes link conditioning configuration
func (*LinkService) GetCondition ¶
func (s *LinkService) GetCondition(ctx context.Context, labID, linkID models.UUID) (models.ConditionResponse, error)
GetCondition retrieves the current link conditioning configuration
func (*LinkService) GetLinksForLab ¶
GetLinksForLab returns all links for a lab.
func (*LinkService) SetCondition ¶
func (s *LinkService) SetCondition(ctx context.Context, labID, linkID models.UUID, config *models.LinkConditionConfiguration) (models.ConditionResponse, error)
SetCondition applies link conditioning configuration
type LinkServiceInterface ¶
type LinkServiceInterface interface {
GetLinksForLab(ctx context.Context, labID models.UUID) ([]models.Link, error)
Delete(ctx context.Context, labID, linkID models.UUID) error
GetCondition(ctx context.Context, labID, linkID models.UUID) (models.ConditionResponse, error)
SetCondition(ctx context.Context, labID, linkID models.UUID, config *models.LinkConditionConfiguration) (models.ConditionResponse, error)
DeleteCondition(ctx context.Context, labID, linkID models.UUID) error
}
LinkServiceInterface defines methods needed by other services
type NodeDefinitionService ¶
type NodeDefinitionService struct {
// contains filtered or unexported fields
}
NodeDefinitionService provides node definition-related operations
func NewNodeDefinitionService ¶
func NewNodeDefinitionService(apiClient *api.Client) *NodeDefinitionService
NewNodeDefinitionService creates a new node definition service
func (*NodeDefinitionService) NodeDefinitions ¶
func (s *NodeDefinitionService) NodeDefinitions(ctx context.Context) (models.NodeDefinitionMap, error)
NodeDefinitions returns the list of node definitions available on the CML controller. The key of the map is the definition type name (e.g. "alpine" or "ios"). The node def data structure matches the OpenAPI schema.
type NodeDefinitionServiceInterface ¶
type NodeDefinitionServiceInterface interface {
NodeDefinitions(ctx context.Context) (models.NodeDefinitionMap, error)
}
NodeDefinitionServiceInterface defines methods needed by other services/clients.
type NodeService ¶
type NodeService struct {
// contains filtered or unexported fields
}
NodeService provides node-related operations
func NewNodeService ¶
func NewNodeService(apiClient *api.Client, useNamedConfigs bool) *NodeService
NewNodeService creates a new node service
func (*NodeService) Create ¶
Create creates a new node on the controller based on the data provided in `node`. Label, node definition and image definition must be provided.
func (*NodeService) GetByID ¶
GetByID returns the node identified by its `ID` and `LabID` in the provided node.
func (*NodeService) GetNodesForLab ¶
func (s *NodeService) GetNodesForLab(ctx context.Context, labID models.UUID) (models.NodeMap, error)
GetNodesForLab returns all nodes for a lab.
func (*NodeService) SetConfig ¶
SetConfig sets a configuration for the specified node. At least the `ID` of the node and the `labID` must be provided in `node`. The `node` instance will be updated with the current values for the node as provided by the controller.
func (*NodeService) SetExcludeConfigurations ¶
func (s *NodeService) SetExcludeConfigurations(v *bool)
SetExcludeConfigurations forces exclude_configurations query behavior for node read operations (GET/LIST). If v is nil, the parameter is omitted.
func (*NodeService) SetNamedConfigs ¶
func (s *NodeService) SetNamedConfigs(ctx context.Context, node *models.Node, configs []models.NodeConfig) error
SetNamedConfigs sets a list of named configurations for the specified node. At least the `ID` of the node and the `labID` must be provided in `node`.
type NodeServiceInterface ¶
type NodeServiceInterface interface {
GetNodesForLab(ctx context.Context, labID models.UUID) (models.NodeMap, error)
GetByID(ctx context.Context, labID, id models.UUID) (models.Node, error)
}
NodeServiceInterface defines methods needed by other services
type SmartAnnotationService ¶
type SmartAnnotationService struct {
// contains filtered or unexported fields
}
SmartAnnotationService provides smart annotation operations.
func NewSmartAnnotationService ¶
func NewSmartAnnotationService(apiClient *api.Client) *SmartAnnotationService
NewSmartAnnotationService creates a new smart annotation service.
func (*SmartAnnotationService) Get ¶
func (s *SmartAnnotationService) Get(ctx context.Context, labID, id models.UUID) (models.SmartAnnotation, error)
Get returns a single smart annotation by ID.
func (*SmartAnnotationService) List ¶
func (s *SmartAnnotationService) List(ctx context.Context, labID models.UUID) ([]models.SmartAnnotation, error)
List returns all smart annotations for a lab.
func (*SmartAnnotationService) Update ¶
func (s *SmartAnnotationService) Update(ctx context.Context, labID, id models.UUID, in models.SmartAnnotationUpdate) (models.SmartAnnotation, error)
Update updates an existing smart annotation.
type SmartAnnotationServiceInterface ¶
type SmartAnnotationServiceInterface interface {
List(ctx context.Context, labID models.UUID) ([]models.SmartAnnotation, error)
Get(ctx context.Context, labID, id models.UUID) (models.SmartAnnotation, error)
Update(ctx context.Context, labID, id models.UUID, in models.SmartAnnotationUpdate) (models.SmartAnnotation, error)
}
SmartAnnotationServiceInterface defines methods needed by other services/clients.
type SystemService ¶
type SystemService struct {
// contains filtered or unexported fields
}
SystemService provides system-related operations
func NewSystemService ¶
func NewSystemService(apiClient *api.Client) *SystemService
NewSystemService creates a new lab service
func (*SystemService) Ready ¶
func (s *SystemService) Ready(ctx context.Context) error
Ready returns nil if the system is compatible and ready
func (*SystemService) UseNamedConfigs ¶
func (s *SystemService) UseNamedConfigs()
UseNamedConfigs turns on the use of named configs (only with 2.7.0 and newer)
func (*SystemService) Version ¶
func (s *SystemService) Version() string
Version returns the CML controller version
func (*SystemService) VersionCheck ¶
VersionCheck checks if the client version satisfies the provided semantic version constraint.
type SystemServiceInterface ¶
type SystemServiceInterface interface {
Ready(ctx context.Context) error
Version() string
VersionCheck(ctx context.Context, constraintStr string) (bool, error)
UseNamedConfigs()
}
SystemServiceInterface defines methods needed by other services/clients.
type UserService ¶
type UserService struct {
Group GroupServiceInterface
// contains filtered or unexported fields
}
UserService provides user-related operations
func NewUserService ¶
func NewUserService(apiClient *api.Client, group GroupServiceInterface) *UserService
NewUserService creates a new user service
func (*UserService) Create ¶
func (s *UserService) Create(ctx context.Context, user models.UserCreateRequest) (models.User, error)
Create creates a new user on the controller based on the data provided in the passed user parameter.