{"modulePath":"github.com/taskcluster/taskcluster-worker","version":"v0.1.20","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package client\n\n## Variables\n\n```go\nvar PostAnyArtifactRequest = mock.MatchedBy(func(i interface{}) bool {\n\t_, ok := i.(*tcqueue.PostArtifactRequest)\n\treturn ok\n})\n```\nPostAnyArtifactRequest matches if tcqueue.PostArtifactRequest is called\n\n```go\nvar PostS3ArtifactRequest = mock.MatchedBy(func(i interface{}) bool {\n\tr, ok := i.(*tcqueue.PostArtifactRequest)\n\tif !ok {\n\t\treturn false\n\t}\n\tvar s3req tcqueue.S3ArtifactRequest\n\tif json.Unmarshal(*r, \u0026s3req) != nil {\n\t\treturn false\n\t}\n\treturn s3req.StorageType == \"s3\"\n})\n```\nPostS3ArtifactRequest matches if tcqueue.PostS3ArtifactRequest is called with an s3 artifact\n\n## Types\n\n```go\ntype Auth interface {\n\tSentryDSN(project string) (*tcauth.SentryDSNResponse, error)\n\tStatsumToken(project string) (*tcauth.StatsumTokenResponse, error)\n}\n```\nAuth interface covers parts of the tcauth.Auth client that we use. This allows us to mock the implementation during tests.\n\n```go\ntype Authorizer interface {\n\tSignHeader(method string, URL *url.URL, payload json.RawMessage) (string, error)\n\tSignURL(URL *url.URL, expiration time.Duration) (*url.URL, error)\n\tWithAuthorizedScopes(scopes ...string) Authorizer\n}\n```\nAn Authorizer is an interface for an object that can sign a request with taskcluster credentials.\n\n```go\nfunc NewAuthorizer(getCredentials func() (clientID string, accessToken string, certificate string, err error)) Authorizer\n```\nNewAuthorizer returns an authorizer that signs with credntials from getCredentials\n\n```go\ntype MockAuth struct {\n\tmock.Mock\n}\n```\nMockAuth is a mock implementation of Auth for testing.\n\n```go\nfunc (m *MockAuth) SentryDSN(project string) (*tcauth.SentryDSNResponse, error)\n```\nSentryDSN is a mock implementation of SentryDSN that calls into m.Mock\n\n```go\nfunc (m *MockAuth) StatsumToken(project string) (*tcauth.StatsumTokenResponse, error)\n```\nStatsumToken is a mock implementation of StatsumToken that calls into Mock\n\n```go\ntype MockQueue struct {\n\tmock.Mock\n}\n```\nMockQueue is a mocked TaskCluster queue client.  Calls to methods exposed by the queue client will be recorded for assertion later and will respond with the data that was specified during creation of the mocked object.\n\nFor more information about each of these client methods, consult the taskcluster-clieng-go/queue package\n\n```go\nfunc (m *MockQueue) CancelTask(taskID string) (*tcqueue.TaskStatusResponse, error)\n```\nCancelTask is a mock implementation of github.com/taskcluster/taskcluster-client-go/tcqueue.CancelTask\n\n```go\nfunc (m *MockQueue) ClaimTask(taskID, runID string, payload *tcqueue.TaskClaimRequest) (*tcqueue.TaskClaimResponse, error)\n```\nClaimTask is a mock implementation of github.com/taskcluster/taskcluster-client-go/tcqueue.ClaimTask\n\n```go\nfunc (m *MockQueue) ClaimWork(provisionerID, workerType string, payload *tcqueue.ClaimWorkRequest) (*tcqueue.ClaimWorkResponse, error)\n```\nClaimWork is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue#Queue.ClaimWork\n\n```go\nfunc (m *MockQueue) CreateArtifact(taskID, runID, name string, payload *tcqueue.PostArtifactRequest) (*tcqueue.PostArtifactResponse, error)\n```\nCreateArtifact is a mock implementation of github.com/taskcluster/taskcluster-client-go/tcqueue.CreateArtifact\n\n```go\nfunc (m *MockQueue) ExpectRedirectArtifact(taskID string, runID int, name string) \u003c-chan string\n```\nExpectRedirectArtifact will setup m to expect a redirect artifact with given name for taskID and runID to be created. This function returns a channel for the url of the redirect artifact.\n\n```go\nfunc (m *MockQueue) ExpectS3Artifact(taskID string, runID int, name string) \u003c-chan []byte\n```\nExpectS3Artifact will setup queue to expect an S3 artifact with given name to be created for taskID and runID using m and returns a channel which will receive the artifact.\n\n```go\nfunc (m *MockQueue) GetArtifact_SignedURL(taskID, runID, name string, duration time.Duration) (*url.URL, error)\n```\nGetArtifact\\_SignedURL is a mock implementation of github.com/taskcluster/taskcluster-client-go/tcqueue.GetArtifact\\_SignedURL\n\n```go\nfunc (m *MockQueue) PollTaskUrls(provisionerID, workerType string) (*tcqueue.PollTaskUrlsResponse, error)\n```\nPollTaskUrls is a mock implementation of github.com/taskcluster/taskcluster-client-go/tcqueue.PollTaskUrls\n\n```go\nfunc (m *MockQueue) ReclaimTask(taskID, runID string) (*tcqueue.TaskReclaimResponse, error)\n```\nReclaimTask is a mock implementation of github.com/taskcluster/taskcluster-client-go/tcqueue.ReclaimTask\n\n```go\nfunc (m *MockQueue) ReportCompleted(taskID, runID string) (*tcqueue.TaskStatusResponse, error)\n```\nReportCompleted is a mock implementation of github.com/taskcluster/taskcluster-client-go/tcqueue.ReportCompleted\n\n```go\nfunc (m *MockQueue) ReportException(taskID, runID string, payload *tcqueue.TaskExceptionRequest) (*tcqueue.TaskStatusResponse, error)\n```\nReportException is a mock implementation of github.com/taskcluster/taskcluster-client-go/tcqueue.ReportException\n\n```go\nfunc (m *MockQueue) ReportFailed(taskID, runID string) (*tcqueue.TaskStatusResponse, error)\n```\nReportFailed is a mock implementation of github.com/taskcluster/taskcluster-client-go/tcqueue.ReportFailed\n\n```go\nfunc (m *MockQueue) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\nServeHTTP handles a queue request by calling the mock implemetation\n\n```go\nfunc (m *MockQueue) Status(taskID string) (*tcqueue.TaskStatusResponse, error)\n```\nStatus is a mock implementation of github.com/taskcluster/taskcluster-client-go/tcqueue.Status\n\n```go\ntype Queue interface {\n\tStatus(string) (*tcqueue.TaskStatusResponse, error)\n\tReportCompleted(string, string) (*tcqueue.TaskStatusResponse, error)\n\tReportException(string, string, *tcqueue.TaskExceptionRequest) (*tcqueue.TaskStatusResponse, error)\n\tReportFailed(string, string) (*tcqueue.TaskStatusResponse, error)\n\tClaimTask(string, string, *tcqueue.TaskClaimRequest) (*tcqueue.TaskClaimResponse, error)\n\tClaimWork(provisionerID, workerType string, payload *tcqueue.ClaimWorkRequest) (*tcqueue.ClaimWorkResponse, error)\n\tReclaimTask(string, string) (*tcqueue.TaskReclaimResponse, error)\n\tPollTaskUrls(string, string) (*tcqueue.PollTaskUrlsResponse, error)\n\tCancelTask(string) (*tcqueue.TaskStatusResponse, error)\n\tCreateArtifact(string, string, string, *tcqueue.PostArtifactRequest) (*tcqueue.PostArtifactResponse, error)\n\tGetArtifact_SignedURL(string, string, string, time.Duration) (*url.URL, error) // nolint\n}\n```\nQueue is an interface to the Queue client provided by the taskcluster-client-go package.  Passing around an interface allows the queue client to be mocked\n\n","path":"github.com/taskcluster/taskcluster-worker/runtime/client","name":"client","synopsis":"","isRedistributable":true}
