Documentation
¶
Index ¶
- Constants
- func ResourceGroupIdFromNodePool(nodepool *hwmgmtv1alpha1.NodePool) string
- type HardwareManagerClient
- func (c *HardwareManagerClient) CheckJobStatus(ctx context.Context, jobId string) (JobStatus, string, error)
- func (c *HardwareManagerClient) CreateResourceGroup(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) (string, error)
- func (c *HardwareManagerClient) DeleteResourceGroup(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) (string, error)
- func (c *HardwareManagerClient) GetResource(ctx context.Context, node *hwmgmtv1alpha1.Node) (*hwmgrapi.ApiprotoGetResourceResp, error)
- func (c *HardwareManagerClient) GetResourceGroupFromId(ctx context.Context, rgId string) (*hwmgrapi.RhprotoResourceGroupObjectGetResponseBody, error)
- func (c *HardwareManagerClient) GetResourceGroupFromNodePool(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) (*hwmgrapi.RhprotoResourceGroupObjectGetResponseBody, error)
- func (c *HardwareManagerClient) GetResourceGroups(ctx context.Context) (*hwmgrapi.RhprotoResourceGroupsResp, error)
- func (c *HardwareManagerClient) GetResourcePools(ctx context.Context) (*hwmgrapi.ApiprotoResourcePoolsResp, error)
- func (c *HardwareManagerClient) GetResources(ctx context.Context) (*hwmgrapi.ApiprotoGetResourcesResp, error)
- func (c *HardwareManagerClient) GetSecret(ctx context.Context, secretKey string) (*hwmgrapi.RhprotoGetSecretsResponseBody, error)
- func (c *HardwareManagerClient) GetServersInventory(ctx context.Context) (*hwmgrapi.ApiprotoGetServersInventoryResp, error)
- func (c *HardwareManagerClient) GetTenant() string
- func (c *HardwareManagerClient) GetToken(ctx context.Context) (string, error)
- func (c *HardwareManagerClient) ResourceGroupExists(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) (bool, error)
- func (c *HardwareManagerClient) ResourceGroupFromNodePool(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) *hwmgrapi.CreateResourceGroupJSONRequestBody
- func (c *HardwareManagerClient) UpdateResourceProfile(ctx context.Context, node *hwmgmtv1alpha1.Node, newHwProfile string) (string, error)
- func (c *HardwareManagerClient) ValidateResourceGroup(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool, ...) error
- type JobStatus
- type RespDefault
- type RespDefaultDetails
- type RespDefaultDetailsMetadata
Constants ¶
const ( RoleKey = "role" DefaultTenant = "default_tenant" )
const ( JobStatusInProgress = iota JobStatusCompleted JobStatusFailed JobStatusUnknown JobStatusNotExist )
Variables ¶
This section is empty.
Functions ¶
func ResourceGroupIdFromNodePool ¶
func ResourceGroupIdFromNodePool(nodepool *hwmgmtv1alpha1.NodePool) string
ResourceGroupIdFromNodePool returns the resource group identifier corresponding to the specified nodepool
Types ¶
type HardwareManagerClient ¶
type HardwareManagerClient struct {
HwmgrClient *hwmgrapi.ClientWithResponses
Logger *slog.Logger
Namespace string
// contains filtered or unexported fields
}
HardwareManagerClient provides functions for calling the hardware manager APIs
func NewClientWithResponses ¶
func NewClientWithResponses( ctx context.Context, logger *slog.Logger, rtclient client.Client, hwmgr *pluginv1alpha1.HardwareManager) (*HardwareManagerClient, error)
NewClientWithResponses creates an authenticated client connected to the hardware manager
func (*HardwareManagerClient) CheckJobStatus ¶
func (c *HardwareManagerClient) CheckJobStatus(ctx context.Context, jobId string) (JobStatus, string, error)
CheckJobStatus queries the hardware manager for the status of a job
func (*HardwareManagerClient) CreateResourceGroup ¶
func (c *HardwareManagerClient) CreateResourceGroup(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) (string, error)
CreateResourceGroup sends a request to the hardware manager, returns a jobId TODO: Improve error handling for different status codes
func (*HardwareManagerClient) DeleteResourceGroup ¶
func (c *HardwareManagerClient) DeleteResourceGroup(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) (string, error)
DeleteResourceGroup asks the hardware manager to delete the resource group associated with the specified nodepool
func (*HardwareManagerClient) GetResource ¶
func (c *HardwareManagerClient) GetResource(ctx context.Context, node *hwmgmtv1alpha1.Node) (*hwmgrapi.ApiprotoGetResourceResp, error)
GetResource queries the hardware manager to get the resource data
func (*HardwareManagerClient) GetResourceGroupFromId ¶
func (c *HardwareManagerClient) GetResourceGroupFromId(ctx context.Context, rgId string) (*hwmgrapi.RhprotoResourceGroupObjectGetResponseBody, error)
GetResourceGroup queries the hardware manager to get the resource group data
func (*HardwareManagerClient) GetResourceGroupFromNodePool ¶
func (c *HardwareManagerClient) GetResourceGroupFromNodePool(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) (*hwmgrapi.RhprotoResourceGroupObjectGetResponseBody, error)
GetResourceGroupFromNodePool queries the hardware manager to get the resource group data
func (*HardwareManagerClient) GetResourceGroups ¶
func (c *HardwareManagerClient) GetResourceGroups(ctx context.Context) (*hwmgrapi.RhprotoResourceGroupsResp, error)
GetResourceGroup queries the hardware manager to get the resource group data
func (*HardwareManagerClient) GetResourcePools ¶
func (c *HardwareManagerClient) GetResourcePools(ctx context.Context) (*hwmgrapi.ApiprotoResourcePoolsResp, error)
GetResourcePools queries the hardware manager to get the resource pool list
func (*HardwareManagerClient) GetResources ¶
func (c *HardwareManagerClient) GetResources(ctx context.Context) (*hwmgrapi.ApiprotoGetResourcesResp, error)
GetResources queries the hardware manager to get the resources list
func (*HardwareManagerClient) GetSecret ¶
func (c *HardwareManagerClient) GetSecret(ctx context.Context, secretKey string) (*hwmgrapi.RhprotoGetSecretsResponseBody, error)
GetSecret queries the hardware manager to get the Secret data
func (*HardwareManagerClient) GetServersInventory ¶
func (c *HardwareManagerClient) GetServersInventory(ctx context.Context) (*hwmgrapi.ApiprotoGetServersInventoryResp, error)
GetServersInventory queries the hardware manager to get the server inventory
func (*HardwareManagerClient) GetTenant ¶
func (c *HardwareManagerClient) GetTenant() string
GetTenant gets the tenant parameter from the hwmgr configuration
func (*HardwareManagerClient) GetToken ¶
func (c *HardwareManagerClient) GetToken(ctx context.Context) (string, error)
GetToken sends a request to the hardware manager to request an authentication token
func (*HardwareManagerClient) ResourceGroupExists ¶
func (c *HardwareManagerClient) ResourceGroupExists(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) (bool, error)
func (*HardwareManagerClient) ResourceGroupFromNodePool ¶
func (c *HardwareManagerClient) ResourceGroupFromNodePool(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) *hwmgrapi.CreateResourceGroupJSONRequestBody
ResourceGroupFromNodePool transforms data from a nodepool object to a CreateResourceGroupJSONRequestBody instance
func (*HardwareManagerClient) UpdateResourceProfile ¶
func (c *HardwareManagerClient) UpdateResourceProfile(ctx context.Context, node *hwmgmtv1alpha1.Node, newHwProfile string) (string, error)
UpdateResourceProfile sends a request to update the resource profile for a node
func (*HardwareManagerClient) ValidateResourceGroup ¶
func (c *HardwareManagerClient) ValidateResourceGroup( ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool, resourceGroup hwmgrapi.RhprotoResourceGroupObjectGetResponseBody, ) error
ValidateResourceGroup validates the hardware manager resource group data with nodepool
type RespDefault ¶
type RespDefault struct {
Code int `json:"code,omitempty"`
Message string `json:"message,omitempty"`
Details []RespDefaultDetails `json:"details,omitempty"`
}
func DecodeRespDefault ¶
func DecodeRespDefault(body []byte) (resp RespDefault, err error)
type RespDefaultDetails ¶
type RespDefaultDetails struct {
Type string `json:"@type,omitempty"`
Reason string `json:"reason,omitempty"`
Domain string `json:"domain,omitempty"`
Metadata RespDefaultDetailsMetadata `json:"metadata,omitempty"`
}
type RespDefaultDetailsMetadata ¶
type RespDefaultDetailsMetadata struct {
DTIASErrorCode string `json:"DTIASErrorCode,omitempty"`
DTIASErrorMessage string `json:"DTIASErrorMessage,omitempty"`
HTTPErrorCode string `json:"HTTPErrorCode,omitempty"`
ManagedServiceError string `json:"ManagedServiceError,omitempty"`
Resolution string `json:"Resolution,omitempty"`
}
Helper for decoding failure response from certain APIs