client

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiKeyHeader = "x-api-key"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayClient added in v0.2.0

type ArrayClient interface {
	// ShowArray will return the current state of the unraid array
	ShowArray(ctx context.Context) (*models.ShowArrayModel, error)
	// MutateArray allows to change make a transition to a new state : STARTED -> STOPPED
	MutateArray(ctx context.Context, state ArrayState) (*models.MutateArrayModel, error)
}

ArrayClient is used to interract with unraid array system

func NewArrayClient added in v0.2.0

func NewArrayClient(apiKey string, graphqlClient *graphql.Client) ArrayClient

type ArrayState added in v0.2.0

type ArrayState = string
const (
	ArrayStateStart ArrayState = "START"
	ArrayStateStop  ArrayState = "STOP"
)

type DockerClient

type DockerClient interface {
	ListContainers(ctx context.Context) (*models.ListContainersModel, error)
	StartContainer(ctx context.Context, startId string) (*models.StartContainerModel, error)
	StopContainer(ctx context.Context, stopId string) (*models.StopContainerModel, error)
}

func NewDockerClient

func NewDockerClient(apiKey string, graphqlClient *graphql.Client) DockerClient

type RealArrayClient added in v0.2.0

type RealArrayClient struct {
	ApiKey        string
	GraphQLClient *graphql.Client
}

RealArrayClient is a basic implementation for an ArrayClient

func (*RealArrayClient) MutateArray added in v0.2.0

func (c *RealArrayClient) MutateArray(ctx context.Context, state ArrayState) (*models.MutateArrayModel, error)

func (*RealArrayClient) ShowArray added in v0.2.0

func (c *RealArrayClient) ShowArray(ctx context.Context) (*models.ShowArrayModel, error)

type RealDockerClient

type RealDockerClient struct {
	ApiKey        string
	GraphQLClient *graphql.Client
}

func (*RealDockerClient) ListContainers

func (c *RealDockerClient) ListContainers(ctx context.Context) (*models.ListContainersModel, error)

func (*RealDockerClient) StartContainer

func (c *RealDockerClient) StartContainer(ctx context.Context, startId string) (*models.StartContainerModel, error)

func (*RealDockerClient) StopContainer

func (c *RealDockerClient) StopContainer(ctx context.Context, stopId string) (*models.StopContainerModel, error)

type RealShareClient added in v0.4.0

type RealShareClient struct {
	ApiKey        string
	GraphQLClient *graphql.Client
}

func (*RealShareClient) ListShares added in v0.4.0

func (c *RealShareClient) ListShares(ctx context.Context) (*models.ListSharesModel, error)

type RealVMClient added in v0.3.0

type RealVMClient struct {
	ApiKey        string
	GraphQLClient *graphql.Client
}

func (*RealVMClient) ListVMs added in v0.3.0

func (c *RealVMClient) ListVMs(ctx context.Context) (*models.ListVMsModel, error)

func (*RealVMClient) Start added in v0.3.0

func (c *RealVMClient) Start(ctx context.Context, id string) (*models.StartVMModel, error)

func (*RealVMClient) Stop added in v0.3.0

func (c *RealVMClient) Stop(ctx context.Context, id string) (*models.StopVMModel, error)

type ShareClient added in v0.4.0

type ShareClient interface {
	ListShares(ctx context.Context) (*models.ListSharesModel, error)
}

func NewShareClient added in v0.4.0

func NewShareClient(apiKey string, graphqlClient *graphql.Client) ShareClient

type UnraidClient

type UnraidClient struct {
	Docker DockerClient
	Array  ArrayClient
	VM     VMClient
	Shares ShareClient
}

UnraidClient is a client wrapper. It registers every sub-clients into one unified structure

func NewUnraidClient

func NewUnraidClient(apiKey string, graphqlClient *graphql.Client, options ...UnraidClientOption) *UnraidClient

NewUnraidClient will return an UnraidClient initialized with standard sub-clients. You can change initialized sub-clients with your own implementations using functionnal options

type UnraidClientOption added in v0.3.0

type UnraidClientOption func(*UnraidClient)

UnraidClientOption is a function that will bind something into an UnraidClient

func WithArrayClient added in v0.3.0

func WithArrayClient(arrayClient ArrayClient) UnraidClientOption

WithDockerClient allow you to custom UnraidClient with your own implementation of ArrayClient

func WithDockerClient added in v0.3.0

func WithDockerClient(dockerClient DockerClient) UnraidClientOption

WithDockerClient allow you to custom UnraidClient with your own implementation of DockerClient

func WithShareClient added in v0.4.0

func WithShareClient(shareClient ShareClient) UnraidClientOption

WithShareClient allow you to custom UnraidClient with your own implementation of ShareClient

func WithVmClient added in v0.3.0

func WithVmClient(vmClient VMClient) UnraidClientOption

WithDockerClient allow you to custom UnraidClient with your own implementation of VMClient

type VMClient added in v0.3.0

type VMClient interface {
	ListVMs(ctx context.Context) (*models.ListVMsModel, error)
	Start(ctx context.Context, id string) (*models.StartVMModel, error)
	Stop(ctx context.Context, id string) (*models.StopVMModel, error)
}

func NewVMClient added in v0.3.0

func NewVMClient(apiKey string, graphqlClient *graphql.Client) VMClient

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL