data

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: MPL-2.0-no-copyleft-exception Imports: 11 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 struct {
	// contains filtered or unexported fields
}

Client is a datasvc client.

func New

func New(addr string, cert *transport.Cert, trace bool) (*Client, error)

New creates a new *Client.

func (*Client) AddCapability

func (c *Client) AddCapability(ctx context.Context, u *model.User, cap model.Capability) error

AddCapability adds a capability for a user.

func (*Client) AddError

func (c *Client) AddError(ctx context.Context, msg, username string) error

AddError adds an error.

func (*Client) AddSubscription

func (c *Client) AddSubscription(ctx context.Context, name, repo string) error

AddSubscription adds a subscription for the user.

func (*Client) AllRepositories

func (c *Client) AllRepositories(ctx context.Context, name, search string) (model.RepositoryList, error)

AllRepositories lists all visible repositories by the user.

func (*Client) CancelRefByName

func (c *Client) CancelRefByName(ctx context.Context, repoID int64, ref string) error

CancelRefByName cancels all jobs for a ref by name

func (*Client) CancelSubmission

func (c *Client) CancelSubmission(ctx context.Context, id int64) error

CancelSubmission cancels a submission by ID.

func (*Client) CancelTask

func (c *Client) CancelTask(ctx context.Context, id int64) error

CancelTask cancels a task by id.

func (*Client) CancelTasksByPR

func (c *Client) CancelTasksByPR(ctx context.Context, repository string, prID int64) error

CancelTasksByPR cancels tasks by PR ID.

func (*Client) Close

func (c *Client) Close() error

Close closes the client's tracing functionality

func (*Client) CountRunsForTask

func (c *Client) CountRunsForTask(ctx context.Context, taskID int64) (int64, error)

CountRunsForTask counts all the runs associated with the task.

func (*Client) CountSubmissions

func (c *Client) CountSubmissions(ctx context.Context, repository, sha string) (int64, error)

CountSubmissions returns the count of all submissions that meet the optional filtering requirements.

func (*Client) CountTasks

func (c *Client) CountTasks(ctx context.Context, repository, sha string) (int64, error)

CountTasks counts the tasks with the filters applied.

func (*Client) DeleteError

func (c *Client) DeleteError(ctx context.Context, id, userID int64) error

DeleteError removes an error.

func (*Client) DeleteSubscription

func (c *Client) DeleteSubscription(ctx context.Context, name, repo string) error

DeleteSubscription removes a subscription for the user.

func (*Client) DeleteToken

func (c *Client) DeleteToken(ctx context.Context, username string) error

DeleteToken removes the existing access token and makes it available to be regenerated.

func (*Client) DisableRepository

func (c *Client) DisableRepository(ctx context.Context, user, name string) error

DisableRepository disabls a repository in CI for a user as owner.

func (*Client) EnableRepository

func (c *Client) EnableRepository(ctx context.Context, user, name string) error

EnableRepository enables a repository in CI for a user as owner.

func (*Client) GetCancel

func (c *Client) GetCancel(ctx context.Context, id int64) (bool, error)

GetCancel returns the state for the run.

func (*Client) GetCapabilities

func (c *Client) GetCapabilities(ctx context.Context, u *model.User) ([]model.Capability, error)

GetCapabilities yields the capabilities that belong to the user.

func (*Client) GetErrors

func (c *Client) GetErrors(ctx context.Context, name string) ([]*model.UserError, error)

GetErrors retrieves all the errors for the user.

func (*Client) GetRefByNameAndSHA

func (c *Client) GetRefByNameAndSHA(ctx context.Context, repoName, sha string) (*model.Ref, error)

GetRefByNameAndSHA retrieves a ref by it's repo name and SHA

func (*Client) GetRepository

func (c *Client) GetRepository(ctx context.Context, name string) (*model.Repository, error)

GetRepository retrieves a repository by name.

func (*Client) GetRun

func (c *Client) GetRun(ctx context.Context, id int64) (*model.Run, error)

GetRun retrieves a run by id.

func (*Client) GetRunUI

func (c *Client) GetRunUI(ctx context.Context, id int64) (*model.Run, error)

GetRunUI retrieves a run by id.

func (*Client) GetRunsForSubmission

func (c *Client) GetRunsForSubmission(ctx context.Context, sub *model.Submission, page, perPage int64) ([]*model.Run, error)

GetRunsForSubmission returns the runs for the given submission; with pagination

func (*Client) GetRunsForTask

func (c *Client) GetRunsForTask(ctx context.Context, taskID, page, perPage int64) ([]*model.Run, error)

GetRunsForTask retrieves all the runs by task ID.

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context, id string) (*model.Session, error)

GetSession retrieves a session from the database by id.

func (*Client) GetSubmissionByID

func (c *Client) GetSubmissionByID(ctx context.Context, id int64) (*model.Submission, error)

GetSubmissionByID returns the submission for the given ID.

func (*Client) GetTasksForSubmission

func (c *Client) GetTasksForSubmission(ctx context.Context, sub *model.Submission, page, perPage int64) ([]*model.Task, error)

GetTasksForSubmission returns the tasks for the given submission; with pagination

func (*Client) GetToken

func (c *Client) GetToken(ctx context.Context, username string) (string, error)

GetToken returns a newly minted access token to tinyCI or error otherwise. To get a new token with this method, call the DeleteToken method first if one exists already.

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, name string) (*model.User, error)

GetUser obtains a user record by name

func (*Client) HasCapability

func (c *Client) HasCapability(ctx context.Context, u *model.User, cap model.Capability) (bool, error)

HasCapability returns true if the user has the specified capability.

func (*Client) ListRuns

func (c *Client) ListRuns(ctx context.Context, repoName, sha string, page, perPage int64) ([]*model.Run, error)

ListRuns lists runs by repository name and sha

func (*Client) ListSubmissions

func (c *Client) ListSubmissions(ctx context.Context, page, perPage int64, repository, sha string) ([]*model.Submission, error)

ListSubmissions lists the submissions with pagination, and an optional (just pass empty strings if undesired) repository and sha filter.

func (*Client) ListSubscribedTasksForUser

func (c *Client) ListSubscribedTasksForUser(ctx context.Context, userID, page, perPage int64) ([]*model.Task, error)

ListSubscribedTasksForUser lists all the tasks for the repos the user is subscribed to.

func (*Client) ListSubscriptions

func (c *Client) ListSubscriptions(ctx context.Context, name, search string) (model.RepositoryList, error)

ListSubscriptions lists the subscriptions that the user has selected.

func (*Client) ListTasks

func (c *Client) ListTasks(ctx context.Context, repository, sha string, page, perPage int64) ([]*model.Task, error)

ListTasks returns the items in the task list that match the repository and sha parameters; they may also be blank to select all items. page and perPage are limiters to define pagination rules.

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context) ([]*model.User, error)

ListUsers lists the users in the system.

func (*Client) NextQueueItem

func (c *Client) NextQueueItem(ctx context.Context, queueName, runningOn string) (*model.QueueItem, error)

NextQueueItem return the next queue item. The runningOn is a hostname which is provided for tracking purposes. It should be unique (but, is ultimately not necessary).

func (*Client) OAuthRegisterState

func (c *Client) OAuthRegisterState(ctx context.Context, state string, scopes []string) error

OAuthRegisterState registers the oauth state in the database.

func (*Client) OAuthValidateState

func (c *Client) OAuthValidateState(ctx context.Context, state string) ([]string, error)

OAuthValidateState validates the state in the database.

func (*Client) OwnedRepositories

func (c *Client) OwnedRepositories(ctx context.Context, name, search string) (model.RepositoryList, error)

OwnedRepositories lists the owned repositories by the user.

func (*Client) PatchUser

func (c *Client) PatchUser(ctx context.Context, u *model.User) error

PatchUser adjusts the token for the user.

func (*Client) PrivateRepositories

func (c *Client) PrivateRepositories(ctx context.Context, name, search string) (model.RepositoryList, error)

PrivateRepositories lists all visible private repositories by the user.

func (*Client) PublicRepositories

func (c *Client) PublicRepositories(ctx context.Context, search string) (model.RepositoryList, error)

PublicRepositories lists all owned public repositories by the user.

func (*Client) PutQueue

func (c *Client) PutQueue(ctx context.Context, qis []*model.QueueItem) ([]*model.QueueItem, error)

PutQueue adds many QueueItems to the queue.

func (*Client) PutRef

func (c *Client) PutRef(ctx context.Context, ref *model.Ref) (int64, error)

PutRef adds a ref to the database.

func (*Client) PutRepositories

func (c *Client) PutRepositories(ctx context.Context, name string, github []*github.Repository, autoCreated bool) error

PutRepositories takes a list of github repositories and adds them to the database for the user as owner.

func (*Client) PutSession

func (c *Client) PutSession(ctx context.Context, s *model.Session) error

PutSession adds a session to the database.

func (*Client) PutStatus

func (c *Client) PutStatus(ctx context.Context, runID int64, status bool, msg string) error

PutStatus returns the status of the run.

func (*Client) PutSubmission

func (c *Client) PutSubmission(ctx context.Context, sub *model.Submission) (*model.Submission, error)

PutSubmission puts a submission into the datasvc. Updates the created_at time.

func (*Client) PutTask

func (c *Client) PutTask(ctx context.Context, task *model.Task) (*model.Task, error)

PutTask adds a task to the database.

func (*Client) PutUser

func (c *Client) PutUser(ctx context.Context, u *model.User) (*model.User, error)

PutUser inserts the user provided.

func (*Client) RemoveCapability

func (c *Client) RemoveCapability(ctx context.Context, u *model.User, cap model.Capability) error

RemoveCapability removes a capability from a user.

func (*Client) RunCount

func (c *Client) RunCount(ctx context.Context, repoName, sha string) (int64, error)

RunCount returns the count of all items that match the repoName and sha.

func (*Client) SetCancel

func (c *Client) SetCancel(ctx context.Context, id int64) error

SetCancel cancels a run, and any other task-level runs.

func (*Client) ValidateToken

func (c *Client) ValidateToken(ctx context.Context, token string) (*model.User, error)

ValidateToken validates the token and returns error if it is not valid somehow.

Jump to

Keyboard shortcuts

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