Documentation
¶
Index ¶
- type CreateSecretRequest
- type Secret
- type SlicerClient
- func (c *SlicerClient) CreateNode(groupName string, request SlicerCreateNodeRequest) (*SlicerCreateNodeResponse, error)
- func (c *SlicerClient) CreateSecret(request CreateSecretRequest) error
- func (c *SlicerClient) DeleteNode(groupName, nodeName string) error
- func (c *SlicerClient) DeleteSecret(secretName string) error
- func (c *SlicerClient) GetHostGroupNodes(groupName string) ([]SlicerNode, error)
- func (c *SlicerClient) GetHostGroups() ([]SlicerHostGroup, error)
- func (c *SlicerClient) ListSecrets() ([]Secret, error)
- func (c *SlicerClient) PatchSecret(secretName string, request UpdateSecretRequest) error
- type SlicerCreateNodeRequest
- type SlicerCreateNodeResponse
- type SlicerHostGroup
- type SlicerNode
- type UpdateSecretRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateSecretRequest ¶ added in v0.0.6
type CreateSecretRequest struct {
// Name is the unique name of the secret
Name string `json:"name"`
// Data is the secret content
Data string `json:"data"`
// Permissions specifies the file permissions (defaults to system default)
Permissions string `json:"permissions,omitempty"`
// GID is the user ID that should own the secret file. If not set, the default for
// a uint32 will be used i.e root.
UID uint32 `json:"uid,omitempty"`
// GID is the group ID that should own the secret file. If not set, the default for
// a uint32 will be used i.e root.
GID uint32 `json:"gid,omitempty"`
}
CreateSecretRequest is the payload for creating a new secret via the REST API.
type Secret ¶ added in v0.0.6
type Secret struct {
// Name is the unique name of the secret
Name string `json:"name"`
// Size is the size of the secret data in bytes
Size int64 `json:"size"`
// Permissions specifies the file permissions for the secret (e.g., "0600")
Permissions string `json:"permissions"`
// GID is the user ID that should own the secret file. If not set, the default for
// a uint32 will be used i.e root.
UID uint32 `json:"uid,omitempty"`
// GID is the group ID that should own the secret file. If not set, the default for
// a uint32 will be used i.e root.
GID uint32 `json:"gid,omitempty"`
}
Secret represents a secret stored in the slicer system. Secrets can be used to store sensitive configuration data, keys, or other private information that can be mounted into nodes or used by services.
type SlicerClient ¶
type SlicerClient struct {
// contains filtered or unexported fields
}
SlicerClient handles all HTTP communication with the Slicer API
func NewSlicerClient ¶
func NewSlicerClient(baseURL, token string, userAgent string, httpClient *http.Client) *SlicerClient
NewSlicerClient creates a new Slicer API client
func (*SlicerClient) CreateNode ¶
func (c *SlicerClient) CreateNode(groupName string, request SlicerCreateNodeRequest) (*SlicerCreateNodeResponse, error)
CreateNode creates a new node in the specified host group
func (*SlicerClient) CreateSecret ¶ added in v0.0.6
func (c *SlicerClient) CreateSecret(request CreateSecretRequest) error
CreateSecret creates a new secret. Returns an error if a secret with the same mame already exists or if creation fails.
func (*SlicerClient) DeleteNode ¶
func (c *SlicerClient) DeleteNode(groupName, nodeName string) error
DeleteNode deletes a node from the specified host group
func (*SlicerClient) DeleteSecret ¶ added in v0.0.6
func (c *SlicerClient) DeleteSecret(secretName string) error
DeleteSecret removes a secret. Returns an error if the secret doesn't exist or if the deletion fails.
func (*SlicerClient) GetHostGroupNodes ¶
func (c *SlicerClient) GetHostGroupNodes(groupName string) ([]SlicerNode, error)
GetHostGroupNodes fetches nodes for a specific host group
func (*SlicerClient) GetHostGroups ¶
func (c *SlicerClient) GetHostGroups() ([]SlicerHostGroup, error)
GetHostGroups fetches all host groups from the API
func (*SlicerClient) ListSecrets ¶ added in v0.0.6
func (c *SlicerClient) ListSecrets() ([]Secret, error)
ListSecrets retrieves all secrets. Note: The actual secret data is not returned for security reasons.
func (*SlicerClient) PatchSecret ¶ added in v0.0.6
func (c *SlicerClient) PatchSecret(secretName string, request UpdateSecretRequest) error
PatchSecret updates an existing secret with new data and/or metadata. Only the fields provided in the UpdateSecretRequest will be modified. Returns an error if the secret doesn't exist or if the update fails.
type SlicerCreateNodeRequest ¶
type SlicerCreateNodeRequest struct {
RamGB int `json:"ram_gb"`
CPUs int `json:"cpus"`
Tags []string `json:"tags,omitempty"`
ImportUser string `json:"import_user"`
Userdata string `json:"userdata,omitempty"`
SSHKeys []string `json:"ssh_keys,omitempty"`
}
SlicerCreateNodeRequest is the payload for creating a node via the REST API.
type SlicerCreateNodeResponse ¶
type SlicerCreateNodeResponse struct {
Hostname string `json:"hostname"`
IP string `json:"ip"`
CreatedAt time.Time `json:"created_at"`
Arch string `json:"arch,omitempty"`
}
SlicerCreateNodeResponse is the response from the REST API when creating a node.
func (*SlicerCreateNodeResponse) IPAddress ¶
func (n *SlicerCreateNodeResponse) IPAddress() net.IP
type SlicerHostGroup ¶
type SlicerHostGroup struct {
Name string `json:"name"`
Count int `json:"count"`
RamGB int `json:"ram_gb"`
CPUs int `json:"cpus"`
Arch string `json:"arch,omitempty"`
GPUCount int `json:"gpu_count,omitempty"`
}
SlicerHostGroup represents a host group from the /hostgroup endpoint.
type SlicerNode ¶
type SlicerNode struct {
Hostname string `json:"hostname"`
IP string `json:"ip"`
CreatedAt time.Time `json:"created_at"`
Arch string `json:"arch,omitempty"`
Tags []string `json:"tags,omitempty"`
}
SlicerNode represents a node managed by the slicer REST API.
type UpdateSecretRequest ¶ added in v0.0.6
type UpdateSecretRequest struct {
// Data is the updated secret content
Data string `json:"data"`
// Permissions specifies the file permissions
Permissions string `json:"permissions,omitempty"`
// GID is the user ID that should own the secret file. If not set, the default for
// a uint32 will be used i.e root.
UID uint32 `json:"uid,omitempty"`
// GID is the group ID that should own the secret file. If not set, the default for
// a uint32 will be used i.e root.
GID uint32 `json:"gid,omitempty"`
}
UpdateSecretRequest is the payload for updating an existing secret via the REST API. All fields are optional - only provided fields will be updated.