Debian Codegraph @

visionai/apiv1/app_platform_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 visionai
18
19 import (
20 "bytes"
21 "context"
22 "fmt"
23 "log/slog"
24 "math"
25 "net/http"
26 "net/url"
27
28 "cloud.google.com/go/longrunning"
29 lroauto "cloud.google.com/go/longrunning/autogen"
30 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
31 visionaipb "cloud.google.com/go/visionai/apiv1/visionaipb"
32 gax "github.com/googleapis/gax-go/v2"
33 "google.golang.org/api/iterator"
34 "google.golang.org/api/option"
35 "google.golang.org/api/option/internaloption"
36 gtransport "google.golang.org/api/transport/grpc"
37 httptransport "google.golang.org/api/transport/http"
38 "google.golang.org/grpc"
39 "google.golang.org/protobuf/encoding/protojson"
40 "google.golang.org/protobuf/proto"
41 )
42
43 var newAppPlatformClientHook clientHook
44
45 // AppPlatformCallOptions contains the retry settings for each method of AppPlatformClient.
46 type AppPlatformCallOptions struct {
47 ListApplications []gax.CallOption
48 GetApplication []gax.CallOption
49 CreateApplication []gax.CallOption
50 UpdateApplication []gax.CallOption
51 DeleteApplication []gax.CallOption
52 DeployApplication []gax.CallOption
53 UndeployApplication []gax.CallOption
54 AddApplicationStreamInput []gax.CallOption
55 RemoveApplicationStreamInput []gax.CallOption
56 UpdateApplicationStreamInput []gax.CallOption
57 ListInstances []gax.CallOption
58 GetInstance []gax.CallOption
59 CreateApplicationInstances []gax.CallOption
60 DeleteApplicationInstances []gax.CallOption
61 UpdateApplicationInstances []gax.CallOption
62 ListDrafts []gax.CallOption
63 GetDraft []gax.CallOption
64 CreateDraft []gax.CallOption
65 UpdateDraft []gax.CallOption
66 DeleteDraft []gax.CallOption
67 ListProcessors []gax.CallOption
68 ListPrebuiltProcessors []gax.CallOption
69 GetProcessor []gax.CallOption
70 CreateProcessor []gax.CallOption
71 UpdateProcessor []gax.CallOption
72 DeleteProcessor []gax.CallOption
73 CancelOperation []gax.CallOption
74 DeleteOperation []gax.CallOption
75 GetOperation []gax.CallOption
76 ListOperations []gax.CallOption
77 }
78
79 func defaultAppPlatformGRPCClientOptions() []option.ClientOption {
80 return []option.ClientOption{
81 internaloption.WithDefaultEndpoint("visionai.googleapis.com:443"),
82 internaloption.WithDefaultEndpointTemplate("visionai.UNIVERSE_DOMAIN:443"),
83 internaloption.WithDefaultMTLSEndpoint("visionai.mtls.googleapis.com:443"),
84 internaloption.WithDefaultUniverseDomain("googleapis.com"),
85 internaloption.WithDefaultAudience("https://visionai.googleapis.com/"),
86 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
87 internaloption.EnableJwtWithScope(),
88 internaloption.EnableNewAuthLibrary(),
89 option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
90 grpc.MaxCallRecvMsgSize(math.MaxInt32))),
91 }
92 }
93
94 func defaultAppPlatformCallOptions() *AppPlatformCallOptions {
95 return &AppPlatformCallOptions{
96 ListApplications: []gax.CallOption{},
97 GetApplication: []gax.CallOption{},
98 CreateApplication: []gax.CallOption{},
99 UpdateApplication: []gax.CallOption{},
100 DeleteApplication: []gax.CallOption{},
101 DeployApplication: []gax.CallOption{},
102 UndeployApplication: []gax.CallOption{},
103 AddApplicationStreamInput: []gax.CallOption{},
104 RemoveApplicationStreamInput: []gax.CallOption{},
105 UpdateApplicationStreamInput: []gax.CallOption{},
106 ListInstances: []gax.CallOption{},
107 GetInstance: []gax.CallOption{},
108 CreateApplicationInstances: []gax.CallOption{},
109 DeleteApplicationInstances: []gax.CallOption{},
110 UpdateApplicationInstances: []gax.CallOption{},
111 ListDrafts: []gax.CallOption{},
112 GetDraft: []gax.CallOption{},
113 CreateDraft: []gax.CallOption{},
114 UpdateDraft: []gax.CallOption{},
115 DeleteDraft: []gax.CallOption{},
116 ListProcessors: []gax.CallOption{},
117 ListPrebuiltProcessors: []gax.CallOption{},
118 GetProcessor: []gax.CallOption{},
119 CreateProcessor: []gax.CallOption{},
120 UpdateProcessor: []gax.CallOption{},
121 DeleteProcessor: []gax.CallOption{},
122 CancelOperation: []gax.CallOption{},
123 DeleteOperation: []gax.CallOption{},
124 GetOperation: []gax.CallOption{},
125 ListOperations: []gax.CallOption{},
126 }
127 }
128
129 func defaultAppPlatformRESTCallOptions() *AppPlatformCallOptions {
130 return &AppPlatformCallOptions{
131 ListApplications: []gax.CallOption{},
132 GetApplication: []gax.CallOption{},
133 CreateApplication: []gax.CallOption{},
134 UpdateApplication: []gax.CallOption{},
135 DeleteApplication: []gax.CallOption{},
136 DeployApplication: []gax.CallOption{},
137 UndeployApplication: []gax.CallOption{},
138 AddApplicationStreamInput: []gax.CallOption{},
139 RemoveApplicationStreamInput: []gax.CallOption{},
140 UpdateApplicationStreamInput: []gax.CallOption{},
141 ListInstances: []gax.CallOption{},
142 GetInstance: []gax.CallOption{},
143 CreateApplicationInstances: []gax.CallOption{},
144 DeleteApplicationInstances: []gax.CallOption{},
145 UpdateApplicationInstances: []gax.CallOption{},
146 ListDrafts: []gax.CallOption{},
147 GetDraft: []gax.CallOption{},
148 CreateDraft: []gax.CallOption{},
149 UpdateDraft: []gax.CallOption{},
150 DeleteDraft: []gax.CallOption{},
151 ListProcessors: []gax.CallOption{},
152 ListPrebuiltProcessors: []gax.CallOption{},
153 GetProcessor: []gax.CallOption{},
154 CreateProcessor: []gax.CallOption{},
155 UpdateProcessor: []gax.CallOption{},
156 DeleteProcessor: []gax.CallOption{},
157 CancelOperation: []gax.CallOption{},
158 DeleteOperation: []gax.CallOption{},
159 GetOperation: []gax.CallOption{},
160 ListOperations: []gax.CallOption{},
161 }
162 }
163
164 // internalAppPlatformClient is an interface that defines the methods available from Vision AI API.
165 type internalAppPlatformClient interface {
166 Close() error
167 setGoogleClientInfo(...string)
168 Connection() *grpc.ClientConn
169 ListApplications(context.Context, *visionaipb.ListApplicationsRequest, ...gax.CallOption) *ApplicationIterator
170 GetApplication(context.Context, *visionaipb.GetApplicationRequest, ...gax.CallOption) (*visionaipb.Application, error)
171 CreateApplication(context.Context, *visionaipb.CreateApplicationRequest, ...gax.CallOption) (*CreateApplicationOperation, error)
172 CreateApplicationOperation(name string) *CreateApplicationOperation
173 UpdateApplication(context.Context, *visionaipb.UpdateApplicationRequest, ...gax.CallOption) (*UpdateApplicationOperation, error)
174 UpdateApplicationOperation(name string) *UpdateApplicationOperation
175 DeleteApplication(context.Context, *visionaipb.DeleteApplicationRequest, ...gax.CallOption) (*DeleteApplicationOperation, error)
176 DeleteApplicationOperation(name string) *DeleteApplicationOperation
177 DeployApplication(context.Context, *visionaipb.DeployApplicationRequest, ...gax.CallOption) (*DeployApplicationOperation, error)
178 DeployApplicationOperation(name string) *DeployApplicationOperation
179 UndeployApplication(context.Context, *visionaipb.UndeployApplicationRequest, ...gax.CallOption) (*UndeployApplicationOperation, error)
180 UndeployApplicationOperation(name string) *UndeployApplicationOperation
181 AddApplicationStreamInput(context.Context, *visionaipb.AddApplicationStreamInputRequest, ...gax.CallOption) (*AddApplicationStreamInputOperation, error)
182 AddApplicationStreamInputOperation(name string) *AddApplicationStreamInputOperation
183 RemoveApplicationStreamInput(context.Context, *visionaipb.RemoveApplicationStreamInputRequest, ...gax.CallOption) (*RemoveApplicationStreamInputOperation, error)
184 RemoveApplicationStreamInputOperation(name string) *RemoveApplicationStreamInputOperation
185 UpdateApplicationStreamInput(context.Context, *visionaipb.UpdateApplicationStreamInputRequest, ...gax.CallOption) (*UpdateApplicationStreamInputOperation, error)
186 UpdateApplicationStreamInputOperation(name string) *UpdateApplicationStreamInputOperation
187 ListInstances(context.Context, *visionaipb.ListInstancesRequest, ...gax.CallOption) *InstanceIterator
188 GetInstance(context.Context, *visionaipb.GetInstanceRequest, ...gax.CallOption) (*visionaipb.Instance, error)
189 CreateApplicationInstances(context.Context, *visionaipb.CreateApplicationInstancesRequest, ...gax.CallOption) (*CreateApplicationInstancesOperation, error)
190 CreateApplicationInstancesOperation(name string) *CreateApplicationInstancesOperation
191 DeleteApplicationInstances(context.Context, *visionaipb.DeleteApplicationInstancesRequest, ...gax.CallOption) (*DeleteApplicationInstancesOperation, error)
192 DeleteApplicationInstancesOperation(name string) *DeleteApplicationInstancesOperation
193 UpdateApplicationInstances(context.Context, *visionaipb.UpdateApplicationInstancesRequest, ...gax.CallOption) (*UpdateApplicationInstancesOperation, error)
194 UpdateApplicationInstancesOperation(name string) *UpdateApplicationInstancesOperation
195 ListDrafts(context.Context, *visionaipb.ListDraftsRequest, ...gax.CallOption) *DraftIterator
196 GetDraft(context.Context, *visionaipb.GetDraftRequest, ...gax.CallOption) (*visionaipb.Draft, error)
197 CreateDraft(context.Context, *visionaipb.CreateDraftRequest, ...gax.CallOption) (*CreateDraftOperation, error)
198 CreateDraftOperation(name string) *CreateDraftOperation
199 UpdateDraft(context.Context, *visionaipb.UpdateDraftRequest, ...gax.CallOption) (*UpdateDraftOperation, error)
200 UpdateDraftOperation(name string) *UpdateDraftOperation
201 DeleteDraft(context.Context, *visionaipb.DeleteDraftRequest, ...gax.CallOption) (*DeleteDraftOperation, error)
202 DeleteDraftOperation(name string) *DeleteDraftOperation
203 ListProcessors(context.Context, *visionaipb.ListProcessorsRequest, ...gax.CallOption) *ProcessorIterator
204 ListPrebuiltProcessors(context.Context, *visionaipb.ListPrebuiltProcessorsRequest, ...gax.CallOption) (*visionaipb.ListPrebuiltProcessorsResponse, error)
205 GetProcessor(context.Context, *visionaipb.GetProcessorRequest, ...gax.CallOption) (*visionaipb.Processor, error)
206 CreateProcessor(context.Context, *visionaipb.CreateProcessorRequest, ...gax.CallOption) (*CreateProcessorOperation, error)
207 CreateProcessorOperation(name string) *CreateProcessorOperation
208 UpdateProcessor(context.Context, *visionaipb.UpdateProcessorRequest, ...gax.CallOption) (*UpdateProcessorOperation, error)
209 UpdateProcessorOperation(name string) *UpdateProcessorOperation
210 DeleteProcessor(context.Context, *visionaipb.DeleteProcessorRequest, ...gax.CallOption) (*DeleteProcessorOperation, error)
211 DeleteProcessorOperation(name string) *DeleteProcessorOperation
212 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
213 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
214 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
215 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
216 }
217
218 // AppPlatformClient is a client for interacting with Vision AI API.
219 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
220 //
221 // Service describing handlers for resources
222 type AppPlatformClient struct {
223 // The internal transport-dependent client.
224 internalClient internalAppPlatformClient
225
226 // The call options for this service.
227 CallOptions *AppPlatformCallOptions
228
229 // LROClient is used internally to handle long-running operations.
230 // It is exposed so that its CallOptions can be modified if required.
231 // Users should not Close this client.
232 LROClient *lroauto.OperationsClient
233 }
234
235 // Wrapper methods routed to the internal client.
236
237 // Close closes the connection to the API service. The user should invoke this when
238 // the client is no longer required.
239 func (c *AppPlatformClient) Close() error {
240 return c.internalClient.Close()
241 }
242
243 // setGoogleClientInfo sets the name and version of the application in
244 // the `x-goog-api-client` header passed on each request. Intended for
245 // use by Google-written clients.
246 func (c *AppPlatformClient) setGoogleClientInfo(keyval ...string) {
247 c.internalClient.setGoogleClientInfo(keyval...)
248 }
249
250 // Connection returns a connection to the API service.
251 //
252 // Deprecated: Connections are now pooled so this method does not always
253 // return the same resource.
254 func (c *AppPlatformClient) Connection() *grpc.ClientConn {
255 return c.internalClient.Connection()
256 }
257
258 // ListApplications lists Applications in a given project and location.
259 func (c *AppPlatformClient) ListApplications(ctx context.Context, req *visionaipb.ListApplicationsRequest, opts ...gax.CallOption) *ApplicationIterator {
260 return c.internalClient.ListApplications(ctx, req, opts...)
261 }
262
263 // GetApplication gets details of a single Application.
264 func (c *AppPlatformClient) GetApplication(ctx context.Context, req *visionaipb.GetApplicationRequest, opts ...gax.CallOption) (*visionaipb.Application, error) {
265 return c.internalClient.GetApplication(ctx, req, opts...)
266 }
267
268 // CreateApplication creates a new Application in a given project and location.
269 func (c *AppPlatformClient) CreateApplication(ctx context.Context, req *visionaipb.CreateApplicationRequest, opts ...gax.CallOption) (*CreateApplicationOperation, error) {
270 return c.internalClient.CreateApplication(ctx, req, opts...)
271 }
272
273 // CreateApplicationOperation returns a new CreateApplicationOperation from a given name.
274 // The name must be that of a previously created CreateApplicationOperation, possibly from a different process.
275 func (c *AppPlatformClient) CreateApplicationOperation(name string) *CreateApplicationOperation {
276 return c.internalClient.CreateApplicationOperation(name)
277 }
278
279 // UpdateApplication updates the parameters of a single Application.
280 func (c *AppPlatformClient) UpdateApplication(ctx context.Context, req *visionaipb.UpdateApplicationRequest, opts ...gax.CallOption) (*UpdateApplicationOperation, error) {
281 return c.internalClient.UpdateApplication(ctx, req, opts...)
282 }
283
284 // UpdateApplicationOperation returns a new UpdateApplicationOperation from a given name.
285 // The name must be that of a previously created UpdateApplicationOperation, possibly from a different process.
286 func (c *AppPlatformClient) UpdateApplicationOperation(name string) *UpdateApplicationOperation {
287 return c.internalClient.UpdateApplicationOperation(name)
288 }
289
290 // DeleteApplication deletes a single Application.
291 func (c *AppPlatformClient) DeleteApplication(ctx context.Context, req *visionaipb.DeleteApplicationRequest, opts ...gax.CallOption) (*DeleteApplicationOperation, error) {
292 return c.internalClient.DeleteApplication(ctx, req, opts...)
293 }
294
295 // DeleteApplicationOperation returns a new DeleteApplicationOperation from a given name.
296 // The name must be that of a previously created DeleteApplicationOperation, possibly from a different process.
297 func (c *AppPlatformClient) DeleteApplicationOperation(name string) *DeleteApplicationOperation {
298 return c.internalClient.DeleteApplicationOperation(name)
299 }
300
301 // DeployApplication deploys a single Application.
302 func (c *AppPlatformClient) DeployApplication(ctx context.Context, req *visionaipb.DeployApplicationRequest, opts ...gax.CallOption) (*DeployApplicationOperation, error) {
303 return c.internalClient.DeployApplication(ctx, req, opts...)
304 }
305
306 // DeployApplicationOperation returns a new DeployApplicationOperation from a given name.
307 // The name must be that of a previously created DeployApplicationOperation, possibly from a different process.
308 func (c *AppPlatformClient) DeployApplicationOperation(name string) *DeployApplicationOperation {
309 return c.internalClient.DeployApplicationOperation(name)
310 }
311
312 // UndeployApplication undeploys a single Application.
313 func (c *AppPlatformClient) UndeployApplication(ctx context.Context, req *visionaipb.UndeployApplicationRequest, opts ...gax.CallOption) (*UndeployApplicationOperation, error) {
314 return c.internalClient.UndeployApplication(ctx, req, opts...)
315 }
316
317 // UndeployApplicationOperation returns a new UndeployApplicationOperation from a given name.
318 // The name must be that of a previously created UndeployApplicationOperation, possibly from a different process.
319 func (c *AppPlatformClient) UndeployApplicationOperation(name string) *UndeployApplicationOperation {
320 return c.internalClient.UndeployApplicationOperation(name)
321 }
322
323 // AddApplicationStreamInput adds target stream input to the Application.
324 // If the Application is deployed, the corresponding new Application instance
325 // will be created. If the stream has already been in the Application, the RPC
326 // will fail.
327 func (c *AppPlatformClient) AddApplicationStreamInput(ctx context.Context, req *visionaipb.AddApplicationStreamInputRequest, opts ...gax.CallOption) (*AddApplicationStreamInputOperation, error) {
328 return c.internalClient.AddApplicationStreamInput(ctx, req, opts...)
329 }
330
331 // AddApplicationStreamInputOperation returns a new AddApplicationStreamInputOperation from a given name.
332 // The name must be that of a previously created AddApplicationStreamInputOperation, possibly from a different process.
333 func (c *AppPlatformClient) AddApplicationStreamInputOperation(name string) *AddApplicationStreamInputOperation {
334 return c.internalClient.AddApplicationStreamInputOperation(name)
335 }
336
337 // RemoveApplicationStreamInput remove target stream input to the Application, if the Application is
338 // deployed, the corresponding instance based will be deleted. If the stream
339 // is not in the Application, the RPC will fail.
340 func (c *AppPlatformClient) RemoveApplicationStreamInput(ctx context.Context, req *visionaipb.RemoveApplicationStreamInputRequest, opts ...gax.CallOption) (*RemoveApplicationStreamInputOperation, error) {
341 return c.internalClient.RemoveApplicationStreamInput(ctx, req, opts...)
342 }
343
344 // RemoveApplicationStreamInputOperation returns a new RemoveApplicationStreamInputOperation from a given name.
345 // The name must be that of a previously created RemoveApplicationStreamInputOperation, possibly from a different process.
346 func (c *AppPlatformClient) RemoveApplicationStreamInputOperation(name string) *RemoveApplicationStreamInputOperation {
347 return c.internalClient.RemoveApplicationStreamInputOperation(name)
348 }
349
350 // UpdateApplicationStreamInput update target stream input to the Application, if the Application is
351 // deployed, the corresponding instance based will be deployed. For
352 // CreateOrUpdate behavior, set allow_missing to true.
353 func (c *AppPlatformClient) UpdateApplicationStreamInput(ctx context.Context, req *visionaipb.UpdateApplicationStreamInputRequest, opts ...gax.CallOption) (*UpdateApplicationStreamInputOperation, error) {
354 return c.internalClient.UpdateApplicationStreamInput(ctx, req, opts...)
355 }
356
357 // UpdateApplicationStreamInputOperation returns a new UpdateApplicationStreamInputOperation from a given name.
358 // The name must be that of a previously created UpdateApplicationStreamInputOperation, possibly from a different process.
359 func (c *AppPlatformClient) UpdateApplicationStreamInputOperation(name string) *UpdateApplicationStreamInputOperation {
360 return c.internalClient.UpdateApplicationStreamInputOperation(name)
361 }
362
363 // ListInstances lists Instances in a given project and location.
364 func (c *AppPlatformClient) ListInstances(ctx context.Context, req *visionaipb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator {
365 return c.internalClient.ListInstances(ctx, req, opts...)
366 }
367
368 // GetInstance gets details of a single Instance.
369 func (c *AppPlatformClient) GetInstance(ctx context.Context, req *visionaipb.GetInstanceRequest, opts ...gax.CallOption) (*visionaipb.Instance, error) {
370 return c.internalClient.GetInstance(ctx, req, opts...)
371 }
372
373 // CreateApplicationInstances adds target stream input to the Application.
374 // If the Application is deployed, the corresponding new Application instance
375 // will be created. If the stream has already been in the Application, the RPC
376 // will fail.
377 func (c *AppPlatformClient) CreateApplicationInstances(ctx context.Context, req *visionaipb.CreateApplicationInstancesRequest, opts ...gax.CallOption) (*CreateApplicationInstancesOperation, error) {
378 return c.internalClient.CreateApplicationInstances(ctx, req, opts...)
379 }
380
381 // CreateApplicationInstancesOperation returns a new CreateApplicationInstancesOperation from a given name.
382 // The name must be that of a previously created CreateApplicationInstancesOperation, possibly from a different process.
383 func (c *AppPlatformClient) CreateApplicationInstancesOperation(name string) *CreateApplicationInstancesOperation {
384 return c.internalClient.CreateApplicationInstancesOperation(name)
385 }
386
387 // DeleteApplicationInstances remove target stream input to the Application, if the Application is
388 // deployed, the corresponding instance based will be deleted. If the stream
389 // is not in the Application, the RPC will fail.
390 func (c *AppPlatformClient) DeleteApplicationInstances(ctx context.Context, req *visionaipb.DeleteApplicationInstancesRequest, opts ...gax.CallOption) (*DeleteApplicationInstancesOperation, error) {
391 return c.internalClient.DeleteApplicationInstances(ctx, req, opts...)
392 }
393
394 // DeleteApplicationInstancesOperation returns a new DeleteApplicationInstancesOperation from a given name.
395 // The name must be that of a previously created DeleteApplicationInstancesOperation, possibly from a different process.
396 func (c *AppPlatformClient) DeleteApplicationInstancesOperation(name string) *DeleteApplicationInstancesOperation {
397 return c.internalClient.DeleteApplicationInstancesOperation(name)
398 }
399
400 // UpdateApplicationInstances adds target stream input to the Application.
401 // If the Application is deployed, the corresponding new Application instance
402 // will be created. If the stream has already been in the Application, the RPC
403 // will fail.
404 func (c *AppPlatformClient) UpdateApplicationInstances(ctx context.Context, req *visionaipb.UpdateApplicationInstancesRequest, opts ...gax.CallOption) (*UpdateApplicationInstancesOperation, error) {
405 return c.internalClient.UpdateApplicationInstances(ctx, req, opts...)
406 }
407
408 // UpdateApplicationInstancesOperation returns a new UpdateApplicationInstancesOperation from a given name.
409 // The name must be that of a previously created UpdateApplicationInstancesOperation, possibly from a different process.
410 func (c *AppPlatformClient) UpdateApplicationInstancesOperation(name string) *UpdateApplicationInstancesOperation {
411 return c.internalClient.UpdateApplicationInstancesOperation(name)
412 }
413
414 // ListDrafts lists Drafts in a given project and location.
415 func (c *AppPlatformClient) ListDrafts(ctx context.Context, req *visionaipb.ListDraftsRequest, opts ...gax.CallOption) *DraftIterator {
416 return c.internalClient.ListDrafts(ctx, req, opts...)
417 }
418
419 // GetDraft gets details of a single Draft.
420 func (c *AppPlatformClient) GetDraft(ctx context.Context, req *visionaipb.GetDraftRequest, opts ...gax.CallOption) (*visionaipb.Draft, error) {
421 return c.internalClient.GetDraft(ctx, req, opts...)
422 }
423
424 // CreateDraft creates a new Draft in a given project and location.
425 func (c *AppPlatformClient) CreateDraft(ctx context.Context, req *visionaipb.CreateDraftRequest, opts ...gax.CallOption) (*CreateDraftOperation, error) {
426 return c.internalClient.CreateDraft(ctx, req, opts...)
427 }
428
429 // CreateDraftOperation returns a new CreateDraftOperation from a given name.
430 // The name must be that of a previously created CreateDraftOperation, possibly from a different process.
431 func (c *AppPlatformClient) CreateDraftOperation(name string) *CreateDraftOperation {
432 return c.internalClient.CreateDraftOperation(name)
433 }
434
435 // UpdateDraft updates the parameters of a single Draft.
436 func (c *AppPlatformClient) UpdateDraft(ctx context.Context, req *visionaipb.UpdateDraftRequest, opts ...gax.CallOption) (*UpdateDraftOperation, error) {
437 return c.internalClient.UpdateDraft(ctx, req, opts...)
438 }
439
440 // UpdateDraftOperation returns a new UpdateDraftOperation from a given name.
441 // The name must be that of a previously created UpdateDraftOperation, possibly from a different process.
442 func (c *AppPlatformClient) UpdateDraftOperation(name string) *UpdateDraftOperation {
443 return c.internalClient.UpdateDraftOperation(name)
444 }
445
446 // DeleteDraft deletes a single Draft.
447 func (c *AppPlatformClient) DeleteDraft(ctx context.Context, req *visionaipb.DeleteDraftRequest, opts ...gax.CallOption) (*DeleteDraftOperation, error) {
448 return c.internalClient.DeleteDraft(ctx, req, opts...)
449 }
450
451 // DeleteDraftOperation returns a new DeleteDraftOperation from a given name.
452 // The name must be that of a previously created DeleteDraftOperation, possibly from a different process.
453 func (c *AppPlatformClient) DeleteDraftOperation(name string) *DeleteDraftOperation {
454 return c.internalClient.DeleteDraftOperation(name)
455 }
456
457 // ListProcessors lists Processors in a given project and location.
458 func (c *AppPlatformClient) ListProcessors(ctx context.Context, req *visionaipb.ListProcessorsRequest, opts ...gax.CallOption) *ProcessorIterator {
459 return c.internalClient.ListProcessors(ctx, req, opts...)
460 }
461
462 // ListPrebuiltProcessors listPrebuiltProcessors is a custom pass-through verb that Lists Prebuilt
463 // Processors.
464 func (c *AppPlatformClient) ListPrebuiltProcessors(ctx context.Context, req *visionaipb.ListPrebuiltProcessorsRequest, opts ...gax.CallOption) (*visionaipb.ListPrebuiltProcessorsResponse, error) {
465 return c.internalClient.ListPrebuiltProcessors(ctx, req, opts...)
466 }
467
468 // GetProcessor gets details of a single Processor.
469 func (c *AppPlatformClient) GetProcessor(ctx context.Context, req *visionaipb.GetProcessorRequest, opts ...gax.CallOption) (*visionaipb.Processor, error) {
470 return c.internalClient.GetProcessor(ctx, req, opts...)
471 }
472
473 // CreateProcessor creates a new Processor in a given project and location.
474 func (c *AppPlatformClient) CreateProcessor(ctx context.Context, req *visionaipb.CreateProcessorRequest, opts ...gax.CallOption) (*CreateProcessorOperation, error) {
475 return c.internalClient.CreateProcessor(ctx, req, opts...)
476 }
477
478 // CreateProcessorOperation returns a new CreateProcessorOperation from a given name.
479 // The name must be that of a previously created CreateProcessorOperation, possibly from a different process.
480 func (c *AppPlatformClient) CreateProcessorOperation(name string) *CreateProcessorOperation {
481 return c.internalClient.CreateProcessorOperation(name)
482 }
483
484 // UpdateProcessor updates the parameters of a single Processor.
485 func (c *AppPlatformClient) UpdateProcessor(ctx context.Context, req *visionaipb.UpdateProcessorRequest, opts ...gax.CallOption) (*UpdateProcessorOperation, error) {
486 return c.internalClient.UpdateProcessor(ctx, req, opts...)
487 }
488
489 // UpdateProcessorOperation returns a new UpdateProcessorOperation from a given name.
490 // The name must be that of a previously created UpdateProcessorOperation, possibly from a different process.
491 func (c *AppPlatformClient) UpdateProcessorOperation(name string) *UpdateProcessorOperation {
492 return c.internalClient.UpdateProcessorOperation(name)
493 }
494
495 // DeleteProcessor deletes a single Processor.
496 func (c *AppPlatformClient) DeleteProcessor(ctx context.Context, req *visionaipb.DeleteProcessorRequest, opts ...gax.CallOption) (*DeleteProcessorOperation, error) {
497 return c.internalClient.DeleteProcessor(ctx, req, opts...)
498 }
499
500 // DeleteProcessorOperation returns a new DeleteProcessorOperation from a given name.
501 // The name must be that of a previously created DeleteProcessorOperation, possibly from a different process.
502 func (c *AppPlatformClient) DeleteProcessorOperation(name string) *DeleteProcessorOperation {
503 return c.internalClient.DeleteProcessorOperation(name)
504 }
505
506 // CancelOperation is a utility method from google.longrunning.Operations.
507 func (c *AppPlatformClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
508 return c.internalClient.CancelOperation(ctx, req, opts...)
509 }
510
511 // DeleteOperation is a utility method from google.longrunning.Operations.
512 func (c *AppPlatformClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
513 return c.internalClient.DeleteOperation(ctx, req, opts...)
514 }
515
516 // GetOperation is a utility method from google.longrunning.Operations.
517 func (c *AppPlatformClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
518 return c.internalClient.GetOperation(ctx, req, opts...)
519 }
520
521 // ListOperations is a utility method from google.longrunning.Operations.
522 func (c *AppPlatformClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
523 return c.internalClient.ListOperations(ctx, req, opts...)
524 }
525
526 // appPlatformGRPCClient is a client for interacting with Vision AI API over gRPC transport.
527 //
528 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
529 type appPlatformGRPCClient struct {
530 // Connection pool of gRPC connections to the service.
531 connPool gtransport.ConnPool
532
533 // Points back to the CallOptions field of the containing AppPlatformClient
534 CallOptions **AppPlatformCallOptions
535
536 // The gRPC API client.
537 appPlatformClient visionaipb.AppPlatformClient
538
539 // LROClient is used internally to handle long-running operations.
540 // It is exposed so that its CallOptions can be modified if required.
541 // Users should not Close this client.
542 LROClient **lroauto.OperationsClient
543
544 operationsClient longrunningpb.OperationsClient
545
546 // The x-goog-* metadata to be sent with each request.
547 xGoogHeaders []string
548
549 logger *slog.Logger
550 }
551
552 // NewAppPlatformClient creates a new app platform client based on gRPC.
553 // The returned client must be Closed when it is done being used to clean up its underlying connections.
554 //
555 // Service describing handlers for resources
556 func NewAppPlatformClient(ctx context.Context, opts ...option.ClientOption) (*AppPlatformClient, error) {
557 clientOpts := defaultAppPlatformGRPCClientOptions()
558 if newAppPlatformClientHook != nil {
559 hookOpts, err := newAppPlatformClientHook(ctx, clientHookParams{})
560 if err != nil {
561 return nil, err
562 }
563 clientOpts = append(clientOpts, hookOpts...)
564 }
565
566 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
567 if err != nil {
568 return nil, err
569 }
570 client := AppPlatformClient{CallOptions: defaultAppPlatformCallOptions()}
571
572 c := &appPlatformGRPCClient{
573 connPool: connPool,
574 appPlatformClient: visionaipb.NewAppPlatformClient(connPool),
575 CallOptions: &client.CallOptions,
576 logger: internaloption.GetLogger(opts),
577 operationsClient: longrunningpb.NewOperationsClient(connPool),
578 }
579 c.setGoogleClientInfo()
580
581 client.internalClient = c
582
583 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
584 if err != nil {
585 // This error "should not happen", since we are just reusing old connection pool
586 // and never actually need to dial.
587 // If this does happen, we could leak connp. However, we cannot close conn:
588 // If the user invoked the constructor with option.WithGRPCConn,
589 // we would close a connection that's still in use.
590 // TODO: investigate error conditions.
591 return nil, err
592 }
593 c.LROClient = &client.LROClient
594 return &client, nil
595 }
596
597 // Connection returns a connection to the API service.
598 //
599 // Deprecated: Connections are now pooled so this method does not always
600 // return the same resource.
601 func (c *appPlatformGRPCClient) Connection() *grpc.ClientConn {
602 return c.connPool.Conn()
603 }
604
605 // setGoogleClientInfo sets the name and version of the application in
606 // the `x-goog-api-client` header passed on each request. Intended for
607 // use by Google-written clients.
608 func (c *appPlatformGRPCClient) setGoogleClientInfo(keyval ...string) {
609 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
610 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
611 c.xGoogHeaders = []string{
612 "x-goog-api-client", gax.XGoogHeader(kv...),
613 }
614 }
615
616 // Close closes the connection to the API service. The user should invoke this when
617 // the client is no longer required.
618 func (c *appPlatformGRPCClient) Close() error {
619 return c.connPool.Close()
620 }
621
622 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
623 type appPlatformRESTClient struct {
624 // The http endpoint to connect to.
625 endpoint string
626
627 // The http client.
628 httpClient *http.Client
629
630 // LROClient is used internally to handle long-running operations.
631 // It is exposed so that its CallOptions can be modified if required.
632 // Users should not Close this client.
633 LROClient **lroauto.OperationsClient
634
635 // The x-goog-* headers to be sent with each request.
636 xGoogHeaders []string
637
638 // Points back to the CallOptions field of the containing AppPlatformClient
639 CallOptions **AppPlatformCallOptions
640
641 logger *slog.Logger
642 }
643
644 // NewAppPlatformRESTClient creates a new app platform rest client.
645 //
646 // Service describing handlers for resources
647 func NewAppPlatformRESTClient(ctx context.Context, opts ...option.ClientOption) (*AppPlatformClient, error) {
648 clientOpts := append(defaultAppPlatformRESTClientOptions(), opts...)
649 httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
650 if err != nil {
651 return nil, err
652 }
653
654 callOpts := defaultAppPlatformRESTCallOptions()
655 c := &appPlatformRESTClient{
656 endpoint: endpoint,
657 httpClient: httpClient,
658 CallOptions: &callOpts,
659 logger: internaloption.GetLogger(opts),
660 }
661 c.setGoogleClientInfo()
662
663 lroOpts := []option.ClientOption{
664 option.WithHTTPClient(httpClient),
665 option.WithEndpoint(endpoint),
666 }
667 opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
668 if err != nil {
669 return nil, err
670 }
671 c.LROClient = &opClient
672
673 return &AppPlatformClient{internalClient: c, CallOptions: callOpts}, nil
674 }
675
676 func defaultAppPlatformRESTClientOptions() []option.ClientOption {
677 return []option.ClientOption{
678 internaloption.WithDefaultEndpoint("https://visionai.googleapis.com"),
679 internaloption.WithDefaultEndpointTemplate("https://visionai.UNIVERSE_DOMAIN"),
680 internaloption.WithDefaultMTLSEndpoint("https://visionai.mtls.googleapis.com"),
681 internaloption.WithDefaultUniverseDomain("googleapis.com"),
682 internaloption.WithDefaultAudience("https://visionai.googleapis.com/"),
683 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
684 internaloption.EnableNewAuthLibrary(),
685 }
686 }
687
688 // setGoogleClientInfo sets the name and version of the application in
689 // the `x-goog-api-client` header passed on each request. Intended for
690 // use by Google-written clients.
691 func (c *appPlatformRESTClient) setGoogleClientInfo(keyval ...string) {
692 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
693 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion)
694 c.xGoogHeaders = []string{
695 "x-goog-api-client", gax.XGoogHeader(kv...),
696 }
697 }
698
699 // Close closes the connection to the API service. The user should invoke this when
700 // the client is no longer required.
701 func (c *appPlatformRESTClient) Close() error {
702 // Replace httpClient with nil to force cleanup.
703 c.httpClient = nil
704 return nil
705 }
706
707 // Connection returns a connection to the API service.
708 //
709 // Deprecated: This method always returns nil.
710 func (c *appPlatformRESTClient) Connection() *grpc.ClientConn {
711 return nil
712 }
713 func (c *appPlatformGRPCClient) ListApplications(ctx context.Context, req *visionaipb.ListApplicationsRequest, opts ...gax.CallOption) *ApplicationIterator {
714 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
715
716 hds = append(c.xGoogHeaders, hds...)
717 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
718 opts = append((*c.CallOptions).ListApplications[0:len((*c.CallOptions).ListApplications):len((*c.CallOptions).ListApplications)], opts...)
719 it := &ApplicationIterator{}
720 req = proto.Clone(req).(*visionaipb.ListApplicationsRequest)
721 it.InternalFetch = func(pageSize int, pageToken string) ([]*visionaipb.Application, string, error) {
722 resp := &visionaipb.ListApplicationsResponse{}
723 if pageToken != "" {
724 req.PageToken = pageToken
725 }
726 if pageSize > math.MaxInt32 {
727 req.PageSize = math.MaxInt32
728 } else if pageSize != 0 {
729 req.PageSize = int32(pageSize)
730 }
731 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
732 var err error
733 resp, err = executeRPC(ctx, c.appPlatformClient.ListApplications, req, settings.GRPC, c.logger, "ListApplications")
734 return err
735 }, opts...)
736 if err != nil {
737 return nil, "", err
738 }
739
740 it.Response = resp
741 return resp.GetApplications(), resp.GetNextPageToken(), nil
742 }
743 fetch := func(pageSize int, pageToken string) (string, error) {
744 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
745 if err != nil {
746 return "", err
747 }
748 it.items = append(it.items, items...)
749 return nextPageToken, nil
750 }
751
752 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
753 it.pageInfo.MaxSize = int(req.GetPageSize())
754 it.pageInfo.Token = req.GetPageToken()
755
756 return it
757 }
758
759 func (c *appPlatformGRPCClient) GetApplication(ctx context.Context, req *visionaipb.GetApplicationRequest, opts ...gax.CallOption) (*visionaipb.Application, error) {
760 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
761
762 hds = append(c.xGoogHeaders, hds...)
763 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
764 opts = append((*c.CallOptions).GetApplication[0:len((*c.CallOptions).GetApplication):len((*c.CallOptions).GetApplication)], opts...)
765 var resp *visionaipb.Application
766 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
767 var err error
768 resp, err = executeRPC(ctx, c.appPlatformClient.GetApplication, req, settings.GRPC, c.logger, "GetApplication")
769 return err
770 }, opts...)
771 if err != nil {
772 return nil, err
773 }
774 return resp, nil
775 }
776
777 func (c *appPlatformGRPCClient) CreateApplication(ctx context.Context, req *visionaipb.CreateApplicationRequest, opts ...gax.CallOption) (*CreateApplicationOperation, error) {
778 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
779
780 hds = append(c.xGoogHeaders, hds...)
781 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
782 opts = append((*c.CallOptions).CreateApplication[0:len((*c.CallOptions).CreateApplication):len((*c.CallOptions).CreateApplication)], opts...)
783 var resp *longrunningpb.Operation
784 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
785 var err error
786 resp, err = executeRPC(ctx, c.appPlatformClient.CreateApplication, req, settings.GRPC, c.logger, "CreateApplication")
787 return err
788 }, opts...)
789 if err != nil {
790 return nil, err
791 }
792 return &CreateApplicationOperation{
793 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
794 }, nil
795 }
796
797 func (c *appPlatformGRPCClient) UpdateApplication(ctx context.Context, req *visionaipb.UpdateApplicationRequest, opts ...gax.CallOption) (*UpdateApplicationOperation, error) {
798 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "application.name", url.QueryEscape(req.GetApplication().GetName()))}
799
800 hds = append(c.xGoogHeaders, hds...)
801 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
802 opts = append((*c.CallOptions).UpdateApplication[0:len((*c.CallOptions).UpdateApplication):len((*c.CallOptions).UpdateApplication)], opts...)
803 var resp *longrunningpb.Operation
804 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
805 var err error
806 resp, err = executeRPC(ctx, c.appPlatformClient.UpdateApplication, req, settings.GRPC, c.logger, "UpdateApplication")
807 return err
808 }, opts...)
809 if err != nil {
810 return nil, err
811 }
812 return &UpdateApplicationOperation{
813 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
814 }, nil
815 }
816
817 func (c *appPlatformGRPCClient) DeleteApplication(ctx context.Context, req *visionaipb.DeleteApplicationRequest, opts ...gax.CallOption) (*DeleteApplicationOperation, error) {
818 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
819
820 hds = append(c.xGoogHeaders, hds...)
821 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
822 opts = append((*c.CallOptions).DeleteApplication[0:len((*c.CallOptions).DeleteApplication):len((*c.CallOptions).DeleteApplication)], opts...)
823 var resp *longrunningpb.Operation
824 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
825 var err error
826 resp, err = executeRPC(ctx, c.appPlatformClient.DeleteApplication, req, settings.GRPC, c.logger, "DeleteApplication")
827 return err
828 }, opts...)
829 if err != nil {
830 return nil, err
831 }
832 return &DeleteApplicationOperation{
833 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
834 }, nil
835 }
836
837 func (c *appPlatformGRPCClient) DeployApplication(ctx context.Context, req *visionaipb.DeployApplicationRequest, opts ...gax.CallOption) (*DeployApplicationOperation, error) {
838 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
839
840 hds = append(c.xGoogHeaders, hds...)
841 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
842 opts = append((*c.CallOptions).DeployApplication[0:len((*c.CallOptions).DeployApplication):len((*c.CallOptions).DeployApplication)], opts...)
843 var resp *longrunningpb.Operation
844 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
845 var err error
846 resp, err = executeRPC(ctx, c.appPlatformClient.DeployApplication, req, settings.GRPC, c.logger, "DeployApplication")
847 return err
848 }, opts...)
849 if err != nil {
850 return nil, err
851 }
852 return &DeployApplicationOperation{
853 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
854 }, nil
855 }
856
857 func (c *appPlatformGRPCClient) UndeployApplication(ctx context.Context, req *visionaipb.UndeployApplicationRequest, opts ...gax.CallOption) (*UndeployApplicationOperation, error) {
858 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
859
860 hds = append(c.xGoogHeaders, hds...)
861 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
862 opts = append((*c.CallOptions).UndeployApplication[0:len((*c.CallOptions).UndeployApplication):len((*c.CallOptions).UndeployApplication)], opts...)
863 var resp *longrunningpb.Operation
864 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
865 var err error
866 resp, err = executeRPC(ctx, c.appPlatformClient.UndeployApplication, req, settings.GRPC, c.logger, "UndeployApplication")
867 return err
868 }, opts...)
869 if err != nil {
870 return nil, err
871 }
872 return &UndeployApplicationOperation{
873 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
874 }, nil
875 }
876
877 func (c *appPlatformGRPCClient) AddApplicationStreamInput(ctx context.Context, req *visionaipb.AddApplicationStreamInputRequest, opts ...gax.CallOption) (*AddApplicationStreamInputOperation, error) {
878 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
879
880 hds = append(c.xGoogHeaders, hds...)
881 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
882 opts = append((*c.CallOptions).AddApplicationStreamInput[0:len((*c.CallOptions).AddApplicationStreamInput):len((*c.CallOptions).AddApplicationStreamInput)], opts...)
883 var resp *longrunningpb.Operation
884 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
885 var err error
886 resp, err = executeRPC(ctx, c.appPlatformClient.AddApplicationStreamInput, req, settings.GRPC, c.logger, "AddApplicationStreamInput")
887 return err
888 }, opts...)
889 if err != nil {
890 return nil, err
891 }
892 return &AddApplicationStreamInputOperation{
893 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
894 }, nil
895 }
896
897 func (c *appPlatformGRPCClient) RemoveApplicationStreamInput(ctx context.Context, req *visionaipb.RemoveApplicationStreamInputRequest, opts ...gax.CallOption) (*RemoveApplicationStreamInputOperation, error) {
898 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
899
900 hds = append(c.xGoogHeaders, hds...)
901 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
902 opts = append((*c.CallOptions).RemoveApplicationStreamInput[0:len((*c.CallOptions).RemoveApplicationStreamInput):len((*c.CallOptions).RemoveApplicationStreamInput)], opts...)
903 var resp *longrunningpb.Operation
904 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
905 var err error
906 resp, err = executeRPC(ctx, c.appPlatformClient.RemoveApplicationStreamInput, req, settings.GRPC, c.logger, "RemoveApplicationStreamInput")
907 return err
908 }, opts...)
909 if err != nil {
910 return nil, err
911 }
912 return &RemoveApplicationStreamInputOperation{
913 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
914 }, nil
915 }
916
917 func (c *appPlatformGRPCClient) UpdateApplicationStreamInput(ctx context.Context, req *visionaipb.UpdateApplicationStreamInputRequest, opts ...gax.CallOption) (*UpdateApplicationStreamInputOperation, error) {
918 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
919
920 hds = append(c.xGoogHeaders, hds...)
921 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
922 opts = append((*c.CallOptions).UpdateApplicationStreamInput[0:len((*c.CallOptions).UpdateApplicationStreamInput):len((*c.CallOptions).UpdateApplicationStreamInput)], opts...)
923 var resp *longrunningpb.Operation
924 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
925 var err error
926 resp, err = executeRPC(ctx, c.appPlatformClient.UpdateApplicationStreamInput, req, settings.GRPC, c.logger, "UpdateApplicationStreamInput")
927 return err
928 }, opts...)
929 if err != nil {
930 return nil, err
931 }
932 return &UpdateApplicationStreamInputOperation{
933 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
934 }, nil
935 }
936
937 func (c *appPlatformGRPCClient) ListInstances(ctx context.Context, req *visionaipb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator {
938 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
939
940 hds = append(c.xGoogHeaders, hds...)
941 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
942 opts = append((*c.CallOptions).ListInstances[0:len((*c.CallOptions).ListInstances):len((*c.CallOptions).ListInstances)], opts...)
943 it := &InstanceIterator{}
944 req = proto.Clone(req).(*visionaipb.ListInstancesRequest)
945 it.InternalFetch = func(pageSize int, pageToken string) ([]*visionaipb.Instance, string, error) {
946 resp := &visionaipb.ListInstancesResponse{}
947 if pageToken != "" {
948 req.PageToken = pageToken
949 }
950 if pageSize > math.MaxInt32 {
951 req.PageSize = math.MaxInt32
952 } else if pageSize != 0 {
953 req.PageSize = int32(pageSize)
954 }
955 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
956 var err error
957 resp, err = executeRPC(ctx, c.appPlatformClient.ListInstances, req, settings.GRPC, c.logger, "ListInstances")
958 return err
959 }, opts...)
960 if err != nil {
961 return nil, "", err
962 }
963
964 it.Response = resp
965 return resp.GetInstances(), resp.GetNextPageToken(), nil
966 }
967 fetch := func(pageSize int, pageToken string) (string, error) {
968 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
969 if err != nil {
970 return "", err
971 }
972 it.items = append(it.items, items...)
973 return nextPageToken, nil
974 }
975
976 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
977 it.pageInfo.MaxSize = int(req.GetPageSize())
978 it.pageInfo.Token = req.GetPageToken()
979
980 return it
981 }
982
983 func (c *appPlatformGRPCClient) GetInstance(ctx context.Context, req *visionaipb.GetInstanceRequest, opts ...gax.CallOption) (*visionaipb.Instance, error) {
984 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
985
986 hds = append(c.xGoogHeaders, hds...)
987 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
988 opts = append((*c.CallOptions).GetInstance[0:len((*c.CallOptions).GetInstance):len((*c.CallOptions).GetInstance)], opts...)
989 var resp *visionaipb.Instance
990 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
991 var err error
992 resp, err = executeRPC(ctx, c.appPlatformClient.GetInstance, req, settings.GRPC, c.logger, "GetInstance")
993 return err
994 }, opts...)
995 if err != nil {
996 return nil, err
997 }
998 return resp, nil
999 }
1000
1001 func (c *appPlatformGRPCClient) CreateApplicationInstances(ctx context.Context, req *visionaipb.CreateApplicationInstancesRequest, opts ...gax.CallOption) (*CreateApplicationInstancesOperation, error) {
1002 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1003
1004 hds = append(c.xGoogHeaders, hds...)
1005 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1006 opts = append((*c.CallOptions).CreateApplicationInstances[0:len((*c.CallOptions).CreateApplicationInstances):len((*c.CallOptions).CreateApplicationInstances)], opts...)
1007 var resp *longrunningpb.Operation
1008 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1009 var err error
1010 resp, err = executeRPC(ctx, c.appPlatformClient.CreateApplicationInstances, req, settings.GRPC, c.logger, "CreateApplicationInstances")
1011 return err
1012 }, opts...)
1013 if err != nil {
1014 return nil, err
1015 }
1016 return &CreateApplicationInstancesOperation{
1017 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1018 }, nil
1019 }
1020
1021 func (c *appPlatformGRPCClient) DeleteApplicationInstances(ctx context.Context, req *visionaipb.DeleteApplicationInstancesRequest, opts ...gax.CallOption) (*DeleteApplicationInstancesOperation, error) {
1022 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1023
1024 hds = append(c.xGoogHeaders, hds...)
1025 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1026 opts = append((*c.CallOptions).DeleteApplicationInstances[0:len((*c.CallOptions).DeleteApplicationInstances):len((*c.CallOptions).DeleteApplicationInstances)], opts...)
1027 var resp *longrunningpb.Operation
1028 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1029 var err error
1030 resp, err = executeRPC(ctx, c.appPlatformClient.DeleteApplicationInstances, req, settings.GRPC, c.logger, "DeleteApplicationInstances")
1031 return err
1032 }, opts...)
1033 if err != nil {
1034 return nil, err
1035 }
1036 return &DeleteApplicationInstancesOperation{
1037 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1038 }, nil
1039 }
1040
1041 func (c *appPlatformGRPCClient) UpdateApplicationInstances(ctx context.Context, req *visionaipb.UpdateApplicationInstancesRequest, opts ...gax.CallOption) (*UpdateApplicationInstancesOperation, error) {
1042 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1043
1044 hds = append(c.xGoogHeaders, hds...)
1045 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1046 opts = append((*c.CallOptions).UpdateApplicationInstances[0:len((*c.CallOptions).UpdateApplicationInstances):len((*c.CallOptions).UpdateApplicationInstances)], opts...)
1047 var resp *longrunningpb.Operation
1048 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1049 var err error
1050 resp, err = executeRPC(ctx, c.appPlatformClient.UpdateApplicationInstances, req, settings.GRPC, c.logger, "UpdateApplicationInstances")
1051 return err
1052 }, opts...)
1053 if err != nil {
1054 return nil, err
1055 }
1056 return &UpdateApplicationInstancesOperation{
1057 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1058 }, nil
1059 }
1060
1061 func (c *appPlatformGRPCClient) ListDrafts(ctx context.Context, req *visionaipb.ListDraftsRequest, opts ...gax.CallOption) *DraftIterator {
1062 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1063
1064 hds = append(c.xGoogHeaders, hds...)
1065 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1066 opts = append((*c.CallOptions).ListDrafts[0:len((*c.CallOptions).ListDrafts):len((*c.CallOptions).ListDrafts)], opts...)
1067 it := &DraftIterator{}
1068 req = proto.Clone(req).(*visionaipb.ListDraftsRequest)
1069 it.InternalFetch = func(pageSize int, pageToken string) ([]*visionaipb.Draft, string, error) {
1070 resp := &visionaipb.ListDraftsResponse{}
1071 if pageToken != "" {
1072 req.PageToken = pageToken
1073 }
1074 if pageSize > math.MaxInt32 {
1075 req.PageSize = math.MaxInt32
1076 } else if pageSize != 0 {
1077 req.PageSize = int32(pageSize)
1078 }
1079 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1080 var err error
1081 resp, err = executeRPC(ctx, c.appPlatformClient.ListDrafts, req, settings.GRPC, c.logger, "ListDrafts")
1082 return err
1083 }, opts...)
1084 if err != nil {
1085 return nil, "", err
1086 }
1087
1088 it.Response = resp
1089 return resp.GetDrafts(), resp.GetNextPageToken(), nil
1090 }
1091 fetch := func(pageSize int, pageToken string) (string, error) {
1092 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1093 if err != nil {
1094 return "", err
1095 }
1096 it.items = append(it.items, items...)
1097 return nextPageToken, nil
1098 }
1099
1100 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1101 it.pageInfo.MaxSize = int(req.GetPageSize())
1102 it.pageInfo.Token = req.GetPageToken()
1103
1104 return it
1105 }
1106
1107 func (c *appPlatformGRPCClient) GetDraft(ctx context.Context, req *visionaipb.GetDraftRequest, opts ...gax.CallOption) (*visionaipb.Draft, error) {
1108 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1109
1110 hds = append(c.xGoogHeaders, hds...)
1111 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1112 opts = append((*c.CallOptions).GetDraft[0:len((*c.CallOptions).GetDraft):len((*c.CallOptions).GetDraft)], opts...)
1113 var resp *visionaipb.Draft
1114 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1115 var err error
1116 resp, err = executeRPC(ctx, c.appPlatformClient.GetDraft, req, settings.GRPC, c.logger, "GetDraft")
1117 return err
1118 }, opts...)
1119 if err != nil {
1120 return nil, err
1121 }
1122 return resp, nil
1123 }
1124
1125 func (c *appPlatformGRPCClient) CreateDraft(ctx context.Context, req *visionaipb.CreateDraftRequest, opts ...gax.CallOption) (*CreateDraftOperation, error) {
1126 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1127
1128 hds = append(c.xGoogHeaders, hds...)
1129 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1130 opts = append((*c.CallOptions).CreateDraft[0:len((*c.CallOptions).CreateDraft):len((*c.CallOptions).CreateDraft)], opts...)
1131 var resp *longrunningpb.Operation
1132 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1133 var err error
1134 resp, err = executeRPC(ctx, c.appPlatformClient.CreateDraft, req, settings.GRPC, c.logger, "CreateDraft")
1135 return err
1136 }, opts...)
1137 if err != nil {
1138 return nil, err
1139 }
1140 return &CreateDraftOperation{
1141 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1142 }, nil
1143 }
1144
1145 func (c *appPlatformGRPCClient) UpdateDraft(ctx context.Context, req *visionaipb.UpdateDraftRequest, opts ...gax.CallOption) (*UpdateDraftOperation, error) {
1146 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "draft.name", url.QueryEscape(req.GetDraft().GetName()))}
1147
1148 hds = append(c.xGoogHeaders, hds...)
1149 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1150 opts = append((*c.CallOptions).UpdateDraft[0:len((*c.CallOptions).UpdateDraft):len((*c.CallOptions).UpdateDraft)], opts...)
1151 var resp *longrunningpb.Operation
1152 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1153 var err error
1154 resp, err = executeRPC(ctx, c.appPlatformClient.UpdateDraft, req, settings.GRPC, c.logger, "UpdateDraft")
1155 return err
1156 }, opts...)
1157 if err != nil {
1158 return nil, err
1159 }
1160 return &UpdateDraftOperation{
1161 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1162 }, nil
1163 }
1164
1165 func (c *appPlatformGRPCClient) DeleteDraft(ctx context.Context, req *visionaipb.DeleteDraftRequest, opts ...gax.CallOption) (*DeleteDraftOperation, error) {
1166 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1167
1168 hds = append(c.xGoogHeaders, hds...)
1169 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1170 opts = append((*c.CallOptions).DeleteDraft[0:len((*c.CallOptions).DeleteDraft):len((*c.CallOptions).DeleteDraft)], opts...)
1171 var resp *longrunningpb.Operation
1172 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1173 var err error
1174 resp, err = executeRPC(ctx, c.appPlatformClient.DeleteDraft, req, settings.GRPC, c.logger, "DeleteDraft")
1175 return err
1176 }, opts...)
1177 if err != nil {
1178 return nil, err
1179 }
1180 return &DeleteDraftOperation{
1181 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1182 }, nil
1183 }
1184
1185 func (c *appPlatformGRPCClient) ListProcessors(ctx context.Context, req *visionaipb.ListProcessorsRequest, opts ...gax.CallOption) *ProcessorIterator {
1186 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1187
1188 hds = append(c.xGoogHeaders, hds...)
1189 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1190 opts = append((*c.CallOptions).ListProcessors[0:len((*c.CallOptions).ListProcessors):len((*c.CallOptions).ListProcessors)], opts...)
1191 it := &ProcessorIterator{}
1192 req = proto.Clone(req).(*visionaipb.ListProcessorsRequest)
1193 it.InternalFetch = func(pageSize int, pageToken string) ([]*visionaipb.Processor, string, error) {
1194 resp := &visionaipb.ListProcessorsResponse{}
1195 if pageToken != "" {
1196 req.PageToken = pageToken
1197 }
1198 if pageSize > math.MaxInt32 {
1199 req.PageSize = math.MaxInt32
1200 } else if pageSize != 0 {
1201 req.PageSize = int32(pageSize)
1202 }
1203 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1204 var err error
1205 resp, err = executeRPC(ctx, c.appPlatformClient.ListProcessors, req, settings.GRPC, c.logger, "ListProcessors")
1206 return err
1207 }, opts...)
1208 if err != nil {
1209 return nil, "", err
1210 }
1211
1212 it.Response = resp
1213 return resp.GetProcessors(), resp.GetNextPageToken(), nil
1214 }
1215 fetch := func(pageSize int, pageToken string) (string, error) {
1216 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1217 if err != nil {
1218 return "", err
1219 }
1220 it.items = append(it.items, items...)
1221 return nextPageToken, nil
1222 }
1223
1224 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1225 it.pageInfo.MaxSize = int(req.GetPageSize())
1226 it.pageInfo.Token = req.GetPageToken()
1227
1228 return it
1229 }
1230
1231 func (c *appPlatformGRPCClient) ListPrebuiltProcessors(ctx context.Context, req *visionaipb.ListPrebuiltProcessorsRequest, opts ...gax.CallOption) (*visionaipb.ListPrebuiltProcessorsResponse, error) {
1232 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1233
1234 hds = append(c.xGoogHeaders, hds...)
1235 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1236 opts = append((*c.CallOptions).ListPrebuiltProcessors[0:len((*c.CallOptions).ListPrebuiltProcessors):len((*c.CallOptions).ListPrebuiltProcessors)], opts...)
1237 var resp *visionaipb.ListPrebuiltProcessorsResponse
1238 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1239 var err error
1240 resp, err = executeRPC(ctx, c.appPlatformClient.ListPrebuiltProcessors, req, settings.GRPC, c.logger, "ListPrebuiltProcessors")
1241 return err
1242 }, opts...)
1243 if err != nil {
1244 return nil, err
1245 }
1246 return resp, nil
1247 }
1248
1249 func (c *appPlatformGRPCClient) GetProcessor(ctx context.Context, req *visionaipb.GetProcessorRequest, opts ...gax.CallOption) (*visionaipb.Processor, error) {
1250 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1251
1252 hds = append(c.xGoogHeaders, hds...)
1253 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1254 opts = append((*c.CallOptions).GetProcessor[0:len((*c.CallOptions).GetProcessor):len((*c.CallOptions).GetProcessor)], opts...)
1255 var resp *visionaipb.Processor
1256 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1257 var err error
1258 resp, err = executeRPC(ctx, c.appPlatformClient.GetProcessor, req, settings.GRPC, c.logger, "GetProcessor")
1259 return err
1260 }, opts...)
1261 if err != nil {
1262 return nil, err
1263 }
1264 return resp, nil
1265 }
1266
1267 func (c *appPlatformGRPCClient) CreateProcessor(ctx context.Context, req *visionaipb.CreateProcessorRequest, opts ...gax.CallOption) (*CreateProcessorOperation, error) {
1268 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1269
1270 hds = append(c.xGoogHeaders, hds...)
1271 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1272 opts = append((*c.CallOptions).CreateProcessor[0:len((*c.CallOptions).CreateProcessor):len((*c.CallOptions).CreateProcessor)], opts...)
1273 var resp *longrunningpb.Operation
1274 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1275 var err error
1276 resp, err = executeRPC(ctx, c.appPlatformClient.CreateProcessor, req, settings.GRPC, c.logger, "CreateProcessor")
1277 return err
1278 }, opts...)
1279 if err != nil {
1280 return nil, err
1281 }
1282 return &CreateProcessorOperation{
1283 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1284 }, nil
1285 }
1286
1287 func (c *appPlatformGRPCClient) UpdateProcessor(ctx context.Context, req *visionaipb.UpdateProcessorRequest, opts ...gax.CallOption) (*UpdateProcessorOperation, error) {
1288 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "processor.name", url.QueryEscape(req.GetProcessor().GetName()))}
1289
1290 hds = append(c.xGoogHeaders, hds...)
1291 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1292 opts = append((*c.CallOptions).UpdateProcessor[0:len((*c.CallOptions).UpdateProcessor):len((*c.CallOptions).UpdateProcessor)], opts...)
1293 var resp *longrunningpb.Operation
1294 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1295 var err error
1296 resp, err = executeRPC(ctx, c.appPlatformClient.UpdateProcessor, req, settings.GRPC, c.logger, "UpdateProcessor")
1297 return err
1298 }, opts...)
1299 if err != nil {
1300 return nil, err
1301 }
1302 return &UpdateProcessorOperation{
1303 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1304 }, nil
1305 }
1306
1307 func (c *appPlatformGRPCClient) DeleteProcessor(ctx context.Context, req *visionaipb.DeleteProcessorRequest, opts ...gax.CallOption) (*DeleteProcessorOperation, error) {
1308 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1309
1310 hds = append(c.xGoogHeaders, hds...)
1311 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1312 opts = append((*c.CallOptions).DeleteProcessor[0:len((*c.CallOptions).DeleteProcessor):len((*c.CallOptions).DeleteProcessor)], opts...)
1313 var resp *longrunningpb.Operation
1314 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1315 var err error
1316 resp, err = executeRPC(ctx, c.appPlatformClient.DeleteProcessor, req, settings.GRPC, c.logger, "DeleteProcessor")
1317 return err
1318 }, opts...)
1319 if err != nil {
1320 return nil, err
1321 }
1322 return &DeleteProcessorOperation{
1323 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1324 }, nil
1325 }
1326
1327 func (c *appPlatformGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
1328 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1329
1330 hds = append(c.xGoogHeaders, hds...)
1331 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1332 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
1333 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1334 var err error
1335 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
1336 return err
1337 }, opts...)
1338 return err
1339 }
1340
1341 func (c *appPlatformGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
1342 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1343
1344 hds = append(c.xGoogHeaders, hds...)
1345 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1346 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
1347 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1348 var err error
1349 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
1350 return err
1351 }, opts...)
1352 return err
1353 }
1354
1355 func (c *appPlatformGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
1356 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1357
1358 hds = append(c.xGoogHeaders, hds...)
1359 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1360 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
1361 var resp *longrunningpb.Operation
1362 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1363 var err error
1364 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
1365 return err
1366 }, opts...)
1367 if err != nil {
1368 return nil, err
1369 }
1370 return resp, nil
1371 }
1372
1373 func (c *appPlatformGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
1374 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1375
1376 hds = append(c.xGoogHeaders, hds...)
1377 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1378 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
1379 it := &OperationIterator{}
1380 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
1381 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
1382 resp := &longrunningpb.ListOperationsResponse{}
1383 if pageToken != "" {
1384 req.PageToken = pageToken
1385 }
1386 if pageSize > math.MaxInt32 {
1387 req.PageSize = math.MaxInt32
1388 } else if pageSize != 0 {
1389 req.PageSize = int32(pageSize)
1390 }
1391 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1392 var err error
1393 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
1394 return err
1395 }, opts...)
1396 if err != nil {
1397 return nil, "", err
1398 }
1399
1400 it.Response = resp
1401 return resp.GetOperations(), resp.GetNextPageToken(), nil
1402 }
1403 fetch := func(pageSize int, pageToken string) (string, error) {
1404 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1405 if err != nil {
1406 return "", err
1407 }
1408 it.items = append(it.items, items...)
1409 return nextPageToken, nil
1410 }
1411
1412 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1413 it.pageInfo.MaxSize = int(req.GetPageSize())
1414 it.pageInfo.Token = req.GetPageToken()
1415
1416 return it
1417 }
1418
1419 // ListApplications lists Applications in a given project and location.
1420 func (c *appPlatformRESTClient) ListApplications(ctx context.Context, req *visionaipb.ListApplicationsRequest, opts ...gax.CallOption) *ApplicationIterator {
1421 it := &ApplicationIterator{}
1422 req = proto.Clone(req).(*visionaipb.ListApplicationsRequest)
1423 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1424 it.InternalFetch = func(pageSize int, pageToken string) ([]*visionaipb.Application, string, error) {
1425 resp := &visionaipb.ListApplicationsResponse{}
1426 if pageToken != "" {
1427 req.PageToken = pageToken
1428 }
1429 if pageSize > math.MaxInt32 {
1430 req.PageSize = math.MaxInt32
1431 } else if pageSize != 0 {
1432 req.PageSize = int32(pageSize)
1433 }
1434 baseUrl, err := url.Parse(c.endpoint)
1435 if err != nil {
1436 return nil, "", err
1437 }
1438 baseUrl.Path += fmt.Sprintf("/v1/%v/applications", req.GetParent())
1439
1440 params := url.Values{}
1441 params.Add("$alt", "json;enum-encoding=int")
1442 if req.GetFilter() != "" {
1443 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
1444 }
1445 if req.GetOrderBy() != "" {
1446 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
1447 }
1448 if req.GetPageSize() != 0 {
1449 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
1450 }
1451 if req.GetPageToken() != "" {
1452 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
1453 }
1454
1455 baseUrl.RawQuery = params.Encode()
1456
1457 // Build HTTP headers from client and context metadata.
1458 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
1459 headers := gax.BuildHeaders(ctx, hds...)
1460 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1461 if settings.Path != "" {
1462 baseUrl.Path = settings.Path
1463 }
1464 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1465 if err != nil {
1466 return err
1467 }
1468 httpReq.Header = headers
1469
1470 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListApplications")
1471 if err != nil {
1472 return err
1473 }
1474 if err := unm.Unmarshal(buf, resp); err != nil {
1475 return err
1476 }
1477
1478 return nil
1479 }, opts...)
1480 if e != nil {
1481 return nil, "", e
1482 }
1483 it.Response = resp
1484 return resp.GetApplications(), resp.GetNextPageToken(), nil
1485 }
1486
1487 fetch := func(pageSize int, pageToken string) (string, error) {
1488 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1489 if err != nil {
1490 return "", err
1491 }
1492 it.items = append(it.items, items...)
1493 return nextPageToken, nil
1494 }
1495
1496 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1497 it.pageInfo.MaxSize = int(req.GetPageSize())
1498 it.pageInfo.Token = req.GetPageToken()
1499
1500 return it
1501 }
1502
1503 // GetApplication gets details of a single Application.
1504 func (c *appPlatformRESTClient) GetApplication(ctx context.Context, req *visionaipb.GetApplicationRequest, opts ...gax.CallOption) (*visionaipb.Application, error) {
1505 baseUrl, err := url.Parse(c.endpoint)
1506 if err != nil {
1507 return nil, err
1508 }
1509 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
1510
1511 params := url.Values{}
1512 params.Add("$alt", "json;enum-encoding=int")
1513
1514 baseUrl.RawQuery = params.Encode()
1515
1516 // Build HTTP headers from client and context metadata.
1517 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1518
1519 hds = append(c.xGoogHeaders, hds...)
1520 hds = append(hds, "Content-Type", "application/json")
1521 headers := gax.BuildHeaders(ctx, hds...)
1522 opts = append((*c.CallOptions).GetApplication[0:len((*c.CallOptions).GetApplication):len((*c.CallOptions).GetApplication)], opts...)
1523 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1524 resp := &visionaipb.Application{}
1525 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1526 if settings.Path != "" {
1527 baseUrl.Path = settings.Path
1528 }
1529 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1530 if err != nil {
1531 return err
1532 }
1533 httpReq = httpReq.WithContext(ctx)
1534 httpReq.Header = headers
1535
1536 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetApplication")
1537 if err != nil {
1538 return err
1539 }
1540
1541 if err := unm.Unmarshal(buf, resp); err != nil {
1542 return err
1543 }
1544
1545 return nil
1546 }, opts...)
1547 if e != nil {
1548 return nil, e
1549 }
1550 return resp, nil
1551 }
1552
1553 // CreateApplication creates a new Application in a given project and location.
1554 func (c *appPlatformRESTClient) CreateApplication(ctx context.Context, req *visionaipb.CreateApplicationRequest, opts ...gax.CallOption) (*CreateApplicationOperation, error) {
1555 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1556 body := req.GetApplication()
1557 jsonReq, err := m.Marshal(body)
1558 if err != nil {
1559 return nil, err
1560 }
1561
1562 baseUrl, err := url.Parse(c.endpoint)
1563 if err != nil {
1564 return nil, err
1565 }
1566 baseUrl.Path += fmt.Sprintf("/v1/%v/applications", req.GetParent())
1567
1568 params := url.Values{}
1569 params.Add("$alt", "json;enum-encoding=int")
1570 params.Add("applicationId", fmt.Sprintf("%v", req.GetApplicationId()))
1571 if req.GetRequestId() != "" {
1572 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
1573 }
1574
1575 baseUrl.RawQuery = params.Encode()
1576
1577 // Build HTTP headers from client and context metadata.
1578 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1579
1580 hds = append(c.xGoogHeaders, hds...)
1581 hds = append(hds, "Content-Type", "application/json")
1582 headers := gax.BuildHeaders(ctx, hds...)
1583 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1584 resp := &longrunningpb.Operation{}
1585 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1586 if settings.Path != "" {
1587 baseUrl.Path = settings.Path
1588 }
1589 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1590 if err != nil {
1591 return err
1592 }
1593 httpReq = httpReq.WithContext(ctx)
1594 httpReq.Header = headers
1595
1596 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateApplication")
1597 if err != nil {
1598 return err
1599 }
1600 if err := unm.Unmarshal(buf, resp); err != nil {
1601 return err
1602 }
1603
1604 return nil
1605 }, opts...)
1606 if e != nil {
1607 return nil, e
1608 }
1609
1610 override := fmt.Sprintf("/v1/%s", resp.GetName())
1611 return &CreateApplicationOperation{
1612 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1613 pollPath: override,
1614 }, nil
1615 }
1616
1617 // UpdateApplication updates the parameters of a single Application.
1618 func (c *appPlatformRESTClient) UpdateApplication(ctx context.Context, req *visionaipb.UpdateApplicationRequest, opts ...gax.CallOption) (*UpdateApplicationOperation, error) {
1619 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1620 body := req.GetApplication()
1621 jsonReq, err := m.Marshal(body)
1622 if err != nil {
1623 return nil, err
1624 }
1625
1626 baseUrl, err := url.Parse(c.endpoint)
1627 if err != nil {
1628 return nil, err
1629 }
1630 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetApplication().GetName())
1631
1632 params := url.Values{}
1633 params.Add("$alt", "json;enum-encoding=int")
1634 if req.GetRequestId() != "" {
1635 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
1636 }
1637 if req.GetUpdateMask() != nil {
1638 field, err := protojson.Marshal(req.GetUpdateMask())
1639 if err != nil {
1640 return nil, err
1641 }
1642 params.Add("updateMask", string(field[1:len(field)-1]))
1643 }
1644
1645 baseUrl.RawQuery = params.Encode()
1646
1647 // Build HTTP headers from client and context metadata.
1648 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "application.name", url.QueryEscape(req.GetApplication().GetName()))}
1649
1650 hds = append(c.xGoogHeaders, hds...)
1651 hds = append(hds, "Content-Type", "application/json")
1652 headers := gax.BuildHeaders(ctx, hds...)
1653 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1654 resp := &longrunningpb.Operation{}
1655 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1656 if settings.Path != "" {
1657 baseUrl.Path = settings.Path
1658 }
1659 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
1660 if err != nil {
1661 return err
1662 }
1663 httpReq = httpReq.WithContext(ctx)
1664 httpReq.Header = headers
1665
1666 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateApplication")
1667 if err != nil {
1668 return err
1669 }
1670 if err := unm.Unmarshal(buf, resp); err != nil {
1671 return err
1672 }
1673
1674 return nil
1675 }, opts...)
1676 if e != nil {
1677 return nil, e
1678 }
1679
1680 override := fmt.Sprintf("/v1/%s", resp.GetName())
1681 return &UpdateApplicationOperation{
1682 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1683 pollPath: override,
1684 }, nil
1685 }
1686
1687 // DeleteApplication deletes a single Application.
1688 func (c *appPlatformRESTClient) DeleteApplication(ctx context.Context, req *visionaipb.DeleteApplicationRequest, opts ...gax.CallOption) (*DeleteApplicationOperation, error) {
1689 baseUrl, err := url.Parse(c.endpoint)
1690 if err != nil {
1691 return nil, err
1692 }
1693 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
1694
1695 params := url.Values{}
1696 params.Add("$alt", "json;enum-encoding=int")
1697 if req.GetForce() {
1698 params.Add("force", fmt.Sprintf("%v", req.GetForce()))
1699 }
1700 if req.GetRequestId() != "" {
1701 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
1702 }
1703
1704 baseUrl.RawQuery = params.Encode()
1705
1706 // Build HTTP headers from client and context metadata.
1707 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1708
1709 hds = append(c.xGoogHeaders, hds...)
1710 hds = append(hds, "Content-Type", "application/json")
1711 headers := gax.BuildHeaders(ctx, hds...)
1712 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1713 resp := &longrunningpb.Operation{}
1714 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1715 if settings.Path != "" {
1716 baseUrl.Path = settings.Path
1717 }
1718 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
1719 if err != nil {
1720 return err
1721 }
1722 httpReq = httpReq.WithContext(ctx)
1723 httpReq.Header = headers
1724
1725 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteApplication")
1726 if err != nil {
1727 return err
1728 }
1729 if err := unm.Unmarshal(buf, resp); err != nil {
1730 return err
1731 }
1732
1733 return nil
1734 }, opts...)
1735 if e != nil {
1736 return nil, e
1737 }
1738
1739 override := fmt.Sprintf("/v1/%s", resp.GetName())
1740 return &DeleteApplicationOperation{
1741 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1742 pollPath: override,
1743 }, nil
1744 }
1745
1746 // DeployApplication deploys a single Application.
1747 func (c *appPlatformRESTClient) DeployApplication(ctx context.Context, req *visionaipb.DeployApplicationRequest, opts ...gax.CallOption) (*DeployApplicationOperation, error) {
1748 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1749 jsonReq, err := m.Marshal(req)
1750 if err != nil {
1751 return nil, err
1752 }
1753
1754 baseUrl, err := url.Parse(c.endpoint)
1755 if err != nil {
1756 return nil, err
1757 }
1758 baseUrl.Path += fmt.Sprintf("/v1/%v:deploy", req.GetName())
1759
1760 params := url.Values{}
1761 params.Add("$alt", "json;enum-encoding=int")
1762
1763 baseUrl.RawQuery = params.Encode()
1764
1765 // Build HTTP headers from client and context metadata.
1766 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1767
1768 hds = append(c.xGoogHeaders, hds...)
1769 hds = append(hds, "Content-Type", "application/json")
1770 headers := gax.BuildHeaders(ctx, hds...)
1771 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1772 resp := &longrunningpb.Operation{}
1773 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1774 if settings.Path != "" {
1775 baseUrl.Path = settings.Path
1776 }
1777 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1778 if err != nil {
1779 return err
1780 }
1781 httpReq = httpReq.WithContext(ctx)
1782 httpReq.Header = headers
1783
1784 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "DeployApplication")
1785 if err != nil {
1786 return err
1787 }
1788 if err := unm.Unmarshal(buf, resp); err != nil {
1789 return err
1790 }
1791
1792 return nil
1793 }, opts...)
1794 if e != nil {
1795 return nil, e
1796 }
1797
1798 override := fmt.Sprintf("/v1/%s", resp.GetName())
1799 return &DeployApplicationOperation{
1800 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1801 pollPath: override,
1802 }, nil
1803 }
1804
1805 // UndeployApplication undeploys a single Application.
1806 func (c *appPlatformRESTClient) UndeployApplication(ctx context.Context, req *visionaipb.UndeployApplicationRequest, opts ...gax.CallOption) (*UndeployApplicationOperation, error) {
1807 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1808 jsonReq, err := m.Marshal(req)
1809 if err != nil {
1810 return nil, err
1811 }
1812
1813 baseUrl, err := url.Parse(c.endpoint)
1814 if err != nil {
1815 return nil, err
1816 }
1817 baseUrl.Path += fmt.Sprintf("/v1/%v:undeploy", req.GetName())
1818
1819 params := url.Values{}
1820 params.Add("$alt", "json;enum-encoding=int")
1821
1822 baseUrl.RawQuery = params.Encode()
1823
1824 // Build HTTP headers from client and context metadata.
1825 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1826
1827 hds = append(c.xGoogHeaders, hds...)
1828 hds = append(hds, "Content-Type", "application/json")
1829 headers := gax.BuildHeaders(ctx, hds...)
1830 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1831 resp := &longrunningpb.Operation{}
1832 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1833 if settings.Path != "" {
1834 baseUrl.Path = settings.Path
1835 }
1836 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1837 if err != nil {
1838 return err
1839 }
1840 httpReq = httpReq.WithContext(ctx)
1841 httpReq.Header = headers
1842
1843 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UndeployApplication")
1844 if err != nil {
1845 return err
1846 }
1847 if err := unm.Unmarshal(buf, resp); err != nil {
1848 return err
1849 }
1850
1851 return nil
1852 }, opts...)
1853 if e != nil {
1854 return nil, e
1855 }
1856
1857 override := fmt.Sprintf("/v1/%s", resp.GetName())
1858 return &UndeployApplicationOperation{
1859 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1860 pollPath: override,
1861 }, nil
1862 }
1863
1864 // AddApplicationStreamInput adds target stream input to the Application.
1865 // If the Application is deployed, the corresponding new Application instance
1866 // will be created. If the stream has already been in the Application, the RPC
1867 // will fail.
1868 func (c *appPlatformRESTClient) AddApplicationStreamInput(ctx context.Context, req *visionaipb.AddApplicationStreamInputRequest, opts ...gax.CallOption) (*AddApplicationStreamInputOperation, error) {
1869 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1870 jsonReq, err := m.Marshal(req)
1871 if err != nil {
1872 return nil, err
1873 }
1874
1875 baseUrl, err := url.Parse(c.endpoint)
1876 if err != nil {
1877 return nil, err
1878 }
1879 baseUrl.Path += fmt.Sprintf("/v1/%v:addStreamInput", req.GetName())
1880
1881 params := url.Values{}
1882 params.Add("$alt", "json;enum-encoding=int")
1883
1884 baseUrl.RawQuery = params.Encode()
1885
1886 // Build HTTP headers from client and context metadata.
1887 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1888
1889 hds = append(c.xGoogHeaders, hds...)
1890 hds = append(hds, "Content-Type", "application/json")
1891 headers := gax.BuildHeaders(ctx, hds...)
1892 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1893 resp := &longrunningpb.Operation{}
1894 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1895 if settings.Path != "" {
1896 baseUrl.Path = settings.Path
1897 }
1898 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1899 if err != nil {
1900 return err
1901 }
1902 httpReq = httpReq.WithContext(ctx)
1903 httpReq.Header = headers
1904
1905 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "AddApplicationStreamInput")
1906 if err != nil {
1907 return err
1908 }
1909 if err := unm.Unmarshal(buf, resp); err != nil {
1910 return err
1911 }
1912
1913 return nil
1914 }, opts...)
1915 if e != nil {
1916 return nil, e
1917 }
1918
1919 override := fmt.Sprintf("/v1/%s", resp.GetName())
1920 return &AddApplicationStreamInputOperation{
1921 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1922 pollPath: override,
1923 }, nil
1924 }
1925
1926 // RemoveApplicationStreamInput remove target stream input to the Application, if the Application is
1927 // deployed, the corresponding instance based will be deleted. If the stream
1928 // is not in the Application, the RPC will fail.
1929 func (c *appPlatformRESTClient) RemoveApplicationStreamInput(ctx context.Context, req *visionaipb.RemoveApplicationStreamInputRequest, opts ...gax.CallOption) (*RemoveApplicationStreamInputOperation, error) {
1930 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1931 jsonReq, err := m.Marshal(req)
1932 if err != nil {
1933 return nil, err
1934 }
1935
1936 baseUrl, err := url.Parse(c.endpoint)
1937 if err != nil {
1938 return nil, err
1939 }
1940 baseUrl.Path += fmt.Sprintf("/v1/%v:removeStreamInput", req.GetName())
1941
1942 params := url.Values{}
1943 params.Add("$alt", "json;enum-encoding=int")
1944
1945 baseUrl.RawQuery = params.Encode()
1946
1947 // Build HTTP headers from client and context metadata.
1948 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1949
1950 hds = append(c.xGoogHeaders, hds...)
1951 hds = append(hds, "Content-Type", "application/json")
1952 headers := gax.BuildHeaders(ctx, hds...)
1953 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1954 resp := &longrunningpb.Operation{}
1955 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1956 if settings.Path != "" {
1957 baseUrl.Path = settings.Path
1958 }
1959 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1960 if err != nil {
1961 return err
1962 }
1963 httpReq = httpReq.WithContext(ctx)
1964 httpReq.Header = headers
1965
1966 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "RemoveApplicationStreamInput")
1967 if err != nil {
1968 return err
1969 }
1970 if err := unm.Unmarshal(buf, resp); err != nil {
1971 return err
1972 }
1973
1974 return nil
1975 }, opts...)
1976 if e != nil {
1977 return nil, e
1978 }
1979
1980 override := fmt.Sprintf("/v1/%s", resp.GetName())
1981 return &RemoveApplicationStreamInputOperation{
1982 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1983 pollPath: override,
1984 }, nil
1985 }
1986
1987 // UpdateApplicationStreamInput update target stream input to the Application, if the Application is
1988 // deployed, the corresponding instance based will be deployed. For
1989 // CreateOrUpdate behavior, set allow_missing to true.
1990 func (c *appPlatformRESTClient) UpdateApplicationStreamInput(ctx context.Context, req *visionaipb.UpdateApplicationStreamInputRequest, opts ...gax.CallOption) (*UpdateApplicationStreamInputOperation, error) {
1991 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1992 jsonReq, err := m.Marshal(req)
1993 if err != nil {
1994 return nil, err
1995 }
1996
1997 baseUrl, err := url.Parse(c.endpoint)
1998 if err != nil {
1999 return nil, err
2000 }
2001 baseUrl.Path += fmt.Sprintf("/v1/%v:updateStreamInput", req.GetName())
2002
2003 params := url.Values{}
2004 params.Add("$alt", "json;enum-encoding=int")
2005
2006 baseUrl.RawQuery = params.Encode()
2007
2008 // Build HTTP headers from client and context metadata.
2009 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2010
2011 hds = append(c.xGoogHeaders, hds...)
2012 hds = append(hds, "Content-Type", "application/json")
2013 headers := gax.BuildHeaders(ctx, hds...)
2014 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2015 resp := &longrunningpb.Operation{}
2016 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2017 if settings.Path != "" {
2018 baseUrl.Path = settings.Path
2019 }
2020 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2021 if err != nil {
2022 return err
2023 }
2024 httpReq = httpReq.WithContext(ctx)
2025 httpReq.Header = headers
2026
2027 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateApplicationStreamInput")
2028 if err != nil {
2029 return err
2030 }
2031 if err := unm.Unmarshal(buf, resp); err != nil {
2032 return err
2033 }
2034
2035 return nil
2036 }, opts...)
2037 if e != nil {
2038 return nil, e
2039 }
2040
2041 override := fmt.Sprintf("/v1/%s", resp.GetName())
2042 return &UpdateApplicationStreamInputOperation{
2043 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2044 pollPath: override,
2045 }, nil
2046 }
2047
2048 // ListInstances lists Instances in a given project and location.
2049 func (c *appPlatformRESTClient) ListInstances(ctx context.Context, req *visionaipb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator {
2050 it := &InstanceIterator{}
2051 req = proto.Clone(req).(*visionaipb.ListInstancesRequest)
2052 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2053 it.InternalFetch = func(pageSize int, pageToken string) ([]*visionaipb.Instance, string, error) {
2054 resp := &visionaipb.ListInstancesResponse{}
2055 if pageToken != "" {
2056 req.PageToken = pageToken
2057 }
2058 if pageSize > math.MaxInt32 {
2059 req.PageSize = math.MaxInt32
2060 } else if pageSize != 0 {
2061 req.PageSize = int32(pageSize)
2062 }
2063 baseUrl, err := url.Parse(c.endpoint)
2064 if err != nil {
2065 return nil, "", err
2066 }
2067 baseUrl.Path += fmt.Sprintf("/v1/%v/instances", req.GetParent())
2068
2069 params := url.Values{}
2070 params.Add("$alt", "json;enum-encoding=int")
2071 if req.GetFilter() != "" {
2072 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2073 }
2074 if req.GetOrderBy() != "" {
2075 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
2076 }
2077 if req.GetPageSize() != 0 {
2078 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2079 }
2080 if req.GetPageToken() != "" {
2081 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2082 }
2083
2084 baseUrl.RawQuery = params.Encode()
2085
2086 // Build HTTP headers from client and context metadata.
2087 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2088 headers := gax.BuildHeaders(ctx, hds...)
2089 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2090 if settings.Path != "" {
2091 baseUrl.Path = settings.Path
2092 }
2093 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2094 if err != nil {
2095 return err
2096 }
2097 httpReq.Header = headers
2098
2099 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListInstances")
2100 if err != nil {
2101 return err
2102 }
2103 if err := unm.Unmarshal(buf, resp); err != nil {
2104 return err
2105 }
2106
2107 return nil
2108 }, opts...)
2109 if e != nil {
2110 return nil, "", e
2111 }
2112 it.Response = resp
2113 return resp.GetInstances(), resp.GetNextPageToken(), nil
2114 }
2115
2116 fetch := func(pageSize int, pageToken string) (string, error) {
2117 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2118 if err != nil {
2119 return "", err
2120 }
2121 it.items = append(it.items, items...)
2122 return nextPageToken, nil
2123 }
2124
2125 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2126 it.pageInfo.MaxSize = int(req.GetPageSize())
2127 it.pageInfo.Token = req.GetPageToken()
2128
2129 return it
2130 }
2131
2132 // GetInstance gets details of a single Instance.
2133 func (c *appPlatformRESTClient) GetInstance(ctx context.Context, req *visionaipb.GetInstanceRequest, opts ...gax.CallOption) (*visionaipb.Instance, error) {
2134 baseUrl, err := url.Parse(c.endpoint)
2135 if err != nil {
2136 return nil, err
2137 }
2138 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2139
2140 params := url.Values{}
2141 params.Add("$alt", "json;enum-encoding=int")
2142
2143 baseUrl.RawQuery = params.Encode()
2144
2145 // Build HTTP headers from client and context metadata.
2146 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2147
2148 hds = append(c.xGoogHeaders, hds...)
2149 hds = append(hds, "Content-Type", "application/json")
2150 headers := gax.BuildHeaders(ctx, hds...)
2151 opts = append((*c.CallOptions).GetInstance[0:len((*c.CallOptions).GetInstance):len((*c.CallOptions).GetInstance)], opts...)
2152 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2153 resp := &visionaipb.Instance{}
2154 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2155 if settings.Path != "" {
2156 baseUrl.Path = settings.Path
2157 }
2158 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2159 if err != nil {
2160 return err
2161 }
2162 httpReq = httpReq.WithContext(ctx)
2163 httpReq.Header = headers
2164
2165 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetInstance")
2166 if err != nil {
2167 return err
2168 }
2169
2170 if err := unm.Unmarshal(buf, resp); err != nil {
2171 return err
2172 }
2173
2174 return nil
2175 }, opts...)
2176 if e != nil {
2177 return nil, e
2178 }
2179 return resp, nil
2180 }
2181
2182 // CreateApplicationInstances adds target stream input to the Application.
2183 // If the Application is deployed, the corresponding new Application instance
2184 // will be created. If the stream has already been in the Application, the RPC
2185 // will fail.
2186 func (c *appPlatformRESTClient) CreateApplicationInstances(ctx context.Context, req *visionaipb.CreateApplicationInstancesRequest, opts ...gax.CallOption) (*CreateApplicationInstancesOperation, error) {
2187 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2188 jsonReq, err := m.Marshal(req)
2189 if err != nil {
2190 return nil, err
2191 }
2192
2193 baseUrl, err := url.Parse(c.endpoint)
2194 if err != nil {
2195 return nil, err
2196 }
2197 baseUrl.Path += fmt.Sprintf("/v1/%v:createApplicationInstances", req.GetName())
2198
2199 params := url.Values{}
2200 params.Add("$alt", "json;enum-encoding=int")
2201
2202 baseUrl.RawQuery = params.Encode()
2203
2204 // Build HTTP headers from client and context metadata.
2205 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2206
2207 hds = append(c.xGoogHeaders, hds...)
2208 hds = append(hds, "Content-Type", "application/json")
2209 headers := gax.BuildHeaders(ctx, hds...)
2210 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2211 resp := &longrunningpb.Operation{}
2212 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2213 if settings.Path != "" {
2214 baseUrl.Path = settings.Path
2215 }
2216 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2217 if err != nil {
2218 return err
2219 }
2220 httpReq = httpReq.WithContext(ctx)
2221 httpReq.Header = headers
2222
2223 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateApplicationInstances")
2224 if err != nil {
2225 return err
2226 }
2227 if err := unm.Unmarshal(buf, resp); err != nil {
2228 return err
2229 }
2230
2231 return nil
2232 }, opts...)
2233 if e != nil {
2234 return nil, e
2235 }
2236
2237 override := fmt.Sprintf("/v1/%s", resp.GetName())
2238 return &CreateApplicationInstancesOperation{
2239 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2240 pollPath: override,
2241 }, nil
2242 }
2243
2244 // DeleteApplicationInstances remove target stream input to the Application, if the Application is
2245 // deployed, the corresponding instance based will be deleted. If the stream
2246 // is not in the Application, the RPC will fail.
2247 func (c *appPlatformRESTClient) DeleteApplicationInstances(ctx context.Context, req *visionaipb.DeleteApplicationInstancesRequest, opts ...gax.CallOption) (*DeleteApplicationInstancesOperation, error) {
2248 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2249 jsonReq, err := m.Marshal(req)
2250 if err != nil {
2251 return nil, err
2252 }
2253
2254 baseUrl, err := url.Parse(c.endpoint)
2255 if err != nil {
2256 return nil, err
2257 }
2258 baseUrl.Path += fmt.Sprintf("/v1/%v:deleteApplicationInstances", req.GetName())
2259
2260 params := url.Values{}
2261 params.Add("$alt", "json;enum-encoding=int")
2262
2263 baseUrl.RawQuery = params.Encode()
2264
2265 // Build HTTP headers from client and context metadata.
2266 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2267
2268 hds = append(c.xGoogHeaders, hds...)
2269 hds = append(hds, "Content-Type", "application/json")
2270 headers := gax.BuildHeaders(ctx, hds...)
2271 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2272 resp := &longrunningpb.Operation{}
2273 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2274 if settings.Path != "" {
2275 baseUrl.Path = settings.Path
2276 }
2277 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2278 if err != nil {
2279 return err
2280 }
2281 httpReq = httpReq.WithContext(ctx)
2282 httpReq.Header = headers
2283
2284 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "DeleteApplicationInstances")
2285 if err != nil {
2286 return err
2287 }
2288 if err := unm.Unmarshal(buf, resp); err != nil {
2289 return err
2290 }
2291
2292 return nil
2293 }, opts...)
2294 if e != nil {
2295 return nil, e
2296 }
2297
2298 override := fmt.Sprintf("/v1/%s", resp.GetName())
2299 return &DeleteApplicationInstancesOperation{
2300 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2301 pollPath: override,
2302 }, nil
2303 }
2304
2305 // UpdateApplicationInstances adds target stream input to the Application.
2306 // If the Application is deployed, the corresponding new Application instance
2307 // will be created. If the stream has already been in the Application, the RPC
2308 // will fail.
2309 func (c *appPlatformRESTClient) UpdateApplicationInstances(ctx context.Context, req *visionaipb.UpdateApplicationInstancesRequest, opts ...gax.CallOption) (*UpdateApplicationInstancesOperation, error) {
2310 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2311 jsonReq, err := m.Marshal(req)
2312 if err != nil {
2313 return nil, err
2314 }
2315
2316 baseUrl, err := url.Parse(c.endpoint)
2317 if err != nil {
2318 return nil, err
2319 }
2320 baseUrl.Path += fmt.Sprintf("/v1/%v:updateApplicationInstances", req.GetName())
2321
2322 params := url.Values{}
2323 params.Add("$alt", "json;enum-encoding=int")
2324
2325 baseUrl.RawQuery = params.Encode()
2326
2327 // Build HTTP headers from client and context metadata.
2328 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2329
2330 hds = append(c.xGoogHeaders, hds...)
2331 hds = append(hds, "Content-Type", "application/json")
2332 headers := gax.BuildHeaders(ctx, hds...)
2333 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2334 resp := &longrunningpb.Operation{}
2335 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2336 if settings.Path != "" {
2337 baseUrl.Path = settings.Path
2338 }
2339 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2340 if err != nil {
2341 return err
2342 }
2343 httpReq = httpReq.WithContext(ctx)
2344 httpReq.Header = headers
2345
2346 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateApplicationInstances")
2347 if err != nil {
2348 return err
2349 }
2350 if err := unm.Unmarshal(buf, resp); err != nil {
2351 return err
2352 }
2353
2354 return nil
2355 }, opts...)
2356 if e != nil {
2357 return nil, e
2358 }
2359
2360 override := fmt.Sprintf("/v1/%s", resp.GetName())
2361 return &UpdateApplicationInstancesOperation{
2362 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2363 pollPath: override,
2364 }, nil
2365 }
2366
2367 // ListDrafts lists Drafts in a given project and location.
2368 func (c *appPlatformRESTClient) ListDrafts(ctx context.Context, req *visionaipb.ListDraftsRequest, opts ...gax.CallOption) *DraftIterator {
2369 it := &DraftIterator{}
2370 req = proto.Clone(req).(*visionaipb.ListDraftsRequest)
2371 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2372 it.InternalFetch = func(pageSize int, pageToken string) ([]*visionaipb.Draft, string, error) {
2373 resp := &visionaipb.ListDraftsResponse{}
2374 if pageToken != "" {
2375 req.PageToken = pageToken
2376 }
2377 if pageSize > math.MaxInt32 {
2378 req.PageSize = math.MaxInt32
2379 } else if pageSize != 0 {
2380 req.PageSize = int32(pageSize)
2381 }
2382 baseUrl, err := url.Parse(c.endpoint)
2383 if err != nil {
2384 return nil, "", err
2385 }
2386 baseUrl.Path += fmt.Sprintf("/v1/%v/drafts", req.GetParent())
2387
2388 params := url.Values{}
2389 params.Add("$alt", "json;enum-encoding=int")
2390 if req.GetFilter() != "" {
2391 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2392 }
2393 if req.GetOrderBy() != "" {
2394 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
2395 }
2396 if req.GetPageSize() != 0 {
2397 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2398 }
2399 if req.GetPageToken() != "" {
2400 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2401 }
2402
2403 baseUrl.RawQuery = params.Encode()
2404
2405 // Build HTTP headers from client and context metadata.
2406 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2407 headers := gax.BuildHeaders(ctx, hds...)
2408 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2409 if settings.Path != "" {
2410 baseUrl.Path = settings.Path
2411 }
2412 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2413 if err != nil {
2414 return err
2415 }
2416 httpReq.Header = headers
2417
2418 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListDrafts")
2419 if err != nil {
2420 return err
2421 }
2422 if err := unm.Unmarshal(buf, resp); err != nil {
2423 return err
2424 }
2425
2426 return nil
2427 }, opts...)
2428 if e != nil {
2429 return nil, "", e
2430 }
2431 it.Response = resp
2432 return resp.GetDrafts(), resp.GetNextPageToken(), nil
2433 }
2434
2435 fetch := func(pageSize int, pageToken string) (string, error) {
2436 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2437 if err != nil {
2438 return "", err
2439 }
2440 it.items = append(it.items, items...)
2441 return nextPageToken, nil
2442 }
2443
2444 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2445 it.pageInfo.MaxSize = int(req.GetPageSize())
2446 it.pageInfo.Token = req.GetPageToken()
2447
2448 return it
2449 }
2450
2451 // GetDraft gets details of a single Draft.
2452 func (c *appPlatformRESTClient) GetDraft(ctx context.Context, req *visionaipb.GetDraftRequest, opts ...gax.CallOption) (*visionaipb.Draft, error) {
2453 baseUrl, err := url.Parse(c.endpoint)
2454 if err != nil {
2455 return nil, err
2456 }
2457 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2458
2459 params := url.Values{}
2460 params.Add("$alt", "json;enum-encoding=int")
2461
2462 baseUrl.RawQuery = params.Encode()
2463
2464 // Build HTTP headers from client and context metadata.
2465 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2466
2467 hds = append(c.xGoogHeaders, hds...)
2468 hds = append(hds, "Content-Type", "application/json")
2469 headers := gax.BuildHeaders(ctx, hds...)
2470 opts = append((*c.CallOptions).GetDraft[0:len((*c.CallOptions).GetDraft):len((*c.CallOptions).GetDraft)], opts...)
2471 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2472 resp := &visionaipb.Draft{}
2473 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2474 if settings.Path != "" {
2475 baseUrl.Path = settings.Path
2476 }
2477 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2478 if err != nil {
2479 return err
2480 }
2481 httpReq = httpReq.WithContext(ctx)
2482 httpReq.Header = headers
2483
2484 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetDraft")
2485 if err != nil {
2486 return err
2487 }
2488
2489 if err := unm.Unmarshal(buf, resp); err != nil {
2490 return err
2491 }
2492
2493 return nil
2494 }, opts...)
2495 if e != nil {
2496 return nil, e
2497 }
2498 return resp, nil
2499 }
2500
2501 // CreateDraft creates a new Draft in a given project and location.
2502 func (c *appPlatformRESTClient) CreateDraft(ctx context.Context, req *visionaipb.CreateDraftRequest, opts ...gax.CallOption) (*CreateDraftOperation, error) {
2503 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2504 body := req.GetDraft()
2505 jsonReq, err := m.Marshal(body)
2506 if err != nil {
2507 return nil, err
2508 }
2509
2510 baseUrl, err := url.Parse(c.endpoint)
2511 if err != nil {
2512 return nil, err
2513 }
2514 baseUrl.Path += fmt.Sprintf("/v1/%v/drafts", req.GetParent())
2515
2516 params := url.Values{}
2517 params.Add("$alt", "json;enum-encoding=int")
2518 params.Add("draftId", fmt.Sprintf("%v", req.GetDraftId()))
2519 if req.GetRequestId() != "" {
2520 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2521 }
2522
2523 baseUrl.RawQuery = params.Encode()
2524
2525 // Build HTTP headers from client and context metadata.
2526 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2527
2528 hds = append(c.xGoogHeaders, hds...)
2529 hds = append(hds, "Content-Type", "application/json")
2530 headers := gax.BuildHeaders(ctx, hds...)
2531 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2532 resp := &longrunningpb.Operation{}
2533 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2534 if settings.Path != "" {
2535 baseUrl.Path = settings.Path
2536 }
2537 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2538 if err != nil {
2539 return err
2540 }
2541 httpReq = httpReq.WithContext(ctx)
2542 httpReq.Header = headers
2543
2544 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateDraft")
2545 if err != nil {
2546 return err
2547 }
2548 if err := unm.Unmarshal(buf, resp); err != nil {
2549 return err
2550 }
2551
2552 return nil
2553 }, opts...)
2554 if e != nil {
2555 return nil, e
2556 }
2557
2558 override := fmt.Sprintf("/v1/%s", resp.GetName())
2559 return &CreateDraftOperation{
2560 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2561 pollPath: override,
2562 }, nil
2563 }
2564
2565 // UpdateDraft updates the parameters of a single Draft.
2566 func (c *appPlatformRESTClient) UpdateDraft(ctx context.Context, req *visionaipb.UpdateDraftRequest, opts ...gax.CallOption) (*UpdateDraftOperation, error) {
2567 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2568 body := req.GetDraft()
2569 jsonReq, err := m.Marshal(body)
2570 if err != nil {
2571 return nil, err
2572 }
2573
2574 baseUrl, err := url.Parse(c.endpoint)
2575 if err != nil {
2576 return nil, err
2577 }
2578 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetDraft().GetName())
2579
2580 params := url.Values{}
2581 params.Add("$alt", "json;enum-encoding=int")
2582 if req.GetAllowMissing() {
2583 params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing()))
2584 }
2585 if req.GetRequestId() != "" {
2586 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2587 }
2588 if req.GetUpdateMask() != nil {
2589 field, err := protojson.Marshal(req.GetUpdateMask())
2590 if err != nil {
2591 return nil, err
2592 }
2593 params.Add("updateMask", string(field[1:len(field)-1]))
2594 }
2595
2596 baseUrl.RawQuery = params.Encode()
2597
2598 // Build HTTP headers from client and context metadata.
2599 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "draft.name", url.QueryEscape(req.GetDraft().GetName()))}
2600
2601 hds = append(c.xGoogHeaders, hds...)
2602 hds = append(hds, "Content-Type", "application/json")
2603 headers := gax.BuildHeaders(ctx, hds...)
2604 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2605 resp := &longrunningpb.Operation{}
2606 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2607 if settings.Path != "" {
2608 baseUrl.Path = settings.Path
2609 }
2610 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
2611 if err != nil {
2612 return err
2613 }
2614 httpReq = httpReq.WithContext(ctx)
2615 httpReq.Header = headers
2616
2617 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateDraft")
2618 if err != nil {
2619 return err
2620 }
2621 if err := unm.Unmarshal(buf, resp); err != nil {
2622 return err
2623 }
2624
2625 return nil
2626 }, opts...)
2627 if e != nil {
2628 return nil, e
2629 }
2630
2631 override := fmt.Sprintf("/v1/%s", resp.GetName())
2632 return &UpdateDraftOperation{
2633 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2634 pollPath: override,
2635 }, nil
2636 }
2637
2638 // DeleteDraft deletes a single Draft.
2639 func (c *appPlatformRESTClient) DeleteDraft(ctx context.Context, req *visionaipb.DeleteDraftRequest, opts ...gax.CallOption) (*DeleteDraftOperation, error) {
2640 baseUrl, err := url.Parse(c.endpoint)
2641 if err != nil {
2642 return nil, err
2643 }
2644 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2645
2646 params := url.Values{}
2647 params.Add("$alt", "json;enum-encoding=int")
2648 if req.GetRequestId() != "" {
2649 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2650 }
2651
2652 baseUrl.RawQuery = params.Encode()
2653
2654 // Build HTTP headers from client and context metadata.
2655 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2656
2657 hds = append(c.xGoogHeaders, hds...)
2658 hds = append(hds, "Content-Type", "application/json")
2659 headers := gax.BuildHeaders(ctx, hds...)
2660 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2661 resp := &longrunningpb.Operation{}
2662 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2663 if settings.Path != "" {
2664 baseUrl.Path = settings.Path
2665 }
2666 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2667 if err != nil {
2668 return err
2669 }
2670 httpReq = httpReq.WithContext(ctx)
2671 httpReq.Header = headers
2672
2673 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteDraft")
2674 if err != nil {
2675 return err
2676 }
2677 if err := unm.Unmarshal(buf, resp); err != nil {
2678 return err
2679 }
2680
2681 return nil
2682 }, opts...)
2683 if e != nil {
2684 return nil, e
2685 }
2686
2687 override := fmt.Sprintf("/v1/%s", resp.GetName())
2688 return &DeleteDraftOperation{
2689 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2690 pollPath: override,
2691 }, nil
2692 }
2693
2694 // ListProcessors lists Processors in a given project and location.
2695 func (c *appPlatformRESTClient) ListProcessors(ctx context.Context, req *visionaipb.ListProcessorsRequest, opts ...gax.CallOption) *ProcessorIterator {
2696 it := &ProcessorIterator{}
2697 req = proto.Clone(req).(*visionaipb.ListProcessorsRequest)
2698 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2699 it.InternalFetch = func(pageSize int, pageToken string) ([]*visionaipb.Processor, string, error) {
2700 resp := &visionaipb.ListProcessorsResponse{}
2701 if pageToken != "" {
2702 req.PageToken = pageToken
2703 }
2704 if pageSize > math.MaxInt32 {
2705 req.PageSize = math.MaxInt32
2706 } else if pageSize != 0 {
2707 req.PageSize = int32(pageSize)
2708 }
2709 baseUrl, err := url.Parse(c.endpoint)
2710 if err != nil {
2711 return nil, "", err
2712 }
2713 baseUrl.Path += fmt.Sprintf("/v1/%v/processors", req.GetParent())
2714
2715 params := url.Values{}
2716 params.Add("$alt", "json;enum-encoding=int")
2717 if req.GetFilter() != "" {
2718 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2719 }
2720 if req.GetOrderBy() != "" {
2721 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
2722 }
2723 if req.GetPageSize() != 0 {
2724 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2725 }
2726 if req.GetPageToken() != "" {
2727 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2728 }
2729
2730 baseUrl.RawQuery = params.Encode()
2731
2732 // Build HTTP headers from client and context metadata.
2733 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2734 headers := gax.BuildHeaders(ctx, hds...)
2735 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2736 if settings.Path != "" {
2737 baseUrl.Path = settings.Path
2738 }
2739 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2740 if err != nil {
2741 return err
2742 }
2743 httpReq.Header = headers
2744
2745 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListProcessors")
2746 if err != nil {
2747 return err
2748 }
2749 if err := unm.Unmarshal(buf, resp); err != nil {
2750 return err
2751 }
2752
2753 return nil
2754 }, opts...)
2755 if e != nil {
2756 return nil, "", e
2757 }
2758 it.Response = resp
2759 return resp.GetProcessors(), resp.GetNextPageToken(), nil
2760 }
2761
2762 fetch := func(pageSize int, pageToken string) (string, error) {
2763 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2764 if err != nil {
2765 return "", err
2766 }
2767 it.items = append(it.items, items...)
2768 return nextPageToken, nil
2769 }
2770
2771 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2772 it.pageInfo.MaxSize = int(req.GetPageSize())
2773 it.pageInfo.Token = req.GetPageToken()
2774
2775 return it
2776 }
2777
2778 // ListPrebuiltProcessors listPrebuiltProcessors is a custom pass-through verb that Lists Prebuilt
2779 // Processors.
2780 func (c *appPlatformRESTClient) ListPrebuiltProcessors(ctx context.Context, req *visionaipb.ListPrebuiltProcessorsRequest, opts ...gax.CallOption) (*visionaipb.ListPrebuiltProcessorsResponse, error) {
2781 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2782 jsonReq, err := m.Marshal(req)
2783 if err != nil {
2784 return nil, err
2785 }
2786
2787 baseUrl, err := url.Parse(c.endpoint)
2788 if err != nil {
2789 return nil, err
2790 }
2791 baseUrl.Path += fmt.Sprintf("/v1/%v/processors:prebuilt", req.GetParent())
2792
2793 params := url.Values{}
2794 params.Add("$alt", "json;enum-encoding=int")
2795
2796 baseUrl.RawQuery = params.Encode()
2797
2798 // Build HTTP headers from client and context metadata.
2799 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2800
2801 hds = append(c.xGoogHeaders, hds...)
2802 hds = append(hds, "Content-Type", "application/json")
2803 headers := gax.BuildHeaders(ctx, hds...)
2804 opts = append((*c.CallOptions).ListPrebuiltProcessors[0:len((*c.CallOptions).ListPrebuiltProcessors):len((*c.CallOptions).ListPrebuiltProcessors)], opts...)
2805 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2806 resp := &visionaipb.ListPrebuiltProcessorsResponse{}
2807 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2808 if settings.Path != "" {
2809 baseUrl.Path = settings.Path
2810 }
2811 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2812 if err != nil {
2813 return err
2814 }
2815 httpReq = httpReq.WithContext(ctx)
2816 httpReq.Header = headers
2817
2818 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ListPrebuiltProcessors")
2819 if err != nil {
2820 return err
2821 }
2822
2823 if err := unm.Unmarshal(buf, resp); err != nil {
2824 return err
2825 }
2826
2827 return nil
2828 }, opts...)
2829 if e != nil {
2830 return nil, e
2831 }
2832 return resp, nil
2833 }
2834
2835 // GetProcessor gets details of a single Processor.
2836 func (c *appPlatformRESTClient) GetProcessor(ctx context.Context, req *visionaipb.GetProcessorRequest, opts ...gax.CallOption) (*visionaipb.Processor, error) {
2837 baseUrl, err := url.Parse(c.endpoint)
2838 if err != nil {
2839 return nil, err
2840 }
2841 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2842
2843 params := url.Values{}
2844 params.Add("$alt", "json;enum-encoding=int")
2845
2846 baseUrl.RawQuery = params.Encode()
2847
2848 // Build HTTP headers from client and context metadata.
2849 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2850
2851 hds = append(c.xGoogHeaders, hds...)
2852 hds = append(hds, "Content-Type", "application/json")
2853 headers := gax.BuildHeaders(ctx, hds...)
2854 opts = append((*c.CallOptions).GetProcessor[0:len((*c.CallOptions).GetProcessor):len((*c.CallOptions).GetProcessor)], opts...)
2855 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2856 resp := &visionaipb.Processor{}
2857 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2858 if settings.Path != "" {
2859 baseUrl.Path = settings.Path
2860 }
2861 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2862 if err != nil {
2863 return err
2864 }
2865 httpReq = httpReq.WithContext(ctx)
2866 httpReq.Header = headers
2867
2868 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetProcessor")
2869 if err != nil {
2870 return err
2871 }
2872
2873 if err := unm.Unmarshal(buf, resp); err != nil {
2874 return err
2875 }
2876
2877 return nil
2878 }, opts...)
2879 if e != nil {
2880 return nil, e
2881 }
2882 return resp, nil
2883 }
2884
2885 // CreateProcessor creates a new Processor in a given project and location.
2886 func (c *appPlatformRESTClient) CreateProcessor(ctx context.Context, req *visionaipb.CreateProcessorRequest, opts ...gax.CallOption) (*CreateProcessorOperation, error) {
2887 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2888 body := req.GetProcessor()
2889 jsonReq, err := m.Marshal(body)
2890 if err != nil {
2891 return nil, err
2892 }
2893
2894 baseUrl, err := url.Parse(c.endpoint)
2895 if err != nil {
2896 return nil, err
2897 }
2898 baseUrl.Path += fmt.Sprintf("/v1/%v/processors", req.GetParent())
2899
2900 params := url.Values{}
2901 params.Add("$alt", "json;enum-encoding=int")
2902 params.Add("processorId", fmt.Sprintf("%v", req.GetProcessorId()))
2903 if req.GetRequestId() != "" {
2904 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2905 }
2906
2907 baseUrl.RawQuery = params.Encode()
2908
2909 // Build HTTP headers from client and context metadata.
2910 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2911
2912 hds = append(c.xGoogHeaders, hds...)
2913 hds = append(hds, "Content-Type", "application/json")
2914 headers := gax.BuildHeaders(ctx, hds...)
2915 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2916 resp := &longrunningpb.Operation{}
2917 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2918 if settings.Path != "" {
2919 baseUrl.Path = settings.Path
2920 }
2921 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2922 if err != nil {
2923 return err
2924 }
2925 httpReq = httpReq.WithContext(ctx)
2926 httpReq.Header = headers
2927
2928 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateProcessor")
2929 if err != nil {
2930 return err
2931 }
2932 if err := unm.Unmarshal(buf, resp); err != nil {
2933 return err
2934 }
2935
2936 return nil
2937 }, opts...)
2938 if e != nil {
2939 return nil, e
2940 }
2941
2942 override := fmt.Sprintf("/v1/%s", resp.GetName())
2943 return &CreateProcessorOperation{
2944 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2945 pollPath: override,
2946 }, nil
2947 }
2948
2949 // UpdateProcessor updates the parameters of a single Processor.
2950 func (c *appPlatformRESTClient) UpdateProcessor(ctx context.Context, req *visionaipb.UpdateProcessorRequest, opts ...gax.CallOption) (*UpdateProcessorOperation, error) {
2951 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2952 body := req.GetProcessor()
2953 jsonReq, err := m.Marshal(body)
2954 if err != nil {
2955 return nil, err
2956 }
2957
2958 baseUrl, err := url.Parse(c.endpoint)
2959 if err != nil {
2960 return nil, err
2961 }
2962 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetProcessor().GetName())
2963
2964 params := url.Values{}
2965 params.Add("$alt", "json;enum-encoding=int")
2966 if req.GetRequestId() != "" {
2967 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2968 }
2969 if req.GetUpdateMask() != nil {
2970 field, err := protojson.Marshal(req.GetUpdateMask())
2971 if err != nil {
2972 return nil, err
2973 }
2974 params.Add("updateMask", string(field[1:len(field)-1]))
2975 }
2976
2977 baseUrl.RawQuery = params.Encode()
2978
2979 // Build HTTP headers from client and context metadata.
2980 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "processor.name", url.QueryEscape(req.GetProcessor().GetName()))}
2981
2982 hds = append(c.xGoogHeaders, hds...)
2983 hds = append(hds, "Content-Type", "application/json")
2984 headers := gax.BuildHeaders(ctx, hds...)
2985 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2986 resp := &longrunningpb.Operation{}
2987 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2988 if settings.Path != "" {
2989 baseUrl.Path = settings.Path
2990 }
2991 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
2992 if err != nil {
2993 return err
2994 }
2995 httpReq = httpReq.WithContext(ctx)
2996 httpReq.Header = headers
2997
2998 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateProcessor")
2999 if err != nil {
3000 return err
3001 }
3002 if err := unm.Unmarshal(buf, resp); err != nil {
3003 return err
3004 }
3005
3006 return nil
3007 }, opts...)
3008 if e != nil {
3009 return nil, e
3010 }
3011
3012 override := fmt.Sprintf("/v1/%s", resp.GetName())
3013 return &UpdateProcessorOperation{
3014 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3015 pollPath: override,
3016 }, nil
3017 }
3018
3019 // DeleteProcessor deletes a single Processor.
3020 func (c *appPlatformRESTClient) DeleteProcessor(ctx context.Context, req *visionaipb.DeleteProcessorRequest, opts ...gax.CallOption) (*DeleteProcessorOperation, error) {
3021 baseUrl, err := url.Parse(c.endpoint)
3022 if err != nil {
3023 return nil, err
3024 }
3025 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3026
3027 params := url.Values{}
3028 params.Add("$alt", "json;enum-encoding=int")
3029 if req.GetRequestId() != "" {
3030 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
3031 }
3032
3033 baseUrl.RawQuery = params.Encode()
3034
3035 // Build HTTP headers from client and context metadata.
3036 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3037
3038 hds = append(c.xGoogHeaders, hds...)
3039 hds = append(hds, "Content-Type", "application/json")
3040 headers := gax.BuildHeaders(ctx, hds...)
3041 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3042 resp := &longrunningpb.Operation{}
3043 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3044 if settings.Path != "" {
3045 baseUrl.Path = settings.Path
3046 }
3047 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
3048 if err != nil {
3049 return err
3050 }
3051 httpReq = httpReq.WithContext(ctx)
3052 httpReq.Header = headers
3053
3054 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteProcessor")
3055 if err != nil {
3056 return err
3057 }
3058 if err := unm.Unmarshal(buf, resp); err != nil {
3059 return err
3060 }
3061
3062 return nil
3063 }, opts...)
3064 if e != nil {
3065 return nil, e
3066 }
3067
3068 override := fmt.Sprintf("/v1/%s", resp.GetName())
3069 return &DeleteProcessorOperation{
3070 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3071 pollPath: override,
3072 }, nil
3073 }
3074
3075 // CancelOperation is a utility method from google.longrunning.Operations.
3076 func (c *appPlatformRESTClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
3077 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3078 jsonReq, err := m.Marshal(req)
3079 if err != nil {
3080 return err
3081 }
3082
3083 baseUrl, err := url.Parse(c.endpoint)
3084 if err != nil {
3085 return err
3086 }
3087 baseUrl.Path += fmt.Sprintf("/v1/%v:cancel", req.GetName())
3088
3089 params := url.Values{}
3090 params.Add("$alt", "json;enum-encoding=int")
3091
3092 baseUrl.RawQuery = params.Encode()
3093
3094 // Build HTTP headers from client and context metadata.
3095 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3096
3097 hds = append(c.xGoogHeaders, hds...)
3098 hds = append(hds, "Content-Type", "application/json")
3099 headers := gax.BuildHeaders(ctx, hds...)
3100 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3101 if settings.Path != "" {
3102 baseUrl.Path = settings.Path
3103 }
3104 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3105 if err != nil {
3106 return err
3107 }
3108 httpReq = httpReq.WithContext(ctx)
3109 httpReq.Header = headers
3110
3111 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CancelOperation")
3112 return err
3113 }, opts...)
3114 }
3115
3116 // DeleteOperation is a utility method from google.longrunning.Operations.
3117 func (c *appPlatformRESTClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
3118 baseUrl, err := url.Parse(c.endpoint)
3119 if err != nil {
3120 return err
3121 }
3122 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3123
3124 params := url.Values{}
3125 params.Add("$alt", "json;enum-encoding=int")
3126
3127 baseUrl.RawQuery = params.Encode()
3128
3129 // Build HTTP headers from client and context metadata.
3130 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3131
3132 hds = append(c.xGoogHeaders, hds...)
3133 hds = append(hds, "Content-Type", "application/json")
3134 headers := gax.BuildHeaders(ctx, hds...)
3135 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3136 if settings.Path != "" {
3137 baseUrl.Path = settings.Path
3138 }
3139 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
3140 if err != nil {
3141 return err
3142 }
3143 httpReq = httpReq.WithContext(ctx)
3144 httpReq.Header = headers
3145
3146 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation")
3147 return err
3148 }, opts...)
3149 }
3150
3151 // GetOperation is a utility method from google.longrunning.Operations.
3152 func (c *appPlatformRESTClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
3153 baseUrl, err := url.Parse(c.endpoint)
3154 if err != nil {
3155 return nil, err
3156 }
3157 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3158
3159 params := url.Values{}
3160 params.Add("$alt", "json;enum-encoding=int")
3161
3162 baseUrl.RawQuery = params.Encode()
3163
3164 // Build HTTP headers from client and context metadata.
3165 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3166
3167 hds = append(c.xGoogHeaders, hds...)
3168 hds = append(hds, "Content-Type", "application/json")
3169 headers := gax.BuildHeaders(ctx, hds...)
3170 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
3171 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3172 resp := &longrunningpb.Operation{}
3173 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3174 if settings.Path != "" {
3175 baseUrl.Path = settings.Path
3176 }
3177 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3178 if err != nil {
3179 return err
3180 }
3181 httpReq = httpReq.WithContext(ctx)
3182 httpReq.Header = headers
3183
3184 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOperation")
3185 if err != nil {
3186 return err
3187 }
3188
3189 if err := unm.Unmarshal(buf, resp); err != nil {
3190 return err
3191 }
3192
3193 return nil
3194 }, opts...)
3195 if e != nil {
3196 return nil, e
3197 }
3198 return resp, nil
3199 }
3200
3201 // ListOperations is a utility method from google.longrunning.Operations.
3202 func (c *appPlatformRESTClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
3203 it := &OperationIterator{}
3204 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
3205 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3206 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
3207 resp := &longrunningpb.ListOperationsResponse{}
3208 if pageToken != "" {
3209 req.PageToken = pageToken
3210 }
3211 if pageSize > math.MaxInt32 {
3212 req.PageSize = math.MaxInt32
3213 } else if pageSize != 0 {
3214 req.PageSize = int32(pageSize)
3215 }
3216 baseUrl, err := url.Parse(c.endpoint)
3217 if err != nil {
3218 return nil, "", err
3219 }
3220 baseUrl.Path += fmt.Sprintf("/v1/%v/operations", req.GetName())
3221
3222 params := url.Values{}
3223 params.Add("$alt", "json;enum-encoding=int")
3224 if req.GetFilter() != "" {
3225 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
3226 }
3227 if req.GetPageSize() != 0 {
3228 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3229 }
3230 if req.GetPageToken() != "" {
3231 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3232 }
3233
3234 baseUrl.RawQuery = params.Encode()
3235
3236 // Build HTTP headers from client and context metadata.
3237 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3238 headers := gax.BuildHeaders(ctx, hds...)
3239 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3240 if settings.Path != "" {
3241 baseUrl.Path = settings.Path
3242 }
3243 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3244 if err != nil {
3245 return err
3246 }
3247 httpReq.Header = headers
3248
3249 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations")
3250 if err != nil {
3251 return err
3252 }
3253 if err := unm.Unmarshal(buf, resp); err != nil {
3254 return err
3255 }
3256
3257 return nil
3258 }, opts...)
3259 if e != nil {
3260 return nil, "", e
3261 }
3262 it.Response = resp
3263 return resp.GetOperations(), resp.GetNextPageToken(), nil
3264 }
3265
3266 fetch := func(pageSize int, pageToken string) (string, error) {
3267 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3268 if err != nil {
3269 return "", err
3270 }
3271 it.items = append(it.items, items...)
3272 return nextPageToken, nil
3273 }
3274
3275 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3276 it.pageInfo.MaxSize = int(req.GetPageSize())
3277 it.pageInfo.Token = req.GetPageToken()
3278
3279 return it
3280 }
3281
3282 // AddApplicationStreamInputOperation returns a new AddApplicationStreamInputOperation from a given name.
3283 // The name must be that of a previously created AddApplicationStreamInputOperation, possibly from a different process.
3284 func (c *appPlatformGRPCClient) AddApplicationStreamInputOperation(name string) *AddApplicationStreamInputOperation {
3285 return &AddApplicationStreamInputOperation{
3286 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3287 }
3288 }
3289
3290 // AddApplicationStreamInputOperation returns a new AddApplicationStreamInputOperation from a given name.
3291 // The name must be that of a previously created AddApplicationStreamInputOperation, possibly from a different process.
3292 func (c *appPlatformRESTClient) AddApplicationStreamInputOperation(name string) *AddApplicationStreamInputOperation {
3293 override := fmt.Sprintf("/v1/%s", name)
3294 return &AddApplicationStreamInputOperation{
3295 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3296 pollPath: override,
3297 }
3298 }
3299
3300 // CreateApplicationOperation returns a new CreateApplicationOperation from a given name.
3301 // The name must be that of a previously created CreateApplicationOperation, possibly from a different process.
3302 func (c *appPlatformGRPCClient) CreateApplicationOperation(name string) *CreateApplicationOperation {
3303 return &CreateApplicationOperation{
3304 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3305 }
3306 }
3307
3308 // CreateApplicationOperation returns a new CreateApplicationOperation from a given name.
3309 // The name must be that of a previously created CreateApplicationOperation, possibly from a different process.
3310 func (c *appPlatformRESTClient) CreateApplicationOperation(name string) *CreateApplicationOperation {
3311 override := fmt.Sprintf("/v1/%s", name)
3312 return &CreateApplicationOperation{
3313 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3314 pollPath: override,
3315 }
3316 }
3317
3318 // CreateApplicationInstancesOperation returns a new CreateApplicationInstancesOperation from a given name.
3319 // The name must be that of a previously created CreateApplicationInstancesOperation, possibly from a different process.
3320 func (c *appPlatformGRPCClient) CreateApplicationInstancesOperation(name string) *CreateApplicationInstancesOperation {
3321 return &CreateApplicationInstancesOperation{
3322 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3323 }
3324 }
3325
3326 // CreateApplicationInstancesOperation returns a new CreateApplicationInstancesOperation from a given name.
3327 // The name must be that of a previously created CreateApplicationInstancesOperation, possibly from a different process.
3328 func (c *appPlatformRESTClient) CreateApplicationInstancesOperation(name string) *CreateApplicationInstancesOperation {
3329 override := fmt.Sprintf("/v1/%s", name)
3330 return &CreateApplicationInstancesOperation{
3331 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3332 pollPath: override,
3333 }
3334 }
3335
3336 // CreateDraftOperation returns a new CreateDraftOperation from a given name.
3337 // The name must be that of a previously created CreateDraftOperation, possibly from a different process.
3338 func (c *appPlatformGRPCClient) CreateDraftOperation(name string) *CreateDraftOperation {
3339 return &CreateDraftOperation{
3340 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3341 }
3342 }
3343
3344 // CreateDraftOperation returns a new CreateDraftOperation from a given name.
3345 // The name must be that of a previously created CreateDraftOperation, possibly from a different process.
3346 func (c *appPlatformRESTClient) CreateDraftOperation(name string) *CreateDraftOperation {
3347 override := fmt.Sprintf("/v1/%s", name)
3348 return &CreateDraftOperation{
3349 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3350 pollPath: override,
3351 }
3352 }
3353
3354 // CreateProcessorOperation returns a new CreateProcessorOperation from a given name.
3355 // The name must be that of a previously created CreateProcessorOperation, possibly from a different process.
3356 func (c *appPlatformGRPCClient) CreateProcessorOperation(name string) *CreateProcessorOperation {
3357 return &CreateProcessorOperation{
3358 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3359 }
3360 }
3361
3362 // CreateProcessorOperation returns a new CreateProcessorOperation from a given name.
3363 // The name must be that of a previously created CreateProcessorOperation, possibly from a different process.
3364 func (c *appPlatformRESTClient) CreateProcessorOperation(name string) *CreateProcessorOperation {
3365 override := fmt.Sprintf("/v1/%s", name)
3366 return &CreateProcessorOperation{
3367 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3368 pollPath: override,
3369 }
3370 }
3371
3372 // DeleteApplicationOperation returns a new DeleteApplicationOperation from a given name.
3373 // The name must be that of a previously created DeleteApplicationOperation, possibly from a different process.
3374 func (c *appPlatformGRPCClient) DeleteApplicationOperation(name string) *DeleteApplicationOperation {
3375 return &DeleteApplicationOperation{
3376 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3377 }
3378 }
3379
3380 // DeleteApplicationOperation returns a new DeleteApplicationOperation from a given name.
3381 // The name must be that of a previously created DeleteApplicationOperation, possibly from a different process.
3382 func (c *appPlatformRESTClient) DeleteApplicationOperation(name string) *DeleteApplicationOperation {
3383 override := fmt.Sprintf("/v1/%s", name)
3384 return &DeleteApplicationOperation{
3385 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3386 pollPath: override,
3387 }
3388 }
3389
3390 // DeleteApplicationInstancesOperation returns a new DeleteApplicationInstancesOperation from a given name.
3391 // The name must be that of a previously created DeleteApplicationInstancesOperation, possibly from a different process.
3392 func (c *appPlatformGRPCClient) DeleteApplicationInstancesOperation(name string) *DeleteApplicationInstancesOperation {
3393 return &DeleteApplicationInstancesOperation{
3394 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3395 }
3396 }
3397
3398 // DeleteApplicationInstancesOperation returns a new DeleteApplicationInstancesOperation from a given name.
3399 // The name must be that of a previously created DeleteApplicationInstancesOperation, possibly from a different process.
3400 func (c *appPlatformRESTClient) DeleteApplicationInstancesOperation(name string) *DeleteApplicationInstancesOperation {
3401 override := fmt.Sprintf("/v1/%s", name)
3402 return &DeleteApplicationInstancesOperation{
3403 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3404 pollPath: override,
3405 }
3406 }
3407
3408 // DeleteDraftOperation returns a new DeleteDraftOperation from a given name.
3409 // The name must be that of a previously created DeleteDraftOperation, possibly from a different process.
3410 func (c *appPlatformGRPCClient) DeleteDraftOperation(name string) *DeleteDraftOperation {
3411 return &DeleteDraftOperation{
3412 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3413 }
3414 }
3415
3416 // DeleteDraftOperation returns a new DeleteDraftOperation from a given name.
3417 // The name must be that of a previously created DeleteDraftOperation, possibly from a different process.
3418 func (c *appPlatformRESTClient) DeleteDraftOperation(name string) *DeleteDraftOperation {
3419 override := fmt.Sprintf("/v1/%s", name)
3420 return &DeleteDraftOperation{
3421 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3422 pollPath: override,
3423 }
3424 }
3425
3426 // DeleteProcessorOperation returns a new DeleteProcessorOperation from a given name.
3427 // The name must be that of a previously created DeleteProcessorOperation, possibly from a different process.
3428 func (c *appPlatformGRPCClient) DeleteProcessorOperation(name string) *DeleteProcessorOperation {
3429 return &DeleteProcessorOperation{
3430 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3431 }
3432 }
3433
3434 // DeleteProcessorOperation returns a new DeleteProcessorOperation from a given name.
3435 // The name must be that of a previously created DeleteProcessorOperation, possibly from a different process.
3436 func (c *appPlatformRESTClient) DeleteProcessorOperation(name string) *DeleteProcessorOperation {
3437 override := fmt.Sprintf("/v1/%s", name)
3438 return &DeleteProcessorOperation{
3439 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3440 pollPath: override,
3441 }
3442 }
3443
3444 // DeployApplicationOperation returns a new DeployApplicationOperation from a given name.
3445 // The name must be that of a previously created DeployApplicationOperation, possibly from a different process.
3446 func (c *appPlatformGRPCClient) DeployApplicationOperation(name string) *DeployApplicationOperation {
3447 return &DeployApplicationOperation{
3448 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3449 }
3450 }
3451
3452 // DeployApplicationOperation returns a new DeployApplicationOperation from a given name.
3453 // The name must be that of a previously created DeployApplicationOperation, possibly from a different process.
3454 func (c *appPlatformRESTClient) DeployApplicationOperation(name string) *DeployApplicationOperation {
3455 override := fmt.Sprintf("/v1/%s", name)
3456 return &DeployApplicationOperation{
3457 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3458 pollPath: override,
3459 }
3460 }
3461
3462 // RemoveApplicationStreamInputOperation returns a new RemoveApplicationStreamInputOperation from a given name.
3463 // The name must be that of a previously created RemoveApplicationStreamInputOperation, possibly from a different process.
3464 func (c *appPlatformGRPCClient) RemoveApplicationStreamInputOperation(name string) *RemoveApplicationStreamInputOperation {
3465 return &RemoveApplicationStreamInputOperation{
3466 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3467 }
3468 }
3469
3470 // RemoveApplicationStreamInputOperation returns a new RemoveApplicationStreamInputOperation from a given name.
3471 // The name must be that of a previously created RemoveApplicationStreamInputOperation, possibly from a different process.
3472 func (c *appPlatformRESTClient) RemoveApplicationStreamInputOperation(name string) *RemoveApplicationStreamInputOperation {
3473 override := fmt.Sprintf("/v1/%s", name)
3474 return &RemoveApplicationStreamInputOperation{
3475 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3476 pollPath: override,
3477 }
3478 }
3479
3480 // UndeployApplicationOperation returns a new UndeployApplicationOperation from a given name.
3481 // The name must be that of a previously created UndeployApplicationOperation, possibly from a different process.
3482 func (c *appPlatformGRPCClient) UndeployApplicationOperation(name string) *UndeployApplicationOperation {
3483 return &UndeployApplicationOperation{
3484 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3485 }
3486 }
3487
3488 // UndeployApplicationOperation returns a new UndeployApplicationOperation from a given name.
3489 // The name must be that of a previously created UndeployApplicationOperation, possibly from a different process.
3490 func (c *appPlatformRESTClient) UndeployApplicationOperation(name string) *UndeployApplicationOperation {
3491 override := fmt.Sprintf("/v1/%s", name)
3492 return &UndeployApplicationOperation{
3493 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3494 pollPath: override,
3495 }
3496 }
3497
3498 // UpdateApplicationOperation returns a new UpdateApplicationOperation from a given name.
3499 // The name must be that of a previously created UpdateApplicationOperation, possibly from a different process.
3500 func (c *appPlatformGRPCClient) UpdateApplicationOperation(name string) *UpdateApplicationOperation {
3501 return &UpdateApplicationOperation{
3502 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3503 }
3504 }
3505
3506 // UpdateApplicationOperation returns a new UpdateApplicationOperation from a given name.
3507 // The name must be that of a previously created UpdateApplicationOperation, possibly from a different process.
3508 func (c *appPlatformRESTClient) UpdateApplicationOperation(name string) *UpdateApplicationOperation {
3509 override := fmt.Sprintf("/v1/%s", name)
3510 return &UpdateApplicationOperation{
3511 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3512 pollPath: override,
3513 }
3514 }
3515
3516 // UpdateApplicationInstancesOperation returns a new UpdateApplicationInstancesOperation from a given name.
3517 // The name must be that of a previously created UpdateApplicationInstancesOperation, possibly from a different process.
3518 func (c *appPlatformGRPCClient) UpdateApplicationInstancesOperation(name string) *UpdateApplicationInstancesOperation {
3519 return &UpdateApplicationInstancesOperation{
3520 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3521 }
3522 }
3523
3524 // UpdateApplicationInstancesOperation returns a new UpdateApplicationInstancesOperation from a given name.
3525 // The name must be that of a previously created UpdateApplicationInstancesOperation, possibly from a different process.
3526 func (c *appPlatformRESTClient) UpdateApplicationInstancesOperation(name string) *UpdateApplicationInstancesOperation {
3527 override := fmt.Sprintf("/v1/%s", name)
3528 return &UpdateApplicationInstancesOperation{
3529 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3530 pollPath: override,
3531 }
3532 }
3533
3534 // UpdateApplicationStreamInputOperation returns a new UpdateApplicationStreamInputOperation from a given name.
3535 // The name must be that of a previously created UpdateApplicationStreamInputOperation, possibly from a different process.
3536 func (c *appPlatformGRPCClient) UpdateApplicationStreamInputOperation(name string) *UpdateApplicationStreamInputOperation {
3537 return &UpdateApplicationStreamInputOperation{
3538 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3539 }
3540 }
3541
3542 // UpdateApplicationStreamInputOperation returns a new UpdateApplicationStreamInputOperation from a given name.
3543 // The name must be that of a previously created UpdateApplicationStreamInputOperation, possibly from a different process.
3544 func (c *appPlatformRESTClient) UpdateApplicationStreamInputOperation(name string) *UpdateApplicationStreamInputOperation {
3545 override := fmt.Sprintf("/v1/%s", name)
3546 return &UpdateApplicationStreamInputOperation{
3547 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3548 pollPath: override,
3549 }
3550 }
3551
3552 // UpdateDraftOperation returns a new UpdateDraftOperation from a given name.
3553 // The name must be that of a previously created UpdateDraftOperation, possibly from a different process.
3554 func (c *appPlatformGRPCClient) UpdateDraftOperation(name string) *UpdateDraftOperation {
3555 return &UpdateDraftOperation{
3556 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3557 }
3558 }
3559
3560 // UpdateDraftOperation returns a new UpdateDraftOperation from a given name.
3561 // The name must be that of a previously created UpdateDraftOperation, possibly from a different process.
3562 func (c *appPlatformRESTClient) UpdateDraftOperation(name string) *UpdateDraftOperation {
3563 override := fmt.Sprintf("/v1/%s", name)
3564 return &UpdateDraftOperation{
3565 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3566 pollPath: override,
3567 }
3568 }
3569
3570 // UpdateProcessorOperation returns a new UpdateProcessorOperation from a given name.
3571 // The name must be that of a previously created UpdateProcessorOperation, possibly from a different process.
3572 func (c *appPlatformGRPCClient) UpdateProcessorOperation(name string) *UpdateProcessorOperation {
3573 return &UpdateProcessorOperation{
3574 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3575 }
3576 }
3577
3578 // UpdateProcessorOperation returns a new UpdateProcessorOperation from a given name.
3579 // The name must be that of a previously created UpdateProcessorOperation, possibly from a different process.
3580 func (c *appPlatformRESTClient) UpdateProcessorOperation(name string) *UpdateProcessorOperation {
3581 override := fmt.Sprintf("/v1/%s", name)
3582 return &UpdateProcessorOperation{
3583 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3584 pollPath: override,
3585 }
3586 }