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) Login(ctx context.Context, options arvados.LoginOptions) (arvados.LoginResponse, error) {
37 as.appendCall(ctx, as.Login, options)
38 return arvados.LoginResponse{}, as.Error
40 func (as *APIStub) Logout(ctx context.Context, options arvados.LogoutOptions) (arvados.LogoutResponse, error) {
41 as.appendCall(ctx, as.Logout, options)
42 return arvados.LogoutResponse{}, as.Error
44 func (as *APIStub) CollectionCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Collection, error) {
45 as.appendCall(ctx, as.CollectionCreate, options)
46 return arvados.Collection{}, as.Error
48 func (as *APIStub) CollectionUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Collection, error) {
49 as.appendCall(ctx, as.CollectionUpdate, options)
50 return arvados.Collection{}, as.Error
52 func (as *APIStub) CollectionGet(ctx context.Context, options arvados.GetOptions) (arvados.Collection, error) {
53 as.appendCall(ctx, as.CollectionGet, options)
54 return arvados.Collection{}, as.Error
56 func (as *APIStub) CollectionList(ctx context.Context, options arvados.ListOptions) (arvados.CollectionList, error) {
57 as.appendCall(ctx, as.CollectionList, options)
58 return arvados.CollectionList{}, as.Error
60 func (as *APIStub) CollectionProvenance(ctx context.Context, options arvados.GetOptions) (map[string]interface{}, error) {
61 as.appendCall(ctx, as.CollectionProvenance, options)
64 func (as *APIStub) CollectionUsedBy(ctx context.Context, options arvados.GetOptions) (map[string]interface{}, error) {
65 as.appendCall(ctx, as.CollectionUsedBy, options)
68 func (as *APIStub) CollectionDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Collection, error) {
69 as.appendCall(ctx, as.CollectionDelete, options)
70 return arvados.Collection{}, as.Error
72 func (as *APIStub) CollectionTrash(ctx context.Context, options arvados.DeleteOptions) (arvados.Collection, error) {
73 as.appendCall(ctx, as.CollectionTrash, options)
74 return arvados.Collection{}, as.Error
76 func (as *APIStub) CollectionUntrash(ctx context.Context, options arvados.UntrashOptions) (arvados.Collection, error) {
77 as.appendCall(ctx, as.CollectionUntrash, options)
78 return arvados.Collection{}, as.Error
80 func (as *APIStub) ContainerCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Container, error) {
81 as.appendCall(ctx, as.ContainerCreate, options)
82 return arvados.Container{}, as.Error
84 func (as *APIStub) ContainerUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Container, error) {
85 as.appendCall(ctx, as.ContainerUpdate, options)
86 return arvados.Container{}, as.Error
88 func (as *APIStub) ContainerGet(ctx context.Context, options arvados.GetOptions) (arvados.Container, error) {
89 as.appendCall(ctx, as.ContainerGet, options)
90 return arvados.Container{}, as.Error
92 func (as *APIStub) ContainerList(ctx context.Context, options arvados.ListOptions) (arvados.ContainerList, error) {
93 as.appendCall(ctx, as.ContainerList, options)
94 return arvados.ContainerList{}, as.Error
96 func (as *APIStub) ContainerDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Container, error) {
97 as.appendCall(ctx, as.ContainerDelete, options)
98 return arvados.Container{}, as.Error
100 func (as *APIStub) ContainerLock(ctx context.Context, options arvados.GetOptions) (arvados.Container, error) {
101 as.appendCall(ctx, as.ContainerLock, options)
102 return arvados.Container{}, as.Error
104 func (as *APIStub) ContainerUnlock(ctx context.Context, options arvados.GetOptions) (arvados.Container, error) {
105 as.appendCall(ctx, as.ContainerUnlock, options)
106 return arvados.Container{}, as.Error
108 func (as *APIStub) ContainerSSH(ctx context.Context, options arvados.ContainerSSHOptions) (arvados.ContainerSSHConnection, error) {
109 as.appendCall(ctx, as.ContainerSSH, options)
110 return arvados.ContainerSSHConnection{}, as.Error
112 func (as *APIStub) ContainerRequestCreate(ctx context.Context, options arvados.CreateOptions) (arvados.ContainerRequest, error) {
113 as.appendCall(ctx, as.ContainerRequestCreate, options)
114 return arvados.ContainerRequest{}, as.Error
116 func (as *APIStub) ContainerRequestUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.ContainerRequest, error) {
117 as.appendCall(ctx, as.ContainerRequestUpdate, options)
118 return arvados.ContainerRequest{}, as.Error
120 func (as *APIStub) ContainerRequestGet(ctx context.Context, options arvados.GetOptions) (arvados.ContainerRequest, error) {
121 as.appendCall(ctx, as.ContainerRequestGet, options)
122 return arvados.ContainerRequest{}, as.Error
124 func (as *APIStub) ContainerRequestList(ctx context.Context, options arvados.ListOptions) (arvados.ContainerRequestList, error) {
125 as.appendCall(ctx, as.ContainerRequestList, options)
126 return arvados.ContainerRequestList{}, as.Error
128 func (as *APIStub) ContainerRequestDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.ContainerRequest, error) {
129 as.appendCall(ctx, as.ContainerRequestDelete, options)
130 return arvados.ContainerRequest{}, as.Error
132 func (as *APIStub) GroupCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Group, error) {
133 as.appendCall(ctx, as.GroupCreate, options)
134 return arvados.Group{}, as.Error
136 func (as *APIStub) GroupUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Group, error) {
137 as.appendCall(ctx, as.GroupUpdate, options)
138 return arvados.Group{}, as.Error
140 func (as *APIStub) GroupGet(ctx context.Context, options arvados.GetOptions) (arvados.Group, error) {
141 as.appendCall(ctx, as.GroupGet, options)
142 return arvados.Group{}, as.Error
144 func (as *APIStub) GroupList(ctx context.Context, options arvados.ListOptions) (arvados.GroupList, error) {
145 as.appendCall(ctx, as.GroupList, options)
146 return arvados.GroupList{}, as.Error
148 func (as *APIStub) GroupContents(ctx context.Context, options arvados.GroupContentsOptions) (arvados.ObjectList, error) {
149 as.appendCall(ctx, as.GroupContents, options)
150 return arvados.ObjectList{}, as.Error
152 func (as *APIStub) GroupShared(ctx context.Context, options arvados.ListOptions) (arvados.GroupList, error) {
153 as.appendCall(ctx, as.GroupShared, options)
154 return arvados.GroupList{}, as.Error
156 func (as *APIStub) GroupDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Group, error) {
157 as.appendCall(ctx, as.GroupDelete, options)
158 return arvados.Group{}, as.Error
160 func (as *APIStub) GroupUntrash(ctx context.Context, options arvados.UntrashOptions) (arvados.Group, error) {
161 as.appendCall(ctx, as.GroupUntrash, options)
162 return arvados.Group{}, as.Error
164 func (as *APIStub) SpecimenCreate(ctx context.Context, options arvados.CreateOptions) (arvados.Specimen, error) {
165 as.appendCall(ctx, as.SpecimenCreate, options)
166 return arvados.Specimen{}, as.Error
168 func (as *APIStub) SpecimenUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.Specimen, error) {
169 as.appendCall(ctx, as.SpecimenUpdate, options)
170 return arvados.Specimen{}, as.Error
172 func (as *APIStub) SpecimenGet(ctx context.Context, options arvados.GetOptions) (arvados.Specimen, error) {
173 as.appendCall(ctx, as.SpecimenGet, options)
174 return arvados.Specimen{}, as.Error
176 func (as *APIStub) SpecimenList(ctx context.Context, options arvados.ListOptions) (arvados.SpecimenList, error) {
177 as.appendCall(ctx, as.SpecimenList, options)
178 return arvados.SpecimenList{}, as.Error
180 func (as *APIStub) SpecimenDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Specimen, error) {
181 as.appendCall(ctx, as.SpecimenDelete, options)
182 return arvados.Specimen{}, as.Error
184 func (as *APIStub) UserCreate(ctx context.Context, options arvados.CreateOptions) (arvados.User, error) {
185 as.appendCall(ctx, as.UserCreate, options)
186 return arvados.User{}, as.Error
188 func (as *APIStub) UserUpdate(ctx context.Context, options arvados.UpdateOptions) (arvados.User, error) {
189 as.appendCall(ctx, as.UserUpdate, options)
190 return arvados.User{}, as.Error
192 func (as *APIStub) UserUpdateUUID(ctx context.Context, options arvados.UpdateUUIDOptions) (arvados.User, error) {
193 as.appendCall(ctx, as.UserUpdateUUID, options)
194 return arvados.User{}, as.Error
196 func (as *APIStub) UserActivate(ctx context.Context, options arvados.UserActivateOptions) (arvados.User, error) {
197 as.appendCall(ctx, as.UserActivate, options)
198 return arvados.User{}, as.Error
200 func (as *APIStub) UserSetup(ctx context.Context, options arvados.UserSetupOptions) (map[string]interface{}, error) {
201 as.appendCall(ctx, as.UserSetup, options)
204 func (as *APIStub) UserUnsetup(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
205 as.appendCall(ctx, as.UserUnsetup, options)
206 return arvados.User{}, as.Error
208 func (as *APIStub) UserGet(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
209 as.appendCall(ctx, as.UserGet, options)
210 return arvados.User{}, as.Error
212 func (as *APIStub) UserGetCurrent(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
213 as.appendCall(ctx, as.UserGetCurrent, options)
214 return arvados.User{}, as.Error
216 func (as *APIStub) UserGetSystem(ctx context.Context, options arvados.GetOptions) (arvados.User, error) {
217 as.appendCall(ctx, as.UserGetSystem, options)
218 return arvados.User{}, as.Error
220 func (as *APIStub) UserList(ctx context.Context, options arvados.ListOptions) (arvados.UserList, error) {
221 as.appendCall(ctx, as.UserList, options)
222 return arvados.UserList{}, as.Error
224 func (as *APIStub) UserDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.User, error) {
225 as.appendCall(ctx, as.UserDelete, options)
226 return arvados.User{}, as.Error
228 func (as *APIStub) UserMerge(ctx context.Context, options arvados.UserMergeOptions) (arvados.User, error) {
229 as.appendCall(ctx, as.UserMerge, options)
230 return arvados.User{}, as.Error
232 func (as *APIStub) UserBatchUpdate(ctx context.Context, options arvados.UserBatchUpdateOptions) (arvados.UserList, error) {
233 as.appendCall(ctx, as.UserBatchUpdate, options)
234 return arvados.UserList{}, as.Error
236 func (as *APIStub) UserAuthenticate(ctx context.Context, options arvados.UserAuthenticateOptions) (arvados.APIClientAuthorization, error) {
237 as.appendCall(ctx, as.UserAuthenticate, options)
238 return arvados.APIClientAuthorization{}, as.Error
240 func (as *APIStub) APIClientAuthorizationCurrent(ctx context.Context, options arvados.GetOptions) (arvados.APIClientAuthorization, error) {
241 as.appendCall(ctx, as.APIClientAuthorizationCurrent, options)
242 return arvados.APIClientAuthorization{}, as.Error
245 func (as *APIStub) appendCall(ctx context.Context, method interface{}, options interface{}) {
247 defer as.mtx.Unlock()
248 as.calls = append(as.calls, APIStubCall{method, ctx, options})
251 func (as *APIStub) Calls(method interface{}) []APIStubCall {
253 defer as.mtx.Unlock()
254 var calls []APIStubCall
255 for _, call := range as.calls {
256 if method == nil || (runtime.FuncForPC(reflect.ValueOf(call.Method).Pointer()).Name() ==
257 runtime.FuncForPC(reflect.ValueOf(method).Pointer()).Name()) {
258 calls = append(calls, call)
264 type APIStubCall struct {
266 Context context.Context