Skip to content
This repository has been archived by the owner on Feb 27, 2020. It is now read-only.

Commit

Permalink
Added interfaces and mock objects
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasfj committed Mar 17, 2016
1 parent 414189b commit a199225
Show file tree
Hide file tree
Showing 11 changed files with 2,293 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ generate:
go get github.com/progrium/go-extpoints
go get github.com/jonasfj/go-import-subtree
go get github.com/taskcluster/taskcluster-worker/codegen/...
go get github.com/rjeczalik/interfaces/cmd/interfacer
go get github.com/vektra/mockery/...
go generate ./...
go fmt ./...

Expand Down
41 changes: 41 additions & 0 deletions runtime/client/auth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Created by interfacer; DO NOT EDIT

package client

import (
"github.com/taskcluster/taskcluster-client-go/auth"
"github.com/taskcluster/taskcluster-client-go/tcclient"
"net/url"
"time"
)

// Auth is an interface generated for "github.com/taskcluster/taskcluster-client-go/auth".Auth.
type Auth interface {
AuthenticateHawk(*auth.HawkSignatureAuthenticationRequest) (*auth.HawkSignatureAuthenticationResponse, *tcclient.CallSummary, error)
AwsS3Credentials(string, string, string) (*auth.AWSS3CredentialsResponse, *tcclient.CallSummary, error)
AwsS3Credentials_SignedURL(string, string, string, time.Duration) (*url.URL, error)
AzureTableSAS(string, string) (*auth.AzureSharedAccessSignatureResponse, *tcclient.CallSummary, error)
AzureTableSAS_SignedURL(string, string, time.Duration) (*url.URL, error)
Cert() (*tcclient.Certificate, error)
Client(string) (*auth.GetClientResponse, *tcclient.CallSummary, error)
CreateClient(string, *auth.CreateClientRequest) (*auth.CreateClientResponse, *tcclient.CallSummary, error)
CreateNamedTemporaryCredentials(string, time.Duration, []string) (*tcclient.Credentials, error)
CreateRole(string, *auth.CreateRoleRequest) (*auth.GetRoleResponse, *tcclient.CallSummary, error)
CreateTemporaryCredentials(time.Duration, []string) (*tcclient.Credentials, error)
CurrentScopes() (*auth.SetOfScopes, *tcclient.CallSummary, error)
DeleteClient(string) (*tcclient.CallSummary, error)
DeleteRole(string) (*tcclient.CallSummary, error)
DisableClient(string) (*auth.GetClientResponse, *tcclient.CallSummary, error)
EnableClient(string) (*auth.GetClientResponse, *tcclient.CallSummary, error)
ExpandScopes(*auth.SetOfScopes) (*auth.SetOfScopes, *tcclient.CallSummary, error)
ListClients(string) (*auth.ListClientResponse, *tcclient.CallSummary, error)
ListRoles() (*auth.ListRolesResponse, *tcclient.CallSummary, error)
Ping() (*tcclient.CallSummary, error)
ResetAccessToken(string) (*auth.CreateClientResponse, *tcclient.CallSummary, error)
Role(string) (*auth.GetRoleResponse, *tcclient.CallSummary, error)
String() string
TestAuthenticate(*auth.TestAuthenticateRequest) (*auth.TestAuthenticateResponse, *tcclient.CallSummary, error)
TestAuthenticateGet() (*auth.TestAuthenticateResponse, *tcclient.CallSummary, error)
UpdateClient(string, *auth.CreateClientRequest) (*auth.GetClientResponse, *tcclient.CallSummary, error)
UpdateRole(string, *auth.CreateRoleRequest) (*auth.GetRoleResponse, *tcclient.CallSummary, error)
}
12 changes: 12 additions & 0 deletions runtime/client/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//go:generate interfacer -for "\"github.com/taskcluster/taskcluster-client-go/queue\".Queue" -as client.Queue -o queue.go
//go:generate interfacer -for "\"github.com/taskcluster/taskcluster-client-go/auth\".Auth" -as client.Auth -o auth.go
//go:generate interfacer -for "\"github.com/taskcluster/taskcluster-client-go/index\".Index" -as client.Index -o index.go
//go:generate interfacer -for "\"github.com/taskcluster/taskcluster-client-go/secrets\".Secrets" -as client.Secrets -o secrets.go
//go:generate mockery -inpkg -name Queue -output .
//go:generate mockery -inpkg -name Auth -output .
//go:generate mockery -inpkg -name Index -output .
//go:generate mockery -inpkg -name Secrets -output .

// Package client contains interfaces wrapping taskcluster-client-go and mock
// implementations of these interfaces.
package client
25 changes: 25 additions & 0 deletions runtime/client/index.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Created by interfacer; DO NOT EDIT

package client

import (
"github.com/taskcluster/taskcluster-client-go/index"
"github.com/taskcluster/taskcluster-client-go/tcclient"
"net/url"
"time"
)

// Index is an interface generated for "github.com/taskcluster/taskcluster-client-go/index".Index.
type Index interface {
Cert() (*tcclient.Certificate, error)
CreateNamedTemporaryCredentials(string, time.Duration, []string) (*tcclient.Credentials, error)
CreateTemporaryCredentials(time.Duration, []string) (*tcclient.Credentials, error)
FindArtifactFromTask(string, string) (*tcclient.CallSummary, error)
FindArtifactFromTask_SignedURL(string, string, time.Duration) (*url.URL, error)
FindTask(string) (*index.IndexedTaskResponse, *tcclient.CallSummary, error)
InsertTask(string, *index.InsertTaskRequest) (*index.IndexedTaskResponse, *tcclient.CallSummary, error)
ListNamespaces(string, *index.ListNamespacesRequest) (*index.ListNamespacesResponse, *tcclient.CallSummary, error)
ListTasks(string, *index.ListTasksRequest) (*index.ListTasksResponse, *tcclient.CallSummary, error)
Ping() (*tcclient.CallSummary, error)
String() string
}
Loading

0 comments on commit a199225

Please sign in to comment.