Documentation
¶
Overview ¶
Package client provides a gRPC client for interacting with the RLA service. This package can be imported by external modules to communicate with RLA.
The client uses types from pkg/types, which can be imported independently for interface definitions and mocking without gRPC dependencies.
Index ¶
- type Client
- func (c *Client) AddComponent(ctx context.Context, comp *types.Component) (*types.Component, error)
- func (c *Client) AssociateRuleWithRack(ctx context.Context, rackID uuid.UUID, ruleID uuid.UUID) error
- func (c *Client) AttachRacksToNVLDomain(ctx context.Context, nvlDomainID types.Identifier, rackIDs []types.Identifier) error
- func (c *Client) Close() error
- func (c *Client) CreateExpectedRack(ctx context.Context, rack *types.Rack) (uuid.UUID, error)
- func (c *Client) CreateNVLDomain(ctx context.Context, nvlDomain *types.NVLDomain) (uuid.UUID, error)
- func (c *Client) CreateOperationRule(ctx context.Context, name string, description string, ...) (uuid.UUID, error)
- func (c *Client) DeleteComponent(ctx context.Context, componentID uuid.UUID) error
- func (c *Client) DeleteOperationRule(ctx context.Context, ruleID uuid.UUID) error
- func (c *Client) DetachRacksFromNVLDomain(ctx context.Context, rackIDs []types.Identifier) error
- func (c *Client) DisassociateRuleFromRack(ctx context.Context, rackID uuid.UUID, operationType types.OperationType, ...) error
- func (c *Client) GetComponentInfoByID(ctx context.Context, id uuid.UUID, withRack bool) (*types.Component, *types.Rack, error)
- func (c *Client) GetComponentInfoBySerial(ctx context.Context, manufacturer string, serial string, withRack bool) (*types.Component, *types.Rack, error)
- func (c *Client) GetExpectedComponentsByComponentIDs(ctx context.Context, componentIDs []string, componentType types.ComponentType) (*GetExpectedComponentsResult, error)
- func (c *Client) GetExpectedComponentsByRackIDs(ctx context.Context, rackIDs []uuid.UUID, componentType types.ComponentType) (*GetExpectedComponentsResult, error)
- func (c *Client) GetExpectedComponentsByRackNames(ctx context.Context, rackNames []string, componentType types.ComponentType) (*GetExpectedComponentsResult, error)
- func (c *Client) GetListOfNVLDomains(ctx context.Context, info *types.StringQueryInfo, pagination *types.Pagination) ([]*types.NVLDomain, int32, error)
- func (c *Client) GetListOfRacks(ctx context.Context, info *types.StringQueryInfo, pagination *types.Pagination, ...) ([]*types.Rack, int32, error)
- func (c *Client) GetOperationRule(ctx context.Context, ruleID uuid.UUID) (*types.OperationRule, error)
- func (c *Client) GetRackInfoByID(ctx context.Context, id uuid.UUID, withComponents bool) (*types.Rack, error)
- func (c *Client) GetRackInfoBySerial(ctx context.Context, manufacturer string, serial string, withComponents bool) (*types.Rack, error)
- func (c *Client) GetRackRuleAssociation(ctx context.Context, rackID uuid.UUID, operationType types.OperationType, ...) (uuid.UUID, error)
- func (c *Client) GetRacksForNVLDomain(ctx context.Context, nvlDomainID types.Identifier) ([]*types.Rack, error)
- func (c *Client) GetTasksByIDs(ctx context.Context, taskIDs []uuid.UUID) ([]*types.Task, error)
- func (c *Client) IngestRackByRackIDs(ctx context.Context, rackIDs []uuid.UUID, description string) (*IngestRackResult, error)
- func (c *Client) IngestRackByRackNames(ctx context.Context, rackNames []string, description string) (*IngestRackResult, error)
- func (c *Client) ListOperationRules(ctx context.Context, operationType *types.OperationType, isDefault *bool, ...) ([]*types.OperationRule, int, error)
- func (c *Client) ListRackRuleAssociations(ctx context.Context, rackID uuid.UUID) ([]*types.RackRuleAssociation, error)
- func (c *Client) ListTasks(ctx context.Context, rackID *uuid.UUID, activeOnly bool, ...) (*ListTasksResult, error)
- func (c *Client) PatchComponent(ctx context.Context, componentID uuid.UUID, opts PatchComponentOpts) (*types.Component, error)
- func (c *Client) PowerControlByMachineIDs(ctx context.Context, machineIDs []string, op types.PowerControlOp) (*PowerControlResult, error)
- func (c *Client) PowerControlByRackIDs(ctx context.Context, rackIDs []uuid.UUID, componentType types.ComponentType, ...) (*PowerControlResult, error)
- func (c *Client) PowerControlByRackNames(ctx context.Context, rackNames []string, componentType types.ComponentType, ...) (*PowerControlResult, error)
- func (c *Client) SetRuleAsDefault(ctx context.Context, ruleID uuid.UUID) error
- func (c *Client) UpdateOperationRule(ctx context.Context, ruleID uuid.UUID, name *string, description *string, ...) error
- func (c *Client) UpgradeFirmwareByMachineIDs(ctx context.Context, machineIDs []string, startTime, endTime *time.Time) (*UpgradeFirmwareResult, error)
- func (c *Client) UpgradeFirmwareByRackIDs(ctx context.Context, rackIDs []uuid.UUID, componentType types.ComponentType, ...) (*UpgradeFirmwareResult, error)
- func (c *Client) UpgradeFirmwareByRackNames(ctx context.Context, rackNames []string, componentType types.ComponentType, ...) (*UpgradeFirmwareResult, error)
- func (c *Client) ValidateComponentsByComponentIDs(ctx context.Context, componentIDs []string, componentType types.ComponentType) (*ValidateComponentsResult, error)
- func (c *Client) ValidateComponentsByRackIDs(ctx context.Context, rackIDs []uuid.UUID, componentType types.ComponentType) (*ValidateComponentsResult, error)
- func (c *Client) ValidateComponentsByRackNames(ctx context.Context, rackNames []string, componentType types.ComponentType) (*ValidateComponentsResult, error)
- type Config
- type GetExpectedComponentsResult
- type IngestRackResult
- type ListTasksResult
- type PatchComponentOpts
- type PowerControlResult
- type UpgradeFirmwareResult
- type ValidateComponentsResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the gRPC client for interacting with the RLA service.
func (*Client) AddComponent ¶
func (c *Client) AddComponent( ctx context.Context, comp *types.Component, ) (*types.Component, error)
AddComponent creates a single component under an existing rack.
func (*Client) AssociateRuleWithRack ¶
func (c *Client) AssociateRuleWithRack( ctx context.Context, rackID uuid.UUID, ruleID uuid.UUID, ) error
AssociateRuleWithRack associates an operation rule with a specific rack.
func (*Client) AttachRacksToNVLDomain ¶
func (c *Client) AttachRacksToNVLDomain( ctx context.Context, nvlDomainID types.Identifier, rackIDs []types.Identifier, ) error
AttachRacksToNVLDomain attaches racks to an NVL domain.
func (*Client) CreateExpectedRack ¶
CreateExpectedRack creates a new expected rack and returns its UUID.
func (*Client) CreateNVLDomain ¶
func (c *Client) CreateNVLDomain( ctx context.Context, nvlDomain *types.NVLDomain, ) (uuid.UUID, error)
CreateNVLDomain creates a new NVL domain and returns its UUID.
func (*Client) CreateOperationRule ¶
func (c *Client) CreateOperationRule( ctx context.Context, name string, description string, operationType types.OperationType, operationCode string, ruleDefinitionJSON string, isDefault bool, ) (uuid.UUID, error)
CreateOperationRule creates a new operation rule and returns its UUID.
func (*Client) DeleteComponent ¶
DeleteComponent soft-deletes a component by UUID.
func (*Client) DeleteOperationRule ¶
DeleteOperationRule deletes an operation rule by its ID.
func (*Client) DetachRacksFromNVLDomain ¶
DetachRacksFromNVLDomain detaches racks from their NVL domain.
func (*Client) DisassociateRuleFromRack ¶
func (c *Client) DisassociateRuleFromRack( ctx context.Context, rackID uuid.UUID, operationType types.OperationType, operationCode string, ) error
DisassociateRuleFromRack removes a rule association from a rack.
func (*Client) GetComponentInfoByID ¶
func (c *Client) GetComponentInfoByID( ctx context.Context, id uuid.UUID, withRack bool, ) (*types.Component, *types.Rack, error)
GetComponentInfoByID retrieves component information by its UUID.
func (*Client) GetComponentInfoBySerial ¶
func (c *Client) GetComponentInfoBySerial( ctx context.Context, manufacturer string, serial string, withRack bool, ) (*types.Component, *types.Rack, error)
GetComponentInfoBySerial retrieves component information by its manufacturer and serial number.
func (*Client) GetExpectedComponentsByComponentIDs ¶
func (c *Client) GetExpectedComponentsByComponentIDs( ctx context.Context, componentIDs []string, componentType types.ComponentType, ) (*GetExpectedComponentsResult, error)
GetExpectedComponentsByComponentIDs retrieves expected components by external component IDs.
func (*Client) GetExpectedComponentsByRackIDs ¶
func (c *Client) GetExpectedComponentsByRackIDs( ctx context.Context, rackIDs []uuid.UUID, componentType types.ComponentType, ) (*GetExpectedComponentsResult, error)
GetExpectedComponentsByRackIDs retrieves expected components from local database by rack IDs.
func (*Client) GetExpectedComponentsByRackNames ¶
func (c *Client) GetExpectedComponentsByRackNames( ctx context.Context, rackNames []string, componentType types.ComponentType, ) (*GetExpectedComponentsResult, error)
GetExpectedComponentsByRackNames retrieves expected components from local database by rack names.
func (*Client) GetListOfNVLDomains ¶
func (c *Client) GetListOfNVLDomains( ctx context.Context, info *types.StringQueryInfo, pagination *types.Pagination, ) ([]*types.NVLDomain, int32, error)
GetListOfNVLDomains retrieves a list of NVL domains matching the query.
func (*Client) GetListOfRacks ¶
func (c *Client) GetListOfRacks( ctx context.Context, info *types.StringQueryInfo, pagination *types.Pagination, withComponents bool, ) ([]*types.Rack, int32, error)
GetListOfRacks retrieves a list of racks matching the query.
func (*Client) GetOperationRule ¶
func (c *Client) GetOperationRule( ctx context.Context, ruleID uuid.UUID, ) (*types.OperationRule, error)
GetOperationRule retrieves an operation rule by its ID.
func (*Client) GetRackInfoByID ¶
func (c *Client) GetRackInfoByID( ctx context.Context, id uuid.UUID, withComponents bool, ) (*types.Rack, error)
GetRackInfoByID retrieves rack information by its UUID.
func (*Client) GetRackInfoBySerial ¶
func (c *Client) GetRackInfoBySerial( ctx context.Context, manufacturer string, serial string, withComponents bool, ) (*types.Rack, error)
GetRackInfoBySerial retrieves rack information by its manufacturer and serial number.
func (*Client) GetRackRuleAssociation ¶
func (c *Client) GetRackRuleAssociation( ctx context.Context, rackID uuid.UUID, operationType types.OperationType, operationCode string, ) (uuid.UUID, error)
GetRackRuleAssociation retrieves the rule associated with a rack for a specific operation.
func (*Client) GetRacksForNVLDomain ¶
func (c *Client) GetRacksForNVLDomain( ctx context.Context, nvlDomainID types.Identifier, ) ([]*types.Rack, error)
GetRacksForNVLDomain retrieves racks belonging to an NVL domain.
func (*Client) GetTasksByIDs ¶
GetTasksByIDs retrieves tasks by their IDs.
func (*Client) IngestRackByRackIDs ¶
func (c *Client) IngestRackByRackIDs( ctx context.Context, rackIDs []uuid.UUID, description string, ) (*IngestRackResult, error)
IngestRackByRackIDs submits an ingestion task for the given rack IDs.
func (*Client) IngestRackByRackNames ¶
func (c *Client) IngestRackByRackNames( ctx context.Context, rackNames []string, description string, ) (*IngestRackResult, error)
IngestRackByRackNames submits an ingestion task for the given rack names.
func (*Client) ListOperationRules ¶
func (c *Client) ListOperationRules( ctx context.Context, operationType *types.OperationType, isDefault *bool, offset *int, limit *int, ) ([]*types.OperationRule, int, error)
ListOperationRules lists operation rules with optional filtering.
func (*Client) ListRackRuleAssociations ¶
func (c *Client) ListRackRuleAssociations( ctx context.Context, rackID uuid.UUID, ) ([]*types.RackRuleAssociation, error)
ListRackRuleAssociations lists all rule associations for a specific rack.
func (*Client) ListTasks ¶
func (c *Client) ListTasks( ctx context.Context, rackID *uuid.UUID, activeOnly bool, pagination *types.Pagination, ) (*ListTasksResult, error)
ListTasks lists tasks matching the query.
func (*Client) PatchComponent ¶
func (c *Client) PatchComponent( ctx context.Context, componentID uuid.UUID, opts PatchComponentOpts, ) (*types.Component, error)
PatchComponent updates a single component's fields.
func (*Client) PowerControlByMachineIDs ¶
func (c *Client) PowerControlByMachineIDs( ctx context.Context, machineIDs []string, op types.PowerControlOp, ) (*PowerControlResult, error)
PowerControlByMachineIDs performs power control on the given machine IDs.
func (*Client) PowerControlByRackIDs ¶
func (c *Client) PowerControlByRackIDs( ctx context.Context, rackIDs []uuid.UUID, componentType types.ComponentType, op types.PowerControlOp, ) (*PowerControlResult, error)
PowerControlByRackIDs performs power control on components in the given rack IDs.
func (*Client) PowerControlByRackNames ¶
func (c *Client) PowerControlByRackNames( ctx context.Context, rackNames []string, componentType types.ComponentType, op types.PowerControlOp, ) (*PowerControlResult, error)
PowerControlByRackNames performs power control on components in the given rack names.
func (*Client) SetRuleAsDefault ¶
SetRuleAsDefault marks a rule as the default for its operation type and code.
func (*Client) UpdateOperationRule ¶
func (c *Client) UpdateOperationRule( ctx context.Context, ruleID uuid.UUID, name *string, description *string, ruleDefinitionJSON *string, ) error
UpdateOperationRule updates an existing operation rule.
func (*Client) UpgradeFirmwareByMachineIDs ¶
func (c *Client) UpgradeFirmwareByMachineIDs( ctx context.Context, machineIDs []string, startTime, endTime *time.Time, ) (*UpgradeFirmwareResult, error)
UpgradeFirmwareByMachineIDs upgrades firmware for the given machine IDs (external component IDs).
func (*Client) UpgradeFirmwareByRackIDs ¶
func (c *Client) UpgradeFirmwareByRackIDs( ctx context.Context, rackIDs []uuid.UUID, componentType types.ComponentType, startTime, endTime *time.Time, ) (*UpgradeFirmwareResult, error)
UpgradeFirmwareByRackIDs upgrades firmware for components in the given rack IDs.
func (*Client) UpgradeFirmwareByRackNames ¶
func (c *Client) UpgradeFirmwareByRackNames( ctx context.Context, rackNames []string, componentType types.ComponentType, startTime, endTime *time.Time, ) (*UpgradeFirmwareResult, error)
UpgradeFirmwareByRackNames upgrades firmware for components in the given rack names.
func (*Client) ValidateComponentsByComponentIDs ¶
func (c *Client) ValidateComponentsByComponentIDs( ctx context.Context, componentIDs []string, componentType types.ComponentType, ) (*ValidateComponentsResult, error)
ValidateComponentsByComponentIDs validates expected vs actual components by external component IDs.
func (*Client) ValidateComponentsByRackIDs ¶
func (c *Client) ValidateComponentsByRackIDs( ctx context.Context, rackIDs []uuid.UUID, componentType types.ComponentType, ) (*ValidateComponentsResult, error)
ValidateComponentsByRackIDs validates expected vs actual components by rack IDs.
func (*Client) ValidateComponentsByRackNames ¶
func (c *Client) ValidateComponentsByRackNames( ctx context.Context, rackNames []string, componentType types.ComponentType, ) (*ValidateComponentsResult, error)
ValidateComponentsByRackNames validates expected vs actual components by rack names.
type Config ¶
Config represents the configuration needed to create a new RLA service gRPC client.
type GetExpectedComponentsResult ¶
GetExpectedComponentsResult contains the result of GetExpectedComponents operation.
type IngestRackResult ¶
IngestRackResult represents the result of an IngestRack operation.
type ListTasksResult ¶
ListTasksResult represents the result of ListTasks call.
type PatchComponentOpts ¶
type PatchComponentOpts struct {
FirmwareVersion *string
SlotID *int32
TrayIndex *int32
HostID *int32
Description *string
RackID *uuid.UUID
}
PatchComponentOpts contains the optional fields for patching a component.
type PowerControlResult ¶
PowerControlResult represents the result of a power control operation.
type UpgradeFirmwareResult ¶
UpgradeFirmwareResult represents the result of a firmware upgrade operation.
type ValidateComponentsResult ¶
type ValidateComponentsResult struct {
Diffs []*types.ComponentDiff
TotalDiffs int
OnlyInExpectedCount int
OnlyInActualCount int
DriftCount int
MatchCount int
}
ValidateComponentsResult represents the result of ValidateComponents call.