Debian Codegraph @

financialservices/apiv1/aml_client.go

raw
1 // Copyright 2025 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Code generated by protoc-gen-go_gapic. DO NOT EDIT.
16
17 package financialservices
18
19 import (
20 "bytes"
21 "context"
22 "fmt"
23 "log/slog"
24 "math"
25 "net/http"
26 "net/url"
27 "time"
28
29 financialservicespb "cloud.google.com/go/financialservices/apiv1/financialservicespb"
30 "cloud.google.com/go/longrunning"
31 lroauto "cloud.google.com/go/longrunning/autogen"
32 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
33 gax "github.com/googleapis/gax-go/v2"
34 "google.golang.org/api/iterator"
35 "google.golang.org/api/option"
36 "google.golang.org/api/option/internaloption"
37 gtransport "google.golang.org/api/transport/grpc"
38 httptransport "google.golang.org/api/transport/http"
39 locationpb "google.golang.org/genproto/googleapis/cloud/location"
40 "google.golang.org/grpc"
41 "google.golang.org/protobuf/encoding/protojson"
42 "google.golang.org/protobuf/proto"
43 )
44
45 var newAMLClientHook clientHook
46
47 // AMLCallOptions contains the retry settings for each method of AMLClient.
48 type AMLCallOptions struct {
49 ListInstances []gax.CallOption
50 GetInstance []gax.CallOption
51 CreateInstance []gax.CallOption
52 UpdateInstance []gax.CallOption
53 DeleteInstance []gax.CallOption
54 ImportRegisteredParties []gax.CallOption
55 ExportRegisteredParties []gax.CallOption
56 ListDatasets []gax.CallOption
57 GetDataset []gax.CallOption
58 CreateDataset []gax.CallOption
59 UpdateDataset []gax.CallOption
60 DeleteDataset []gax.CallOption
61 ListModels []gax.CallOption
62 GetModel []gax.CallOption
63 CreateModel []gax.CallOption
64 UpdateModel []gax.CallOption
65 ExportModelMetadata []gax.CallOption
66 DeleteModel []gax.CallOption
67 ListEngineConfigs []gax.CallOption
68 GetEngineConfig []gax.CallOption
69 CreateEngineConfig []gax.CallOption
70 UpdateEngineConfig []gax.CallOption
71 ExportEngineConfigMetadata []gax.CallOption
72 DeleteEngineConfig []gax.CallOption
73 GetEngineVersion []gax.CallOption
74 ListEngineVersions []gax.CallOption
75 ListPredictionResults []gax.CallOption
76 GetPredictionResult []gax.CallOption
77 CreatePredictionResult []gax.CallOption
78 UpdatePredictionResult []gax.CallOption
79 ExportPredictionResultMetadata []gax.CallOption
80 DeletePredictionResult []gax.CallOption
81 ListBacktestResults []gax.CallOption
82 GetBacktestResult []gax.CallOption
83 CreateBacktestResult []gax.CallOption
84 UpdateBacktestResult []gax.CallOption
85 ExportBacktestResultMetadata []gax.CallOption
86 DeleteBacktestResult []gax.CallOption
87 GetLocation []gax.CallOption
88 ListLocations []gax.CallOption
89 CancelOperation []gax.CallOption
90 DeleteOperation []gax.CallOption
91 GetOperation []gax.CallOption
92 ListOperations []gax.CallOption
93 }
94
95 func defaultAMLGRPCClientOptions() []option.ClientOption {
96 return []option.ClientOption{
97 internaloption.WithDefaultEndpoint("financialservices.googleapis.com:443"),
98 internaloption.WithDefaultEndpointTemplate("financialservices.UNIVERSE_DOMAIN:443"),
99 internaloption.WithDefaultMTLSEndpoint("financialservices.mtls.googleapis.com:443"),
100 internaloption.WithDefaultUniverseDomain("googleapis.com"),
101 internaloption.WithDefaultAudience("https://financialservices.googleapis.com/"),
102 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
103 internaloption.EnableJwtWithScope(),
104 internaloption.EnableNewAuthLibrary(),
105 option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
106 grpc.MaxCallRecvMsgSize(math.MaxInt32))),
107 }
108 }
109
110 func defaultAMLCallOptions() *AMLCallOptions {
111 return &AMLCallOptions{
112 ListInstances: []gax.CallOption{
113 gax.WithTimeout(10000 * time.Millisecond),
114 },
115 GetInstance: []gax.CallOption{
116 gax.WithTimeout(10000 * time.Millisecond),
117 },
118 CreateInstance: []gax.CallOption{
119 gax.WithTimeout(120000 * time.Millisecond),
120 },
121 UpdateInstance: []gax.CallOption{
122 gax.WithTimeout(120000 * time.Millisecond),
123 },
124 DeleteInstance: []gax.CallOption{
125 gax.WithTimeout(120000 * time.Millisecond),
126 },
127 ImportRegisteredParties: []gax.CallOption{
128 gax.WithTimeout(120000 * time.Millisecond),
129 },
130 ExportRegisteredParties: []gax.CallOption{
131 gax.WithTimeout(120000 * time.Millisecond),
132 },
133 ListDatasets: []gax.CallOption{
134 gax.WithTimeout(10000 * time.Millisecond),
135 },
136 GetDataset: []gax.CallOption{
137 gax.WithTimeout(10000 * time.Millisecond),
138 },
139 CreateDataset: []gax.CallOption{
140 gax.WithTimeout(120000 * time.Millisecond),
141 },
142 UpdateDataset: []gax.CallOption{
143 gax.WithTimeout(120000 * time.Millisecond),
144 },
145 DeleteDataset: []gax.CallOption{
146 gax.WithTimeout(120000 * time.Millisecond),
147 },
148 ListModels: []gax.CallOption{
149 gax.WithTimeout(10000 * time.Millisecond),
150 },
151 GetModel: []gax.CallOption{
152 gax.WithTimeout(10000 * time.Millisecond),
153 },
154 CreateModel: []gax.CallOption{
155 gax.WithTimeout(120000 * time.Millisecond),
156 },
157 UpdateModel: []gax.CallOption{
158 gax.WithTimeout(120000 * time.Millisecond),
159 },
160 ExportModelMetadata: []gax.CallOption{
161 gax.WithTimeout(120000 * time.Millisecond),
162 },
163 DeleteModel: []gax.CallOption{
164 gax.WithTimeout(120000 * time.Millisecond),
165 },
166 ListEngineConfigs: []gax.CallOption{
167 gax.WithTimeout(10000 * time.Millisecond),
168 },
169 GetEngineConfig: []gax.CallOption{
170 gax.WithTimeout(10000 * time.Millisecond),
171 },
172 CreateEngineConfig: []gax.CallOption{},
173 UpdateEngineConfig: []gax.CallOption{
174 gax.WithTimeout(120000 * time.Millisecond),
175 },
176 ExportEngineConfigMetadata: []gax.CallOption{
177 gax.WithTimeout(120000 * time.Millisecond),
178 },
179 DeleteEngineConfig: []gax.CallOption{
180 gax.WithTimeout(120000 * time.Millisecond),
181 },
182 GetEngineVersion: []gax.CallOption{
183 gax.WithTimeout(10000 * time.Millisecond),
184 },
185 ListEngineVersions: []gax.CallOption{
186 gax.WithTimeout(10000 * time.Millisecond),
187 },
188 ListPredictionResults: []gax.CallOption{
189 gax.WithTimeout(10000 * time.Millisecond),
190 },
191 GetPredictionResult: []gax.CallOption{
192 gax.WithTimeout(10000 * time.Millisecond),
193 },
194 CreatePredictionResult: []gax.CallOption{
195 gax.WithTimeout(120000 * time.Millisecond),
196 },
197 UpdatePredictionResult: []gax.CallOption{
198 gax.WithTimeout(120000 * time.Millisecond),
199 },
200 ExportPredictionResultMetadata: []gax.CallOption{
201 gax.WithTimeout(120000 * time.Millisecond),
202 },
203 DeletePredictionResult: []gax.CallOption{
204 gax.WithTimeout(120000 * time.Millisecond),
205 },
206 ListBacktestResults: []gax.CallOption{
207 gax.WithTimeout(10000 * time.Millisecond),
208 },
209 GetBacktestResult: []gax.CallOption{
210 gax.WithTimeout(10000 * time.Millisecond),
211 },
212 CreateBacktestResult: []gax.CallOption{
213 gax.WithTimeout(120000 * time.Millisecond),
214 },
215 UpdateBacktestResult: []gax.CallOption{
216 gax.WithTimeout(120000 * time.Millisecond),
217 },
218 ExportBacktestResultMetadata: []gax.CallOption{
219 gax.WithTimeout(120000 * time.Millisecond),
220 },
221 DeleteBacktestResult: []gax.CallOption{
222 gax.WithTimeout(120000 * time.Millisecond),
223 },
224 GetLocation: []gax.CallOption{},
225 ListLocations: []gax.CallOption{},
226 CancelOperation: []gax.CallOption{},
227 DeleteOperation: []gax.CallOption{},
228 GetOperation: []gax.CallOption{},
229 ListOperations: []gax.CallOption{},
230 }
231 }
232
233 func defaultAMLRESTCallOptions() *AMLCallOptions {
234 return &AMLCallOptions{
235 ListInstances: []gax.CallOption{
236 gax.WithTimeout(10000 * time.Millisecond),
237 },
238 GetInstance: []gax.CallOption{
239 gax.WithTimeout(10000 * time.Millisecond),
240 },
241 CreateInstance: []gax.CallOption{
242 gax.WithTimeout(120000 * time.Millisecond),
243 },
244 UpdateInstance: []gax.CallOption{
245 gax.WithTimeout(120000 * time.Millisecond),
246 },
247 DeleteInstance: []gax.CallOption{
248 gax.WithTimeout(120000 * time.Millisecond),
249 },
250 ImportRegisteredParties: []gax.CallOption{
251 gax.WithTimeout(120000 * time.Millisecond),
252 },
253 ExportRegisteredParties: []gax.CallOption{
254 gax.WithTimeout(120000 * time.Millisecond),
255 },
256 ListDatasets: []gax.CallOption{
257 gax.WithTimeout(10000 * time.Millisecond),
258 },
259 GetDataset: []gax.CallOption{
260 gax.WithTimeout(10000 * time.Millisecond),
261 },
262 CreateDataset: []gax.CallOption{
263 gax.WithTimeout(120000 * time.Millisecond),
264 },
265 UpdateDataset: []gax.CallOption{
266 gax.WithTimeout(120000 * time.Millisecond),
267 },
268 DeleteDataset: []gax.CallOption{
269 gax.WithTimeout(120000 * time.Millisecond),
270 },
271 ListModels: []gax.CallOption{
272 gax.WithTimeout(10000 * time.Millisecond),
273 },
274 GetModel: []gax.CallOption{
275 gax.WithTimeout(10000 * time.Millisecond),
276 },
277 CreateModel: []gax.CallOption{
278 gax.WithTimeout(120000 * time.Millisecond),
279 },
280 UpdateModel: []gax.CallOption{
281 gax.WithTimeout(120000 * time.Millisecond),
282 },
283 ExportModelMetadata: []gax.CallOption{
284 gax.WithTimeout(120000 * time.Millisecond),
285 },
286 DeleteModel: []gax.CallOption{
287 gax.WithTimeout(120000 * time.Millisecond),
288 },
289 ListEngineConfigs: []gax.CallOption{
290 gax.WithTimeout(10000 * time.Millisecond),
291 },
292 GetEngineConfig: []gax.CallOption{
293 gax.WithTimeout(10000 * time.Millisecond),
294 },
295 CreateEngineConfig: []gax.CallOption{},
296 UpdateEngineConfig: []gax.CallOption{
297 gax.WithTimeout(120000 * time.Millisecond),
298 },
299 ExportEngineConfigMetadata: []gax.CallOption{
300 gax.WithTimeout(120000 * time.Millisecond),
301 },
302 DeleteEngineConfig: []gax.CallOption{
303 gax.WithTimeout(120000 * time.Millisecond),
304 },
305 GetEngineVersion: []gax.CallOption{
306 gax.WithTimeout(10000 * time.Millisecond),
307 },
308 ListEngineVersions: []gax.CallOption{
309 gax.WithTimeout(10000 * time.Millisecond),
310 },
311 ListPredictionResults: []gax.CallOption{
312 gax.WithTimeout(10000 * time.Millisecond),
313 },
314 GetPredictionResult: []gax.CallOption{
315 gax.WithTimeout(10000 * time.Millisecond),
316 },
317 CreatePredictionResult: []gax.CallOption{
318 gax.WithTimeout(120000 * time.Millisecond),
319 },
320 UpdatePredictionResult: []gax.CallOption{
321 gax.WithTimeout(120000 * time.Millisecond),
322 },
323 ExportPredictionResultMetadata: []gax.CallOption{
324 gax.WithTimeout(120000 * time.Millisecond),
325 },
326 DeletePredictionResult: []gax.CallOption{
327 gax.WithTimeout(120000 * time.Millisecond),
328 },
329 ListBacktestResults: []gax.CallOption{
330 gax.WithTimeout(10000 * time.Millisecond),
331 },
332 GetBacktestResult: []gax.CallOption{
333 gax.WithTimeout(10000 * time.Millisecond),
334 },
335 CreateBacktestResult: []gax.CallOption{
336 gax.WithTimeout(120000 * time.Millisecond),
337 },
338 UpdateBacktestResult: []gax.CallOption{
339 gax.WithTimeout(120000 * time.Millisecond),
340 },
341 ExportBacktestResultMetadata: []gax.CallOption{
342 gax.WithTimeout(120000 * time.Millisecond),
343 },
344 DeleteBacktestResult: []gax.CallOption{
345 gax.WithTimeout(120000 * time.Millisecond),
346 },
347 GetLocation: []gax.CallOption{},
348 ListLocations: []gax.CallOption{},
349 CancelOperation: []gax.CallOption{},
350 DeleteOperation: []gax.CallOption{},
351 GetOperation: []gax.CallOption{},
352 ListOperations: []gax.CallOption{},
353 }
354 }
355
356 // internalAMLClient is an interface that defines the methods available from Financial Services API.
357 type internalAMLClient interface {
358 Close() error
359 setGoogleClientInfo(...string)
360 Connection() *grpc.ClientConn
361 ListInstances(context.Context, *financialservicespb.ListInstancesRequest, ...gax.CallOption) *InstanceIterator
362 GetInstance(context.Context, *financialservicespb.GetInstanceRequest, ...gax.CallOption) (*financialservicespb.Instance, error)
363 CreateInstance(context.Context, *financialservicespb.CreateInstanceRequest, ...gax.CallOption) (*CreateInstanceOperation, error)
364 CreateInstanceOperation(name string) *CreateInstanceOperation
365 UpdateInstance(context.Context, *financialservicespb.UpdateInstanceRequest, ...gax.CallOption) (*UpdateInstanceOperation, error)
366 UpdateInstanceOperation(name string) *UpdateInstanceOperation
367 DeleteInstance(context.Context, *financialservicespb.DeleteInstanceRequest, ...gax.CallOption) (*DeleteInstanceOperation, error)
368 DeleteInstanceOperation(name string) *DeleteInstanceOperation
369 ImportRegisteredParties(context.Context, *financialservicespb.ImportRegisteredPartiesRequest, ...gax.CallOption) (*ImportRegisteredPartiesOperation, error)
370 ImportRegisteredPartiesOperation(name string) *ImportRegisteredPartiesOperation
371 ExportRegisteredParties(context.Context, *financialservicespb.ExportRegisteredPartiesRequest, ...gax.CallOption) (*ExportRegisteredPartiesOperation, error)
372 ExportRegisteredPartiesOperation(name string) *ExportRegisteredPartiesOperation
373 ListDatasets(context.Context, *financialservicespb.ListDatasetsRequest, ...gax.CallOption) *DatasetIterator
374 GetDataset(context.Context, *financialservicespb.GetDatasetRequest, ...gax.CallOption) (*financialservicespb.Dataset, error)
375 CreateDataset(context.Context, *financialservicespb.CreateDatasetRequest, ...gax.CallOption) (*CreateDatasetOperation, error)
376 CreateDatasetOperation(name string) *CreateDatasetOperation
377 UpdateDataset(context.Context, *financialservicespb.UpdateDatasetRequest, ...gax.CallOption) (*UpdateDatasetOperation, error)
378 UpdateDatasetOperation(name string) *UpdateDatasetOperation
379 DeleteDataset(context.Context, *financialservicespb.DeleteDatasetRequest, ...gax.CallOption) (*DeleteDatasetOperation, error)
380 DeleteDatasetOperation(name string) *DeleteDatasetOperation
381 ListModels(context.Context, *financialservicespb.ListModelsRequest, ...gax.CallOption) *ModelIterator
382 GetModel(context.Context, *financialservicespb.GetModelRequest, ...gax.CallOption) (*financialservicespb.Model, error)
383 CreateModel(context.Context, *financialservicespb.CreateModelRequest, ...gax.CallOption) (*CreateModelOperation, error)
384 CreateModelOperation(name string) *CreateModelOperation
385 UpdateModel(context.Context, *financialservicespb.UpdateModelRequest, ...gax.CallOption) (*UpdateModelOperation, error)
386 UpdateModelOperation(name string) *UpdateModelOperation
387 ExportModelMetadata(context.Context, *financialservicespb.ExportModelMetadataRequest, ...gax.CallOption) (*ExportModelMetadataOperation, error)
388 ExportModelMetadataOperation(name string) *ExportModelMetadataOperation
389 DeleteModel(context.Context, *financialservicespb.DeleteModelRequest, ...gax.CallOption) (*DeleteModelOperation, error)
390 DeleteModelOperation(name string) *DeleteModelOperation
391 ListEngineConfigs(context.Context, *financialservicespb.ListEngineConfigsRequest, ...gax.CallOption) *EngineConfigIterator
392 GetEngineConfig(context.Context, *financialservicespb.GetEngineConfigRequest, ...gax.CallOption) (*financialservicespb.EngineConfig, error)
393 CreateEngineConfig(context.Context, *financialservicespb.CreateEngineConfigRequest, ...gax.CallOption) (*CreateEngineConfigOperation, error)
394 CreateEngineConfigOperation(name string) *CreateEngineConfigOperation
395 UpdateEngineConfig(context.Context, *financialservicespb.UpdateEngineConfigRequest, ...gax.CallOption) (*UpdateEngineConfigOperation, error)
396 UpdateEngineConfigOperation(name string) *UpdateEngineConfigOperation
397 ExportEngineConfigMetadata(context.Context, *financialservicespb.ExportEngineConfigMetadataRequest, ...gax.CallOption) (*ExportEngineConfigMetadataOperation, error)
398 ExportEngineConfigMetadataOperation(name string) *ExportEngineConfigMetadataOperation
399 DeleteEngineConfig(context.Context, *financialservicespb.DeleteEngineConfigRequest, ...gax.CallOption) (*DeleteEngineConfigOperation, error)
400 DeleteEngineConfigOperation(name string) *DeleteEngineConfigOperation
401 GetEngineVersion(context.Context, *financialservicespb.GetEngineVersionRequest, ...gax.CallOption) (*financialservicespb.EngineVersion, error)
402 ListEngineVersions(context.Context, *financialservicespb.ListEngineVersionsRequest, ...gax.CallOption) *EngineVersionIterator
403 ListPredictionResults(context.Context, *financialservicespb.ListPredictionResultsRequest, ...gax.CallOption) *PredictionResultIterator
404 GetPredictionResult(context.Context, *financialservicespb.GetPredictionResultRequest, ...gax.CallOption) (*financialservicespb.PredictionResult, error)
405 CreatePredictionResult(context.Context, *financialservicespb.CreatePredictionResultRequest, ...gax.CallOption) (*CreatePredictionResultOperation, error)
406 CreatePredictionResultOperation(name string) *CreatePredictionResultOperation
407 UpdatePredictionResult(context.Context, *financialservicespb.UpdatePredictionResultRequest, ...gax.CallOption) (*UpdatePredictionResultOperation, error)
408 UpdatePredictionResultOperation(name string) *UpdatePredictionResultOperation
409 ExportPredictionResultMetadata(context.Context, *financialservicespb.ExportPredictionResultMetadataRequest, ...gax.CallOption) (*ExportPredictionResultMetadataOperation, error)
410 ExportPredictionResultMetadataOperation(name string) *ExportPredictionResultMetadataOperation
411 DeletePredictionResult(context.Context, *financialservicespb.DeletePredictionResultRequest, ...gax.CallOption) (*DeletePredictionResultOperation, error)
412 DeletePredictionResultOperation(name string) *DeletePredictionResultOperation
413 ListBacktestResults(context.Context, *financialservicespb.ListBacktestResultsRequest, ...gax.CallOption) *BacktestResultIterator
414 GetBacktestResult(context.Context, *financialservicespb.GetBacktestResultRequest, ...gax.CallOption) (*financialservicespb.BacktestResult, error)
415 CreateBacktestResult(context.Context, *financialservicespb.CreateBacktestResultRequest, ...gax.CallOption) (*CreateBacktestResultOperation, error)
416 CreateBacktestResultOperation(name string) *CreateBacktestResultOperation
417 UpdateBacktestResult(context.Context, *financialservicespb.UpdateBacktestResultRequest, ...gax.CallOption) (*UpdateBacktestResultOperation, error)
418 UpdateBacktestResultOperation(name string) *UpdateBacktestResultOperation
419 ExportBacktestResultMetadata(context.Context, *financialservicespb.ExportBacktestResultMetadataRequest, ...gax.CallOption) (*ExportBacktestResultMetadataOperation, error)
420 ExportBacktestResultMetadataOperation(name string) *ExportBacktestResultMetadataOperation
421 DeleteBacktestResult(context.Context, *financialservicespb.DeleteBacktestResultRequest, ...gax.CallOption) (*DeleteBacktestResultOperation, error)
422 DeleteBacktestResultOperation(name string) *DeleteBacktestResultOperation
423 GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error)
424 ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator
425 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
426 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
427 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
428 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
429 }
430
431 // AMLClient is a client for interacting with Financial Services API.
432 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
433 //
434 // The AML (Anti Money Laundering) service allows users to perform REST
435 // operations on aml.
436 type AMLClient struct {
437 // The internal transport-dependent client.
438 internalClient internalAMLClient
439
440 // The call options for this service.
441 CallOptions *AMLCallOptions
442
443 // LROClient is used internally to handle long-running operations.
444 // It is exposed so that its CallOptions can be modified if required.
445 // Users should not Close this client.
446 LROClient *lroauto.OperationsClient
447 }
448
449 // Wrapper methods routed to the internal client.
450
451 // Close closes the connection to the API service. The user should invoke this when
452 // the client is no longer required.
453 func (c *AMLClient) Close() error {
454 return c.internalClient.Close()
455 }
456
457 // setGoogleClientInfo sets the name and version of the application in
458 // the `x-goog-api-client` header passed on each request. Intended for
459 // use by Google-written clients.
460 func (c *AMLClient) setGoogleClientInfo(keyval ...string) {
461 c.internalClient.setGoogleClientInfo(keyval...)
462 }
463
464 // Connection returns a connection to the API service.
465 //
466 // Deprecated: Connections are now pooled so this method does not always
467 // return the same resource.
468 func (c *AMLClient) Connection() *grpc.ClientConn {
469 return c.internalClient.Connection()
470 }
471
472 // ListInstances lists instances.
473 func (c *AMLClient) ListInstances(ctx context.Context, req *financialservicespb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator {
474 return c.internalClient.ListInstances(ctx, req, opts...)
475 }
476
477 // GetInstance gets an instance.
478 func (c *AMLClient) GetInstance(ctx context.Context, req *financialservicespb.GetInstanceRequest, opts ...gax.CallOption) (*financialservicespb.Instance, error) {
479 return c.internalClient.GetInstance(ctx, req, opts...)
480 }
481
482 // CreateInstance creates an instance.
483 func (c *AMLClient) CreateInstance(ctx context.Context, req *financialservicespb.CreateInstanceRequest, opts ...gax.CallOption) (*CreateInstanceOperation, error) {
484 return c.internalClient.CreateInstance(ctx, req, opts...)
485 }
486
487 // CreateInstanceOperation returns a new CreateInstanceOperation from a given name.
488 // The name must be that of a previously created CreateInstanceOperation, possibly from a different process.
489 func (c *AMLClient) CreateInstanceOperation(name string) *CreateInstanceOperation {
490 return c.internalClient.CreateInstanceOperation(name)
491 }
492
493 // UpdateInstance updates the parameters of a single Instance.
494 func (c *AMLClient) UpdateInstance(ctx context.Context, req *financialservicespb.UpdateInstanceRequest, opts ...gax.CallOption) (*UpdateInstanceOperation, error) {
495 return c.internalClient.UpdateInstance(ctx, req, opts...)
496 }
497
498 // UpdateInstanceOperation returns a new UpdateInstanceOperation from a given name.
499 // The name must be that of a previously created UpdateInstanceOperation, possibly from a different process.
500 func (c *AMLClient) UpdateInstanceOperation(name string) *UpdateInstanceOperation {
501 return c.internalClient.UpdateInstanceOperation(name)
502 }
503
504 // DeleteInstance deletes an instance.
505 func (c *AMLClient) DeleteInstance(ctx context.Context, req *financialservicespb.DeleteInstanceRequest, opts ...gax.CallOption) (*DeleteInstanceOperation, error) {
506 return c.internalClient.DeleteInstance(ctx, req, opts...)
507 }
508
509 // DeleteInstanceOperation returns a new DeleteInstanceOperation from a given name.
510 // The name must be that of a previously created DeleteInstanceOperation, possibly from a different process.
511 func (c *AMLClient) DeleteInstanceOperation(name string) *DeleteInstanceOperation {
512 return c.internalClient.DeleteInstanceOperation(name)
513 }
514
515 // ImportRegisteredParties imports the list of registered parties. See
516 // Create and manage
517 // instances (at https://cloud.google.com/financial-services/anti-money-laundering/docs/create-and-manage-instances#import-registered-parties)
518 // for information on the input schema and response for this method.
519 func (c *AMLClient) ImportRegisteredParties(ctx context.Context, req *financialservicespb.ImportRegisteredPartiesRequest, opts ...gax.CallOption) (*ImportRegisteredPartiesOperation, error) {
520 return c.internalClient.ImportRegisteredParties(ctx, req, opts...)
521 }
522
523 // ImportRegisteredPartiesOperation returns a new ImportRegisteredPartiesOperation from a given name.
524 // The name must be that of a previously created ImportRegisteredPartiesOperation, possibly from a different process.
525 func (c *AMLClient) ImportRegisteredPartiesOperation(name string) *ImportRegisteredPartiesOperation {
526 return c.internalClient.ImportRegisteredPartiesOperation(name)
527 }
528
529 // ExportRegisteredParties exports the list of registered parties. See
530 // Create and manage
531 // instances (at https://cloud.google.com/financial-services/anti-money-laundering/docs/create-and-manage-instances#export-registered-parties)
532 // for information on the output schema for this method.
533 func (c *AMLClient) ExportRegisteredParties(ctx context.Context, req *financialservicespb.ExportRegisteredPartiesRequest, opts ...gax.CallOption) (*ExportRegisteredPartiesOperation, error) {
534 return c.internalClient.ExportRegisteredParties(ctx, req, opts...)
535 }
536
537 // ExportRegisteredPartiesOperation returns a new ExportRegisteredPartiesOperation from a given name.
538 // The name must be that of a previously created ExportRegisteredPartiesOperation, possibly from a different process.
539 func (c *AMLClient) ExportRegisteredPartiesOperation(name string) *ExportRegisteredPartiesOperation {
540 return c.internalClient.ExportRegisteredPartiesOperation(name)
541 }
542
543 // ListDatasets lists datasets.
544 func (c *AMLClient) ListDatasets(ctx context.Context, req *financialservicespb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator {
545 return c.internalClient.ListDatasets(ctx, req, opts...)
546 }
547
548 // GetDataset gets a dataset.
549 func (c *AMLClient) GetDataset(ctx context.Context, req *financialservicespb.GetDatasetRequest, opts ...gax.CallOption) (*financialservicespb.Dataset, error) {
550 return c.internalClient.GetDataset(ctx, req, opts...)
551 }
552
553 // CreateDataset creates a dataset.
554 func (c *AMLClient) CreateDataset(ctx context.Context, req *financialservicespb.CreateDatasetRequest, opts ...gax.CallOption) (*CreateDatasetOperation, error) {
555 return c.internalClient.CreateDataset(ctx, req, opts...)
556 }
557
558 // CreateDatasetOperation returns a new CreateDatasetOperation from a given name.
559 // The name must be that of a previously created CreateDatasetOperation, possibly from a different process.
560 func (c *AMLClient) CreateDatasetOperation(name string) *CreateDatasetOperation {
561 return c.internalClient.CreateDatasetOperation(name)
562 }
563
564 // UpdateDataset updates the parameters of a single Dataset.
565 func (c *AMLClient) UpdateDataset(ctx context.Context, req *financialservicespb.UpdateDatasetRequest, opts ...gax.CallOption) (*UpdateDatasetOperation, error) {
566 return c.internalClient.UpdateDataset(ctx, req, opts...)
567 }
568
569 // UpdateDatasetOperation returns a new UpdateDatasetOperation from a given name.
570 // The name must be that of a previously created UpdateDatasetOperation, possibly from a different process.
571 func (c *AMLClient) UpdateDatasetOperation(name string) *UpdateDatasetOperation {
572 return c.internalClient.UpdateDatasetOperation(name)
573 }
574
575 // DeleteDataset deletes a dataset.
576 func (c *AMLClient) DeleteDataset(ctx context.Context, req *financialservicespb.DeleteDatasetRequest, opts ...gax.CallOption) (*DeleteDatasetOperation, error) {
577 return c.internalClient.DeleteDataset(ctx, req, opts...)
578 }
579
580 // DeleteDatasetOperation returns a new DeleteDatasetOperation from a given name.
581 // The name must be that of a previously created DeleteDatasetOperation, possibly from a different process.
582 func (c *AMLClient) DeleteDatasetOperation(name string) *DeleteDatasetOperation {
583 return c.internalClient.DeleteDatasetOperation(name)
584 }
585
586 // ListModels lists models.
587 func (c *AMLClient) ListModels(ctx context.Context, req *financialservicespb.ListModelsRequest, opts ...gax.CallOption) *ModelIterator {
588 return c.internalClient.ListModels(ctx, req, opts...)
589 }
590
591 // GetModel gets a model.
592 func (c *AMLClient) GetModel(ctx context.Context, req *financialservicespb.GetModelRequest, opts ...gax.CallOption) (*financialservicespb.Model, error) {
593 return c.internalClient.GetModel(ctx, req, opts...)
594 }
595
596 // CreateModel creates a model.
597 func (c *AMLClient) CreateModel(ctx context.Context, req *financialservicespb.CreateModelRequest, opts ...gax.CallOption) (*CreateModelOperation, error) {
598 return c.internalClient.CreateModel(ctx, req, opts...)
599 }
600
601 // CreateModelOperation returns a new CreateModelOperation from a given name.
602 // The name must be that of a previously created CreateModelOperation, possibly from a different process.
603 func (c *AMLClient) CreateModelOperation(name string) *CreateModelOperation {
604 return c.internalClient.CreateModelOperation(name)
605 }
606
607 // UpdateModel updates the parameters of a single Model.
608 func (c *AMLClient) UpdateModel(ctx context.Context, req *financialservicespb.UpdateModelRequest, opts ...gax.CallOption) (*UpdateModelOperation, error) {
609 return c.internalClient.UpdateModel(ctx, req, opts...)
610 }
611
612 // UpdateModelOperation returns a new UpdateModelOperation from a given name.
613 // The name must be that of a previously created UpdateModelOperation, possibly from a different process.
614 func (c *AMLClient) UpdateModelOperation(name string) *UpdateModelOperation {
615 return c.internalClient.UpdateModelOperation(name)
616 }
617
618 // ExportModelMetadata export governance information for a Model resource. For
619 // information on the exported fields, see
620 // AML output data
621 // model (at https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#model).
622 func (c *AMLClient) ExportModelMetadata(ctx context.Context, req *financialservicespb.ExportModelMetadataRequest, opts ...gax.CallOption) (*ExportModelMetadataOperation, error) {
623 return c.internalClient.ExportModelMetadata(ctx, req, opts...)
624 }
625
626 // ExportModelMetadataOperation returns a new ExportModelMetadataOperation from a given name.
627 // The name must be that of a previously created ExportModelMetadataOperation, possibly from a different process.
628 func (c *AMLClient) ExportModelMetadataOperation(name string) *ExportModelMetadataOperation {
629 return c.internalClient.ExportModelMetadataOperation(name)
630 }
631
632 // DeleteModel deletes a model.
633 func (c *AMLClient) DeleteModel(ctx context.Context, req *financialservicespb.DeleteModelRequest, opts ...gax.CallOption) (*DeleteModelOperation, error) {
634 return c.internalClient.DeleteModel(ctx, req, opts...)
635 }
636
637 // DeleteModelOperation returns a new DeleteModelOperation from a given name.
638 // The name must be that of a previously created DeleteModelOperation, possibly from a different process.
639 func (c *AMLClient) DeleteModelOperation(name string) *DeleteModelOperation {
640 return c.internalClient.DeleteModelOperation(name)
641 }
642
643 // ListEngineConfigs lists engine configs.
644 func (c *AMLClient) ListEngineConfigs(ctx context.Context, req *financialservicespb.ListEngineConfigsRequest, opts ...gax.CallOption) *EngineConfigIterator {
645 return c.internalClient.ListEngineConfigs(ctx, req, opts...)
646 }
647
648 // GetEngineConfig gets an engine config.
649 func (c *AMLClient) GetEngineConfig(ctx context.Context, req *financialservicespb.GetEngineConfigRequest, opts ...gax.CallOption) (*financialservicespb.EngineConfig, error) {
650 return c.internalClient.GetEngineConfig(ctx, req, opts...)
651 }
652
653 // CreateEngineConfig creates an engine config.
654 func (c *AMLClient) CreateEngineConfig(ctx context.Context, req *financialservicespb.CreateEngineConfigRequest, opts ...gax.CallOption) (*CreateEngineConfigOperation, error) {
655 return c.internalClient.CreateEngineConfig(ctx, req, opts...)
656 }
657
658 // CreateEngineConfigOperation returns a new CreateEngineConfigOperation from a given name.
659 // The name must be that of a previously created CreateEngineConfigOperation, possibly from a different process.
660 func (c *AMLClient) CreateEngineConfigOperation(name string) *CreateEngineConfigOperation {
661 return c.internalClient.CreateEngineConfigOperation(name)
662 }
663
664 // UpdateEngineConfig updates the parameters of a single EngineConfig.
665 func (c *AMLClient) UpdateEngineConfig(ctx context.Context, req *financialservicespb.UpdateEngineConfigRequest, opts ...gax.CallOption) (*UpdateEngineConfigOperation, error) {
666 return c.internalClient.UpdateEngineConfig(ctx, req, opts...)
667 }
668
669 // UpdateEngineConfigOperation returns a new UpdateEngineConfigOperation from a given name.
670 // The name must be that of a previously created UpdateEngineConfigOperation, possibly from a different process.
671 func (c *AMLClient) UpdateEngineConfigOperation(name string) *UpdateEngineConfigOperation {
672 return c.internalClient.UpdateEngineConfigOperation(name)
673 }
674
675 // ExportEngineConfigMetadata export governance information for an EngineConfig resource. For
676 // information on the exported fields, see
677 // AML output data
678 // model (at https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#engine-config).
679 func (c *AMLClient) ExportEngineConfigMetadata(ctx context.Context, req *financialservicespb.ExportEngineConfigMetadataRequest, opts ...gax.CallOption) (*ExportEngineConfigMetadataOperation, error) {
680 return c.internalClient.ExportEngineConfigMetadata(ctx, req, opts...)
681 }
682
683 // ExportEngineConfigMetadataOperation returns a new ExportEngineConfigMetadataOperation from a given name.
684 // The name must be that of a previously created ExportEngineConfigMetadataOperation, possibly from a different process.
685 func (c *AMLClient) ExportEngineConfigMetadataOperation(name string) *ExportEngineConfigMetadataOperation {
686 return c.internalClient.ExportEngineConfigMetadataOperation(name)
687 }
688
689 // DeleteEngineConfig deletes an engine config.
690 func (c *AMLClient) DeleteEngineConfig(ctx context.Context, req *financialservicespb.DeleteEngineConfigRequest, opts ...gax.CallOption) (*DeleteEngineConfigOperation, error) {
691 return c.internalClient.DeleteEngineConfig(ctx, req, opts...)
692 }
693
694 // DeleteEngineConfigOperation returns a new DeleteEngineConfigOperation from a given name.
695 // The name must be that of a previously created DeleteEngineConfigOperation, possibly from a different process.
696 func (c *AMLClient) DeleteEngineConfigOperation(name string) *DeleteEngineConfigOperation {
697 return c.internalClient.DeleteEngineConfigOperation(name)
698 }
699
700 // GetEngineVersion gets a single EngineVersion.
701 func (c *AMLClient) GetEngineVersion(ctx context.Context, req *financialservicespb.GetEngineVersionRequest, opts ...gax.CallOption) (*financialservicespb.EngineVersion, error) {
702 return c.internalClient.GetEngineVersion(ctx, req, opts...)
703 }
704
705 // ListEngineVersions lists EngineVersions for given location.
706 func (c *AMLClient) ListEngineVersions(ctx context.Context, req *financialservicespb.ListEngineVersionsRequest, opts ...gax.CallOption) *EngineVersionIterator {
707 return c.internalClient.ListEngineVersions(ctx, req, opts...)
708 }
709
710 // ListPredictionResults list PredictionResults.
711 func (c *AMLClient) ListPredictionResults(ctx context.Context, req *financialservicespb.ListPredictionResultsRequest, opts ...gax.CallOption) *PredictionResultIterator {
712 return c.internalClient.ListPredictionResults(ctx, req, opts...)
713 }
714
715 // GetPredictionResult gets a PredictionResult.
716 func (c *AMLClient) GetPredictionResult(ctx context.Context, req *financialservicespb.GetPredictionResultRequest, opts ...gax.CallOption) (*financialservicespb.PredictionResult, error) {
717 return c.internalClient.GetPredictionResult(ctx, req, opts...)
718 }
719
720 // CreatePredictionResult create a PredictionResult.
721 func (c *AMLClient) CreatePredictionResult(ctx context.Context, req *financialservicespb.CreatePredictionResultRequest, opts ...gax.CallOption) (*CreatePredictionResultOperation, error) {
722 return c.internalClient.CreatePredictionResult(ctx, req, opts...)
723 }
724
725 // CreatePredictionResultOperation returns a new CreatePredictionResultOperation from a given name.
726 // The name must be that of a previously created CreatePredictionResultOperation, possibly from a different process.
727 func (c *AMLClient) CreatePredictionResultOperation(name string) *CreatePredictionResultOperation {
728 return c.internalClient.CreatePredictionResultOperation(name)
729 }
730
731 // UpdatePredictionResult updates the parameters of a single PredictionResult.
732 func (c *AMLClient) UpdatePredictionResult(ctx context.Context, req *financialservicespb.UpdatePredictionResultRequest, opts ...gax.CallOption) (*UpdatePredictionResultOperation, error) {
733 return c.internalClient.UpdatePredictionResult(ctx, req, opts...)
734 }
735
736 // UpdatePredictionResultOperation returns a new UpdatePredictionResultOperation from a given name.
737 // The name must be that of a previously created UpdatePredictionResultOperation, possibly from a different process.
738 func (c *AMLClient) UpdatePredictionResultOperation(name string) *UpdatePredictionResultOperation {
739 return c.internalClient.UpdatePredictionResultOperation(name)
740 }
741
742 // ExportPredictionResultMetadata export governance information for a PredictionResult resource. For
743 // information on the exported fields, see
744 // AML output data
745 // model (at https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#prediction-results).
746 func (c *AMLClient) ExportPredictionResultMetadata(ctx context.Context, req *financialservicespb.ExportPredictionResultMetadataRequest, opts ...gax.CallOption) (*ExportPredictionResultMetadataOperation, error) {
747 return c.internalClient.ExportPredictionResultMetadata(ctx, req, opts...)
748 }
749
750 // ExportPredictionResultMetadataOperation returns a new ExportPredictionResultMetadataOperation from a given name.
751 // The name must be that of a previously created ExportPredictionResultMetadataOperation, possibly from a different process.
752 func (c *AMLClient) ExportPredictionResultMetadataOperation(name string) *ExportPredictionResultMetadataOperation {
753 return c.internalClient.ExportPredictionResultMetadataOperation(name)
754 }
755
756 // DeletePredictionResult deletes a PredictionResult.
757 func (c *AMLClient) DeletePredictionResult(ctx context.Context, req *financialservicespb.DeletePredictionResultRequest, opts ...gax.CallOption) (*DeletePredictionResultOperation, error) {
758 return c.internalClient.DeletePredictionResult(ctx, req, opts...)
759 }
760
761 // DeletePredictionResultOperation returns a new DeletePredictionResultOperation from a given name.
762 // The name must be that of a previously created DeletePredictionResultOperation, possibly from a different process.
763 func (c *AMLClient) DeletePredictionResultOperation(name string) *DeletePredictionResultOperation {
764 return c.internalClient.DeletePredictionResultOperation(name)
765 }
766
767 // ListBacktestResults list BacktestResults.
768 func (c *AMLClient) ListBacktestResults(ctx context.Context, req *financialservicespb.ListBacktestResultsRequest, opts ...gax.CallOption) *BacktestResultIterator {
769 return c.internalClient.ListBacktestResults(ctx, req, opts...)
770 }
771
772 // GetBacktestResult gets a BacktestResult.
773 func (c *AMLClient) GetBacktestResult(ctx context.Context, req *financialservicespb.GetBacktestResultRequest, opts ...gax.CallOption) (*financialservicespb.BacktestResult, error) {
774 return c.internalClient.GetBacktestResult(ctx, req, opts...)
775 }
776
777 // CreateBacktestResult create a BacktestResult.
778 func (c *AMLClient) CreateBacktestResult(ctx context.Context, req *financialservicespb.CreateBacktestResultRequest, opts ...gax.CallOption) (*CreateBacktestResultOperation, error) {
779 return c.internalClient.CreateBacktestResult(ctx, req, opts...)
780 }
781
782 // CreateBacktestResultOperation returns a new CreateBacktestResultOperation from a given name.
783 // The name must be that of a previously created CreateBacktestResultOperation, possibly from a different process.
784 func (c *AMLClient) CreateBacktestResultOperation(name string) *CreateBacktestResultOperation {
785 return c.internalClient.CreateBacktestResultOperation(name)
786 }
787
788 // UpdateBacktestResult updates the parameters of a single BacktestResult.
789 func (c *AMLClient) UpdateBacktestResult(ctx context.Context, req *financialservicespb.UpdateBacktestResultRequest, opts ...gax.CallOption) (*UpdateBacktestResultOperation, error) {
790 return c.internalClient.UpdateBacktestResult(ctx, req, opts...)
791 }
792
793 // UpdateBacktestResultOperation returns a new UpdateBacktestResultOperation from a given name.
794 // The name must be that of a previously created UpdateBacktestResultOperation, possibly from a different process.
795 func (c *AMLClient) UpdateBacktestResultOperation(name string) *UpdateBacktestResultOperation {
796 return c.internalClient.UpdateBacktestResultOperation(name)
797 }
798
799 // ExportBacktestResultMetadata export governance information for a BacktestResult resource. For
800 // information on the exported fields, see
801 // AML output data
802 // model (at https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#backtest-results).
803 func (c *AMLClient) ExportBacktestResultMetadata(ctx context.Context, req *financialservicespb.ExportBacktestResultMetadataRequest, opts ...gax.CallOption) (*ExportBacktestResultMetadataOperation, error) {
804 return c.internalClient.ExportBacktestResultMetadata(ctx, req, opts...)
805 }
806
807 // ExportBacktestResultMetadataOperation returns a new ExportBacktestResultMetadataOperation from a given name.
808 // The name must be that of a previously created ExportBacktestResultMetadataOperation, possibly from a different process.
809 func (c *AMLClient) ExportBacktestResultMetadataOperation(name string) *ExportBacktestResultMetadataOperation {
810 return c.internalClient.ExportBacktestResultMetadataOperation(name)
811 }
812
813 // DeleteBacktestResult deletes a BacktestResult.
814 func (c *AMLClient) DeleteBacktestResult(ctx context.Context, req *financialservicespb.DeleteBacktestResultRequest, opts ...gax.CallOption) (*DeleteBacktestResultOperation, error) {
815 return c.internalClient.DeleteBacktestResult(ctx, req, opts...)
816 }
817
818 // DeleteBacktestResultOperation returns a new DeleteBacktestResultOperation from a given name.
819 // The name must be that of a previously created DeleteBacktestResultOperation, possibly from a different process.
820 func (c *AMLClient) DeleteBacktestResultOperation(name string) *DeleteBacktestResultOperation {
821 return c.internalClient.DeleteBacktestResultOperation(name)
822 }
823
824 // GetLocation gets information about a location.
825 func (c *AMLClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
826 return c.internalClient.GetLocation(ctx, req, opts...)
827 }
828
829 // ListLocations lists information about the supported locations for this service.
830 func (c *AMLClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
831 return c.internalClient.ListLocations(ctx, req, opts...)
832 }
833
834 // CancelOperation is a utility method from google.longrunning.Operations.
835 func (c *AMLClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
836 return c.internalClient.CancelOperation(ctx, req, opts...)
837 }
838
839 // DeleteOperation is a utility method from google.longrunning.Operations.
840 func (c *AMLClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
841 return c.internalClient.DeleteOperation(ctx, req, opts...)
842 }
843
844 // GetOperation is a utility method from google.longrunning.Operations.
845 func (c *AMLClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
846 return c.internalClient.GetOperation(ctx, req, opts...)
847 }
848
849 // ListOperations is a utility method from google.longrunning.Operations.
850 func (c *AMLClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
851 return c.internalClient.ListOperations(ctx, req, opts...)
852 }
853
854 // aMLGRPCClient is a client for interacting with Financial Services API over gRPC transport.
855 //
856 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
857 type aMLGRPCClient struct {
858 // Connection pool of gRPC connections to the service.
859 connPool gtransport.ConnPool
860
861 // Points back to the CallOptions field of the containing AMLClient
862 CallOptions **AMLCallOptions
863
864 // The gRPC API client.
865 aMLClient financialservicespb.AMLClient
866
867 // LROClient is used internally to handle long-running operations.
868 // It is exposed so that its CallOptions can be modified if required.
869 // Users should not Close this client.
870 LROClient **lroauto.OperationsClient
871
872 operationsClient longrunningpb.OperationsClient
873
874 locationsClient locationpb.LocationsClient
875
876 // The x-goog-* metadata to be sent with each request.
877 xGoogHeaders []string
878
879 logger *slog.Logger
880 }
881
882 // NewAMLClient creates a new aml client based on gRPC.
883 // The returned client must be Closed when it is done being used to clean up its underlying connections.
884 //
885 // The AML (Anti Money Laundering) service allows users to perform REST
886 // operations on aml.
887 func NewAMLClient(ctx context.Context, opts ...option.ClientOption) (*AMLClient, error) {
888 clientOpts := defaultAMLGRPCClientOptions()
889 if newAMLClientHook != nil {
890 hookOpts, err := newAMLClientHook(ctx, clientHookParams{})
891 if err != nil {
892 return nil, err
893 }
894 clientOpts = append(clientOpts, hookOpts...)
895 }
896
897 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
898 if err != nil {
899 return nil, err
900 }
901 client := AMLClient{CallOptions: defaultAMLCallOptions()}
902
903 c := &aMLGRPCClient{
904 connPool: connPool,
905 aMLClient: financialservicespb.NewAMLClient(connPool),
906 CallOptions: &client.CallOptions,
907 logger: internaloption.GetLogger(opts),
908 operationsClient: longrunningpb.NewOperationsClient(connPool),
909 locationsClient: locationpb.NewLocationsClient(connPool),
910 }
911 c.setGoogleClientInfo()
912
913 client.internalClient = c
914
915 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
916 if err != nil {
917 // This error "should not happen", since we are just reusing old connection pool
918 // and never actually need to dial.
919 // If this does happen, we could leak connp. However, we cannot close conn:
920 // If the user invoked the constructor with option.WithGRPCConn,
921 // we would close a connection that's still in use.
922 // TODO: investigate error conditions.
923 return nil, err
924 }
925 c.LROClient = &client.LROClient
926 return &client, nil
927 }
928
929 // Connection returns a connection to the API service.
930 //
931 // Deprecated: Connections are now pooled so this method does not always
932 // return the same resource.
933 func (c *aMLGRPCClient) Connection() *grpc.ClientConn {
934 return c.connPool.Conn()
935 }
936
937 // setGoogleClientInfo sets the name and version of the application in
938 // the `x-goog-api-client` header passed on each request. Intended for
939 // use by Google-written clients.
940 func (c *aMLGRPCClient) setGoogleClientInfo(keyval ...string) {
941 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
942 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
943 c.xGoogHeaders = []string{
944 "x-goog-api-client", gax.XGoogHeader(kv...),
945 }
946 }
947
948 // Close closes the connection to the API service. The user should invoke this when
949 // the client is no longer required.
950 func (c *aMLGRPCClient) Close() error {
951 return c.connPool.Close()
952 }
953
954 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
955 type aMLRESTClient struct {
956 // The http endpoint to connect to.
957 endpoint string
958
959 // The http client.
960 httpClient *http.Client
961
962 // LROClient is used internally to handle long-running operations.
963 // It is exposed so that its CallOptions can be modified if required.
964 // Users should not Close this client.
965 LROClient **lroauto.OperationsClient
966
967 // The x-goog-* headers to be sent with each request.
968 xGoogHeaders []string
969
970 // Points back to the CallOptions field of the containing AMLClient
971 CallOptions **AMLCallOptions
972
973 logger *slog.Logger
974 }
975
976 // NewAMLRESTClient creates a new aml rest client.
977 //
978 // The AML (Anti Money Laundering) service allows users to perform REST
979 // operations on aml.
980 func NewAMLRESTClient(ctx context.Context, opts ...option.ClientOption) (*AMLClient, error) {
981 clientOpts := append(defaultAMLRESTClientOptions(), opts...)
982 httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
983 if err != nil {
984 return nil, err
985 }
986
987 callOpts := defaultAMLRESTCallOptions()
988 c := &aMLRESTClient{
989 endpoint: endpoint,
990 httpClient: httpClient,
991 CallOptions: &callOpts,
992 logger: internaloption.GetLogger(opts),
993 }
994 c.setGoogleClientInfo()
995
996 lroOpts := []option.ClientOption{
997 option.WithHTTPClient(httpClient),
998 option.WithEndpoint(endpoint),
999 }
1000 opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
1001 if err != nil {
1002 return nil, err
1003 }
1004 c.LROClient = &opClient
1005
1006 return &AMLClient{internalClient: c, CallOptions: callOpts}, nil
1007 }
1008
1009 func defaultAMLRESTClientOptions() []option.ClientOption {
1010 return []option.ClientOption{
1011 internaloption.WithDefaultEndpoint("https://financialservices.googleapis.com"),
1012 internaloption.WithDefaultEndpointTemplate("https://financialservices.UNIVERSE_DOMAIN"),
1013 internaloption.WithDefaultMTLSEndpoint("https://financialservices.mtls.googleapis.com"),
1014 internaloption.WithDefaultUniverseDomain("googleapis.com"),
1015 internaloption.WithDefaultAudience("https://financialservices.googleapis.com/"),
1016 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
1017 internaloption.EnableNewAuthLibrary(),
1018 }
1019 }
1020
1021 // setGoogleClientInfo sets the name and version of the application in
1022 // the `x-goog-api-client` header passed on each request. Intended for
1023 // use by Google-written clients.
1024 func (c *aMLRESTClient) setGoogleClientInfo(keyval ...string) {
1025 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
1026 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion)
1027 c.xGoogHeaders = []string{
1028 "x-goog-api-client", gax.XGoogHeader(kv...),
1029 }
1030 }
1031
1032 // Close closes the connection to the API service. The user should invoke this when
1033 // the client is no longer required.
1034 func (c *aMLRESTClient) Close() error {
1035 // Replace httpClient with nil to force cleanup.
1036 c.httpClient = nil
1037 return nil
1038 }
1039
1040 // Connection returns a connection to the API service.
1041 //
1042 // Deprecated: This method always returns nil.
1043 func (c *aMLRESTClient) Connection() *grpc.ClientConn {
1044 return nil
1045 }
1046 func (c *aMLGRPCClient) ListInstances(ctx context.Context, req *financialservicespb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator {
1047 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1048
1049 hds = append(c.xGoogHeaders, hds...)
1050 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1051 opts = append((*c.CallOptions).ListInstances[0:len((*c.CallOptions).ListInstances):len((*c.CallOptions).ListInstances)], opts...)
1052 it := &InstanceIterator{}
1053 req = proto.Clone(req).(*financialservicespb.ListInstancesRequest)
1054 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.Instance, string, error) {
1055 resp := &financialservicespb.ListInstancesResponse{}
1056 if pageToken != "" {
1057 req.PageToken = pageToken
1058 }
1059 if pageSize > math.MaxInt32 {
1060 req.PageSize = math.MaxInt32
1061 } else if pageSize != 0 {
1062 req.PageSize = int32(pageSize)
1063 }
1064 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1065 var err error
1066 resp, err = executeRPC(ctx, c.aMLClient.ListInstances, req, settings.GRPC, c.logger, "ListInstances")
1067 return err
1068 }, opts...)
1069 if err != nil {
1070 return nil, "", err
1071 }
1072
1073 it.Response = resp
1074 return resp.GetInstances(), resp.GetNextPageToken(), nil
1075 }
1076 fetch := func(pageSize int, pageToken string) (string, error) {
1077 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1078 if err != nil {
1079 return "", err
1080 }
1081 it.items = append(it.items, items...)
1082 return nextPageToken, nil
1083 }
1084
1085 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1086 it.pageInfo.MaxSize = int(req.GetPageSize())
1087 it.pageInfo.Token = req.GetPageToken()
1088
1089 return it
1090 }
1091
1092 func (c *aMLGRPCClient) GetInstance(ctx context.Context, req *financialservicespb.GetInstanceRequest, opts ...gax.CallOption) (*financialservicespb.Instance, error) {
1093 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1094
1095 hds = append(c.xGoogHeaders, hds...)
1096 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1097 opts = append((*c.CallOptions).GetInstance[0:len((*c.CallOptions).GetInstance):len((*c.CallOptions).GetInstance)], opts...)
1098 var resp *financialservicespb.Instance
1099 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1100 var err error
1101 resp, err = executeRPC(ctx, c.aMLClient.GetInstance, req, settings.GRPC, c.logger, "GetInstance")
1102 return err
1103 }, opts...)
1104 if err != nil {
1105 return nil, err
1106 }
1107 return resp, nil
1108 }
1109
1110 func (c *aMLGRPCClient) CreateInstance(ctx context.Context, req *financialservicespb.CreateInstanceRequest, opts ...gax.CallOption) (*CreateInstanceOperation, error) {
1111 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1112
1113 hds = append(c.xGoogHeaders, hds...)
1114 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1115 opts = append((*c.CallOptions).CreateInstance[0:len((*c.CallOptions).CreateInstance):len((*c.CallOptions).CreateInstance)], opts...)
1116 var resp *longrunningpb.Operation
1117 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1118 var err error
1119 resp, err = executeRPC(ctx, c.aMLClient.CreateInstance, req, settings.GRPC, c.logger, "CreateInstance")
1120 return err
1121 }, opts...)
1122 if err != nil {
1123 return nil, err
1124 }
1125 return &CreateInstanceOperation{
1126 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1127 }, nil
1128 }
1129
1130 func (c *aMLGRPCClient) UpdateInstance(ctx context.Context, req *financialservicespb.UpdateInstanceRequest, opts ...gax.CallOption) (*UpdateInstanceOperation, error) {
1131 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "instance.name", url.QueryEscape(req.GetInstance().GetName()))}
1132
1133 hds = append(c.xGoogHeaders, hds...)
1134 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1135 opts = append((*c.CallOptions).UpdateInstance[0:len((*c.CallOptions).UpdateInstance):len((*c.CallOptions).UpdateInstance)], opts...)
1136 var resp *longrunningpb.Operation
1137 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1138 var err error
1139 resp, err = executeRPC(ctx, c.aMLClient.UpdateInstance, req, settings.GRPC, c.logger, "UpdateInstance")
1140 return err
1141 }, opts...)
1142 if err != nil {
1143 return nil, err
1144 }
1145 return &UpdateInstanceOperation{
1146 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1147 }, nil
1148 }
1149
1150 func (c *aMLGRPCClient) DeleteInstance(ctx context.Context, req *financialservicespb.DeleteInstanceRequest, opts ...gax.CallOption) (*DeleteInstanceOperation, error) {
1151 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1152
1153 hds = append(c.xGoogHeaders, hds...)
1154 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1155 opts = append((*c.CallOptions).DeleteInstance[0:len((*c.CallOptions).DeleteInstance):len((*c.CallOptions).DeleteInstance)], opts...)
1156 var resp *longrunningpb.Operation
1157 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1158 var err error
1159 resp, err = executeRPC(ctx, c.aMLClient.DeleteInstance, req, settings.GRPC, c.logger, "DeleteInstance")
1160 return err
1161 }, opts...)
1162 if err != nil {
1163 return nil, err
1164 }
1165 return &DeleteInstanceOperation{
1166 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1167 }, nil
1168 }
1169
1170 func (c *aMLGRPCClient) ImportRegisteredParties(ctx context.Context, req *financialservicespb.ImportRegisteredPartiesRequest, opts ...gax.CallOption) (*ImportRegisteredPartiesOperation, error) {
1171 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1172
1173 hds = append(c.xGoogHeaders, hds...)
1174 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1175 opts = append((*c.CallOptions).ImportRegisteredParties[0:len((*c.CallOptions).ImportRegisteredParties):len((*c.CallOptions).ImportRegisteredParties)], opts...)
1176 var resp *longrunningpb.Operation
1177 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1178 var err error
1179 resp, err = executeRPC(ctx, c.aMLClient.ImportRegisteredParties, req, settings.GRPC, c.logger, "ImportRegisteredParties")
1180 return err
1181 }, opts...)
1182 if err != nil {
1183 return nil, err
1184 }
1185 return &ImportRegisteredPartiesOperation{
1186 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1187 }, nil
1188 }
1189
1190 func (c *aMLGRPCClient) ExportRegisteredParties(ctx context.Context, req *financialservicespb.ExportRegisteredPartiesRequest, opts ...gax.CallOption) (*ExportRegisteredPartiesOperation, error) {
1191 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1192
1193 hds = append(c.xGoogHeaders, hds...)
1194 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1195 opts = append((*c.CallOptions).ExportRegisteredParties[0:len((*c.CallOptions).ExportRegisteredParties):len((*c.CallOptions).ExportRegisteredParties)], opts...)
1196 var resp *longrunningpb.Operation
1197 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1198 var err error
1199 resp, err = executeRPC(ctx, c.aMLClient.ExportRegisteredParties, req, settings.GRPC, c.logger, "ExportRegisteredParties")
1200 return err
1201 }, opts...)
1202 if err != nil {
1203 return nil, err
1204 }
1205 return &ExportRegisteredPartiesOperation{
1206 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1207 }, nil
1208 }
1209
1210 func (c *aMLGRPCClient) ListDatasets(ctx context.Context, req *financialservicespb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator {
1211 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1212
1213 hds = append(c.xGoogHeaders, hds...)
1214 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1215 opts = append((*c.CallOptions).ListDatasets[0:len((*c.CallOptions).ListDatasets):len((*c.CallOptions).ListDatasets)], opts...)
1216 it := &DatasetIterator{}
1217 req = proto.Clone(req).(*financialservicespb.ListDatasetsRequest)
1218 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.Dataset, string, error) {
1219 resp := &financialservicespb.ListDatasetsResponse{}
1220 if pageToken != "" {
1221 req.PageToken = pageToken
1222 }
1223 if pageSize > math.MaxInt32 {
1224 req.PageSize = math.MaxInt32
1225 } else if pageSize != 0 {
1226 req.PageSize = int32(pageSize)
1227 }
1228 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1229 var err error
1230 resp, err = executeRPC(ctx, c.aMLClient.ListDatasets, req, settings.GRPC, c.logger, "ListDatasets")
1231 return err
1232 }, opts...)
1233 if err != nil {
1234 return nil, "", err
1235 }
1236
1237 it.Response = resp
1238 return resp.GetDatasets(), resp.GetNextPageToken(), nil
1239 }
1240 fetch := func(pageSize int, pageToken string) (string, error) {
1241 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1242 if err != nil {
1243 return "", err
1244 }
1245 it.items = append(it.items, items...)
1246 return nextPageToken, nil
1247 }
1248
1249 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1250 it.pageInfo.MaxSize = int(req.GetPageSize())
1251 it.pageInfo.Token = req.GetPageToken()
1252
1253 return it
1254 }
1255
1256 func (c *aMLGRPCClient) GetDataset(ctx context.Context, req *financialservicespb.GetDatasetRequest, opts ...gax.CallOption) (*financialservicespb.Dataset, error) {
1257 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1258
1259 hds = append(c.xGoogHeaders, hds...)
1260 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1261 opts = append((*c.CallOptions).GetDataset[0:len((*c.CallOptions).GetDataset):len((*c.CallOptions).GetDataset)], opts...)
1262 var resp *financialservicespb.Dataset
1263 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1264 var err error
1265 resp, err = executeRPC(ctx, c.aMLClient.GetDataset, req, settings.GRPC, c.logger, "GetDataset")
1266 return err
1267 }, opts...)
1268 if err != nil {
1269 return nil, err
1270 }
1271 return resp, nil
1272 }
1273
1274 func (c *aMLGRPCClient) CreateDataset(ctx context.Context, req *financialservicespb.CreateDatasetRequest, opts ...gax.CallOption) (*CreateDatasetOperation, error) {
1275 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1276
1277 hds = append(c.xGoogHeaders, hds...)
1278 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1279 opts = append((*c.CallOptions).CreateDataset[0:len((*c.CallOptions).CreateDataset):len((*c.CallOptions).CreateDataset)], opts...)
1280 var resp *longrunningpb.Operation
1281 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1282 var err error
1283 resp, err = executeRPC(ctx, c.aMLClient.CreateDataset, req, settings.GRPC, c.logger, "CreateDataset")
1284 return err
1285 }, opts...)
1286 if err != nil {
1287 return nil, err
1288 }
1289 return &CreateDatasetOperation{
1290 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1291 }, nil
1292 }
1293
1294 func (c *aMLGRPCClient) UpdateDataset(ctx context.Context, req *financialservicespb.UpdateDatasetRequest, opts ...gax.CallOption) (*UpdateDatasetOperation, error) {
1295 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "dataset.name", url.QueryEscape(req.GetDataset().GetName()))}
1296
1297 hds = append(c.xGoogHeaders, hds...)
1298 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1299 opts = append((*c.CallOptions).UpdateDataset[0:len((*c.CallOptions).UpdateDataset):len((*c.CallOptions).UpdateDataset)], opts...)
1300 var resp *longrunningpb.Operation
1301 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1302 var err error
1303 resp, err = executeRPC(ctx, c.aMLClient.UpdateDataset, req, settings.GRPC, c.logger, "UpdateDataset")
1304 return err
1305 }, opts...)
1306 if err != nil {
1307 return nil, err
1308 }
1309 return &UpdateDatasetOperation{
1310 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1311 }, nil
1312 }
1313
1314 func (c *aMLGRPCClient) DeleteDataset(ctx context.Context, req *financialservicespb.DeleteDatasetRequest, opts ...gax.CallOption) (*DeleteDatasetOperation, error) {
1315 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1316
1317 hds = append(c.xGoogHeaders, hds...)
1318 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1319 opts = append((*c.CallOptions).DeleteDataset[0:len((*c.CallOptions).DeleteDataset):len((*c.CallOptions).DeleteDataset)], opts...)
1320 var resp *longrunningpb.Operation
1321 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1322 var err error
1323 resp, err = executeRPC(ctx, c.aMLClient.DeleteDataset, req, settings.GRPC, c.logger, "DeleteDataset")
1324 return err
1325 }, opts...)
1326 if err != nil {
1327 return nil, err
1328 }
1329 return &DeleteDatasetOperation{
1330 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1331 }, nil
1332 }
1333
1334 func (c *aMLGRPCClient) ListModels(ctx context.Context, req *financialservicespb.ListModelsRequest, opts ...gax.CallOption) *ModelIterator {
1335 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1336
1337 hds = append(c.xGoogHeaders, hds...)
1338 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1339 opts = append((*c.CallOptions).ListModels[0:len((*c.CallOptions).ListModels):len((*c.CallOptions).ListModels)], opts...)
1340 it := &ModelIterator{}
1341 req = proto.Clone(req).(*financialservicespb.ListModelsRequest)
1342 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.Model, string, error) {
1343 resp := &financialservicespb.ListModelsResponse{}
1344 if pageToken != "" {
1345 req.PageToken = pageToken
1346 }
1347 if pageSize > math.MaxInt32 {
1348 req.PageSize = math.MaxInt32
1349 } else if pageSize != 0 {
1350 req.PageSize = int32(pageSize)
1351 }
1352 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1353 var err error
1354 resp, err = executeRPC(ctx, c.aMLClient.ListModels, req, settings.GRPC, c.logger, "ListModels")
1355 return err
1356 }, opts...)
1357 if err != nil {
1358 return nil, "", err
1359 }
1360
1361 it.Response = resp
1362 return resp.GetModels(), resp.GetNextPageToken(), nil
1363 }
1364 fetch := func(pageSize int, pageToken string) (string, error) {
1365 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1366 if err != nil {
1367 return "", err
1368 }
1369 it.items = append(it.items, items...)
1370 return nextPageToken, nil
1371 }
1372
1373 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1374 it.pageInfo.MaxSize = int(req.GetPageSize())
1375 it.pageInfo.Token = req.GetPageToken()
1376
1377 return it
1378 }
1379
1380 func (c *aMLGRPCClient) GetModel(ctx context.Context, req *financialservicespb.GetModelRequest, opts ...gax.CallOption) (*financialservicespb.Model, error) {
1381 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1382
1383 hds = append(c.xGoogHeaders, hds...)
1384 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1385 opts = append((*c.CallOptions).GetModel[0:len((*c.CallOptions).GetModel):len((*c.CallOptions).GetModel)], opts...)
1386 var resp *financialservicespb.Model
1387 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1388 var err error
1389 resp, err = executeRPC(ctx, c.aMLClient.GetModel, req, settings.GRPC, c.logger, "GetModel")
1390 return err
1391 }, opts...)
1392 if err != nil {
1393 return nil, err
1394 }
1395 return resp, nil
1396 }
1397
1398 func (c *aMLGRPCClient) CreateModel(ctx context.Context, req *financialservicespb.CreateModelRequest, opts ...gax.CallOption) (*CreateModelOperation, error) {
1399 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1400
1401 hds = append(c.xGoogHeaders, hds...)
1402 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1403 opts = append((*c.CallOptions).CreateModel[0:len((*c.CallOptions).CreateModel):len((*c.CallOptions).CreateModel)], opts...)
1404 var resp *longrunningpb.Operation
1405 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1406 var err error
1407 resp, err = executeRPC(ctx, c.aMLClient.CreateModel, req, settings.GRPC, c.logger, "CreateModel")
1408 return err
1409 }, opts...)
1410 if err != nil {
1411 return nil, err
1412 }
1413 return &CreateModelOperation{
1414 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1415 }, nil
1416 }
1417
1418 func (c *aMLGRPCClient) UpdateModel(ctx context.Context, req *financialservicespb.UpdateModelRequest, opts ...gax.CallOption) (*UpdateModelOperation, error) {
1419 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "model.name", url.QueryEscape(req.GetModel().GetName()))}
1420
1421 hds = append(c.xGoogHeaders, hds...)
1422 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1423 opts = append((*c.CallOptions).UpdateModel[0:len((*c.CallOptions).UpdateModel):len((*c.CallOptions).UpdateModel)], opts...)
1424 var resp *longrunningpb.Operation
1425 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1426 var err error
1427 resp, err = executeRPC(ctx, c.aMLClient.UpdateModel, req, settings.GRPC, c.logger, "UpdateModel")
1428 return err
1429 }, opts...)
1430 if err != nil {
1431 return nil, err
1432 }
1433 return &UpdateModelOperation{
1434 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1435 }, nil
1436 }
1437
1438 func (c *aMLGRPCClient) ExportModelMetadata(ctx context.Context, req *financialservicespb.ExportModelMetadataRequest, opts ...gax.CallOption) (*ExportModelMetadataOperation, error) {
1439 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "model", url.QueryEscape(req.GetModel()))}
1440
1441 hds = append(c.xGoogHeaders, hds...)
1442 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1443 opts = append((*c.CallOptions).ExportModelMetadata[0:len((*c.CallOptions).ExportModelMetadata):len((*c.CallOptions).ExportModelMetadata)], opts...)
1444 var resp *longrunningpb.Operation
1445 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1446 var err error
1447 resp, err = executeRPC(ctx, c.aMLClient.ExportModelMetadata, req, settings.GRPC, c.logger, "ExportModelMetadata")
1448 return err
1449 }, opts...)
1450 if err != nil {
1451 return nil, err
1452 }
1453 return &ExportModelMetadataOperation{
1454 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1455 }, nil
1456 }
1457
1458 func (c *aMLGRPCClient) DeleteModel(ctx context.Context, req *financialservicespb.DeleteModelRequest, opts ...gax.CallOption) (*DeleteModelOperation, error) {
1459 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1460
1461 hds = append(c.xGoogHeaders, hds...)
1462 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1463 opts = append((*c.CallOptions).DeleteModel[0:len((*c.CallOptions).DeleteModel):len((*c.CallOptions).DeleteModel)], opts...)
1464 var resp *longrunningpb.Operation
1465 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1466 var err error
1467 resp, err = executeRPC(ctx, c.aMLClient.DeleteModel, req, settings.GRPC, c.logger, "DeleteModel")
1468 return err
1469 }, opts...)
1470 if err != nil {
1471 return nil, err
1472 }
1473 return &DeleteModelOperation{
1474 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1475 }, nil
1476 }
1477
1478 func (c *aMLGRPCClient) ListEngineConfigs(ctx context.Context, req *financialservicespb.ListEngineConfigsRequest, opts ...gax.CallOption) *EngineConfigIterator {
1479 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1480
1481 hds = append(c.xGoogHeaders, hds...)
1482 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1483 opts = append((*c.CallOptions).ListEngineConfigs[0:len((*c.CallOptions).ListEngineConfigs):len((*c.CallOptions).ListEngineConfigs)], opts...)
1484 it := &EngineConfigIterator{}
1485 req = proto.Clone(req).(*financialservicespb.ListEngineConfigsRequest)
1486 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.EngineConfig, string, error) {
1487 resp := &financialservicespb.ListEngineConfigsResponse{}
1488 if pageToken != "" {
1489 req.PageToken = pageToken
1490 }
1491 if pageSize > math.MaxInt32 {
1492 req.PageSize = math.MaxInt32
1493 } else if pageSize != 0 {
1494 req.PageSize = int32(pageSize)
1495 }
1496 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1497 var err error
1498 resp, err = executeRPC(ctx, c.aMLClient.ListEngineConfigs, req, settings.GRPC, c.logger, "ListEngineConfigs")
1499 return err
1500 }, opts...)
1501 if err != nil {
1502 return nil, "", err
1503 }
1504
1505 it.Response = resp
1506 return resp.GetEngineConfigs(), resp.GetNextPageToken(), nil
1507 }
1508 fetch := func(pageSize int, pageToken string) (string, error) {
1509 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1510 if err != nil {
1511 return "", err
1512 }
1513 it.items = append(it.items, items...)
1514 return nextPageToken, nil
1515 }
1516
1517 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1518 it.pageInfo.MaxSize = int(req.GetPageSize())
1519 it.pageInfo.Token = req.GetPageToken()
1520
1521 return it
1522 }
1523
1524 func (c *aMLGRPCClient) GetEngineConfig(ctx context.Context, req *financialservicespb.GetEngineConfigRequest, opts ...gax.CallOption) (*financialservicespb.EngineConfig, error) {
1525 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1526
1527 hds = append(c.xGoogHeaders, hds...)
1528 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1529 opts = append((*c.CallOptions).GetEngineConfig[0:len((*c.CallOptions).GetEngineConfig):len((*c.CallOptions).GetEngineConfig)], opts...)
1530 var resp *financialservicespb.EngineConfig
1531 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1532 var err error
1533 resp, err = executeRPC(ctx, c.aMLClient.GetEngineConfig, req, settings.GRPC, c.logger, "GetEngineConfig")
1534 return err
1535 }, opts...)
1536 if err != nil {
1537 return nil, err
1538 }
1539 return resp, nil
1540 }
1541
1542 func (c *aMLGRPCClient) CreateEngineConfig(ctx context.Context, req *financialservicespb.CreateEngineConfigRequest, opts ...gax.CallOption) (*CreateEngineConfigOperation, error) {
1543 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1544
1545 hds = append(c.xGoogHeaders, hds...)
1546 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1547 opts = append((*c.CallOptions).CreateEngineConfig[0:len((*c.CallOptions).CreateEngineConfig):len((*c.CallOptions).CreateEngineConfig)], opts...)
1548 var resp *longrunningpb.Operation
1549 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1550 var err error
1551 resp, err = executeRPC(ctx, c.aMLClient.CreateEngineConfig, req, settings.GRPC, c.logger, "CreateEngineConfig")
1552 return err
1553 }, opts...)
1554 if err != nil {
1555 return nil, err
1556 }
1557 return &CreateEngineConfigOperation{
1558 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1559 }, nil
1560 }
1561
1562 func (c *aMLGRPCClient) UpdateEngineConfig(ctx context.Context, req *financialservicespb.UpdateEngineConfigRequest, opts ...gax.CallOption) (*UpdateEngineConfigOperation, error) {
1563 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "engine_config.name", url.QueryEscape(req.GetEngineConfig().GetName()))}
1564
1565 hds = append(c.xGoogHeaders, hds...)
1566 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1567 opts = append((*c.CallOptions).UpdateEngineConfig[0:len((*c.CallOptions).UpdateEngineConfig):len((*c.CallOptions).UpdateEngineConfig)], opts...)
1568 var resp *longrunningpb.Operation
1569 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1570 var err error
1571 resp, err = executeRPC(ctx, c.aMLClient.UpdateEngineConfig, req, settings.GRPC, c.logger, "UpdateEngineConfig")
1572 return err
1573 }, opts...)
1574 if err != nil {
1575 return nil, err
1576 }
1577 return &UpdateEngineConfigOperation{
1578 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1579 }, nil
1580 }
1581
1582 func (c *aMLGRPCClient) ExportEngineConfigMetadata(ctx context.Context, req *financialservicespb.ExportEngineConfigMetadataRequest, opts ...gax.CallOption) (*ExportEngineConfigMetadataOperation, error) {
1583 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "engine_config", url.QueryEscape(req.GetEngineConfig()))}
1584
1585 hds = append(c.xGoogHeaders, hds...)
1586 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1587 opts = append((*c.CallOptions).ExportEngineConfigMetadata[0:len((*c.CallOptions).ExportEngineConfigMetadata):len((*c.CallOptions).ExportEngineConfigMetadata)], opts...)
1588 var resp *longrunningpb.Operation
1589 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1590 var err error
1591 resp, err = executeRPC(ctx, c.aMLClient.ExportEngineConfigMetadata, req, settings.GRPC, c.logger, "ExportEngineConfigMetadata")
1592 return err
1593 }, opts...)
1594 if err != nil {
1595 return nil, err
1596 }
1597 return &ExportEngineConfigMetadataOperation{
1598 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1599 }, nil
1600 }
1601
1602 func (c *aMLGRPCClient) DeleteEngineConfig(ctx context.Context, req *financialservicespb.DeleteEngineConfigRequest, opts ...gax.CallOption) (*DeleteEngineConfigOperation, error) {
1603 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1604
1605 hds = append(c.xGoogHeaders, hds...)
1606 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1607 opts = append((*c.CallOptions).DeleteEngineConfig[0:len((*c.CallOptions).DeleteEngineConfig):len((*c.CallOptions).DeleteEngineConfig)], opts...)
1608 var resp *longrunningpb.Operation
1609 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1610 var err error
1611 resp, err = executeRPC(ctx, c.aMLClient.DeleteEngineConfig, req, settings.GRPC, c.logger, "DeleteEngineConfig")
1612 return err
1613 }, opts...)
1614 if err != nil {
1615 return nil, err
1616 }
1617 return &DeleteEngineConfigOperation{
1618 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1619 }, nil
1620 }
1621
1622 func (c *aMLGRPCClient) GetEngineVersion(ctx context.Context, req *financialservicespb.GetEngineVersionRequest, opts ...gax.CallOption) (*financialservicespb.EngineVersion, error) {
1623 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1624
1625 hds = append(c.xGoogHeaders, hds...)
1626 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1627 opts = append((*c.CallOptions).GetEngineVersion[0:len((*c.CallOptions).GetEngineVersion):len((*c.CallOptions).GetEngineVersion)], opts...)
1628 var resp *financialservicespb.EngineVersion
1629 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1630 var err error
1631 resp, err = executeRPC(ctx, c.aMLClient.GetEngineVersion, req, settings.GRPC, c.logger, "GetEngineVersion")
1632 return err
1633 }, opts...)
1634 if err != nil {
1635 return nil, err
1636 }
1637 return resp, nil
1638 }
1639
1640 func (c *aMLGRPCClient) ListEngineVersions(ctx context.Context, req *financialservicespb.ListEngineVersionsRequest, opts ...gax.CallOption) *EngineVersionIterator {
1641 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1642
1643 hds = append(c.xGoogHeaders, hds...)
1644 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1645 opts = append((*c.CallOptions).ListEngineVersions[0:len((*c.CallOptions).ListEngineVersions):len((*c.CallOptions).ListEngineVersions)], opts...)
1646 it := &EngineVersionIterator{}
1647 req = proto.Clone(req).(*financialservicespb.ListEngineVersionsRequest)
1648 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.EngineVersion, string, error) {
1649 resp := &financialservicespb.ListEngineVersionsResponse{}
1650 if pageToken != "" {
1651 req.PageToken = pageToken
1652 }
1653 if pageSize > math.MaxInt32 {
1654 req.PageSize = math.MaxInt32
1655 } else if pageSize != 0 {
1656 req.PageSize = int32(pageSize)
1657 }
1658 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1659 var err error
1660 resp, err = executeRPC(ctx, c.aMLClient.ListEngineVersions, req, settings.GRPC, c.logger, "ListEngineVersions")
1661 return err
1662 }, opts...)
1663 if err != nil {
1664 return nil, "", err
1665 }
1666
1667 it.Response = resp
1668 return resp.GetEngineVersions(), resp.GetNextPageToken(), nil
1669 }
1670 fetch := func(pageSize int, pageToken string) (string, error) {
1671 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1672 if err != nil {
1673 return "", err
1674 }
1675 it.items = append(it.items, items...)
1676 return nextPageToken, nil
1677 }
1678
1679 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1680 it.pageInfo.MaxSize = int(req.GetPageSize())
1681 it.pageInfo.Token = req.GetPageToken()
1682
1683 return it
1684 }
1685
1686 func (c *aMLGRPCClient) ListPredictionResults(ctx context.Context, req *financialservicespb.ListPredictionResultsRequest, opts ...gax.CallOption) *PredictionResultIterator {
1687 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1688
1689 hds = append(c.xGoogHeaders, hds...)
1690 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1691 opts = append((*c.CallOptions).ListPredictionResults[0:len((*c.CallOptions).ListPredictionResults):len((*c.CallOptions).ListPredictionResults)], opts...)
1692 it := &PredictionResultIterator{}
1693 req = proto.Clone(req).(*financialservicespb.ListPredictionResultsRequest)
1694 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.PredictionResult, string, error) {
1695 resp := &financialservicespb.ListPredictionResultsResponse{}
1696 if pageToken != "" {
1697 req.PageToken = pageToken
1698 }
1699 if pageSize > math.MaxInt32 {
1700 req.PageSize = math.MaxInt32
1701 } else if pageSize != 0 {
1702 req.PageSize = int32(pageSize)
1703 }
1704 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1705 var err error
1706 resp, err = executeRPC(ctx, c.aMLClient.ListPredictionResults, req, settings.GRPC, c.logger, "ListPredictionResults")
1707 return err
1708 }, opts...)
1709 if err != nil {
1710 return nil, "", err
1711 }
1712
1713 it.Response = resp
1714 return resp.GetPredictionResults(), resp.GetNextPageToken(), nil
1715 }
1716 fetch := func(pageSize int, pageToken string) (string, error) {
1717 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1718 if err != nil {
1719 return "", err
1720 }
1721 it.items = append(it.items, items...)
1722 return nextPageToken, nil
1723 }
1724
1725 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1726 it.pageInfo.MaxSize = int(req.GetPageSize())
1727 it.pageInfo.Token = req.GetPageToken()
1728
1729 return it
1730 }
1731
1732 func (c *aMLGRPCClient) GetPredictionResult(ctx context.Context, req *financialservicespb.GetPredictionResultRequest, opts ...gax.CallOption) (*financialservicespb.PredictionResult, error) {
1733 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1734
1735 hds = append(c.xGoogHeaders, hds...)
1736 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1737 opts = append((*c.CallOptions).GetPredictionResult[0:len((*c.CallOptions).GetPredictionResult):len((*c.CallOptions).GetPredictionResult)], opts...)
1738 var resp *financialservicespb.PredictionResult
1739 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1740 var err error
1741 resp, err = executeRPC(ctx, c.aMLClient.GetPredictionResult, req, settings.GRPC, c.logger, "GetPredictionResult")
1742 return err
1743 }, opts...)
1744 if err != nil {
1745 return nil, err
1746 }
1747 return resp, nil
1748 }
1749
1750 func (c *aMLGRPCClient) CreatePredictionResult(ctx context.Context, req *financialservicespb.CreatePredictionResultRequest, opts ...gax.CallOption) (*CreatePredictionResultOperation, error) {
1751 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1752
1753 hds = append(c.xGoogHeaders, hds...)
1754 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1755 opts = append((*c.CallOptions).CreatePredictionResult[0:len((*c.CallOptions).CreatePredictionResult):len((*c.CallOptions).CreatePredictionResult)], opts...)
1756 var resp *longrunningpb.Operation
1757 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1758 var err error
1759 resp, err = executeRPC(ctx, c.aMLClient.CreatePredictionResult, req, settings.GRPC, c.logger, "CreatePredictionResult")
1760 return err
1761 }, opts...)
1762 if err != nil {
1763 return nil, err
1764 }
1765 return &CreatePredictionResultOperation{
1766 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1767 }, nil
1768 }
1769
1770 func (c *aMLGRPCClient) UpdatePredictionResult(ctx context.Context, req *financialservicespb.UpdatePredictionResultRequest, opts ...gax.CallOption) (*UpdatePredictionResultOperation, error) {
1771 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "prediction_result.name", url.QueryEscape(req.GetPredictionResult().GetName()))}
1772
1773 hds = append(c.xGoogHeaders, hds...)
1774 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1775 opts = append((*c.CallOptions).UpdatePredictionResult[0:len((*c.CallOptions).UpdatePredictionResult):len((*c.CallOptions).UpdatePredictionResult)], opts...)
1776 var resp *longrunningpb.Operation
1777 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1778 var err error
1779 resp, err = executeRPC(ctx, c.aMLClient.UpdatePredictionResult, req, settings.GRPC, c.logger, "UpdatePredictionResult")
1780 return err
1781 }, opts...)
1782 if err != nil {
1783 return nil, err
1784 }
1785 return &UpdatePredictionResultOperation{
1786 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1787 }, nil
1788 }
1789
1790 func (c *aMLGRPCClient) ExportPredictionResultMetadata(ctx context.Context, req *financialservicespb.ExportPredictionResultMetadataRequest, opts ...gax.CallOption) (*ExportPredictionResultMetadataOperation, error) {
1791 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "prediction_result", url.QueryEscape(req.GetPredictionResult()))}
1792
1793 hds = append(c.xGoogHeaders, hds...)
1794 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1795 opts = append((*c.CallOptions).ExportPredictionResultMetadata[0:len((*c.CallOptions).ExportPredictionResultMetadata):len((*c.CallOptions).ExportPredictionResultMetadata)], opts...)
1796 var resp *longrunningpb.Operation
1797 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1798 var err error
1799 resp, err = executeRPC(ctx, c.aMLClient.ExportPredictionResultMetadata, req, settings.GRPC, c.logger, "ExportPredictionResultMetadata")
1800 return err
1801 }, opts...)
1802 if err != nil {
1803 return nil, err
1804 }
1805 return &ExportPredictionResultMetadataOperation{
1806 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1807 }, nil
1808 }
1809
1810 func (c *aMLGRPCClient) DeletePredictionResult(ctx context.Context, req *financialservicespb.DeletePredictionResultRequest, opts ...gax.CallOption) (*DeletePredictionResultOperation, error) {
1811 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1812
1813 hds = append(c.xGoogHeaders, hds...)
1814 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1815 opts = append((*c.CallOptions).DeletePredictionResult[0:len((*c.CallOptions).DeletePredictionResult):len((*c.CallOptions).DeletePredictionResult)], opts...)
1816 var resp *longrunningpb.Operation
1817 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1818 var err error
1819 resp, err = executeRPC(ctx, c.aMLClient.DeletePredictionResult, req, settings.GRPC, c.logger, "DeletePredictionResult")
1820 return err
1821 }, opts...)
1822 if err != nil {
1823 return nil, err
1824 }
1825 return &DeletePredictionResultOperation{
1826 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1827 }, nil
1828 }
1829
1830 func (c *aMLGRPCClient) ListBacktestResults(ctx context.Context, req *financialservicespb.ListBacktestResultsRequest, opts ...gax.CallOption) *BacktestResultIterator {
1831 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1832
1833 hds = append(c.xGoogHeaders, hds...)
1834 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1835 opts = append((*c.CallOptions).ListBacktestResults[0:len((*c.CallOptions).ListBacktestResults):len((*c.CallOptions).ListBacktestResults)], opts...)
1836 it := &BacktestResultIterator{}
1837 req = proto.Clone(req).(*financialservicespb.ListBacktestResultsRequest)
1838 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.BacktestResult, string, error) {
1839 resp := &financialservicespb.ListBacktestResultsResponse{}
1840 if pageToken != "" {
1841 req.PageToken = pageToken
1842 }
1843 if pageSize > math.MaxInt32 {
1844 req.PageSize = math.MaxInt32
1845 } else if pageSize != 0 {
1846 req.PageSize = int32(pageSize)
1847 }
1848 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1849 var err error
1850 resp, err = executeRPC(ctx, c.aMLClient.ListBacktestResults, req, settings.GRPC, c.logger, "ListBacktestResults")
1851 return err
1852 }, opts...)
1853 if err != nil {
1854 return nil, "", err
1855 }
1856
1857 it.Response = resp
1858 return resp.GetBacktestResults(), resp.GetNextPageToken(), nil
1859 }
1860 fetch := func(pageSize int, pageToken string) (string, error) {
1861 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1862 if err != nil {
1863 return "", err
1864 }
1865 it.items = append(it.items, items...)
1866 return nextPageToken, nil
1867 }
1868
1869 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1870 it.pageInfo.MaxSize = int(req.GetPageSize())
1871 it.pageInfo.Token = req.GetPageToken()
1872
1873 return it
1874 }
1875
1876 func (c *aMLGRPCClient) GetBacktestResult(ctx context.Context, req *financialservicespb.GetBacktestResultRequest, opts ...gax.CallOption) (*financialservicespb.BacktestResult, error) {
1877 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1878
1879 hds = append(c.xGoogHeaders, hds...)
1880 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1881 opts = append((*c.CallOptions).GetBacktestResult[0:len((*c.CallOptions).GetBacktestResult):len((*c.CallOptions).GetBacktestResult)], opts...)
1882 var resp *financialservicespb.BacktestResult
1883 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1884 var err error
1885 resp, err = executeRPC(ctx, c.aMLClient.GetBacktestResult, req, settings.GRPC, c.logger, "GetBacktestResult")
1886 return err
1887 }, opts...)
1888 if err != nil {
1889 return nil, err
1890 }
1891 return resp, nil
1892 }
1893
1894 func (c *aMLGRPCClient) CreateBacktestResult(ctx context.Context, req *financialservicespb.CreateBacktestResultRequest, opts ...gax.CallOption) (*CreateBacktestResultOperation, error) {
1895 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1896
1897 hds = append(c.xGoogHeaders, hds...)
1898 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1899 opts = append((*c.CallOptions).CreateBacktestResult[0:len((*c.CallOptions).CreateBacktestResult):len((*c.CallOptions).CreateBacktestResult)], opts...)
1900 var resp *longrunningpb.Operation
1901 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1902 var err error
1903 resp, err = executeRPC(ctx, c.aMLClient.CreateBacktestResult, req, settings.GRPC, c.logger, "CreateBacktestResult")
1904 return err
1905 }, opts...)
1906 if err != nil {
1907 return nil, err
1908 }
1909 return &CreateBacktestResultOperation{
1910 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1911 }, nil
1912 }
1913
1914 func (c *aMLGRPCClient) UpdateBacktestResult(ctx context.Context, req *financialservicespb.UpdateBacktestResultRequest, opts ...gax.CallOption) (*UpdateBacktestResultOperation, error) {
1915 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "backtest_result.name", url.QueryEscape(req.GetBacktestResult().GetName()))}
1916
1917 hds = append(c.xGoogHeaders, hds...)
1918 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1919 opts = append((*c.CallOptions).UpdateBacktestResult[0:len((*c.CallOptions).UpdateBacktestResult):len((*c.CallOptions).UpdateBacktestResult)], opts...)
1920 var resp *longrunningpb.Operation
1921 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1922 var err error
1923 resp, err = executeRPC(ctx, c.aMLClient.UpdateBacktestResult, req, settings.GRPC, c.logger, "UpdateBacktestResult")
1924 return err
1925 }, opts...)
1926 if err != nil {
1927 return nil, err
1928 }
1929 return &UpdateBacktestResultOperation{
1930 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1931 }, nil
1932 }
1933
1934 func (c *aMLGRPCClient) ExportBacktestResultMetadata(ctx context.Context, req *financialservicespb.ExportBacktestResultMetadataRequest, opts ...gax.CallOption) (*ExportBacktestResultMetadataOperation, error) {
1935 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "backtest_result", url.QueryEscape(req.GetBacktestResult()))}
1936
1937 hds = append(c.xGoogHeaders, hds...)
1938 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1939 opts = append((*c.CallOptions).ExportBacktestResultMetadata[0:len((*c.CallOptions).ExportBacktestResultMetadata):len((*c.CallOptions).ExportBacktestResultMetadata)], opts...)
1940 var resp *longrunningpb.Operation
1941 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1942 var err error
1943 resp, err = executeRPC(ctx, c.aMLClient.ExportBacktestResultMetadata, req, settings.GRPC, c.logger, "ExportBacktestResultMetadata")
1944 return err
1945 }, opts...)
1946 if err != nil {
1947 return nil, err
1948 }
1949 return &ExportBacktestResultMetadataOperation{
1950 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1951 }, nil
1952 }
1953
1954 func (c *aMLGRPCClient) DeleteBacktestResult(ctx context.Context, req *financialservicespb.DeleteBacktestResultRequest, opts ...gax.CallOption) (*DeleteBacktestResultOperation, error) {
1955 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1956
1957 hds = append(c.xGoogHeaders, hds...)
1958 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1959 opts = append((*c.CallOptions).DeleteBacktestResult[0:len((*c.CallOptions).DeleteBacktestResult):len((*c.CallOptions).DeleteBacktestResult)], opts...)
1960 var resp *longrunningpb.Operation
1961 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1962 var err error
1963 resp, err = executeRPC(ctx, c.aMLClient.DeleteBacktestResult, req, settings.GRPC, c.logger, "DeleteBacktestResult")
1964 return err
1965 }, opts...)
1966 if err != nil {
1967 return nil, err
1968 }
1969 return &DeleteBacktestResultOperation{
1970 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1971 }, nil
1972 }
1973
1974 func (c *aMLGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
1975 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1976
1977 hds = append(c.xGoogHeaders, hds...)
1978 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1979 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
1980 var resp *locationpb.Location
1981 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1982 var err error
1983 resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation")
1984 return err
1985 }, opts...)
1986 if err != nil {
1987 return nil, err
1988 }
1989 return resp, nil
1990 }
1991
1992 func (c *aMLGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
1993 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1994
1995 hds = append(c.xGoogHeaders, hds...)
1996 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1997 opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...)
1998 it := &LocationIterator{}
1999 req = proto.Clone(req).(*locationpb.ListLocationsRequest)
2000 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
2001 resp := &locationpb.ListLocationsResponse{}
2002 if pageToken != "" {
2003 req.PageToken = pageToken
2004 }
2005 if pageSize > math.MaxInt32 {
2006 req.PageSize = math.MaxInt32
2007 } else if pageSize != 0 {
2008 req.PageSize = int32(pageSize)
2009 }
2010 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2011 var err error
2012 resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations")
2013 return err
2014 }, opts...)
2015 if err != nil {
2016 return nil, "", err
2017 }
2018
2019 it.Response = resp
2020 return resp.GetLocations(), resp.GetNextPageToken(), nil
2021 }
2022 fetch := func(pageSize int, pageToken string) (string, error) {
2023 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2024 if err != nil {
2025 return "", err
2026 }
2027 it.items = append(it.items, items...)
2028 return nextPageToken, nil
2029 }
2030
2031 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2032 it.pageInfo.MaxSize = int(req.GetPageSize())
2033 it.pageInfo.Token = req.GetPageToken()
2034
2035 return it
2036 }
2037
2038 func (c *aMLGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
2039 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2040
2041 hds = append(c.xGoogHeaders, hds...)
2042 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2043 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
2044 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2045 var err error
2046 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
2047 return err
2048 }, opts...)
2049 return err
2050 }
2051
2052 func (c *aMLGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
2053 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2054
2055 hds = append(c.xGoogHeaders, hds...)
2056 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2057 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
2058 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2059 var err error
2060 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
2061 return err
2062 }, opts...)
2063 return err
2064 }
2065
2066 func (c *aMLGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
2067 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2068
2069 hds = append(c.xGoogHeaders, hds...)
2070 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2071 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
2072 var resp *longrunningpb.Operation
2073 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2074 var err error
2075 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
2076 return err
2077 }, opts...)
2078 if err != nil {
2079 return nil, err
2080 }
2081 return resp, nil
2082 }
2083
2084 func (c *aMLGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
2085 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2086
2087 hds = append(c.xGoogHeaders, hds...)
2088 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2089 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
2090 it := &OperationIterator{}
2091 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
2092 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
2093 resp := &longrunningpb.ListOperationsResponse{}
2094 if pageToken != "" {
2095 req.PageToken = pageToken
2096 }
2097 if pageSize > math.MaxInt32 {
2098 req.PageSize = math.MaxInt32
2099 } else if pageSize != 0 {
2100 req.PageSize = int32(pageSize)
2101 }
2102 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2103 var err error
2104 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
2105 return err
2106 }, opts...)
2107 if err != nil {
2108 return nil, "", err
2109 }
2110
2111 it.Response = resp
2112 return resp.GetOperations(), resp.GetNextPageToken(), nil
2113 }
2114 fetch := func(pageSize int, pageToken string) (string, error) {
2115 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2116 if err != nil {
2117 return "", err
2118 }
2119 it.items = append(it.items, items...)
2120 return nextPageToken, nil
2121 }
2122
2123 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2124 it.pageInfo.MaxSize = int(req.GetPageSize())
2125 it.pageInfo.Token = req.GetPageToken()
2126
2127 return it
2128 }
2129
2130 // ListInstances lists instances.
2131 func (c *aMLRESTClient) ListInstances(ctx context.Context, req *financialservicespb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator {
2132 it := &InstanceIterator{}
2133 req = proto.Clone(req).(*financialservicespb.ListInstancesRequest)
2134 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2135 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.Instance, string, error) {
2136 resp := &financialservicespb.ListInstancesResponse{}
2137 if pageToken != "" {
2138 req.PageToken = pageToken
2139 }
2140 if pageSize > math.MaxInt32 {
2141 req.PageSize = math.MaxInt32
2142 } else if pageSize != 0 {
2143 req.PageSize = int32(pageSize)
2144 }
2145 baseUrl, err := url.Parse(c.endpoint)
2146 if err != nil {
2147 return nil, "", err
2148 }
2149 baseUrl.Path += fmt.Sprintf("/v1/%v/instances", req.GetParent())
2150
2151 params := url.Values{}
2152 params.Add("$alt", "json;enum-encoding=int")
2153 if req.GetFilter() != "" {
2154 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2155 }
2156 if req.GetOrderBy() != "" {
2157 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
2158 }
2159 if req.GetPageSize() != 0 {
2160 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2161 }
2162 if req.GetPageToken() != "" {
2163 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2164 }
2165
2166 baseUrl.RawQuery = params.Encode()
2167
2168 // Build HTTP headers from client and context metadata.
2169 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2170 headers := gax.BuildHeaders(ctx, hds...)
2171 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2172 if settings.Path != "" {
2173 baseUrl.Path = settings.Path
2174 }
2175 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2176 if err != nil {
2177 return err
2178 }
2179 httpReq.Header = headers
2180
2181 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListInstances")
2182 if err != nil {
2183 return err
2184 }
2185 if err := unm.Unmarshal(buf, resp); err != nil {
2186 return err
2187 }
2188
2189 return nil
2190 }, opts...)
2191 if e != nil {
2192 return nil, "", e
2193 }
2194 it.Response = resp
2195 return resp.GetInstances(), resp.GetNextPageToken(), nil
2196 }
2197
2198 fetch := func(pageSize int, pageToken string) (string, error) {
2199 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2200 if err != nil {
2201 return "", err
2202 }
2203 it.items = append(it.items, items...)
2204 return nextPageToken, nil
2205 }
2206
2207 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2208 it.pageInfo.MaxSize = int(req.GetPageSize())
2209 it.pageInfo.Token = req.GetPageToken()
2210
2211 return it
2212 }
2213
2214 // GetInstance gets an instance.
2215 func (c *aMLRESTClient) GetInstance(ctx context.Context, req *financialservicespb.GetInstanceRequest, opts ...gax.CallOption) (*financialservicespb.Instance, error) {
2216 baseUrl, err := url.Parse(c.endpoint)
2217 if err != nil {
2218 return nil, err
2219 }
2220 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2221
2222 params := url.Values{}
2223 params.Add("$alt", "json;enum-encoding=int")
2224
2225 baseUrl.RawQuery = params.Encode()
2226
2227 // Build HTTP headers from client and context metadata.
2228 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2229
2230 hds = append(c.xGoogHeaders, hds...)
2231 hds = append(hds, "Content-Type", "application/json")
2232 headers := gax.BuildHeaders(ctx, hds...)
2233 opts = append((*c.CallOptions).GetInstance[0:len((*c.CallOptions).GetInstance):len((*c.CallOptions).GetInstance)], opts...)
2234 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2235 resp := &financialservicespb.Instance{}
2236 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2237 if settings.Path != "" {
2238 baseUrl.Path = settings.Path
2239 }
2240 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2241 if err != nil {
2242 return err
2243 }
2244 httpReq = httpReq.WithContext(ctx)
2245 httpReq.Header = headers
2246
2247 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetInstance")
2248 if err != nil {
2249 return err
2250 }
2251
2252 if err := unm.Unmarshal(buf, resp); err != nil {
2253 return err
2254 }
2255
2256 return nil
2257 }, opts...)
2258 if e != nil {
2259 return nil, e
2260 }
2261 return resp, nil
2262 }
2263
2264 // CreateInstance creates an instance.
2265 func (c *aMLRESTClient) CreateInstance(ctx context.Context, req *financialservicespb.CreateInstanceRequest, opts ...gax.CallOption) (*CreateInstanceOperation, error) {
2266 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2267 body := req.GetInstance()
2268 jsonReq, err := m.Marshal(body)
2269 if err != nil {
2270 return nil, err
2271 }
2272
2273 baseUrl, err := url.Parse(c.endpoint)
2274 if err != nil {
2275 return nil, err
2276 }
2277 baseUrl.Path += fmt.Sprintf("/v1/%v/instances", req.GetParent())
2278
2279 params := url.Values{}
2280 params.Add("$alt", "json;enum-encoding=int")
2281 params.Add("instanceId", fmt.Sprintf("%v", req.GetInstanceId()))
2282 if req.GetRequestId() != "" {
2283 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2284 }
2285
2286 baseUrl.RawQuery = params.Encode()
2287
2288 // Build HTTP headers from client and context metadata.
2289 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2290
2291 hds = append(c.xGoogHeaders, hds...)
2292 hds = append(hds, "Content-Type", "application/json")
2293 headers := gax.BuildHeaders(ctx, hds...)
2294 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2295 resp := &longrunningpb.Operation{}
2296 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2297 if settings.Path != "" {
2298 baseUrl.Path = settings.Path
2299 }
2300 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2301 if err != nil {
2302 return err
2303 }
2304 httpReq = httpReq.WithContext(ctx)
2305 httpReq.Header = headers
2306
2307 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateInstance")
2308 if err != nil {
2309 return err
2310 }
2311 if err := unm.Unmarshal(buf, resp); err != nil {
2312 return err
2313 }
2314
2315 return nil
2316 }, opts...)
2317 if e != nil {
2318 return nil, e
2319 }
2320
2321 override := fmt.Sprintf("/v1/%s", resp.GetName())
2322 return &CreateInstanceOperation{
2323 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2324 pollPath: override,
2325 }, nil
2326 }
2327
2328 // UpdateInstance updates the parameters of a single Instance.
2329 func (c *aMLRESTClient) UpdateInstance(ctx context.Context, req *financialservicespb.UpdateInstanceRequest, opts ...gax.CallOption) (*UpdateInstanceOperation, error) {
2330 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2331 body := req.GetInstance()
2332 jsonReq, err := m.Marshal(body)
2333 if err != nil {
2334 return nil, err
2335 }
2336
2337 baseUrl, err := url.Parse(c.endpoint)
2338 if err != nil {
2339 return nil, err
2340 }
2341 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetInstance().GetName())
2342
2343 params := url.Values{}
2344 params.Add("$alt", "json;enum-encoding=int")
2345 if req.GetRequestId() != "" {
2346 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2347 }
2348 if req.GetUpdateMask() != nil {
2349 field, err := protojson.Marshal(req.GetUpdateMask())
2350 if err != nil {
2351 return nil, err
2352 }
2353 params.Add("updateMask", string(field[1:len(field)-1]))
2354 }
2355
2356 baseUrl.RawQuery = params.Encode()
2357
2358 // Build HTTP headers from client and context metadata.
2359 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "instance.name", url.QueryEscape(req.GetInstance().GetName()))}
2360
2361 hds = append(c.xGoogHeaders, hds...)
2362 hds = append(hds, "Content-Type", "application/json")
2363 headers := gax.BuildHeaders(ctx, hds...)
2364 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2365 resp := &longrunningpb.Operation{}
2366 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2367 if settings.Path != "" {
2368 baseUrl.Path = settings.Path
2369 }
2370 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
2371 if err != nil {
2372 return err
2373 }
2374 httpReq = httpReq.WithContext(ctx)
2375 httpReq.Header = headers
2376
2377 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateInstance")
2378 if err != nil {
2379 return err
2380 }
2381 if err := unm.Unmarshal(buf, resp); err != nil {
2382 return err
2383 }
2384
2385 return nil
2386 }, opts...)
2387 if e != nil {
2388 return nil, e
2389 }
2390
2391 override := fmt.Sprintf("/v1/%s", resp.GetName())
2392 return &UpdateInstanceOperation{
2393 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2394 pollPath: override,
2395 }, nil
2396 }
2397
2398 // DeleteInstance deletes an instance.
2399 func (c *aMLRESTClient) DeleteInstance(ctx context.Context, req *financialservicespb.DeleteInstanceRequest, opts ...gax.CallOption) (*DeleteInstanceOperation, error) {
2400 baseUrl, err := url.Parse(c.endpoint)
2401 if err != nil {
2402 return nil, err
2403 }
2404 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2405
2406 params := url.Values{}
2407 params.Add("$alt", "json;enum-encoding=int")
2408 if req.GetRequestId() != "" {
2409 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2410 }
2411
2412 baseUrl.RawQuery = params.Encode()
2413
2414 // Build HTTP headers from client and context metadata.
2415 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2416
2417 hds = append(c.xGoogHeaders, hds...)
2418 hds = append(hds, "Content-Type", "application/json")
2419 headers := gax.BuildHeaders(ctx, hds...)
2420 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2421 resp := &longrunningpb.Operation{}
2422 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2423 if settings.Path != "" {
2424 baseUrl.Path = settings.Path
2425 }
2426 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2427 if err != nil {
2428 return err
2429 }
2430 httpReq = httpReq.WithContext(ctx)
2431 httpReq.Header = headers
2432
2433 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteInstance")
2434 if err != nil {
2435 return err
2436 }
2437 if err := unm.Unmarshal(buf, resp); err != nil {
2438 return err
2439 }
2440
2441 return nil
2442 }, opts...)
2443 if e != nil {
2444 return nil, e
2445 }
2446
2447 override := fmt.Sprintf("/v1/%s", resp.GetName())
2448 return &DeleteInstanceOperation{
2449 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2450 pollPath: override,
2451 }, nil
2452 }
2453
2454 // ImportRegisteredParties imports the list of registered parties. See
2455 // Create and manage
2456 // instances (at https://cloud.google.com/financial-services/anti-money-laundering/docs/create-and-manage-instances#import-registered-parties)
2457 // for information on the input schema and response for this method.
2458 func (c *aMLRESTClient) ImportRegisteredParties(ctx context.Context, req *financialservicespb.ImportRegisteredPartiesRequest, opts ...gax.CallOption) (*ImportRegisteredPartiesOperation, error) {
2459 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2460 jsonReq, err := m.Marshal(req)
2461 if err != nil {
2462 return nil, err
2463 }
2464
2465 baseUrl, err := url.Parse(c.endpoint)
2466 if err != nil {
2467 return nil, err
2468 }
2469 baseUrl.Path += fmt.Sprintf("/v1/%v:importRegisteredParties", req.GetName())
2470
2471 params := url.Values{}
2472 params.Add("$alt", "json;enum-encoding=int")
2473
2474 baseUrl.RawQuery = params.Encode()
2475
2476 // Build HTTP headers from client and context metadata.
2477 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2478
2479 hds = append(c.xGoogHeaders, hds...)
2480 hds = append(hds, "Content-Type", "application/json")
2481 headers := gax.BuildHeaders(ctx, hds...)
2482 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2483 resp := &longrunningpb.Operation{}
2484 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2485 if settings.Path != "" {
2486 baseUrl.Path = settings.Path
2487 }
2488 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2489 if err != nil {
2490 return err
2491 }
2492 httpReq = httpReq.WithContext(ctx)
2493 httpReq.Header = headers
2494
2495 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ImportRegisteredParties")
2496 if err != nil {
2497 return err
2498 }
2499 if err := unm.Unmarshal(buf, resp); err != nil {
2500 return err
2501 }
2502
2503 return nil
2504 }, opts...)
2505 if e != nil {
2506 return nil, e
2507 }
2508
2509 override := fmt.Sprintf("/v1/%s", resp.GetName())
2510 return &ImportRegisteredPartiesOperation{
2511 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2512 pollPath: override,
2513 }, nil
2514 }
2515
2516 // ExportRegisteredParties exports the list of registered parties. See
2517 // Create and manage
2518 // instances (at https://cloud.google.com/financial-services/anti-money-laundering/docs/create-and-manage-instances#export-registered-parties)
2519 // for information on the output schema for this method.
2520 func (c *aMLRESTClient) ExportRegisteredParties(ctx context.Context, req *financialservicespb.ExportRegisteredPartiesRequest, opts ...gax.CallOption) (*ExportRegisteredPartiesOperation, error) {
2521 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2522 jsonReq, err := m.Marshal(req)
2523 if err != nil {
2524 return nil, err
2525 }
2526
2527 baseUrl, err := url.Parse(c.endpoint)
2528 if err != nil {
2529 return nil, err
2530 }
2531 baseUrl.Path += fmt.Sprintf("/v1/%v:exportRegisteredParties", req.GetName())
2532
2533 params := url.Values{}
2534 params.Add("$alt", "json;enum-encoding=int")
2535
2536 baseUrl.RawQuery = params.Encode()
2537
2538 // Build HTTP headers from client and context metadata.
2539 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2540
2541 hds = append(c.xGoogHeaders, hds...)
2542 hds = append(hds, "Content-Type", "application/json")
2543 headers := gax.BuildHeaders(ctx, hds...)
2544 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2545 resp := &longrunningpb.Operation{}
2546 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2547 if settings.Path != "" {
2548 baseUrl.Path = settings.Path
2549 }
2550 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2551 if err != nil {
2552 return err
2553 }
2554 httpReq = httpReq.WithContext(ctx)
2555 httpReq.Header = headers
2556
2557 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ExportRegisteredParties")
2558 if err != nil {
2559 return err
2560 }
2561 if err := unm.Unmarshal(buf, resp); err != nil {
2562 return err
2563 }
2564
2565 return nil
2566 }, opts...)
2567 if e != nil {
2568 return nil, e
2569 }
2570
2571 override := fmt.Sprintf("/v1/%s", resp.GetName())
2572 return &ExportRegisteredPartiesOperation{
2573 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2574 pollPath: override,
2575 }, nil
2576 }
2577
2578 // ListDatasets lists datasets.
2579 func (c *aMLRESTClient) ListDatasets(ctx context.Context, req *financialservicespb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator {
2580 it := &DatasetIterator{}
2581 req = proto.Clone(req).(*financialservicespb.ListDatasetsRequest)
2582 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2583 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.Dataset, string, error) {
2584 resp := &financialservicespb.ListDatasetsResponse{}
2585 if pageToken != "" {
2586 req.PageToken = pageToken
2587 }
2588 if pageSize > math.MaxInt32 {
2589 req.PageSize = math.MaxInt32
2590 } else if pageSize != 0 {
2591 req.PageSize = int32(pageSize)
2592 }
2593 baseUrl, err := url.Parse(c.endpoint)
2594 if err != nil {
2595 return nil, "", err
2596 }
2597 baseUrl.Path += fmt.Sprintf("/v1/%v/datasets", req.GetParent())
2598
2599 params := url.Values{}
2600 params.Add("$alt", "json;enum-encoding=int")
2601 if req.GetFilter() != "" {
2602 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2603 }
2604 if req.GetOrderBy() != "" {
2605 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
2606 }
2607 if req.GetPageSize() != 0 {
2608 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2609 }
2610 if req.GetPageToken() != "" {
2611 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2612 }
2613
2614 baseUrl.RawQuery = params.Encode()
2615
2616 // Build HTTP headers from client and context metadata.
2617 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2618 headers := gax.BuildHeaders(ctx, hds...)
2619 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2620 if settings.Path != "" {
2621 baseUrl.Path = settings.Path
2622 }
2623 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2624 if err != nil {
2625 return err
2626 }
2627 httpReq.Header = headers
2628
2629 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListDatasets")
2630 if err != nil {
2631 return err
2632 }
2633 if err := unm.Unmarshal(buf, resp); err != nil {
2634 return err
2635 }
2636
2637 return nil
2638 }, opts...)
2639 if e != nil {
2640 return nil, "", e
2641 }
2642 it.Response = resp
2643 return resp.GetDatasets(), resp.GetNextPageToken(), nil
2644 }
2645
2646 fetch := func(pageSize int, pageToken string) (string, error) {
2647 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2648 if err != nil {
2649 return "", err
2650 }
2651 it.items = append(it.items, items...)
2652 return nextPageToken, nil
2653 }
2654
2655 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2656 it.pageInfo.MaxSize = int(req.GetPageSize())
2657 it.pageInfo.Token = req.GetPageToken()
2658
2659 return it
2660 }
2661
2662 // GetDataset gets a dataset.
2663 func (c *aMLRESTClient) GetDataset(ctx context.Context, req *financialservicespb.GetDatasetRequest, opts ...gax.CallOption) (*financialservicespb.Dataset, error) {
2664 baseUrl, err := url.Parse(c.endpoint)
2665 if err != nil {
2666 return nil, err
2667 }
2668 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2669
2670 params := url.Values{}
2671 params.Add("$alt", "json;enum-encoding=int")
2672
2673 baseUrl.RawQuery = params.Encode()
2674
2675 // Build HTTP headers from client and context metadata.
2676 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2677
2678 hds = append(c.xGoogHeaders, hds...)
2679 hds = append(hds, "Content-Type", "application/json")
2680 headers := gax.BuildHeaders(ctx, hds...)
2681 opts = append((*c.CallOptions).GetDataset[0:len((*c.CallOptions).GetDataset):len((*c.CallOptions).GetDataset)], opts...)
2682 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2683 resp := &financialservicespb.Dataset{}
2684 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2685 if settings.Path != "" {
2686 baseUrl.Path = settings.Path
2687 }
2688 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2689 if err != nil {
2690 return err
2691 }
2692 httpReq = httpReq.WithContext(ctx)
2693 httpReq.Header = headers
2694
2695 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetDataset")
2696 if err != nil {
2697 return err
2698 }
2699
2700 if err := unm.Unmarshal(buf, resp); err != nil {
2701 return err
2702 }
2703
2704 return nil
2705 }, opts...)
2706 if e != nil {
2707 return nil, e
2708 }
2709 return resp, nil
2710 }
2711
2712 // CreateDataset creates a dataset.
2713 func (c *aMLRESTClient) CreateDataset(ctx context.Context, req *financialservicespb.CreateDatasetRequest, opts ...gax.CallOption) (*CreateDatasetOperation, error) {
2714 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2715 body := req.GetDataset()
2716 jsonReq, err := m.Marshal(body)
2717 if err != nil {
2718 return nil, err
2719 }
2720
2721 baseUrl, err := url.Parse(c.endpoint)
2722 if err != nil {
2723 return nil, err
2724 }
2725 baseUrl.Path += fmt.Sprintf("/v1/%v/datasets", req.GetParent())
2726
2727 params := url.Values{}
2728 params.Add("$alt", "json;enum-encoding=int")
2729 params.Add("datasetId", fmt.Sprintf("%v", req.GetDatasetId()))
2730 if req.GetRequestId() != "" {
2731 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2732 }
2733
2734 baseUrl.RawQuery = params.Encode()
2735
2736 // Build HTTP headers from client and context metadata.
2737 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2738
2739 hds = append(c.xGoogHeaders, hds...)
2740 hds = append(hds, "Content-Type", "application/json")
2741 headers := gax.BuildHeaders(ctx, hds...)
2742 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2743 resp := &longrunningpb.Operation{}
2744 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2745 if settings.Path != "" {
2746 baseUrl.Path = settings.Path
2747 }
2748 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2749 if err != nil {
2750 return err
2751 }
2752 httpReq = httpReq.WithContext(ctx)
2753 httpReq.Header = headers
2754
2755 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateDataset")
2756 if err != nil {
2757 return err
2758 }
2759 if err := unm.Unmarshal(buf, resp); err != nil {
2760 return err
2761 }
2762
2763 return nil
2764 }, opts...)
2765 if e != nil {
2766 return nil, e
2767 }
2768
2769 override := fmt.Sprintf("/v1/%s", resp.GetName())
2770 return &CreateDatasetOperation{
2771 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2772 pollPath: override,
2773 }, nil
2774 }
2775
2776 // UpdateDataset updates the parameters of a single Dataset.
2777 func (c *aMLRESTClient) UpdateDataset(ctx context.Context, req *financialservicespb.UpdateDatasetRequest, opts ...gax.CallOption) (*UpdateDatasetOperation, error) {
2778 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2779 body := req.GetDataset()
2780 jsonReq, err := m.Marshal(body)
2781 if err != nil {
2782 return nil, err
2783 }
2784
2785 baseUrl, err := url.Parse(c.endpoint)
2786 if err != nil {
2787 return nil, err
2788 }
2789 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetDataset().GetName())
2790
2791 params := url.Values{}
2792 params.Add("$alt", "json;enum-encoding=int")
2793 if req.GetRequestId() != "" {
2794 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2795 }
2796 if req.GetUpdateMask() != nil {
2797 field, err := protojson.Marshal(req.GetUpdateMask())
2798 if err != nil {
2799 return nil, err
2800 }
2801 params.Add("updateMask", string(field[1:len(field)-1]))
2802 }
2803
2804 baseUrl.RawQuery = params.Encode()
2805
2806 // Build HTTP headers from client and context metadata.
2807 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "dataset.name", url.QueryEscape(req.GetDataset().GetName()))}
2808
2809 hds = append(c.xGoogHeaders, hds...)
2810 hds = append(hds, "Content-Type", "application/json")
2811 headers := gax.BuildHeaders(ctx, hds...)
2812 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2813 resp := &longrunningpb.Operation{}
2814 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2815 if settings.Path != "" {
2816 baseUrl.Path = settings.Path
2817 }
2818 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
2819 if err != nil {
2820 return err
2821 }
2822 httpReq = httpReq.WithContext(ctx)
2823 httpReq.Header = headers
2824
2825 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateDataset")
2826 if err != nil {
2827 return err
2828 }
2829 if err := unm.Unmarshal(buf, resp); err != nil {
2830 return err
2831 }
2832
2833 return nil
2834 }, opts...)
2835 if e != nil {
2836 return nil, e
2837 }
2838
2839 override := fmt.Sprintf("/v1/%s", resp.GetName())
2840 return &UpdateDatasetOperation{
2841 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2842 pollPath: override,
2843 }, nil
2844 }
2845
2846 // DeleteDataset deletes a dataset.
2847 func (c *aMLRESTClient) DeleteDataset(ctx context.Context, req *financialservicespb.DeleteDatasetRequest, opts ...gax.CallOption) (*DeleteDatasetOperation, error) {
2848 baseUrl, err := url.Parse(c.endpoint)
2849 if err != nil {
2850 return nil, err
2851 }
2852 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2853
2854 params := url.Values{}
2855 params.Add("$alt", "json;enum-encoding=int")
2856 if req.GetRequestId() != "" {
2857 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2858 }
2859
2860 baseUrl.RawQuery = params.Encode()
2861
2862 // Build HTTP headers from client and context metadata.
2863 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2864
2865 hds = append(c.xGoogHeaders, hds...)
2866 hds = append(hds, "Content-Type", "application/json")
2867 headers := gax.BuildHeaders(ctx, hds...)
2868 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2869 resp := &longrunningpb.Operation{}
2870 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2871 if settings.Path != "" {
2872 baseUrl.Path = settings.Path
2873 }
2874 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2875 if err != nil {
2876 return err
2877 }
2878 httpReq = httpReq.WithContext(ctx)
2879 httpReq.Header = headers
2880
2881 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteDataset")
2882 if err != nil {
2883 return err
2884 }
2885 if err := unm.Unmarshal(buf, resp); err != nil {
2886 return err
2887 }
2888
2889 return nil
2890 }, opts...)
2891 if e != nil {
2892 return nil, e
2893 }
2894
2895 override := fmt.Sprintf("/v1/%s", resp.GetName())
2896 return &DeleteDatasetOperation{
2897 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2898 pollPath: override,
2899 }, nil
2900 }
2901
2902 // ListModels lists models.
2903 func (c *aMLRESTClient) ListModels(ctx context.Context, req *financialservicespb.ListModelsRequest, opts ...gax.CallOption) *ModelIterator {
2904 it := &ModelIterator{}
2905 req = proto.Clone(req).(*financialservicespb.ListModelsRequest)
2906 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2907 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.Model, string, error) {
2908 resp := &financialservicespb.ListModelsResponse{}
2909 if pageToken != "" {
2910 req.PageToken = pageToken
2911 }
2912 if pageSize > math.MaxInt32 {
2913 req.PageSize = math.MaxInt32
2914 } else if pageSize != 0 {
2915 req.PageSize = int32(pageSize)
2916 }
2917 baseUrl, err := url.Parse(c.endpoint)
2918 if err != nil {
2919 return nil, "", err
2920 }
2921 baseUrl.Path += fmt.Sprintf("/v1/%v/models", req.GetParent())
2922
2923 params := url.Values{}
2924 params.Add("$alt", "json;enum-encoding=int")
2925 if req.GetFilter() != "" {
2926 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2927 }
2928 if req.GetOrderBy() != "" {
2929 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
2930 }
2931 if req.GetPageSize() != 0 {
2932 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2933 }
2934 if req.GetPageToken() != "" {
2935 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2936 }
2937
2938 baseUrl.RawQuery = params.Encode()
2939
2940 // Build HTTP headers from client and context metadata.
2941 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2942 headers := gax.BuildHeaders(ctx, hds...)
2943 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2944 if settings.Path != "" {
2945 baseUrl.Path = settings.Path
2946 }
2947 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2948 if err != nil {
2949 return err
2950 }
2951 httpReq.Header = headers
2952
2953 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListModels")
2954 if err != nil {
2955 return err
2956 }
2957 if err := unm.Unmarshal(buf, resp); err != nil {
2958 return err
2959 }
2960
2961 return nil
2962 }, opts...)
2963 if e != nil {
2964 return nil, "", e
2965 }
2966 it.Response = resp
2967 return resp.GetModels(), resp.GetNextPageToken(), nil
2968 }
2969
2970 fetch := func(pageSize int, pageToken string) (string, error) {
2971 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2972 if err != nil {
2973 return "", err
2974 }
2975 it.items = append(it.items, items...)
2976 return nextPageToken, nil
2977 }
2978
2979 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2980 it.pageInfo.MaxSize = int(req.GetPageSize())
2981 it.pageInfo.Token = req.GetPageToken()
2982
2983 return it
2984 }
2985
2986 // GetModel gets a model.
2987 func (c *aMLRESTClient) GetModel(ctx context.Context, req *financialservicespb.GetModelRequest, opts ...gax.CallOption) (*financialservicespb.Model, error) {
2988 baseUrl, err := url.Parse(c.endpoint)
2989 if err != nil {
2990 return nil, err
2991 }
2992 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2993
2994 params := url.Values{}
2995 params.Add("$alt", "json;enum-encoding=int")
2996
2997 baseUrl.RawQuery = params.Encode()
2998
2999 // Build HTTP headers from client and context metadata.
3000 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3001
3002 hds = append(c.xGoogHeaders, hds...)
3003 hds = append(hds, "Content-Type", "application/json")
3004 headers := gax.BuildHeaders(ctx, hds...)
3005 opts = append((*c.CallOptions).GetModel[0:len((*c.CallOptions).GetModel):len((*c.CallOptions).GetModel)], opts...)
3006 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3007 resp := &financialservicespb.Model{}
3008 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3009 if settings.Path != "" {
3010 baseUrl.Path = settings.Path
3011 }
3012 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3013 if err != nil {
3014 return err
3015 }
3016 httpReq = httpReq.WithContext(ctx)
3017 httpReq.Header = headers
3018
3019 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetModel")
3020 if err != nil {
3021 return err
3022 }
3023
3024 if err := unm.Unmarshal(buf, resp); err != nil {
3025 return err
3026 }
3027
3028 return nil
3029 }, opts...)
3030 if e != nil {
3031 return nil, e
3032 }
3033 return resp, nil
3034 }
3035
3036 // CreateModel creates a model.
3037 func (c *aMLRESTClient) CreateModel(ctx context.Context, req *financialservicespb.CreateModelRequest, opts ...gax.CallOption) (*CreateModelOperation, error) {
3038 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3039 body := req.GetModel()
3040 jsonReq, err := m.Marshal(body)
3041 if err != nil {
3042 return nil, err
3043 }
3044
3045 baseUrl, err := url.Parse(c.endpoint)
3046 if err != nil {
3047 return nil, err
3048 }
3049 baseUrl.Path += fmt.Sprintf("/v1/%v/models", req.GetParent())
3050
3051 params := url.Values{}
3052 params.Add("$alt", "json;enum-encoding=int")
3053 params.Add("modelId", fmt.Sprintf("%v", req.GetModelId()))
3054 if req.GetRequestId() != "" {
3055 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
3056 }
3057
3058 baseUrl.RawQuery = params.Encode()
3059
3060 // Build HTTP headers from client and context metadata.
3061 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
3062
3063 hds = append(c.xGoogHeaders, hds...)
3064 hds = append(hds, "Content-Type", "application/json")
3065 headers := gax.BuildHeaders(ctx, hds...)
3066 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3067 resp := &longrunningpb.Operation{}
3068 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3069 if settings.Path != "" {
3070 baseUrl.Path = settings.Path
3071 }
3072 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3073 if err != nil {
3074 return err
3075 }
3076 httpReq = httpReq.WithContext(ctx)
3077 httpReq.Header = headers
3078
3079 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateModel")
3080 if err != nil {
3081 return err
3082 }
3083 if err := unm.Unmarshal(buf, resp); err != nil {
3084 return err
3085 }
3086
3087 return nil
3088 }, opts...)
3089 if e != nil {
3090 return nil, e
3091 }
3092
3093 override := fmt.Sprintf("/v1/%s", resp.GetName())
3094 return &CreateModelOperation{
3095 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3096 pollPath: override,
3097 }, nil
3098 }
3099
3100 // UpdateModel updates the parameters of a single Model.
3101 func (c *aMLRESTClient) UpdateModel(ctx context.Context, req *financialservicespb.UpdateModelRequest, opts ...gax.CallOption) (*UpdateModelOperation, error) {
3102 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3103 body := req.GetModel()
3104 jsonReq, err := m.Marshal(body)
3105 if err != nil {
3106 return nil, err
3107 }
3108
3109 baseUrl, err := url.Parse(c.endpoint)
3110 if err != nil {
3111 return nil, err
3112 }
3113 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetModel().GetName())
3114
3115 params := url.Values{}
3116 params.Add("$alt", "json;enum-encoding=int")
3117 if req.GetRequestId() != "" {
3118 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
3119 }
3120 if req.GetUpdateMask() != nil {
3121 field, err := protojson.Marshal(req.GetUpdateMask())
3122 if err != nil {
3123 return nil, err
3124 }
3125 params.Add("updateMask", string(field[1:len(field)-1]))
3126 }
3127
3128 baseUrl.RawQuery = params.Encode()
3129
3130 // Build HTTP headers from client and context metadata.
3131 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "model.name", url.QueryEscape(req.GetModel().GetName()))}
3132
3133 hds = append(c.xGoogHeaders, hds...)
3134 hds = append(hds, "Content-Type", "application/json")
3135 headers := gax.BuildHeaders(ctx, hds...)
3136 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3137 resp := &longrunningpb.Operation{}
3138 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3139 if settings.Path != "" {
3140 baseUrl.Path = settings.Path
3141 }
3142 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
3143 if err != nil {
3144 return err
3145 }
3146 httpReq = httpReq.WithContext(ctx)
3147 httpReq.Header = headers
3148
3149 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateModel")
3150 if err != nil {
3151 return err
3152 }
3153 if err := unm.Unmarshal(buf, resp); err != nil {
3154 return err
3155 }
3156
3157 return nil
3158 }, opts...)
3159 if e != nil {
3160 return nil, e
3161 }
3162
3163 override := fmt.Sprintf("/v1/%s", resp.GetName())
3164 return &UpdateModelOperation{
3165 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3166 pollPath: override,
3167 }, nil
3168 }
3169
3170 // ExportModelMetadata export governance information for a Model resource. For
3171 // information on the exported fields, see
3172 // AML output data
3173 // model (at https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#model).
3174 func (c *aMLRESTClient) ExportModelMetadata(ctx context.Context, req *financialservicespb.ExportModelMetadataRequest, opts ...gax.CallOption) (*ExportModelMetadataOperation, error) {
3175 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3176 jsonReq, err := m.Marshal(req)
3177 if err != nil {
3178 return nil, err
3179 }
3180
3181 baseUrl, err := url.Parse(c.endpoint)
3182 if err != nil {
3183 return nil, err
3184 }
3185 baseUrl.Path += fmt.Sprintf("/v1/%v:exportMetadata", req.GetModel())
3186
3187 params := url.Values{}
3188 params.Add("$alt", "json;enum-encoding=int")
3189
3190 baseUrl.RawQuery = params.Encode()
3191
3192 // Build HTTP headers from client and context metadata.
3193 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "model", url.QueryEscape(req.GetModel()))}
3194
3195 hds = append(c.xGoogHeaders, hds...)
3196 hds = append(hds, "Content-Type", "application/json")
3197 headers := gax.BuildHeaders(ctx, hds...)
3198 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3199 resp := &longrunningpb.Operation{}
3200 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3201 if settings.Path != "" {
3202 baseUrl.Path = settings.Path
3203 }
3204 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3205 if err != nil {
3206 return err
3207 }
3208 httpReq = httpReq.WithContext(ctx)
3209 httpReq.Header = headers
3210
3211 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ExportModelMetadata")
3212 if err != nil {
3213 return err
3214 }
3215 if err := unm.Unmarshal(buf, resp); err != nil {
3216 return err
3217 }
3218
3219 return nil
3220 }, opts...)
3221 if e != nil {
3222 return nil, e
3223 }
3224
3225 override := fmt.Sprintf("/v1/%s", resp.GetName())
3226 return &ExportModelMetadataOperation{
3227 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3228 pollPath: override,
3229 }, nil
3230 }
3231
3232 // DeleteModel deletes a model.
3233 func (c *aMLRESTClient) DeleteModel(ctx context.Context, req *financialservicespb.DeleteModelRequest, opts ...gax.CallOption) (*DeleteModelOperation, error) {
3234 baseUrl, err := url.Parse(c.endpoint)
3235 if err != nil {
3236 return nil, err
3237 }
3238 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3239
3240 params := url.Values{}
3241 params.Add("$alt", "json;enum-encoding=int")
3242 if req.GetRequestId() != "" {
3243 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
3244 }
3245
3246 baseUrl.RawQuery = params.Encode()
3247
3248 // Build HTTP headers from client and context metadata.
3249 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3250
3251 hds = append(c.xGoogHeaders, hds...)
3252 hds = append(hds, "Content-Type", "application/json")
3253 headers := gax.BuildHeaders(ctx, hds...)
3254 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3255 resp := &longrunningpb.Operation{}
3256 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3257 if settings.Path != "" {
3258 baseUrl.Path = settings.Path
3259 }
3260 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
3261 if err != nil {
3262 return err
3263 }
3264 httpReq = httpReq.WithContext(ctx)
3265 httpReq.Header = headers
3266
3267 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteModel")
3268 if err != nil {
3269 return err
3270 }
3271 if err := unm.Unmarshal(buf, resp); err != nil {
3272 return err
3273 }
3274
3275 return nil
3276 }, opts...)
3277 if e != nil {
3278 return nil, e
3279 }
3280
3281 override := fmt.Sprintf("/v1/%s", resp.GetName())
3282 return &DeleteModelOperation{
3283 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3284 pollPath: override,
3285 }, nil
3286 }
3287
3288 // ListEngineConfigs lists engine configs.
3289 func (c *aMLRESTClient) ListEngineConfigs(ctx context.Context, req *financialservicespb.ListEngineConfigsRequest, opts ...gax.CallOption) *EngineConfigIterator {
3290 it := &EngineConfigIterator{}
3291 req = proto.Clone(req).(*financialservicespb.ListEngineConfigsRequest)
3292 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3293 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.EngineConfig, string, error) {
3294 resp := &financialservicespb.ListEngineConfigsResponse{}
3295 if pageToken != "" {
3296 req.PageToken = pageToken
3297 }
3298 if pageSize > math.MaxInt32 {
3299 req.PageSize = math.MaxInt32
3300 } else if pageSize != 0 {
3301 req.PageSize = int32(pageSize)
3302 }
3303 baseUrl, err := url.Parse(c.endpoint)
3304 if err != nil {
3305 return nil, "", err
3306 }
3307 baseUrl.Path += fmt.Sprintf("/v1/%v/engineConfigs", req.GetParent())
3308
3309 params := url.Values{}
3310 params.Add("$alt", "json;enum-encoding=int")
3311 if req.GetFilter() != "" {
3312 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
3313 }
3314 if req.GetOrderBy() != "" {
3315 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
3316 }
3317 if req.GetPageSize() != 0 {
3318 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3319 }
3320 if req.GetPageToken() != "" {
3321 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3322 }
3323
3324 baseUrl.RawQuery = params.Encode()
3325
3326 // Build HTTP headers from client and context metadata.
3327 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3328 headers := gax.BuildHeaders(ctx, hds...)
3329 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3330 if settings.Path != "" {
3331 baseUrl.Path = settings.Path
3332 }
3333 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3334 if err != nil {
3335 return err
3336 }
3337 httpReq.Header = headers
3338
3339 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListEngineConfigs")
3340 if err != nil {
3341 return err
3342 }
3343 if err := unm.Unmarshal(buf, resp); err != nil {
3344 return err
3345 }
3346
3347 return nil
3348 }, opts...)
3349 if e != nil {
3350 return nil, "", e
3351 }
3352 it.Response = resp
3353 return resp.GetEngineConfigs(), resp.GetNextPageToken(), nil
3354 }
3355
3356 fetch := func(pageSize int, pageToken string) (string, error) {
3357 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3358 if err != nil {
3359 return "", err
3360 }
3361 it.items = append(it.items, items...)
3362 return nextPageToken, nil
3363 }
3364
3365 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3366 it.pageInfo.MaxSize = int(req.GetPageSize())
3367 it.pageInfo.Token = req.GetPageToken()
3368
3369 return it
3370 }
3371
3372 // GetEngineConfig gets an engine config.
3373 func (c *aMLRESTClient) GetEngineConfig(ctx context.Context, req *financialservicespb.GetEngineConfigRequest, opts ...gax.CallOption) (*financialservicespb.EngineConfig, error) {
3374 baseUrl, err := url.Parse(c.endpoint)
3375 if err != nil {
3376 return nil, err
3377 }
3378 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3379
3380 params := url.Values{}
3381 params.Add("$alt", "json;enum-encoding=int")
3382
3383 baseUrl.RawQuery = params.Encode()
3384
3385 // Build HTTP headers from client and context metadata.
3386 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3387
3388 hds = append(c.xGoogHeaders, hds...)
3389 hds = append(hds, "Content-Type", "application/json")
3390 headers := gax.BuildHeaders(ctx, hds...)
3391 opts = append((*c.CallOptions).GetEngineConfig[0:len((*c.CallOptions).GetEngineConfig):len((*c.CallOptions).GetEngineConfig)], opts...)
3392 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3393 resp := &financialservicespb.EngineConfig{}
3394 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3395 if settings.Path != "" {
3396 baseUrl.Path = settings.Path
3397 }
3398 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3399 if err != nil {
3400 return err
3401 }
3402 httpReq = httpReq.WithContext(ctx)
3403 httpReq.Header = headers
3404
3405 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetEngineConfig")
3406 if err != nil {
3407 return err
3408 }
3409
3410 if err := unm.Unmarshal(buf, resp); err != nil {
3411 return err
3412 }
3413
3414 return nil
3415 }, opts...)
3416 if e != nil {
3417 return nil, e
3418 }
3419 return resp, nil
3420 }
3421
3422 // CreateEngineConfig creates an engine config.
3423 func (c *aMLRESTClient) CreateEngineConfig(ctx context.Context, req *financialservicespb.CreateEngineConfigRequest, opts ...gax.CallOption) (*CreateEngineConfigOperation, error) {
3424 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3425 body := req.GetEngineConfig()
3426 jsonReq, err := m.Marshal(body)
3427 if err != nil {
3428 return nil, err
3429 }
3430
3431 baseUrl, err := url.Parse(c.endpoint)
3432 if err != nil {
3433 return nil, err
3434 }
3435 baseUrl.Path += fmt.Sprintf("/v1/%v/engineConfigs", req.GetParent())
3436
3437 params := url.Values{}
3438 params.Add("$alt", "json;enum-encoding=int")
3439 params.Add("engineConfigId", fmt.Sprintf("%v", req.GetEngineConfigId()))
3440 if req.GetRequestId() != "" {
3441 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
3442 }
3443
3444 baseUrl.RawQuery = params.Encode()
3445
3446 // Build HTTP headers from client and context metadata.
3447 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
3448
3449 hds = append(c.xGoogHeaders, hds...)
3450 hds = append(hds, "Content-Type", "application/json")
3451 headers := gax.BuildHeaders(ctx, hds...)
3452 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3453 resp := &longrunningpb.Operation{}
3454 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3455 if settings.Path != "" {
3456 baseUrl.Path = settings.Path
3457 }
3458 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3459 if err != nil {
3460 return err
3461 }
3462 httpReq = httpReq.WithContext(ctx)
3463 httpReq.Header = headers
3464
3465 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateEngineConfig")
3466 if err != nil {
3467 return err
3468 }
3469 if err := unm.Unmarshal(buf, resp); err != nil {
3470 return err
3471 }
3472
3473 return nil
3474 }, opts...)
3475 if e != nil {
3476 return nil, e
3477 }
3478
3479 override := fmt.Sprintf("/v1/%s", resp.GetName())
3480 return &CreateEngineConfigOperation{
3481 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3482 pollPath: override,
3483 }, nil
3484 }
3485
3486 // UpdateEngineConfig updates the parameters of a single EngineConfig.
3487 func (c *aMLRESTClient) UpdateEngineConfig(ctx context.Context, req *financialservicespb.UpdateEngineConfigRequest, opts ...gax.CallOption) (*UpdateEngineConfigOperation, error) {
3488 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3489 body := req.GetEngineConfig()
3490 jsonReq, err := m.Marshal(body)
3491 if err != nil {
3492 return nil, err
3493 }
3494
3495 baseUrl, err := url.Parse(c.endpoint)
3496 if err != nil {
3497 return nil, err
3498 }
3499 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetEngineConfig().GetName())
3500
3501 params := url.Values{}
3502 params.Add("$alt", "json;enum-encoding=int")
3503 if req.GetRequestId() != "" {
3504 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
3505 }
3506 if req.GetUpdateMask() != nil {
3507 field, err := protojson.Marshal(req.GetUpdateMask())
3508 if err != nil {
3509 return nil, err
3510 }
3511 params.Add("updateMask", string(field[1:len(field)-1]))
3512 }
3513
3514 baseUrl.RawQuery = params.Encode()
3515
3516 // Build HTTP headers from client and context metadata.
3517 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "engine_config.name", url.QueryEscape(req.GetEngineConfig().GetName()))}
3518
3519 hds = append(c.xGoogHeaders, hds...)
3520 hds = append(hds, "Content-Type", "application/json")
3521 headers := gax.BuildHeaders(ctx, hds...)
3522 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3523 resp := &longrunningpb.Operation{}
3524 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3525 if settings.Path != "" {
3526 baseUrl.Path = settings.Path
3527 }
3528 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
3529 if err != nil {
3530 return err
3531 }
3532 httpReq = httpReq.WithContext(ctx)
3533 httpReq.Header = headers
3534
3535 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateEngineConfig")
3536 if err != nil {
3537 return err
3538 }
3539 if err := unm.Unmarshal(buf, resp); err != nil {
3540 return err
3541 }
3542
3543 return nil
3544 }, opts...)
3545 if e != nil {
3546 return nil, e
3547 }
3548
3549 override := fmt.Sprintf("/v1/%s", resp.GetName())
3550 return &UpdateEngineConfigOperation{
3551 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3552 pollPath: override,
3553 }, nil
3554 }
3555
3556 // ExportEngineConfigMetadata export governance information for an EngineConfig resource. For
3557 // information on the exported fields, see
3558 // AML output data
3559 // model (at https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#engine-config).
3560 func (c *aMLRESTClient) ExportEngineConfigMetadata(ctx context.Context, req *financialservicespb.ExportEngineConfigMetadataRequest, opts ...gax.CallOption) (*ExportEngineConfigMetadataOperation, error) {
3561 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3562 jsonReq, err := m.Marshal(req)
3563 if err != nil {
3564 return nil, err
3565 }
3566
3567 baseUrl, err := url.Parse(c.endpoint)
3568 if err != nil {
3569 return nil, err
3570 }
3571 baseUrl.Path += fmt.Sprintf("/v1/%v:exportMetadata", req.GetEngineConfig())
3572
3573 params := url.Values{}
3574 params.Add("$alt", "json;enum-encoding=int")
3575
3576 baseUrl.RawQuery = params.Encode()
3577
3578 // Build HTTP headers from client and context metadata.
3579 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "engine_config", url.QueryEscape(req.GetEngineConfig()))}
3580
3581 hds = append(c.xGoogHeaders, hds...)
3582 hds = append(hds, "Content-Type", "application/json")
3583 headers := gax.BuildHeaders(ctx, hds...)
3584 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3585 resp := &longrunningpb.Operation{}
3586 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3587 if settings.Path != "" {
3588 baseUrl.Path = settings.Path
3589 }
3590 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3591 if err != nil {
3592 return err
3593 }
3594 httpReq = httpReq.WithContext(ctx)
3595 httpReq.Header = headers
3596
3597 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ExportEngineConfigMetadata")
3598 if err != nil {
3599 return err
3600 }
3601 if err := unm.Unmarshal(buf, resp); err != nil {
3602 return err
3603 }
3604
3605 return nil
3606 }, opts...)
3607 if e != nil {
3608 return nil, e
3609 }
3610
3611 override := fmt.Sprintf("/v1/%s", resp.GetName())
3612 return &ExportEngineConfigMetadataOperation{
3613 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3614 pollPath: override,
3615 }, nil
3616 }
3617
3618 // DeleteEngineConfig deletes an engine config.
3619 func (c *aMLRESTClient) DeleteEngineConfig(ctx context.Context, req *financialservicespb.DeleteEngineConfigRequest, opts ...gax.CallOption) (*DeleteEngineConfigOperation, error) {
3620 baseUrl, err := url.Parse(c.endpoint)
3621 if err != nil {
3622 return nil, err
3623 }
3624 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3625
3626 params := url.Values{}
3627 params.Add("$alt", "json;enum-encoding=int")
3628 if req.GetRequestId() != "" {
3629 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
3630 }
3631
3632 baseUrl.RawQuery = params.Encode()
3633
3634 // Build HTTP headers from client and context metadata.
3635 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3636
3637 hds = append(c.xGoogHeaders, hds...)
3638 hds = append(hds, "Content-Type", "application/json")
3639 headers := gax.BuildHeaders(ctx, hds...)
3640 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3641 resp := &longrunningpb.Operation{}
3642 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3643 if settings.Path != "" {
3644 baseUrl.Path = settings.Path
3645 }
3646 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
3647 if err != nil {
3648 return err
3649 }
3650 httpReq = httpReq.WithContext(ctx)
3651 httpReq.Header = headers
3652
3653 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteEngineConfig")
3654 if err != nil {
3655 return err
3656 }
3657 if err := unm.Unmarshal(buf, resp); err != nil {
3658 return err
3659 }
3660
3661 return nil
3662 }, opts...)
3663 if e != nil {
3664 return nil, e
3665 }
3666
3667 override := fmt.Sprintf("/v1/%s", resp.GetName())
3668 return &DeleteEngineConfigOperation{
3669 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3670 pollPath: override,
3671 }, nil
3672 }
3673
3674 // GetEngineVersion gets a single EngineVersion.
3675 func (c *aMLRESTClient) GetEngineVersion(ctx context.Context, req *financialservicespb.GetEngineVersionRequest, opts ...gax.CallOption) (*financialservicespb.EngineVersion, error) {
3676 baseUrl, err := url.Parse(c.endpoint)
3677 if err != nil {
3678 return nil, err
3679 }
3680 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3681
3682 params := url.Values{}
3683 params.Add("$alt", "json;enum-encoding=int")
3684
3685 baseUrl.RawQuery = params.Encode()
3686
3687 // Build HTTP headers from client and context metadata.
3688 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3689
3690 hds = append(c.xGoogHeaders, hds...)
3691 hds = append(hds, "Content-Type", "application/json")
3692 headers := gax.BuildHeaders(ctx, hds...)
3693 opts = append((*c.CallOptions).GetEngineVersion[0:len((*c.CallOptions).GetEngineVersion):len((*c.CallOptions).GetEngineVersion)], opts...)
3694 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3695 resp := &financialservicespb.EngineVersion{}
3696 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3697 if settings.Path != "" {
3698 baseUrl.Path = settings.Path
3699 }
3700 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3701 if err != nil {
3702 return err
3703 }
3704 httpReq = httpReq.WithContext(ctx)
3705 httpReq.Header = headers
3706
3707 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetEngineVersion")
3708 if err != nil {
3709 return err
3710 }
3711
3712 if err := unm.Unmarshal(buf, resp); err != nil {
3713 return err
3714 }
3715
3716 return nil
3717 }, opts...)
3718 if e != nil {
3719 return nil, e
3720 }
3721 return resp, nil
3722 }
3723
3724 // ListEngineVersions lists EngineVersions for given location.
3725 func (c *aMLRESTClient) ListEngineVersions(ctx context.Context, req *financialservicespb.ListEngineVersionsRequest, opts ...gax.CallOption) *EngineVersionIterator {
3726 it := &EngineVersionIterator{}
3727 req = proto.Clone(req).(*financialservicespb.ListEngineVersionsRequest)
3728 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3729 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.EngineVersion, string, error) {
3730 resp := &financialservicespb.ListEngineVersionsResponse{}
3731 if pageToken != "" {
3732 req.PageToken = pageToken
3733 }
3734 if pageSize > math.MaxInt32 {
3735 req.PageSize = math.MaxInt32
3736 } else if pageSize != 0 {
3737 req.PageSize = int32(pageSize)
3738 }
3739 baseUrl, err := url.Parse(c.endpoint)
3740 if err != nil {
3741 return nil, "", err
3742 }
3743 baseUrl.Path += fmt.Sprintf("/v1/%v/engineVersions", req.GetParent())
3744
3745 params := url.Values{}
3746 params.Add("$alt", "json;enum-encoding=int")
3747 if req.GetFilter() != "" {
3748 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
3749 }
3750 if req.GetOrderBy() != "" {
3751 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
3752 }
3753 if req.GetPageSize() != 0 {
3754 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3755 }
3756 if req.GetPageToken() != "" {
3757 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3758 }
3759
3760 baseUrl.RawQuery = params.Encode()
3761
3762 // Build HTTP headers from client and context metadata.
3763 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3764 headers := gax.BuildHeaders(ctx, hds...)
3765 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3766 if settings.Path != "" {
3767 baseUrl.Path = settings.Path
3768 }
3769 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3770 if err != nil {
3771 return err
3772 }
3773 httpReq.Header = headers
3774
3775 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListEngineVersions")
3776 if err != nil {
3777 return err
3778 }
3779 if err := unm.Unmarshal(buf, resp); err != nil {
3780 return err
3781 }
3782
3783 return nil
3784 }, opts...)
3785 if e != nil {
3786 return nil, "", e
3787 }
3788 it.Response = resp
3789 return resp.GetEngineVersions(), resp.GetNextPageToken(), nil
3790 }
3791
3792 fetch := func(pageSize int, pageToken string) (string, error) {
3793 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3794 if err != nil {
3795 return "", err
3796 }
3797 it.items = append(it.items, items...)
3798 return nextPageToken, nil
3799 }
3800
3801 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3802 it.pageInfo.MaxSize = int(req.GetPageSize())
3803 it.pageInfo.Token = req.GetPageToken()
3804
3805 return it
3806 }
3807
3808 // ListPredictionResults list PredictionResults.
3809 func (c *aMLRESTClient) ListPredictionResults(ctx context.Context, req *financialservicespb.ListPredictionResultsRequest, opts ...gax.CallOption) *PredictionResultIterator {
3810 it := &PredictionResultIterator{}
3811 req = proto.Clone(req).(*financialservicespb.ListPredictionResultsRequest)
3812 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3813 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.PredictionResult, string, error) {
3814 resp := &financialservicespb.ListPredictionResultsResponse{}
3815 if pageToken != "" {
3816 req.PageToken = pageToken
3817 }
3818 if pageSize > math.MaxInt32 {
3819 req.PageSize = math.MaxInt32
3820 } else if pageSize != 0 {
3821 req.PageSize = int32(pageSize)
3822 }
3823 baseUrl, err := url.Parse(c.endpoint)
3824 if err != nil {
3825 return nil, "", err
3826 }
3827 baseUrl.Path += fmt.Sprintf("/v1/%v/predictionResults", req.GetParent())
3828
3829 params := url.Values{}
3830 params.Add("$alt", "json;enum-encoding=int")
3831 if req.GetFilter() != "" {
3832 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
3833 }
3834 if req.GetOrderBy() != "" {
3835 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
3836 }
3837 if req.GetPageSize() != 0 {
3838 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3839 }
3840 if req.GetPageToken() != "" {
3841 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3842 }
3843
3844 baseUrl.RawQuery = params.Encode()
3845
3846 // Build HTTP headers from client and context metadata.
3847 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3848 headers := gax.BuildHeaders(ctx, hds...)
3849 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3850 if settings.Path != "" {
3851 baseUrl.Path = settings.Path
3852 }
3853 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3854 if err != nil {
3855 return err
3856 }
3857 httpReq.Header = headers
3858
3859 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListPredictionResults")
3860 if err != nil {
3861 return err
3862 }
3863 if err := unm.Unmarshal(buf, resp); err != nil {
3864 return err
3865 }
3866
3867 return nil
3868 }, opts...)
3869 if e != nil {
3870 return nil, "", e
3871 }
3872 it.Response = resp
3873 return resp.GetPredictionResults(), resp.GetNextPageToken(), nil
3874 }
3875
3876 fetch := func(pageSize int, pageToken string) (string, error) {
3877 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3878 if err != nil {
3879 return "", err
3880 }
3881 it.items = append(it.items, items...)
3882 return nextPageToken, nil
3883 }
3884
3885 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3886 it.pageInfo.MaxSize = int(req.GetPageSize())
3887 it.pageInfo.Token = req.GetPageToken()
3888
3889 return it
3890 }
3891
3892 // GetPredictionResult gets a PredictionResult.
3893 func (c *aMLRESTClient) GetPredictionResult(ctx context.Context, req *financialservicespb.GetPredictionResultRequest, opts ...gax.CallOption) (*financialservicespb.PredictionResult, error) {
3894 baseUrl, err := url.Parse(c.endpoint)
3895 if err != nil {
3896 return nil, err
3897 }
3898 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3899
3900 params := url.Values{}
3901 params.Add("$alt", "json;enum-encoding=int")
3902
3903 baseUrl.RawQuery = params.Encode()
3904
3905 // Build HTTP headers from client and context metadata.
3906 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3907
3908 hds = append(c.xGoogHeaders, hds...)
3909 hds = append(hds, "Content-Type", "application/json")
3910 headers := gax.BuildHeaders(ctx, hds...)
3911 opts = append((*c.CallOptions).GetPredictionResult[0:len((*c.CallOptions).GetPredictionResult):len((*c.CallOptions).GetPredictionResult)], opts...)
3912 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3913 resp := &financialservicespb.PredictionResult{}
3914 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3915 if settings.Path != "" {
3916 baseUrl.Path = settings.Path
3917 }
3918 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3919 if err != nil {
3920 return err
3921 }
3922 httpReq = httpReq.WithContext(ctx)
3923 httpReq.Header = headers
3924
3925 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetPredictionResult")
3926 if err != nil {
3927 return err
3928 }
3929
3930 if err := unm.Unmarshal(buf, resp); err != nil {
3931 return err
3932 }
3933
3934 return nil
3935 }, opts...)
3936 if e != nil {
3937 return nil, e
3938 }
3939 return resp, nil
3940 }
3941
3942 // CreatePredictionResult create a PredictionResult.
3943 func (c *aMLRESTClient) CreatePredictionResult(ctx context.Context, req *financialservicespb.CreatePredictionResultRequest, opts ...gax.CallOption) (*CreatePredictionResultOperation, error) {
3944 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3945 body := req.GetPredictionResult()
3946 jsonReq, err := m.Marshal(body)
3947 if err != nil {
3948 return nil, err
3949 }
3950
3951 baseUrl, err := url.Parse(c.endpoint)
3952 if err != nil {
3953 return nil, err
3954 }
3955 baseUrl.Path += fmt.Sprintf("/v1/%v/predictionResults", req.GetParent())
3956
3957 params := url.Values{}
3958 params.Add("$alt", "json;enum-encoding=int")
3959 params.Add("predictionResultId", fmt.Sprintf("%v", req.GetPredictionResultId()))
3960 if req.GetRequestId() != "" {
3961 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
3962 }
3963
3964 baseUrl.RawQuery = params.Encode()
3965
3966 // Build HTTP headers from client and context metadata.
3967 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
3968
3969 hds = append(c.xGoogHeaders, hds...)
3970 hds = append(hds, "Content-Type", "application/json")
3971 headers := gax.BuildHeaders(ctx, hds...)
3972 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3973 resp := &longrunningpb.Operation{}
3974 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3975 if settings.Path != "" {
3976 baseUrl.Path = settings.Path
3977 }
3978 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3979 if err != nil {
3980 return err
3981 }
3982 httpReq = httpReq.WithContext(ctx)
3983 httpReq.Header = headers
3984
3985 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreatePredictionResult")
3986 if err != nil {
3987 return err
3988 }
3989 if err := unm.Unmarshal(buf, resp); err != nil {
3990 return err
3991 }
3992
3993 return nil
3994 }, opts...)
3995 if e != nil {
3996 return nil, e
3997 }
3998
3999 override := fmt.Sprintf("/v1/%s", resp.GetName())
4000 return &CreatePredictionResultOperation{
4001 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4002 pollPath: override,
4003 }, nil
4004 }
4005
4006 // UpdatePredictionResult updates the parameters of a single PredictionResult.
4007 func (c *aMLRESTClient) UpdatePredictionResult(ctx context.Context, req *financialservicespb.UpdatePredictionResultRequest, opts ...gax.CallOption) (*UpdatePredictionResultOperation, error) {
4008 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4009 body := req.GetPredictionResult()
4010 jsonReq, err := m.Marshal(body)
4011 if err != nil {
4012 return nil, err
4013 }
4014
4015 baseUrl, err := url.Parse(c.endpoint)
4016 if err != nil {
4017 return nil, err
4018 }
4019 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetPredictionResult().GetName())
4020
4021 params := url.Values{}
4022 params.Add("$alt", "json;enum-encoding=int")
4023 if req.GetRequestId() != "" {
4024 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
4025 }
4026 if req.GetUpdateMask() != nil {
4027 field, err := protojson.Marshal(req.GetUpdateMask())
4028 if err != nil {
4029 return nil, err
4030 }
4031 params.Add("updateMask", string(field[1:len(field)-1]))
4032 }
4033
4034 baseUrl.RawQuery = params.Encode()
4035
4036 // Build HTTP headers from client and context metadata.
4037 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "prediction_result.name", url.QueryEscape(req.GetPredictionResult().GetName()))}
4038
4039 hds = append(c.xGoogHeaders, hds...)
4040 hds = append(hds, "Content-Type", "application/json")
4041 headers := gax.BuildHeaders(ctx, hds...)
4042 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4043 resp := &longrunningpb.Operation{}
4044 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4045 if settings.Path != "" {
4046 baseUrl.Path = settings.Path
4047 }
4048 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
4049 if err != nil {
4050 return err
4051 }
4052 httpReq = httpReq.WithContext(ctx)
4053 httpReq.Header = headers
4054
4055 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdatePredictionResult")
4056 if err != nil {
4057 return err
4058 }
4059 if err := unm.Unmarshal(buf, resp); err != nil {
4060 return err
4061 }
4062
4063 return nil
4064 }, opts...)
4065 if e != nil {
4066 return nil, e
4067 }
4068
4069 override := fmt.Sprintf("/v1/%s", resp.GetName())
4070 return &UpdatePredictionResultOperation{
4071 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4072 pollPath: override,
4073 }, nil
4074 }
4075
4076 // ExportPredictionResultMetadata export governance information for a PredictionResult resource. For
4077 // information on the exported fields, see
4078 // AML output data
4079 // model (at https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#prediction-results).
4080 func (c *aMLRESTClient) ExportPredictionResultMetadata(ctx context.Context, req *financialservicespb.ExportPredictionResultMetadataRequest, opts ...gax.CallOption) (*ExportPredictionResultMetadataOperation, error) {
4081 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4082 jsonReq, err := m.Marshal(req)
4083 if err != nil {
4084 return nil, err
4085 }
4086
4087 baseUrl, err := url.Parse(c.endpoint)
4088 if err != nil {
4089 return nil, err
4090 }
4091 baseUrl.Path += fmt.Sprintf("/v1/%v:exportMetadata", req.GetPredictionResult())
4092
4093 params := url.Values{}
4094 params.Add("$alt", "json;enum-encoding=int")
4095
4096 baseUrl.RawQuery = params.Encode()
4097
4098 // Build HTTP headers from client and context metadata.
4099 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "prediction_result", url.QueryEscape(req.GetPredictionResult()))}
4100
4101 hds = append(c.xGoogHeaders, hds...)
4102 hds = append(hds, "Content-Type", "application/json")
4103 headers := gax.BuildHeaders(ctx, hds...)
4104 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4105 resp := &longrunningpb.Operation{}
4106 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4107 if settings.Path != "" {
4108 baseUrl.Path = settings.Path
4109 }
4110 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
4111 if err != nil {
4112 return err
4113 }
4114 httpReq = httpReq.WithContext(ctx)
4115 httpReq.Header = headers
4116
4117 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ExportPredictionResultMetadata")
4118 if err != nil {
4119 return err
4120 }
4121 if err := unm.Unmarshal(buf, resp); err != nil {
4122 return err
4123 }
4124
4125 return nil
4126 }, opts...)
4127 if e != nil {
4128 return nil, e
4129 }
4130
4131 override := fmt.Sprintf("/v1/%s", resp.GetName())
4132 return &ExportPredictionResultMetadataOperation{
4133 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4134 pollPath: override,
4135 }, nil
4136 }
4137
4138 // DeletePredictionResult deletes a PredictionResult.
4139 func (c *aMLRESTClient) DeletePredictionResult(ctx context.Context, req *financialservicespb.DeletePredictionResultRequest, opts ...gax.CallOption) (*DeletePredictionResultOperation, error) {
4140 baseUrl, err := url.Parse(c.endpoint)
4141 if err != nil {
4142 return nil, err
4143 }
4144 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4145
4146 params := url.Values{}
4147 params.Add("$alt", "json;enum-encoding=int")
4148 if req.GetRequestId() != "" {
4149 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
4150 }
4151
4152 baseUrl.RawQuery = params.Encode()
4153
4154 // Build HTTP headers from client and context metadata.
4155 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4156
4157 hds = append(c.xGoogHeaders, hds...)
4158 hds = append(hds, "Content-Type", "application/json")
4159 headers := gax.BuildHeaders(ctx, hds...)
4160 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4161 resp := &longrunningpb.Operation{}
4162 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4163 if settings.Path != "" {
4164 baseUrl.Path = settings.Path
4165 }
4166 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
4167 if err != nil {
4168 return err
4169 }
4170 httpReq = httpReq.WithContext(ctx)
4171 httpReq.Header = headers
4172
4173 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeletePredictionResult")
4174 if err != nil {
4175 return err
4176 }
4177 if err := unm.Unmarshal(buf, resp); err != nil {
4178 return err
4179 }
4180
4181 return nil
4182 }, opts...)
4183 if e != nil {
4184 return nil, e
4185 }
4186
4187 override := fmt.Sprintf("/v1/%s", resp.GetName())
4188 return &DeletePredictionResultOperation{
4189 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4190 pollPath: override,
4191 }, nil
4192 }
4193
4194 // ListBacktestResults list BacktestResults.
4195 func (c *aMLRESTClient) ListBacktestResults(ctx context.Context, req *financialservicespb.ListBacktestResultsRequest, opts ...gax.CallOption) *BacktestResultIterator {
4196 it := &BacktestResultIterator{}
4197 req = proto.Clone(req).(*financialservicespb.ListBacktestResultsRequest)
4198 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4199 it.InternalFetch = func(pageSize int, pageToken string) ([]*financialservicespb.BacktestResult, string, error) {
4200 resp := &financialservicespb.ListBacktestResultsResponse{}
4201 if pageToken != "" {
4202 req.PageToken = pageToken
4203 }
4204 if pageSize > math.MaxInt32 {
4205 req.PageSize = math.MaxInt32
4206 } else if pageSize != 0 {
4207 req.PageSize = int32(pageSize)
4208 }
4209 baseUrl, err := url.Parse(c.endpoint)
4210 if err != nil {
4211 return nil, "", err
4212 }
4213 baseUrl.Path += fmt.Sprintf("/v1/%v/backtestResults", req.GetParent())
4214
4215 params := url.Values{}
4216 params.Add("$alt", "json;enum-encoding=int")
4217 if req.GetFilter() != "" {
4218 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
4219 }
4220 if req.GetOrderBy() != "" {
4221 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
4222 }
4223 if req.GetPageSize() != 0 {
4224 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
4225 }
4226 if req.GetPageToken() != "" {
4227 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
4228 }
4229
4230 baseUrl.RawQuery = params.Encode()
4231
4232 // Build HTTP headers from client and context metadata.
4233 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
4234 headers := gax.BuildHeaders(ctx, hds...)
4235 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4236 if settings.Path != "" {
4237 baseUrl.Path = settings.Path
4238 }
4239 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4240 if err != nil {
4241 return err
4242 }
4243 httpReq.Header = headers
4244
4245 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListBacktestResults")
4246 if err != nil {
4247 return err
4248 }
4249 if err := unm.Unmarshal(buf, resp); err != nil {
4250 return err
4251 }
4252
4253 return nil
4254 }, opts...)
4255 if e != nil {
4256 return nil, "", e
4257 }
4258 it.Response = resp
4259 return resp.GetBacktestResults(), resp.GetNextPageToken(), nil
4260 }
4261
4262 fetch := func(pageSize int, pageToken string) (string, error) {
4263 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
4264 if err != nil {
4265 return "", err
4266 }
4267 it.items = append(it.items, items...)
4268 return nextPageToken, nil
4269 }
4270
4271 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
4272 it.pageInfo.MaxSize = int(req.GetPageSize())
4273 it.pageInfo.Token = req.GetPageToken()
4274
4275 return it
4276 }
4277
4278 // GetBacktestResult gets a BacktestResult.
4279 func (c *aMLRESTClient) GetBacktestResult(ctx context.Context, req *financialservicespb.GetBacktestResultRequest, opts ...gax.CallOption) (*financialservicespb.BacktestResult, error) {
4280 baseUrl, err := url.Parse(c.endpoint)
4281 if err != nil {
4282 return nil, err
4283 }
4284 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4285
4286 params := url.Values{}
4287 params.Add("$alt", "json;enum-encoding=int")
4288
4289 baseUrl.RawQuery = params.Encode()
4290
4291 // Build HTTP headers from client and context metadata.
4292 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4293
4294 hds = append(c.xGoogHeaders, hds...)
4295 hds = append(hds, "Content-Type", "application/json")
4296 headers := gax.BuildHeaders(ctx, hds...)
4297 opts = append((*c.CallOptions).GetBacktestResult[0:len((*c.CallOptions).GetBacktestResult):len((*c.CallOptions).GetBacktestResult)], opts...)
4298 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4299 resp := &financialservicespb.BacktestResult{}
4300 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4301 if settings.Path != "" {
4302 baseUrl.Path = settings.Path
4303 }
4304 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4305 if err != nil {
4306 return err
4307 }
4308 httpReq = httpReq.WithContext(ctx)
4309 httpReq.Header = headers
4310
4311 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetBacktestResult")
4312 if err != nil {
4313 return err
4314 }
4315
4316 if err := unm.Unmarshal(buf, resp); err != nil {
4317 return err
4318 }
4319
4320 return nil
4321 }, opts...)
4322 if e != nil {
4323 return nil, e
4324 }
4325 return resp, nil
4326 }
4327
4328 // CreateBacktestResult create a BacktestResult.
4329 func (c *aMLRESTClient) CreateBacktestResult(ctx context.Context, req *financialservicespb.CreateBacktestResultRequest, opts ...gax.CallOption) (*CreateBacktestResultOperation, error) {
4330 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4331 body := req.GetBacktestResult()
4332 jsonReq, err := m.Marshal(body)
4333 if err != nil {
4334 return nil, err
4335 }
4336
4337 baseUrl, err := url.Parse(c.endpoint)
4338 if err != nil {
4339 return nil, err
4340 }
4341 baseUrl.Path += fmt.Sprintf("/v1/%v/backtestResults", req.GetParent())
4342
4343 params := url.Values{}
4344 params.Add("$alt", "json;enum-encoding=int")
4345 params.Add("backtestResultId", fmt.Sprintf("%v", req.GetBacktestResultId()))
4346 if req.GetRequestId() != "" {
4347 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
4348 }
4349
4350 baseUrl.RawQuery = params.Encode()
4351
4352 // Build HTTP headers from client and context metadata.
4353 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
4354
4355 hds = append(c.xGoogHeaders, hds...)
4356 hds = append(hds, "Content-Type", "application/json")
4357 headers := gax.BuildHeaders(ctx, hds...)
4358 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4359 resp := &longrunningpb.Operation{}
4360 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4361 if settings.Path != "" {
4362 baseUrl.Path = settings.Path
4363 }
4364 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
4365 if err != nil {
4366 return err
4367 }
4368 httpReq = httpReq.WithContext(ctx)
4369 httpReq.Header = headers
4370
4371 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateBacktestResult")
4372 if err != nil {
4373 return err
4374 }
4375 if err := unm.Unmarshal(buf, resp); err != nil {
4376 return err
4377 }
4378
4379 return nil
4380 }, opts...)
4381 if e != nil {
4382 return nil, e
4383 }
4384
4385 override := fmt.Sprintf("/v1/%s", resp.GetName())
4386 return &CreateBacktestResultOperation{
4387 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4388 pollPath: override,
4389 }, nil
4390 }
4391
4392 // UpdateBacktestResult updates the parameters of a single BacktestResult.
4393 func (c *aMLRESTClient) UpdateBacktestResult(ctx context.Context, req *financialservicespb.UpdateBacktestResultRequest, opts ...gax.CallOption) (*UpdateBacktestResultOperation, error) {
4394 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4395 body := req.GetBacktestResult()
4396 jsonReq, err := m.Marshal(body)
4397 if err != nil {
4398 return nil, err
4399 }
4400
4401 baseUrl, err := url.Parse(c.endpoint)
4402 if err != nil {
4403 return nil, err
4404 }
4405 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetBacktestResult().GetName())
4406
4407 params := url.Values{}
4408 params.Add("$alt", "json;enum-encoding=int")
4409 if req.GetRequestId() != "" {
4410 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
4411 }
4412 if req.GetUpdateMask() != nil {
4413 field, err := protojson.Marshal(req.GetUpdateMask())
4414 if err != nil {
4415 return nil, err
4416 }
4417 params.Add("updateMask", string(field[1:len(field)-1]))
4418 }
4419
4420 baseUrl.RawQuery = params.Encode()
4421
4422 // Build HTTP headers from client and context metadata.
4423 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "backtest_result.name", url.QueryEscape(req.GetBacktestResult().GetName()))}
4424
4425 hds = append(c.xGoogHeaders, hds...)
4426 hds = append(hds, "Content-Type", "application/json")
4427 headers := gax.BuildHeaders(ctx, hds...)
4428 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4429 resp := &longrunningpb.Operation{}
4430 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4431 if settings.Path != "" {
4432 baseUrl.Path = settings.Path
4433 }
4434 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
4435 if err != nil {
4436 return err
4437 }
4438 httpReq = httpReq.WithContext(ctx)
4439 httpReq.Header = headers
4440
4441 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateBacktestResult")
4442 if err != nil {
4443 return err
4444 }
4445 if err := unm.Unmarshal(buf, resp); err != nil {
4446 return err
4447 }
4448
4449 return nil
4450 }, opts...)
4451 if e != nil {
4452 return nil, e
4453 }
4454
4455 override := fmt.Sprintf("/v1/%s", resp.GetName())
4456 return &UpdateBacktestResultOperation{
4457 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4458 pollPath: override,
4459 }, nil
4460 }
4461
4462 // ExportBacktestResultMetadata export governance information for a BacktestResult resource. For
4463 // information on the exported fields, see
4464 // AML output data
4465 // model (at https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/schemas/aml-output-data-model#backtest-results).
4466 func (c *aMLRESTClient) ExportBacktestResultMetadata(ctx context.Context, req *financialservicespb.ExportBacktestResultMetadataRequest, opts ...gax.CallOption) (*ExportBacktestResultMetadataOperation, error) {
4467 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4468 jsonReq, err := m.Marshal(req)
4469 if err != nil {
4470 return nil, err
4471 }
4472
4473 baseUrl, err := url.Parse(c.endpoint)
4474 if err != nil {
4475 return nil, err
4476 }
4477 baseUrl.Path += fmt.Sprintf("/v1/%v:exportMetadata", req.GetBacktestResult())
4478
4479 params := url.Values{}
4480 params.Add("$alt", "json;enum-encoding=int")
4481
4482 baseUrl.RawQuery = params.Encode()
4483
4484 // Build HTTP headers from client and context metadata.
4485 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "backtest_result", url.QueryEscape(req.GetBacktestResult()))}
4486
4487 hds = append(c.xGoogHeaders, hds...)
4488 hds = append(hds, "Content-Type", "application/json")
4489 headers := gax.BuildHeaders(ctx, hds...)
4490 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4491 resp := &longrunningpb.Operation{}
4492 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4493 if settings.Path != "" {
4494 baseUrl.Path = settings.Path
4495 }
4496 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
4497 if err != nil {
4498 return err
4499 }
4500 httpReq = httpReq.WithContext(ctx)
4501 httpReq.Header = headers
4502
4503 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ExportBacktestResultMetadata")
4504 if err != nil {
4505 return err
4506 }
4507 if err := unm.Unmarshal(buf, resp); err != nil {
4508 return err
4509 }
4510
4511 return nil
4512 }, opts...)
4513 if e != nil {
4514 return nil, e
4515 }
4516
4517 override := fmt.Sprintf("/v1/%s", resp.GetName())
4518 return &ExportBacktestResultMetadataOperation{
4519 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4520 pollPath: override,
4521 }, nil
4522 }
4523
4524 // DeleteBacktestResult deletes a BacktestResult.
4525 func (c *aMLRESTClient) DeleteBacktestResult(ctx context.Context, req *financialservicespb.DeleteBacktestResultRequest, opts ...gax.CallOption) (*DeleteBacktestResultOperation, error) {
4526 baseUrl, err := url.Parse(c.endpoint)
4527 if err != nil {
4528 return nil, err
4529 }
4530 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4531
4532 params := url.Values{}
4533 params.Add("$alt", "json;enum-encoding=int")
4534 if req.GetRequestId() != "" {
4535 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
4536 }
4537
4538 baseUrl.RawQuery = params.Encode()
4539
4540 // Build HTTP headers from client and context metadata.
4541 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4542
4543 hds = append(c.xGoogHeaders, hds...)
4544 hds = append(hds, "Content-Type", "application/json")
4545 headers := gax.BuildHeaders(ctx, hds...)
4546 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4547 resp := &longrunningpb.Operation{}
4548 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4549 if settings.Path != "" {
4550 baseUrl.Path = settings.Path
4551 }
4552 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
4553 if err != nil {
4554 return err
4555 }
4556 httpReq = httpReq.WithContext(ctx)
4557 httpReq.Header = headers
4558
4559 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteBacktestResult")
4560 if err != nil {
4561 return err
4562 }
4563 if err := unm.Unmarshal(buf, resp); err != nil {
4564 return err
4565 }
4566
4567 return nil
4568 }, opts...)
4569 if e != nil {
4570 return nil, e
4571 }
4572
4573 override := fmt.Sprintf("/v1/%s", resp.GetName())
4574 return &DeleteBacktestResultOperation{
4575 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4576 pollPath: override,
4577 }, nil
4578 }
4579
4580 // GetLocation gets information about a location.
4581 func (c *aMLRESTClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
4582 baseUrl, err := url.Parse(c.endpoint)
4583 if err != nil {
4584 return nil, err
4585 }
4586 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4587
4588 params := url.Values{}
4589 params.Add("$alt", "json;enum-encoding=int")
4590
4591 baseUrl.RawQuery = params.Encode()
4592
4593 // Build HTTP headers from client and context metadata.
4594 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4595
4596 hds = append(c.xGoogHeaders, hds...)
4597 hds = append(hds, "Content-Type", "application/json")
4598 headers := gax.BuildHeaders(ctx, hds...)
4599 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
4600 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4601 resp := &locationpb.Location{}
4602 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4603 if settings.Path != "" {
4604 baseUrl.Path = settings.Path
4605 }
4606 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4607 if err != nil {
4608 return err
4609 }
4610 httpReq = httpReq.WithContext(ctx)
4611 httpReq.Header = headers
4612
4613 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetLocation")
4614 if err != nil {
4615 return err
4616 }
4617
4618 if err := unm.Unmarshal(buf, resp); err != nil {
4619 return err
4620 }
4621
4622 return nil
4623 }, opts...)
4624 if e != nil {
4625 return nil, e
4626 }
4627 return resp, nil
4628 }
4629
4630 // ListLocations lists information about the supported locations for this service.
4631 func (c *aMLRESTClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
4632 it := &LocationIterator{}
4633 req = proto.Clone(req).(*locationpb.ListLocationsRequest)
4634 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4635 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
4636 resp := &locationpb.ListLocationsResponse{}
4637 if pageToken != "" {
4638 req.PageToken = pageToken
4639 }
4640 if pageSize > math.MaxInt32 {
4641 req.PageSize = math.MaxInt32
4642 } else if pageSize != 0 {
4643 req.PageSize = int32(pageSize)
4644 }
4645 baseUrl, err := url.Parse(c.endpoint)
4646 if err != nil {
4647 return nil, "", err
4648 }
4649 baseUrl.Path += fmt.Sprintf("/v1/%v/locations", req.GetName())
4650
4651 params := url.Values{}
4652 params.Add("$alt", "json;enum-encoding=int")
4653 if req.GetFilter() != "" {
4654 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
4655 }
4656 if req.GetPageSize() != 0 {
4657 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
4658 }
4659 if req.GetPageToken() != "" {
4660 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
4661 }
4662
4663 baseUrl.RawQuery = params.Encode()
4664
4665 // Build HTTP headers from client and context metadata.
4666 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
4667 headers := gax.BuildHeaders(ctx, hds...)
4668 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4669 if settings.Path != "" {
4670 baseUrl.Path = settings.Path
4671 }
4672 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4673 if err != nil {
4674 return err
4675 }
4676 httpReq.Header = headers
4677
4678 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListLocations")
4679 if err != nil {
4680 return err
4681 }
4682 if err := unm.Unmarshal(buf, resp); err != nil {
4683 return err
4684 }
4685
4686 return nil
4687 }, opts...)
4688 if e != nil {
4689 return nil, "", e
4690 }
4691 it.Response = resp
4692 return resp.GetLocations(), resp.GetNextPageToken(), nil
4693 }
4694
4695 fetch := func(pageSize int, pageToken string) (string, error) {
4696 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
4697 if err != nil {
4698 return "", err
4699 }
4700 it.items = append(it.items, items...)
4701 return nextPageToken, nil
4702 }
4703
4704 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
4705 it.pageInfo.MaxSize = int(req.GetPageSize())
4706 it.pageInfo.Token = req.GetPageToken()
4707
4708 return it
4709 }
4710
4711 // CancelOperation is a utility method from google.longrunning.Operations.
4712 func (c *aMLRESTClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
4713 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4714 jsonReq, err := m.Marshal(req)
4715 if err != nil {
4716 return err
4717 }
4718
4719 baseUrl, err := url.Parse(c.endpoint)
4720 if err != nil {
4721 return err
4722 }
4723 baseUrl.Path += fmt.Sprintf("/v1/%v:cancel", req.GetName())
4724
4725 params := url.Values{}
4726 params.Add("$alt", "json;enum-encoding=int")
4727
4728 baseUrl.RawQuery = params.Encode()
4729
4730 // Build HTTP headers from client and context metadata.
4731 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4732
4733 hds = append(c.xGoogHeaders, hds...)
4734 hds = append(hds, "Content-Type", "application/json")
4735 headers := gax.BuildHeaders(ctx, hds...)
4736 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4737 if settings.Path != "" {
4738 baseUrl.Path = settings.Path
4739 }
4740 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
4741 if err != nil {
4742 return err
4743 }
4744 httpReq = httpReq.WithContext(ctx)
4745 httpReq.Header = headers
4746
4747 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CancelOperation")
4748 return err
4749 }, opts...)
4750 }
4751
4752 // DeleteOperation is a utility method from google.longrunning.Operations.
4753 func (c *aMLRESTClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
4754 baseUrl, err := url.Parse(c.endpoint)
4755 if err != nil {
4756 return err
4757 }
4758 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4759
4760 params := url.Values{}
4761 params.Add("$alt", "json;enum-encoding=int")
4762
4763 baseUrl.RawQuery = params.Encode()
4764
4765 // Build HTTP headers from client and context metadata.
4766 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4767
4768 hds = append(c.xGoogHeaders, hds...)
4769 hds = append(hds, "Content-Type", "application/json")
4770 headers := gax.BuildHeaders(ctx, hds...)
4771 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4772 if settings.Path != "" {
4773 baseUrl.Path = settings.Path
4774 }
4775 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
4776 if err != nil {
4777 return err
4778 }
4779 httpReq = httpReq.WithContext(ctx)
4780 httpReq.Header = headers
4781
4782 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation")
4783 return err
4784 }, opts...)
4785 }
4786
4787 // GetOperation is a utility method from google.longrunning.Operations.
4788 func (c *aMLRESTClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
4789 baseUrl, err := url.Parse(c.endpoint)
4790 if err != nil {
4791 return nil, err
4792 }
4793 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4794
4795 params := url.Values{}
4796 params.Add("$alt", "json;enum-encoding=int")
4797
4798 baseUrl.RawQuery = params.Encode()
4799
4800 // Build HTTP headers from client and context metadata.
4801 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4802
4803 hds = append(c.xGoogHeaders, hds...)
4804 hds = append(hds, "Content-Type", "application/json")
4805 headers := gax.BuildHeaders(ctx, hds...)
4806 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
4807 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4808 resp := &longrunningpb.Operation{}
4809 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4810 if settings.Path != "" {
4811 baseUrl.Path = settings.Path
4812 }
4813 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4814 if err != nil {
4815 return err
4816 }
4817 httpReq = httpReq.WithContext(ctx)
4818 httpReq.Header = headers
4819
4820 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOperation")
4821 if err != nil {
4822 return err
4823 }
4824
4825 if err := unm.Unmarshal(buf, resp); err != nil {
4826 return err
4827 }
4828
4829 return nil
4830 }, opts...)
4831 if e != nil {
4832 return nil, e
4833 }
4834 return resp, nil
4835 }
4836
4837 // ListOperations is a utility method from google.longrunning.Operations.
4838 func (c *aMLRESTClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
4839 it := &OperationIterator{}
4840 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
4841 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4842 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
4843 resp := &longrunningpb.ListOperationsResponse{}
4844 if pageToken != "" {
4845 req.PageToken = pageToken
4846 }
4847 if pageSize > math.MaxInt32 {
4848 req.PageSize = math.MaxInt32
4849 } else if pageSize != 0 {
4850 req.PageSize = int32(pageSize)
4851 }
4852 baseUrl, err := url.Parse(c.endpoint)
4853 if err != nil {
4854 return nil, "", err
4855 }
4856 baseUrl.Path += fmt.Sprintf("/v1/%v/operations", req.GetName())
4857
4858 params := url.Values{}
4859 params.Add("$alt", "json;enum-encoding=int")
4860 if req.GetFilter() != "" {
4861 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
4862 }
4863 if req.GetPageSize() != 0 {
4864 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
4865 }
4866 if req.GetPageToken() != "" {
4867 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
4868 }
4869
4870 baseUrl.RawQuery = params.Encode()
4871
4872 // Build HTTP headers from client and context metadata.
4873 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
4874 headers := gax.BuildHeaders(ctx, hds...)
4875 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4876 if settings.Path != "" {
4877 baseUrl.Path = settings.Path
4878 }
4879 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4880 if err != nil {
4881 return err
4882 }
4883 httpReq.Header = headers
4884
4885 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations")
4886 if err != nil {
4887 return err
4888 }
4889 if err := unm.Unmarshal(buf, resp); err != nil {
4890 return err
4891 }
4892
4893 return nil
4894 }, opts...)
4895 if e != nil {
4896 return nil, "", e
4897 }
4898 it.Response = resp
4899 return resp.GetOperations(), resp.GetNextPageToken(), nil
4900 }
4901
4902 fetch := func(pageSize int, pageToken string) (string, error) {
4903 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
4904 if err != nil {
4905 return "", err
4906 }
4907 it.items = append(it.items, items...)
4908 return nextPageToken, nil
4909 }
4910
4911 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
4912 it.pageInfo.MaxSize = int(req.GetPageSize())
4913 it.pageInfo.Token = req.GetPageToken()
4914
4915 return it
4916 }
4917
4918 // CreateBacktestResultOperation returns a new CreateBacktestResultOperation from a given name.
4919 // The name must be that of a previously created CreateBacktestResultOperation, possibly from a different process.
4920 func (c *aMLGRPCClient) CreateBacktestResultOperation(name string) *CreateBacktestResultOperation {
4921 return &CreateBacktestResultOperation{
4922 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
4923 }
4924 }
4925
4926 // CreateBacktestResultOperation returns a new CreateBacktestResultOperation from a given name.
4927 // The name must be that of a previously created CreateBacktestResultOperation, possibly from a different process.
4928 func (c *aMLRESTClient) CreateBacktestResultOperation(name string) *CreateBacktestResultOperation {
4929 override := fmt.Sprintf("/v1/%s", name)
4930 return &CreateBacktestResultOperation{
4931 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
4932 pollPath: override,
4933 }
4934 }
4935
4936 // CreateDatasetOperation returns a new CreateDatasetOperation from a given name.
4937 // The name must be that of a previously created CreateDatasetOperation, possibly from a different process.
4938 func (c *aMLGRPCClient) CreateDatasetOperation(name string) *CreateDatasetOperation {
4939 return &CreateDatasetOperation{
4940 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
4941 }
4942 }
4943
4944 // CreateDatasetOperation returns a new CreateDatasetOperation from a given name.
4945 // The name must be that of a previously created CreateDatasetOperation, possibly from a different process.
4946 func (c *aMLRESTClient) CreateDatasetOperation(name string) *CreateDatasetOperation {
4947 override := fmt.Sprintf("/v1/%s", name)
4948 return &CreateDatasetOperation{
4949 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
4950 pollPath: override,
4951 }
4952 }
4953
4954 // CreateEngineConfigOperation returns a new CreateEngineConfigOperation from a given name.
4955 // The name must be that of a previously created CreateEngineConfigOperation, possibly from a different process.
4956 func (c *aMLGRPCClient) CreateEngineConfigOperation(name string) *CreateEngineConfigOperation {
4957 return &CreateEngineConfigOperation{
4958 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
4959 }
4960 }
4961
4962 // CreateEngineConfigOperation returns a new CreateEngineConfigOperation from a given name.
4963 // The name must be that of a previously created CreateEngineConfigOperation, possibly from a different process.
4964 func (c *aMLRESTClient) CreateEngineConfigOperation(name string) *CreateEngineConfigOperation {
4965 override := fmt.Sprintf("/v1/%s", name)
4966 return &CreateEngineConfigOperation{
4967 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
4968 pollPath: override,
4969 }
4970 }
4971
4972 // CreateInstanceOperation returns a new CreateInstanceOperation from a given name.
4973 // The name must be that of a previously created CreateInstanceOperation, possibly from a different process.
4974 func (c *aMLGRPCClient) CreateInstanceOperation(name string) *CreateInstanceOperation {
4975 return &CreateInstanceOperation{
4976 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
4977 }
4978 }
4979
4980 // CreateInstanceOperation returns a new CreateInstanceOperation from a given name.
4981 // The name must be that of a previously created CreateInstanceOperation, possibly from a different process.
4982 func (c *aMLRESTClient) CreateInstanceOperation(name string) *CreateInstanceOperation {
4983 override := fmt.Sprintf("/v1/%s", name)
4984 return &CreateInstanceOperation{
4985 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
4986 pollPath: override,
4987 }
4988 }
4989
4990 // CreateModelOperation returns a new CreateModelOperation from a given name.
4991 // The name must be that of a previously created CreateModelOperation, possibly from a different process.
4992 func (c *aMLGRPCClient) CreateModelOperation(name string) *CreateModelOperation {
4993 return &CreateModelOperation{
4994 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
4995 }
4996 }
4997
4998 // CreateModelOperation returns a new CreateModelOperation from a given name.
4999 // The name must be that of a previously created CreateModelOperation, possibly from a different process.
5000 func (c *aMLRESTClient) CreateModelOperation(name string) *CreateModelOperation {
5001 override := fmt.Sprintf("/v1/%s", name)
5002 return &CreateModelOperation{
5003 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5004 pollPath: override,
5005 }
5006 }
5007
5008 // CreatePredictionResultOperation returns a new CreatePredictionResultOperation from a given name.
5009 // The name must be that of a previously created CreatePredictionResultOperation, possibly from a different process.
5010 func (c *aMLGRPCClient) CreatePredictionResultOperation(name string) *CreatePredictionResultOperation {
5011 return &CreatePredictionResultOperation{
5012 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5013 }
5014 }
5015
5016 // CreatePredictionResultOperation returns a new CreatePredictionResultOperation from a given name.
5017 // The name must be that of a previously created CreatePredictionResultOperation, possibly from a different process.
5018 func (c *aMLRESTClient) CreatePredictionResultOperation(name string) *CreatePredictionResultOperation {
5019 override := fmt.Sprintf("/v1/%s", name)
5020 return &CreatePredictionResultOperation{
5021 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5022 pollPath: override,
5023 }
5024 }
5025
5026 // DeleteBacktestResultOperation returns a new DeleteBacktestResultOperation from a given name.
5027 // The name must be that of a previously created DeleteBacktestResultOperation, possibly from a different process.
5028 func (c *aMLGRPCClient) DeleteBacktestResultOperation(name string) *DeleteBacktestResultOperation {
5029 return &DeleteBacktestResultOperation{
5030 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5031 }
5032 }
5033
5034 // DeleteBacktestResultOperation returns a new DeleteBacktestResultOperation from a given name.
5035 // The name must be that of a previously created DeleteBacktestResultOperation, possibly from a different process.
5036 func (c *aMLRESTClient) DeleteBacktestResultOperation(name string) *DeleteBacktestResultOperation {
5037 override := fmt.Sprintf("/v1/%s", name)
5038 return &DeleteBacktestResultOperation{
5039 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5040 pollPath: override,
5041 }
5042 }
5043
5044 // DeleteDatasetOperation returns a new DeleteDatasetOperation from a given name.
5045 // The name must be that of a previously created DeleteDatasetOperation, possibly from a different process.
5046 func (c *aMLGRPCClient) DeleteDatasetOperation(name string) *DeleteDatasetOperation {
5047 return &DeleteDatasetOperation{
5048 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5049 }
5050 }
5051
5052 // DeleteDatasetOperation returns a new DeleteDatasetOperation from a given name.
5053 // The name must be that of a previously created DeleteDatasetOperation, possibly from a different process.
5054 func (c *aMLRESTClient) DeleteDatasetOperation(name string) *DeleteDatasetOperation {
5055 override := fmt.Sprintf("/v1/%s", name)
5056 return &DeleteDatasetOperation{
5057 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5058 pollPath: override,
5059 }
5060 }
5061
5062 // DeleteEngineConfigOperation returns a new DeleteEngineConfigOperation from a given name.
5063 // The name must be that of a previously created DeleteEngineConfigOperation, possibly from a different process.
5064 func (c *aMLGRPCClient) DeleteEngineConfigOperation(name string) *DeleteEngineConfigOperation {
5065 return &DeleteEngineConfigOperation{
5066 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5067 }
5068 }
5069
5070 // DeleteEngineConfigOperation returns a new DeleteEngineConfigOperation from a given name.
5071 // The name must be that of a previously created DeleteEngineConfigOperation, possibly from a different process.
5072 func (c *aMLRESTClient) DeleteEngineConfigOperation(name string) *DeleteEngineConfigOperation {
5073 override := fmt.Sprintf("/v1/%s", name)
5074 return &DeleteEngineConfigOperation{
5075 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5076 pollPath: override,
5077 }
5078 }
5079
5080 // DeleteInstanceOperation returns a new DeleteInstanceOperation from a given name.
5081 // The name must be that of a previously created DeleteInstanceOperation, possibly from a different process.
5082 func (c *aMLGRPCClient) DeleteInstanceOperation(name string) *DeleteInstanceOperation {
5083 return &DeleteInstanceOperation{
5084 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5085 }
5086 }
5087
5088 // DeleteInstanceOperation returns a new DeleteInstanceOperation from a given name.
5089 // The name must be that of a previously created DeleteInstanceOperation, possibly from a different process.
5090 func (c *aMLRESTClient) DeleteInstanceOperation(name string) *DeleteInstanceOperation {
5091 override := fmt.Sprintf("/v1/%s", name)
5092 return &DeleteInstanceOperation{
5093 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5094 pollPath: override,
5095 }
5096 }
5097
5098 // DeleteModelOperation returns a new DeleteModelOperation from a given name.
5099 // The name must be that of a previously created DeleteModelOperation, possibly from a different process.
5100 func (c *aMLGRPCClient) DeleteModelOperation(name string) *DeleteModelOperation {
5101 return &DeleteModelOperation{
5102 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5103 }
5104 }
5105
5106 // DeleteModelOperation returns a new DeleteModelOperation from a given name.
5107 // The name must be that of a previously created DeleteModelOperation, possibly from a different process.
5108 func (c *aMLRESTClient) DeleteModelOperation(name string) *DeleteModelOperation {
5109 override := fmt.Sprintf("/v1/%s", name)
5110 return &DeleteModelOperation{
5111 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5112 pollPath: override,
5113 }
5114 }
5115
5116 // DeletePredictionResultOperation returns a new DeletePredictionResultOperation from a given name.
5117 // The name must be that of a previously created DeletePredictionResultOperation, possibly from a different process.
5118 func (c *aMLGRPCClient) DeletePredictionResultOperation(name string) *DeletePredictionResultOperation {
5119 return &DeletePredictionResultOperation{
5120 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5121 }
5122 }
5123
5124 // DeletePredictionResultOperation returns a new DeletePredictionResultOperation from a given name.
5125 // The name must be that of a previously created DeletePredictionResultOperation, possibly from a different process.
5126 func (c *aMLRESTClient) DeletePredictionResultOperation(name string) *DeletePredictionResultOperation {
5127 override := fmt.Sprintf("/v1/%s", name)
5128 return &DeletePredictionResultOperation{
5129 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5130 pollPath: override,
5131 }
5132 }
5133
5134 // ExportBacktestResultMetadataOperation returns a new ExportBacktestResultMetadataOperation from a given name.
5135 // The name must be that of a previously created ExportBacktestResultMetadataOperation, possibly from a different process.
5136 func (c *aMLGRPCClient) ExportBacktestResultMetadataOperation(name string) *ExportBacktestResultMetadataOperation {
5137 return &ExportBacktestResultMetadataOperation{
5138 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5139 }
5140 }
5141
5142 // ExportBacktestResultMetadataOperation returns a new ExportBacktestResultMetadataOperation from a given name.
5143 // The name must be that of a previously created ExportBacktestResultMetadataOperation, possibly from a different process.
5144 func (c *aMLRESTClient) ExportBacktestResultMetadataOperation(name string) *ExportBacktestResultMetadataOperation {
5145 override := fmt.Sprintf("/v1/%s", name)
5146 return &ExportBacktestResultMetadataOperation{
5147 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5148 pollPath: override,
5149 }
5150 }
5151
5152 // ExportEngineConfigMetadataOperation returns a new ExportEngineConfigMetadataOperation from a given name.
5153 // The name must be that of a previously created ExportEngineConfigMetadataOperation, possibly from a different process.
5154 func (c *aMLGRPCClient) ExportEngineConfigMetadataOperation(name string) *ExportEngineConfigMetadataOperation {
5155 return &ExportEngineConfigMetadataOperation{
5156 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5157 }
5158 }
5159
5160 // ExportEngineConfigMetadataOperation returns a new ExportEngineConfigMetadataOperation from a given name.
5161 // The name must be that of a previously created ExportEngineConfigMetadataOperation, possibly from a different process.
5162 func (c *aMLRESTClient) ExportEngineConfigMetadataOperation(name string) *ExportEngineConfigMetadataOperation {
5163 override := fmt.Sprintf("/v1/%s", name)
5164 return &ExportEngineConfigMetadataOperation{
5165 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5166 pollPath: override,
5167 }
5168 }
5169
5170 // ExportModelMetadataOperation returns a new ExportModelMetadataOperation from a given name.
5171 // The name must be that of a previously created ExportModelMetadataOperation, possibly from a different process.
5172 func (c *aMLGRPCClient) ExportModelMetadataOperation(name string) *ExportModelMetadataOperation {
5173 return &ExportModelMetadataOperation{
5174 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5175 }
5176 }
5177
5178 // ExportModelMetadataOperation returns a new ExportModelMetadataOperation from a given name.
5179 // The name must be that of a previously created ExportModelMetadataOperation, possibly from a different process.
5180 func (c *aMLRESTClient) ExportModelMetadataOperation(name string) *ExportModelMetadataOperation {
5181 override := fmt.Sprintf("/v1/%s", name)
5182 return &ExportModelMetadataOperation{
5183 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5184 pollPath: override,
5185 }
5186 }
5187
5188 // ExportPredictionResultMetadataOperation returns a new ExportPredictionResultMetadataOperation from a given name.
5189 // The name must be that of a previously created ExportPredictionResultMetadataOperation, possibly from a different process.
5190 func (c *aMLGRPCClient) ExportPredictionResultMetadataOperation(name string) *ExportPredictionResultMetadataOperation {
5191 return &ExportPredictionResultMetadataOperation{
5192 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5193 }
5194 }
5195
5196 // ExportPredictionResultMetadataOperation returns a new ExportPredictionResultMetadataOperation from a given name.
5197 // The name must be that of a previously created ExportPredictionResultMetadataOperation, possibly from a different process.
5198 func (c *aMLRESTClient) ExportPredictionResultMetadataOperation(name string) *ExportPredictionResultMetadataOperation {
5199 override := fmt.Sprintf("/v1/%s", name)
5200 return &ExportPredictionResultMetadataOperation{
5201 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5202 pollPath: override,
5203 }
5204 }
5205
5206 // ExportRegisteredPartiesOperation returns a new ExportRegisteredPartiesOperation from a given name.
5207 // The name must be that of a previously created ExportRegisteredPartiesOperation, possibly from a different process.
5208 func (c *aMLGRPCClient) ExportRegisteredPartiesOperation(name string) *ExportRegisteredPartiesOperation {
5209 return &ExportRegisteredPartiesOperation{
5210 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5211 }
5212 }
5213
5214 // ExportRegisteredPartiesOperation returns a new ExportRegisteredPartiesOperation from a given name.
5215 // The name must be that of a previously created ExportRegisteredPartiesOperation, possibly from a different process.
5216 func (c *aMLRESTClient) ExportRegisteredPartiesOperation(name string) *ExportRegisteredPartiesOperation {
5217 override := fmt.Sprintf("/v1/%s", name)
5218 return &ExportRegisteredPartiesOperation{
5219 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5220 pollPath: override,
5221 }
5222 }
5223
5224 // ImportRegisteredPartiesOperation returns a new ImportRegisteredPartiesOperation from a given name.
5225 // The name must be that of a previously created ImportRegisteredPartiesOperation, possibly from a different process.
5226 func (c *aMLGRPCClient) ImportRegisteredPartiesOperation(name string) *ImportRegisteredPartiesOperation {
5227 return &ImportRegisteredPartiesOperation{
5228 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5229 }
5230 }
5231
5232 // ImportRegisteredPartiesOperation returns a new ImportRegisteredPartiesOperation from a given name.
5233 // The name must be that of a previously created ImportRegisteredPartiesOperation, possibly from a different process.
5234 func (c *aMLRESTClient) ImportRegisteredPartiesOperation(name string) *ImportRegisteredPartiesOperation {
5235 override := fmt.Sprintf("/v1/%s", name)
5236 return &ImportRegisteredPartiesOperation{
5237 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5238 pollPath: override,
5239 }
5240 }
5241
5242 // UpdateBacktestResultOperation returns a new UpdateBacktestResultOperation from a given name.
5243 // The name must be that of a previously created UpdateBacktestResultOperation, possibly from a different process.
5244 func (c *aMLGRPCClient) UpdateBacktestResultOperation(name string) *UpdateBacktestResultOperation {
5245 return &UpdateBacktestResultOperation{
5246 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5247 }
5248 }
5249
5250 // UpdateBacktestResultOperation returns a new UpdateBacktestResultOperation from a given name.
5251 // The name must be that of a previously created UpdateBacktestResultOperation, possibly from a different process.
5252 func (c *aMLRESTClient) UpdateBacktestResultOperation(name string) *UpdateBacktestResultOperation {
5253 override := fmt.Sprintf("/v1/%s", name)
5254 return &UpdateBacktestResultOperation{
5255 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5256 pollPath: override,
5257 }
5258 }
5259
5260 // UpdateDatasetOperation returns a new UpdateDatasetOperation from a given name.
5261 // The name must be that of a previously created UpdateDatasetOperation, possibly from a different process.
5262 func (c *aMLGRPCClient) UpdateDatasetOperation(name string) *UpdateDatasetOperation {
5263 return &UpdateDatasetOperation{
5264 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5265 }
5266 }
5267
5268 // UpdateDatasetOperation returns a new UpdateDatasetOperation from a given name.
5269 // The name must be that of a previously created UpdateDatasetOperation, possibly from a different process.
5270 func (c *aMLRESTClient) UpdateDatasetOperation(name string) *UpdateDatasetOperation {
5271 override := fmt.Sprintf("/v1/%s", name)
5272 return &UpdateDatasetOperation{
5273 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5274 pollPath: override,
5275 }
5276 }
5277
5278 // UpdateEngineConfigOperation returns a new UpdateEngineConfigOperation from a given name.
5279 // The name must be that of a previously created UpdateEngineConfigOperation, possibly from a different process.
5280 func (c *aMLGRPCClient) UpdateEngineConfigOperation(name string) *UpdateEngineConfigOperation {
5281 return &UpdateEngineConfigOperation{
5282 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5283 }
5284 }
5285
5286 // UpdateEngineConfigOperation returns a new UpdateEngineConfigOperation from a given name.
5287 // The name must be that of a previously created UpdateEngineConfigOperation, possibly from a different process.
5288 func (c *aMLRESTClient) UpdateEngineConfigOperation(name string) *UpdateEngineConfigOperation {
5289 override := fmt.Sprintf("/v1/%s", name)
5290 return &UpdateEngineConfigOperation{
5291 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5292 pollPath: override,
5293 }
5294 }
5295
5296 // UpdateInstanceOperation returns a new UpdateInstanceOperation from a given name.
5297 // The name must be that of a previously created UpdateInstanceOperation, possibly from a different process.
5298 func (c *aMLGRPCClient) UpdateInstanceOperation(name string) *UpdateInstanceOperation {
5299 return &UpdateInstanceOperation{
5300 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5301 }
5302 }
5303
5304 // UpdateInstanceOperation returns a new UpdateInstanceOperation from a given name.
5305 // The name must be that of a previously created UpdateInstanceOperation, possibly from a different process.
5306 func (c *aMLRESTClient) UpdateInstanceOperation(name string) *UpdateInstanceOperation {
5307 override := fmt.Sprintf("/v1/%s", name)
5308 return &UpdateInstanceOperation{
5309 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5310 pollPath: override,
5311 }
5312 }
5313
5314 // UpdateModelOperation returns a new UpdateModelOperation from a given name.
5315 // The name must be that of a previously created UpdateModelOperation, possibly from a different process.
5316 func (c *aMLGRPCClient) UpdateModelOperation(name string) *UpdateModelOperation {
5317 return &UpdateModelOperation{
5318 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5319 }
5320 }
5321
5322 // UpdateModelOperation returns a new UpdateModelOperation from a given name.
5323 // The name must be that of a previously created UpdateModelOperation, possibly from a different process.
5324 func (c *aMLRESTClient) UpdateModelOperation(name string) *UpdateModelOperation {
5325 override := fmt.Sprintf("/v1/%s", name)
5326 return &UpdateModelOperation{
5327 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5328 pollPath: override,
5329 }
5330 }
5331
5332 // UpdatePredictionResultOperation returns a new UpdatePredictionResultOperation from a given name.
5333 // The name must be that of a previously created UpdatePredictionResultOperation, possibly from a different process.
5334 func (c *aMLGRPCClient) UpdatePredictionResultOperation(name string) *UpdatePredictionResultOperation {
5335 return &UpdatePredictionResultOperation{
5336 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5337 }
5338 }
5339
5340 // UpdatePredictionResultOperation returns a new UpdatePredictionResultOperation from a given name.
5341 // The name must be that of a previously created UpdatePredictionResultOperation, possibly from a different process.
5342 func (c *aMLRESTClient) UpdatePredictionResultOperation(name string) *UpdatePredictionResultOperation {
5343 override := fmt.Sprintf("/v1/%s", name)
5344 return &UpdatePredictionResultOperation{
5345 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
5346 pollPath: override,
5347 }
5348 }