1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
16 "git.arvados.org/arvados.git/sdk/go/arvados"
19 var ErrStubUnimplemented = errors.New("stub unimplemented")
22 // The error to return from every stubbed API method.
28 // BaseURL implements federation.backend
29 func (as *APIStub) BaseURL() url.URL {
30 return url.URL{Scheme: "https", Host: "apistub.example.com"}
32 func (as *APIStub) ConfigGet(ctx context.Context) (json.RawMessage, error) {
33 as.appendCall(ctx, as.ConfigGet, nil)
36 func (as *APIStub) VocabularyGet(ctx context.Context) (arvados.Vocabulary, error) {
37 as.appendCall(ctx, as.VocabularyGet, nil)
38 return arvados.Vocabulary{}, as.Error
40 func (as *APIStub) Login(ctx context.Context, options arvados.LoginOptions) (arvados.LoginResponse, error) {
41 as.appendCall(ctx, as.Login, options)
42 return arvados.LoginResponse{}, as.Error
44 func (as *APIStub) Logout(ctx context.Context, options arvados.LogoutOptions) (arvados.LogoutResponse, error) {
45 as.appendCall(ctx, as.Logout, options)
46 return arvados.LogoutResponse{}, as.Error
48 func (as *APIStub) CollectionCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Collection, error) {
49 as.appendCall(ctx, as.CollectionCreate, options)
50 return arvados.Collection{}, as.Error
52 func (as *APIStub) CollectionUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Collection, error) {
53 as.appendCall(ctx, as.CollectionUpdate, options)
54 return arvados.Collection{}, as.Error
56 func (as *APIStub) CollectionGet(ctx context.Context, options arvados.GetOptions) (arvados.Collection, error) {
57 as.appendCall(ctx, as.CollectionGet, options)
58 return arvados.Collection{}, as.Error
60 func (as *APIStub) CollectionList(ctx context.Context, options arvados.ListOptions) (arvados.CollectionList, error) {
61 as.appendCall(ctx, as.CollectionList, options)
62 return arvados.CollectionList{}, as.Error
64 func (as *APIStub) CollectionProvenance(ctx context.Context, options arvados.GetOptions) (map[string]interface{}, error) {
65 as.appendCall(ctx, as.CollectionProvenance, options)
68 func (as *APIStub) CollectionUsedBy(ctx context.Context, options arvados.GetOptions) (map[string]interface{}, error) {
69 as.appendCall(ctx, as.CollectionUsedBy, options)
72 func (as *APIStub) CollectionDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Collection, error) {
73 as.appendCall(ctx, as.CollectionDelete, options)
74 return arvados.Collection{}, as.Error
76 func (as *APIStub) CollectionTrash(ctx context.Context, options arvados.DeleteOptions) (arvados.Collection, error) {
77 as.appendCall(ctx, as.CollectionTrash, options)
78 return arvados.Collection{}, as.Error
80 func (as *APIStub) CollectionUntrash(ctx context.Context, options arvados.UntrashOptions) (arvados.Collection, error) {
81 as.appendCall(ctx, as.CollectionUntrash, options)
82 return arvados.Collection{}, as.Error
84 func (as *APIStub) ContainerCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Container, error) {
85 as.appendCall(ctx, as.ContainerCreate, options)
86 return arvados.Container{}, as.Error
88 func (as *APIStub) ContainerUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Container, error) {
89 as.appendCall(ctx, as.ContainerUpdate, options)
90 return arvados.Container{}, as.Error
92 func (as *APIStub) ContainerGet(ctx context.Context, options arvados.GetOptions) (arvados.Container, error) {
93 as.appendCall(ctx, as.ContainerGet, options)
94 return arvados.Container{}, as.Error
96 func (as *APIStub) ContainerList(ctx context.Context, options arvados.ListOptions) (arvados.ContainerList, error) {
97 as.appendCall(ctx, as.ContainerList, options)
98 return arvados.ContainerList{}, as.Error
100 func (as *APIStub) ContainerDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Container, error) {
101 as.appendCall(ctx, as.ContainerDelete, options)
102 return arvados.Container{}, as.Error
104 func (as *APIStub) ContainerLock(ctx context.Context, options arvados.GetOptions) (arvados.Container, error) {
105 as.appendCall(ctx, as.ContainerLock, options)
106 return arvados.Container{}, as.Error
108 func (as *APIStub) ContainerUnlock(ctx context.Context, options arvados.GetOptions) (arvados.Container, error) {
109 as.appendCall(ctx, as.ContainerUnlock, options)
110 return arvados.Container{}, as.Error
112 func (as *APIStub) ContainerSSH(ctx context.Context, options arvados.ContainerSSHOptions) (arvados.ContainerSSHConnection, error) {
113 as.appendCall(ctx, as.ContainerSSH, options)
114 return arvados.ContainerSSHConnection{}, as.Error
116 func (as *APIStub) ContainerRequestCreate(ctx context.Context, options arvados.CreateOptions) (arvados.ContainerRequest, error) {
117 as.appendCall(ctx, as.ContainerRequestCreate, options)
118 return arvados.ContainerRequest{}, as.Error
120 func (as *APIStub) ContainerRequestUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.ContainerRequest, error) {
121 as.appendCall(ctx, as.ContainerRequestUpdate, options)
122 return arvados.ContainerRequest{}, as.Error
124 func (as *APIStub) ContainerRequestGet(ctx context.Context, options arvados.GetOptions) (arvados.ContainerRequest, error) {
125 as.appendCall(ctx, as.ContainerRequestGet, options)
126 return arvados.ContainerRequest{}, as.Error
128 func (as *APIStub) ContainerRequestList(ctx context.Context, options arvados.ListOptions) (arvados.ContainerRequestList, error) {
129 as.appendCall(ctx, as.ContainerRequestList, options)
130 return arvados.ContainerRequestList{}, as.Error
132 func (as *APIStub) ContainerRequestDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.ContainerRequest, error) {
133 as.appendCall(ctx, as.ContainerRequestDelete, options)
134 return arvados.ContainerRequest{}, as.Error
136 func (as *APIStub) GroupCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Group, error) {
137 as.appendCall(ctx, as.GroupCreate, options)
138 return arvados.Group{}, as.Error
140 func (as *APIStub) GroupUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Group, error) {
141 as.appendCall(ctx, as.GroupUpdate, options)
142 return arvados.Group{}, as.Error
144 func (as *APIStub) GroupGet(ctx context.Context, options arvados.GetOptions) (arvados.Group, error) {
145 as.appendCall(ctx, as.GroupGet, options)
146 return arvados.Group{}, as.Error
148 func (as *APIStub) GroupList(ctx context.Context, options arvados.ListOptions) (arvados.GroupList, error) {
149 as.appendCall(ctx, as.GroupList, options)
150 return arvados.GroupList{}, as.Error
152 func (as *APIStub) GroupContents(ctx context.Context, options arvados.GroupContentsOptions) (arvados.ObjectList, error) {
153 as.appendCall(ctx, as.GroupContents, options)
154 return arvados.ObjectList{}, as.Error
156 func (as *APIStub) GroupShared(ctx context.Context, options arvados.ListOptions) (arvados.GroupList, error) {
157 as.appendCall(ctx, as.GroupShared, options)
158 return arvados.GroupList{}, as.Error
160 func (as *APIStub) GroupDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Group, error) {
161 as.appendCall(ctx, as.GroupDelete, options)
162 return arvados.Group{}, as.Error
164 func (as *APIStub) GroupTrash(ctx context.Context, options arvados.DeleteOptions) (arvados.Group, error) {
165 as.appendCall(ctx, as.GroupTrash, options)
166 return arvados.Group{}, as.Error
168 func (as *APIStub) GroupUntrash(ctx context.Context, options arvados.UntrashOptions) (arvados.Group, error) {
169 as.appendCall(ctx, as.GroupUntrash, options)
170 return arvados.Group{}, as.Error
172 func (as *APIStub) LinkCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Link, error) {
173 as.appendCall(ctx, as.LinkCreate, options)
174 return arvados.Link{}, as.Error
176 func (as *APIStub) LinkUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Link, error) {
177 as.appendCall(ctx, as.LinkUpdate, options)
178 return arvados.Link{}, as.Error
180 func (as *APIStub) LinkGet(ctx context.Context, options arvados.GetOptions) (arvados.Link, error) {
181 as.appendCall(ctx, as.LinkGet, options)
182 return arvados.Link{}, as.Error
184 func (as *APIStub) LinkList(ctx context.Context, options arvados.ListOptions) (arvados.LinkList, error) {
185 as.appendCall(ctx, as.LinkList, options)
186 return arvados.LinkList{}, as.Error
188 func (as *APIStub) LinkDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Link, error) {
189 as.appendCall(ctx, as.LinkDelete, options)
190 return arvados.Link{}, as.Error
192 func (as *APIStub) SpecimenCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Specimen, error) {
193 as.appendCall(ctx, as.SpecimenCreate, options)
194 return arvados.Specimen{}, as.Error
196 func (as *APIStub) SpecimenUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Specimen, error) {
197 as.appendCall(ctx, as.SpecimenUpdate, options)
198 return arvados.Specimen{}, as.Error
200 func (as *APIStub) SpecimenGet(ctx context.Context, options arvados.GetOptions) (arvados.Specimen, error) {
201 as.appendCall(ctx, as.SpecimenGet, options)
202 return arvados.Specimen{}, as.Error
204 func (as *APIStub) SpecimenList(ctx context.Context, options arvados.ListOptions) (arvados.SpecimenList, error) {
205 as.appendCall(ctx, as.SpecimenList, options)
206 return arvados.SpecimenList{}, as.Error
208 func (as *APIStub) SpecimenDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Specimen, error) {
209 as.appendCall(ctx, as.SpecimenDelete, options)
210 return arvados.Specimen{}, as.Error
212 func (as *APIStub) SysTrashSweep(ctx context.Context, options struct{}) (struct{}, error) {
213 as.appendCall(ctx, as.SysTrashSweep, options)
214 return struct{}{}, as.Error
216 func (as *APIStub) UserCreate(ctx context.Context, options arvados.CreateOptions) (arvados.User, error) {
217 as.appendCall(ctx, as.UserCreate, options)
218 return arvados.User{}, as.Error
220 func (as *APIStub) UserUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.User, error) {
221 as.appendCall(ctx, as.UserUpdate, options)
222 return arvados.User{}, as.Error
224 func (as *APIStub) UserActivate(ctx context.Context, options arvados.UserActivateOptions) (arvados.User, error) {
225 as.appendCall(ctx, as.UserActivate, options)
226 return arvados.User{}, as.Error
228 func (as *APIStub) UserSetup(ctx context.Context, options arvados.UserSetupOptions) (map[string]interface{}, error) {
229 as.appendCall(ctx, as.UserSetup, options)
232 func (as *APIStub) UserUnsetup(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
233 as.appendCall(ctx, as.UserUnsetup, options)
234 return arvados.User{}, as.Error
236 func (as *APIStub) UserGet(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
237 as.appendCall(ctx, as.UserGet, options)
238 return arvados.User{}, as.Error
240 func (as *APIStub) UserGetCurrent(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
241 as.appendCall(ctx, as.UserGetCurrent, options)
242 return arvados.User{}, as.Error
244 func (as *APIStub) UserGetSystem(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
245 as.appendCall(ctx, as.UserGetSystem, options)
246 return arvados.User{}, as.Error
248 func (as *APIStub) UserList(ctx context.Context, options arvados.ListOptions) (arvados.UserList, error) {
249 as.appendCall(ctx, as.UserList, options)
250 return arvados.UserList{}, as.Error
252 func (as *APIStub) UserDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.User, error) {
253 as.appendCall(ctx, as.UserDelete, options)
254 return arvados.User{}, as.Error
256 func (as *APIStub) UserMerge(ctx context.Context, options arvados.UserMergeOptions) (arvados.User, error) {
257 as.appendCall(ctx, as.UserMerge, options)
258 return arvados.User{}, as.Error
260 func (as *APIStub) UserBatchUpdate(ctx context.Context, options arvados.UserBatchUpdateOptions) (arvados.UserList, error) {
261 as.appendCall(ctx, as.UserBatchUpdate, options)
262 return arvados.UserList{}, as.Error
264 func (as *APIStub) UserAuthenticate(ctx context.Context, options arvados.UserAuthenticateOptions) (arvados.APIClientAuthorization, error) {
265 as.appendCall(ctx, as.UserAuthenticate, options)
266 return arvados.APIClientAuthorization{}, as.Error
268 func (as *APIStub) APIClientAuthorizationCurrent(ctx context.Context, options arvados.GetOptions) (arvados.APIClientAuthorization, error) {
269 as.appendCall(ctx, as.APIClientAuthorizationCurrent, options)
270 return arvados.APIClientAuthorization{}, as.Error
272 func (as *APIStub) APIClientAuthorizationCreate(ctx context.Context, options arvados.CreateOptions) (arvados.APIClientAuthorization, error) {
273 as.appendCall(ctx, as.APIClientAuthorizationCreate, options)
274 return arvados.APIClientAuthorization{}, as.Error
276 func (as *APIStub) APIClientAuthorizationUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.APIClientAuthorization, error) {
277 as.appendCall(ctx, as.APIClientAuthorizationUpdate, options)
278 return arvados.APIClientAuthorization{}, as.Error
280 func (as *APIStub) APIClientAuthorizationDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.APIClientAuthorization, error) {
281 as.appendCall(ctx, as.APIClientAuthorizationDelete, options)
282 return arvados.APIClientAuthorization{}, as.Error
284 func (as *APIStub) APIClientAuthorizationList(ctx context.Context, options arvados.ListOptions) (arvados.APIClientAuthorizationList, error) {
285 as.appendCall(ctx, as.APIClientAuthorizationList, options)
286 return arvados.APIClientAuthorizationList{}, as.Error
288 func (as *APIStub) APIClientAuthorizationGet(ctx context.Context, options arvados.GetOptions) (arvados.APIClientAuthorization, error) {
289 as.appendCall(ctx, as.APIClientAuthorizationGet, options)
290 return arvados.APIClientAuthorization{}, as.Error
293 func (as *APIStub) appendCall(ctx context.Context, method interface{}, options interface{}) {
295 defer as.mtx.Unlock()
296 as.calls = append(as.calls, APIStubCall{method, ctx, options})
299 func (as *APIStub) Calls(method interface{}) []APIStubCall {
301 defer as.mtx.Unlock()
302 var calls []APIStubCall
303 for _, call := range as.calls {
304 if method == nil || (runtime.FuncForPC(reflect.ValueOf(call.Method).Pointer()).Name() ==
305 runtime.FuncForPC(reflect.ValueOf(method).Pointer()).Name()) {
306 calls = append(calls, call)
312 type APIStubCall struct {
314 Context context.Context