github

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateRegistrationToken(context.Context, string, string) (*github.RegistrationToken, error)
	ListRunners(context.Context, string, string, []string) ([]*Runner, error)
	RemoveRunner(context.Context, string, string, int64) error
}

Client generates token for GitHub Action selfhosted runner

type ClientCredential added in v0.6.0

type ClientCredential struct {
	PersonalAccessToken string
	AppID               int64
	AppInstallationID   int64
	PrivateKey          []byte
	PrivateKeyPath      string
}

type ClientFactory added in v0.6.0

type ClientFactory interface {
	New(*ClientCredential) (Client, error)
}

ClientFactory is a factory of Clients.

func NewFactory added in v0.6.0

func NewFactory() ClientFactory

type FakeClient

type FakeClient struct {
	// contains filtered or unexported fields
}

FakeClient is a fake client

func (*FakeClient) CreateRegistrationToken

func (c *FakeClient) CreateRegistrationToken(ctx context.Context, owner, repo string) (*github.RegistrationToken, error)

CreateRegistrationToken returns dummy token.

func (*FakeClient) ListRunners

func (c *FakeClient) ListRunners(ctx context.Context, owner, repo string, labels []string) ([]*Runner, error)

ListRunners returns dummy list.

func (*FakeClient) RemoveRunner

func (c *FakeClient) RemoveRunner(ctx context.Context, owner, repo string, runnerID int64) error

RemoveRunner does not delete anything and returns success.

type FakeClientFactory added in v0.6.0

type FakeClientFactory struct {
	// contains filtered or unexported fields
}

func NewFakeClientFactory added in v0.6.0

func NewFakeClientFactory() *FakeClientFactory

func (*FakeClientFactory) ListRunners added in v0.6.0

func (f *FakeClientFactory) ListRunners(ctx context.Context, owner, repo string, labels []string) ([]*Runner, error)

ListRunners returns dummy list.

func (*FakeClientFactory) New added in v0.6.0

func (*FakeClientFactory) RemoveRunner added in v0.6.0

func (f *FakeClientFactory) RemoveRunner(ctx context.Context, owner, repo string, runnerID int64) error

RemoveRunner does not delete anything and returns success.

func (*FakeClientFactory) SetExpiredAtDuration added in v0.6.0

func (f *FakeClientFactory) SetExpiredAtDuration(d time.Duration)

func (*FakeClientFactory) SetRunners added in v0.6.0

func (f *FakeClientFactory) SetRunners(runners map[string][]*Runner)

type Runner

type Runner struct {
	ID     int64
	Name   string
	Online bool
	Busy   bool
	Labels []string
}

Jump to

Keyboard shortcuts

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