| 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_test |
| 18 |
|
| 19 |
import ( |
| 20 |
"context" |
| 21 |
|
| 22 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 23 |
visionai "cloud.google.com/go/visionai/apiv1" |
| 24 |
visionaipb "cloud.google.com/go/visionai/apiv1/visionaipb" |
| 25 |
"google.golang.org/api/iterator" |
| 26 |
) |
| 27 |
|
| 28 |
func ExampleNewAppPlatformClient() { |
| 29 |
ctx := context.Background() |
| 30 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 31 |
// It will require modifications to work: |
| 32 |
// - It may require correct/in-range values for request initialization. |
| 33 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 34 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 35 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 36 |
if err != nil { |
| 37 |
// TODO: Handle error. |
| 38 |
} |
| 39 |
defer c.Close() |
| 40 |
|
| 41 |
// TODO: Use client. |
| 42 |
_ = c |
| 43 |
} |
| 44 |
|
| 45 |
func ExampleNewAppPlatformRESTClient() { |
| 46 |
ctx := context.Background() |
| 47 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 48 |
// It will require modifications to work: |
| 49 |
// - It may require correct/in-range values for request initialization. |
| 50 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 51 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 52 |
c, err := visionai.NewAppPlatformRESTClient(ctx) |
| 53 |
if err != nil { |
| 54 |
// TODO: Handle error. |
| 55 |
} |
| 56 |
defer c.Close() |
| 57 |
|
| 58 |
// TODO: Use client. |
| 59 |
_ = c |
| 60 |
} |
| 61 |
|
| 62 |
func ExampleAppPlatformClient_AddApplicationStreamInput() { |
| 63 |
ctx := context.Background() |
| 64 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 65 |
// It will require modifications to work: |
| 66 |
// - It may require correct/in-range values for request initialization. |
| 67 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 68 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 69 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 70 |
if err != nil { |
| 71 |
// TODO: Handle error. |
| 72 |
} |
| 73 |
defer c.Close() |
| 74 |
|
| 75 |
req := &visionaipb.AddApplicationStreamInputRequest{ |
| 76 |
// TODO: Fill request struct fields. |
| 77 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#AddApplicationStreamInputRequest. |
| 78 |
} |
| 79 |
op, err := c.AddApplicationStreamInput(ctx, req) |
| 80 |
if err != nil { |
| 81 |
// TODO: Handle error. |
| 82 |
} |
| 83 |
|
| 84 |
resp, err := op.Wait(ctx) |
| 85 |
if err != nil { |
| 86 |
// TODO: Handle error. |
| 87 |
} |
| 88 |
// TODO: Use resp. |
| 89 |
_ = resp |
| 90 |
} |
| 91 |
|
| 92 |
func ExampleAppPlatformClient_CreateApplication() { |
| 93 |
ctx := context.Background() |
| 94 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 95 |
// It will require modifications to work: |
| 96 |
// - It may require correct/in-range values for request initialization. |
| 97 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 98 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 99 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 100 |
if err != nil { |
| 101 |
// TODO: Handle error. |
| 102 |
} |
| 103 |
defer c.Close() |
| 104 |
|
| 105 |
req := &visionaipb.CreateApplicationRequest{ |
| 106 |
// TODO: Fill request struct fields. |
| 107 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateApplicationRequest. |
| 108 |
} |
| 109 |
op, err := c.CreateApplication(ctx, req) |
| 110 |
if err != nil { |
| 111 |
// TODO: Handle error. |
| 112 |
} |
| 113 |
|
| 114 |
resp, err := op.Wait(ctx) |
| 115 |
if err != nil { |
| 116 |
// TODO: Handle error. |
| 117 |
} |
| 118 |
// TODO: Use resp. |
| 119 |
_ = resp |
| 120 |
} |
| 121 |
|
| 122 |
func ExampleAppPlatformClient_CreateApplicationInstances() { |
| 123 |
ctx := context.Background() |
| 124 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 125 |
// It will require modifications to work: |
| 126 |
// - It may require correct/in-range values for request initialization. |
| 127 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 128 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 129 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 130 |
if err != nil { |
| 131 |
// TODO: Handle error. |
| 132 |
} |
| 133 |
defer c.Close() |
| 134 |
|
| 135 |
req := &visionaipb.CreateApplicationInstancesRequest{ |
| 136 |
// TODO: Fill request struct fields. |
| 137 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateApplicationInstancesRequest. |
| 138 |
} |
| 139 |
op, err := c.CreateApplicationInstances(ctx, req) |
| 140 |
if err != nil { |
| 141 |
// TODO: Handle error. |
| 142 |
} |
| 143 |
|
| 144 |
resp, err := op.Wait(ctx) |
| 145 |
if err != nil { |
| 146 |
// TODO: Handle error. |
| 147 |
} |
| 148 |
// TODO: Use resp. |
| 149 |
_ = resp |
| 150 |
} |
| 151 |
|
| 152 |
func ExampleAppPlatformClient_CreateDraft() { |
| 153 |
ctx := context.Background() |
| 154 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 155 |
// It will require modifications to work: |
| 156 |
// - It may require correct/in-range values for request initialization. |
| 157 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 158 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 159 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 160 |
if err != nil { |
| 161 |
// TODO: Handle error. |
| 162 |
} |
| 163 |
defer c.Close() |
| 164 |
|
| 165 |
req := &visionaipb.CreateDraftRequest{ |
| 166 |
// TODO: Fill request struct fields. |
| 167 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateDraftRequest. |
| 168 |
} |
| 169 |
op, err := c.CreateDraft(ctx, req) |
| 170 |
if err != nil { |
| 171 |
// TODO: Handle error. |
| 172 |
} |
| 173 |
|
| 174 |
resp, err := op.Wait(ctx) |
| 175 |
if err != nil { |
| 176 |
// TODO: Handle error. |
| 177 |
} |
| 178 |
// TODO: Use resp. |
| 179 |
_ = resp |
| 180 |
} |
| 181 |
|
| 182 |
func ExampleAppPlatformClient_CreateProcessor() { |
| 183 |
ctx := context.Background() |
| 184 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 185 |
// It will require modifications to work: |
| 186 |
// - It may require correct/in-range values for request initialization. |
| 187 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 188 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 189 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 190 |
if err != nil { |
| 191 |
// TODO: Handle error. |
| 192 |
} |
| 193 |
defer c.Close() |
| 194 |
|
| 195 |
req := &visionaipb.CreateProcessorRequest{ |
| 196 |
// TODO: Fill request struct fields. |
| 197 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#CreateProcessorRequest. |
| 198 |
} |
| 199 |
op, err := c.CreateProcessor(ctx, req) |
| 200 |
if err != nil { |
| 201 |
// TODO: Handle error. |
| 202 |
} |
| 203 |
|
| 204 |
resp, err := op.Wait(ctx) |
| 205 |
if err != nil { |
| 206 |
// TODO: Handle error. |
| 207 |
} |
| 208 |
// TODO: Use resp. |
| 209 |
_ = resp |
| 210 |
} |
| 211 |
|
| 212 |
func ExampleAppPlatformClient_DeleteApplication() { |
| 213 |
ctx := context.Background() |
| 214 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 215 |
// It will require modifications to work: |
| 216 |
// - It may require correct/in-range values for request initialization. |
| 217 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 218 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 219 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 220 |
if err != nil { |
| 221 |
// TODO: Handle error. |
| 222 |
} |
| 223 |
defer c.Close() |
| 224 |
|
| 225 |
req := &visionaipb.DeleteApplicationRequest{ |
| 226 |
// TODO: Fill request struct fields. |
| 227 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteApplicationRequest. |
| 228 |
} |
| 229 |
op, err := c.DeleteApplication(ctx, req) |
| 230 |
if err != nil { |
| 231 |
// TODO: Handle error. |
| 232 |
} |
| 233 |
|
| 234 |
err = op.Wait(ctx) |
| 235 |
if err != nil { |
| 236 |
// TODO: Handle error. |
| 237 |
} |
| 238 |
} |
| 239 |
|
| 240 |
func ExampleAppPlatformClient_DeleteApplicationInstances() { |
| 241 |
ctx := context.Background() |
| 242 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 243 |
// It will require modifications to work: |
| 244 |
// - It may require correct/in-range values for request initialization. |
| 245 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 246 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 247 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 248 |
if err != nil { |
| 249 |
// TODO: Handle error. |
| 250 |
} |
| 251 |
defer c.Close() |
| 252 |
|
| 253 |
req := &visionaipb.DeleteApplicationInstancesRequest{ |
| 254 |
// TODO: Fill request struct fields. |
| 255 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteApplicationInstancesRequest. |
| 256 |
} |
| 257 |
op, err := c.DeleteApplicationInstances(ctx, req) |
| 258 |
if err != nil { |
| 259 |
// TODO: Handle error. |
| 260 |
} |
| 261 |
|
| 262 |
resp, err := op.Wait(ctx) |
| 263 |
if err != nil { |
| 264 |
// TODO: Handle error. |
| 265 |
} |
| 266 |
// TODO: Use resp. |
| 267 |
_ = resp |
| 268 |
} |
| 269 |
|
| 270 |
func ExampleAppPlatformClient_DeleteDraft() { |
| 271 |
ctx := context.Background() |
| 272 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 273 |
// It will require modifications to work: |
| 274 |
// - It may require correct/in-range values for request initialization. |
| 275 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 276 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 277 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 278 |
if err != nil { |
| 279 |
// TODO: Handle error. |
| 280 |
} |
| 281 |
defer c.Close() |
| 282 |
|
| 283 |
req := &visionaipb.DeleteDraftRequest{ |
| 284 |
// TODO: Fill request struct fields. |
| 285 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteDraftRequest. |
| 286 |
} |
| 287 |
op, err := c.DeleteDraft(ctx, req) |
| 288 |
if err != nil { |
| 289 |
// TODO: Handle error. |
| 290 |
} |
| 291 |
|
| 292 |
err = op.Wait(ctx) |
| 293 |
if err != nil { |
| 294 |
// TODO: Handle error. |
| 295 |
} |
| 296 |
} |
| 297 |
|
| 298 |
func ExampleAppPlatformClient_DeleteProcessor() { |
| 299 |
ctx := context.Background() |
| 300 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 301 |
// It will require modifications to work: |
| 302 |
// - It may require correct/in-range values for request initialization. |
| 303 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 304 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 305 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 306 |
if err != nil { |
| 307 |
// TODO: Handle error. |
| 308 |
} |
| 309 |
defer c.Close() |
| 310 |
|
| 311 |
req := &visionaipb.DeleteProcessorRequest{ |
| 312 |
// TODO: Fill request struct fields. |
| 313 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeleteProcessorRequest. |
| 314 |
} |
| 315 |
op, err := c.DeleteProcessor(ctx, req) |
| 316 |
if err != nil { |
| 317 |
// TODO: Handle error. |
| 318 |
} |
| 319 |
|
| 320 |
err = op.Wait(ctx) |
| 321 |
if err != nil { |
| 322 |
// TODO: Handle error. |
| 323 |
} |
| 324 |
} |
| 325 |
|
| 326 |
func ExampleAppPlatformClient_DeployApplication() { |
| 327 |
ctx := context.Background() |
| 328 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 329 |
// It will require modifications to work: |
| 330 |
// - It may require correct/in-range values for request initialization. |
| 331 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 332 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 333 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 334 |
if err != nil { |
| 335 |
// TODO: Handle error. |
| 336 |
} |
| 337 |
defer c.Close() |
| 338 |
|
| 339 |
req := &visionaipb.DeployApplicationRequest{ |
| 340 |
// TODO: Fill request struct fields. |
| 341 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#DeployApplicationRequest. |
| 342 |
} |
| 343 |
op, err := c.DeployApplication(ctx, req) |
| 344 |
if err != nil { |
| 345 |
// TODO: Handle error. |
| 346 |
} |
| 347 |
|
| 348 |
resp, err := op.Wait(ctx) |
| 349 |
if err != nil { |
| 350 |
// TODO: Handle error. |
| 351 |
} |
| 352 |
// TODO: Use resp. |
| 353 |
_ = resp |
| 354 |
} |
| 355 |
|
| 356 |
func ExampleAppPlatformClient_GetApplication() { |
| 357 |
ctx := context.Background() |
| 358 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 359 |
// It will require modifications to work: |
| 360 |
// - It may require correct/in-range values for request initialization. |
| 361 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 362 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 363 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 364 |
if err != nil { |
| 365 |
// TODO: Handle error. |
| 366 |
} |
| 367 |
defer c.Close() |
| 368 |
|
| 369 |
req := &visionaipb.GetApplicationRequest{ |
| 370 |
// TODO: Fill request struct fields. |
| 371 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetApplicationRequest. |
| 372 |
} |
| 373 |
resp, err := c.GetApplication(ctx, req) |
| 374 |
if err != nil { |
| 375 |
// TODO: Handle error. |
| 376 |
} |
| 377 |
// TODO: Use resp. |
| 378 |
_ = resp |
| 379 |
} |
| 380 |
|
| 381 |
func ExampleAppPlatformClient_GetDraft() { |
| 382 |
ctx := context.Background() |
| 383 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 384 |
// It will require modifications to work: |
| 385 |
// - It may require correct/in-range values for request initialization. |
| 386 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 387 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 388 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 389 |
if err != nil { |
| 390 |
// TODO: Handle error. |
| 391 |
} |
| 392 |
defer c.Close() |
| 393 |
|
| 394 |
req := &visionaipb.GetDraftRequest{ |
| 395 |
// TODO: Fill request struct fields. |
| 396 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetDraftRequest. |
| 397 |
} |
| 398 |
resp, err := c.GetDraft(ctx, req) |
| 399 |
if err != nil { |
| 400 |
// TODO: Handle error. |
| 401 |
} |
| 402 |
// TODO: Use resp. |
| 403 |
_ = resp |
| 404 |
} |
| 405 |
|
| 406 |
func ExampleAppPlatformClient_GetInstance() { |
| 407 |
ctx := context.Background() |
| 408 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 409 |
// It will require modifications to work: |
| 410 |
// - It may require correct/in-range values for request initialization. |
| 411 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 412 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 413 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 414 |
if err != nil { |
| 415 |
// TODO: Handle error. |
| 416 |
} |
| 417 |
defer c.Close() |
| 418 |
|
| 419 |
req := &visionaipb.GetInstanceRequest{ |
| 420 |
// TODO: Fill request struct fields. |
| 421 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetInstanceRequest. |
| 422 |
} |
| 423 |
resp, err := c.GetInstance(ctx, req) |
| 424 |
if err != nil { |
| 425 |
// TODO: Handle error. |
| 426 |
} |
| 427 |
// TODO: Use resp. |
| 428 |
_ = resp |
| 429 |
} |
| 430 |
|
| 431 |
func ExampleAppPlatformClient_GetProcessor() { |
| 432 |
ctx := context.Background() |
| 433 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 434 |
// It will require modifications to work: |
| 435 |
// - It may require correct/in-range values for request initialization. |
| 436 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 437 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 438 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 439 |
if err != nil { |
| 440 |
// TODO: Handle error. |
| 441 |
} |
| 442 |
defer c.Close() |
| 443 |
|
| 444 |
req := &visionaipb.GetProcessorRequest{ |
| 445 |
// TODO: Fill request struct fields. |
| 446 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#GetProcessorRequest. |
| 447 |
} |
| 448 |
resp, err := c.GetProcessor(ctx, req) |
| 449 |
if err != nil { |
| 450 |
// TODO: Handle error. |
| 451 |
} |
| 452 |
// TODO: Use resp. |
| 453 |
_ = resp |
| 454 |
} |
| 455 |
|
| 456 |
func ExampleAppPlatformClient_ListApplications() { |
| 457 |
ctx := context.Background() |
| 458 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 459 |
// It will require modifications to work: |
| 460 |
// - It may require correct/in-range values for request initialization. |
| 461 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 462 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 463 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 464 |
if err != nil { |
| 465 |
// TODO: Handle error. |
| 466 |
} |
| 467 |
defer c.Close() |
| 468 |
|
| 469 |
req := &visionaipb.ListApplicationsRequest{ |
| 470 |
// TODO: Fill request struct fields. |
| 471 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListApplicationsRequest. |
| 472 |
} |
| 473 |
it := c.ListApplications(ctx, req) |
| 474 |
for { |
| 475 |
resp, err := it.Next() |
| 476 |
if err == iterator.Done { |
| 477 |
break |
| 478 |
} |
| 479 |
if err != nil { |
| 480 |
// TODO: Handle error. |
| 481 |
} |
| 482 |
// TODO: Use resp. |
| 483 |
_ = resp |
| 484 |
|
| 485 |
// If you need to access the underlying RPC response, |
| 486 |
// you can do so by casting the `Response` as below. |
| 487 |
// Otherwise, remove this line. Only populated after |
| 488 |
// first call to Next(). Not safe for concurrent access. |
| 489 |
_ = it.Response.(*visionaipb.ListApplicationsResponse) |
| 490 |
} |
| 491 |
} |
| 492 |
|
| 493 |
func ExampleAppPlatformClient_ListDrafts() { |
| 494 |
ctx := context.Background() |
| 495 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 496 |
// It will require modifications to work: |
| 497 |
// - It may require correct/in-range values for request initialization. |
| 498 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 499 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 500 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 501 |
if err != nil { |
| 502 |
// TODO: Handle error. |
| 503 |
} |
| 504 |
defer c.Close() |
| 505 |
|
| 506 |
req := &visionaipb.ListDraftsRequest{ |
| 507 |
// TODO: Fill request struct fields. |
| 508 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListDraftsRequest. |
| 509 |
} |
| 510 |
it := c.ListDrafts(ctx, req) |
| 511 |
for { |
| 512 |
resp, err := it.Next() |
| 513 |
if err == iterator.Done { |
| 514 |
break |
| 515 |
} |
| 516 |
if err != nil { |
| 517 |
// TODO: Handle error. |
| 518 |
} |
| 519 |
// TODO: Use resp. |
| 520 |
_ = resp |
| 521 |
|
| 522 |
// If you need to access the underlying RPC response, |
| 523 |
// you can do so by casting the `Response` as below. |
| 524 |
// Otherwise, remove this line. Only populated after |
| 525 |
// first call to Next(). Not safe for concurrent access. |
| 526 |
_ = it.Response.(*visionaipb.ListDraftsResponse) |
| 527 |
} |
| 528 |
} |
| 529 |
|
| 530 |
func ExampleAppPlatformClient_ListInstances() { |
| 531 |
ctx := context.Background() |
| 532 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 533 |
// It will require modifications to work: |
| 534 |
// - It may require correct/in-range values for request initialization. |
| 535 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 536 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 537 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 538 |
if err != nil { |
| 539 |
// TODO: Handle error. |
| 540 |
} |
| 541 |
defer c.Close() |
| 542 |
|
| 543 |
req := &visionaipb.ListInstancesRequest{ |
| 544 |
// TODO: Fill request struct fields. |
| 545 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListInstancesRequest. |
| 546 |
} |
| 547 |
it := c.ListInstances(ctx, req) |
| 548 |
for { |
| 549 |
resp, err := it.Next() |
| 550 |
if err == iterator.Done { |
| 551 |
break |
| 552 |
} |
| 553 |
if err != nil { |
| 554 |
// TODO: Handle error. |
| 555 |
} |
| 556 |
// TODO: Use resp. |
| 557 |
_ = resp |
| 558 |
|
| 559 |
// If you need to access the underlying RPC response, |
| 560 |
// you can do so by casting the `Response` as below. |
| 561 |
// Otherwise, remove this line. Only populated after |
| 562 |
// first call to Next(). Not safe for concurrent access. |
| 563 |
_ = it.Response.(*visionaipb.ListInstancesResponse) |
| 564 |
} |
| 565 |
} |
| 566 |
|
| 567 |
func ExampleAppPlatformClient_ListPrebuiltProcessors() { |
| 568 |
ctx := context.Background() |
| 569 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 570 |
// It will require modifications to work: |
| 571 |
// - It may require correct/in-range values for request initialization. |
| 572 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 573 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 574 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 575 |
if err != nil { |
| 576 |
// TODO: Handle error. |
| 577 |
} |
| 578 |
defer c.Close() |
| 579 |
|
| 580 |
req := &visionaipb.ListPrebuiltProcessorsRequest{ |
| 581 |
// TODO: Fill request struct fields. |
| 582 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListPrebuiltProcessorsRequest. |
| 583 |
} |
| 584 |
resp, err := c.ListPrebuiltProcessors(ctx, req) |
| 585 |
if err != nil { |
| 586 |
// TODO: Handle error. |
| 587 |
} |
| 588 |
// TODO: Use resp. |
| 589 |
_ = resp |
| 590 |
} |
| 591 |
|
| 592 |
func ExampleAppPlatformClient_ListProcessors() { |
| 593 |
ctx := context.Background() |
| 594 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 595 |
// It will require modifications to work: |
| 596 |
// - It may require correct/in-range values for request initialization. |
| 597 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 598 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 599 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 600 |
if err != nil { |
| 601 |
// TODO: Handle error. |
| 602 |
} |
| 603 |
defer c.Close() |
| 604 |
|
| 605 |
req := &visionaipb.ListProcessorsRequest{ |
| 606 |
// TODO: Fill request struct fields. |
| 607 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListProcessorsRequest. |
| 608 |
} |
| 609 |
it := c.ListProcessors(ctx, req) |
| 610 |
for { |
| 611 |
resp, err := it.Next() |
| 612 |
if err == iterator.Done { |
| 613 |
break |
| 614 |
} |
| 615 |
if err != nil { |
| 616 |
// TODO: Handle error. |
| 617 |
} |
| 618 |
// TODO: Use resp. |
| 619 |
_ = resp |
| 620 |
|
| 621 |
// If you need to access the underlying RPC response, |
| 622 |
// you can do so by casting the `Response` as below. |
| 623 |
// Otherwise, remove this line. Only populated after |
| 624 |
// first call to Next(). Not safe for concurrent access. |
| 625 |
_ = it.Response.(*visionaipb.ListProcessorsResponse) |
| 626 |
} |
| 627 |
} |
| 628 |
|
| 629 |
func ExampleAppPlatformClient_RemoveApplicationStreamInput() { |
| 630 |
ctx := context.Background() |
| 631 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 632 |
// It will require modifications to work: |
| 633 |
// - It may require correct/in-range values for request initialization. |
| 634 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 635 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 636 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 637 |
if err != nil { |
| 638 |
// TODO: Handle error. |
| 639 |
} |
| 640 |
defer c.Close() |
| 641 |
|
| 642 |
req := &visionaipb.RemoveApplicationStreamInputRequest{ |
| 643 |
// TODO: Fill request struct fields. |
| 644 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#RemoveApplicationStreamInputRequest. |
| 645 |
} |
| 646 |
op, err := c.RemoveApplicationStreamInput(ctx, req) |
| 647 |
if err != nil { |
| 648 |
// TODO: Handle error. |
| 649 |
} |
| 650 |
|
| 651 |
resp, err := op.Wait(ctx) |
| 652 |
if err != nil { |
| 653 |
// TODO: Handle error. |
| 654 |
} |
| 655 |
// TODO: Use resp. |
| 656 |
_ = resp |
| 657 |
} |
| 658 |
|
| 659 |
func ExampleAppPlatformClient_UndeployApplication() { |
| 660 |
ctx := context.Background() |
| 661 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 662 |
// It will require modifications to work: |
| 663 |
// - It may require correct/in-range values for request initialization. |
| 664 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 665 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 666 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 667 |
if err != nil { |
| 668 |
// TODO: Handle error. |
| 669 |
} |
| 670 |
defer c.Close() |
| 671 |
|
| 672 |
req := &visionaipb.UndeployApplicationRequest{ |
| 673 |
// TODO: Fill request struct fields. |
| 674 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UndeployApplicationRequest. |
| 675 |
} |
| 676 |
op, err := c.UndeployApplication(ctx, req) |
| 677 |
if err != nil { |
| 678 |
// TODO: Handle error. |
| 679 |
} |
| 680 |
|
| 681 |
resp, err := op.Wait(ctx) |
| 682 |
if err != nil { |
| 683 |
// TODO: Handle error. |
| 684 |
} |
| 685 |
// TODO: Use resp. |
| 686 |
_ = resp |
| 687 |
} |
| 688 |
|
| 689 |
func ExampleAppPlatformClient_UpdateApplication() { |
| 690 |
ctx := context.Background() |
| 691 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 692 |
// It will require modifications to work: |
| 693 |
// - It may require correct/in-range values for request initialization. |
| 694 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 695 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 696 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 697 |
if err != nil { |
| 698 |
// TODO: Handle error. |
| 699 |
} |
| 700 |
defer c.Close() |
| 701 |
|
| 702 |
req := &visionaipb.UpdateApplicationRequest{ |
| 703 |
// TODO: Fill request struct fields. |
| 704 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateApplicationRequest. |
| 705 |
} |
| 706 |
op, err := c.UpdateApplication(ctx, req) |
| 707 |
if err != nil { |
| 708 |
// TODO: Handle error. |
| 709 |
} |
| 710 |
|
| 711 |
resp, err := op.Wait(ctx) |
| 712 |
if err != nil { |
| 713 |
// TODO: Handle error. |
| 714 |
} |
| 715 |
// TODO: Use resp. |
| 716 |
_ = resp |
| 717 |
} |
| 718 |
|
| 719 |
func ExampleAppPlatformClient_UpdateApplicationInstances() { |
| 720 |
ctx := context.Background() |
| 721 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 722 |
// It will require modifications to work: |
| 723 |
// - It may require correct/in-range values for request initialization. |
| 724 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 725 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 726 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 727 |
if err != nil { |
| 728 |
// TODO: Handle error. |
| 729 |
} |
| 730 |
defer c.Close() |
| 731 |
|
| 732 |
req := &visionaipb.UpdateApplicationInstancesRequest{ |
| 733 |
// TODO: Fill request struct fields. |
| 734 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateApplicationInstancesRequest. |
| 735 |
} |
| 736 |
op, err := c.UpdateApplicationInstances(ctx, req) |
| 737 |
if err != nil { |
| 738 |
// TODO: Handle error. |
| 739 |
} |
| 740 |
|
| 741 |
resp, err := op.Wait(ctx) |
| 742 |
if err != nil { |
| 743 |
// TODO: Handle error. |
| 744 |
} |
| 745 |
// TODO: Use resp. |
| 746 |
_ = resp |
| 747 |
} |
| 748 |
|
| 749 |
func ExampleAppPlatformClient_UpdateApplicationStreamInput() { |
| 750 |
ctx := context.Background() |
| 751 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 752 |
// It will require modifications to work: |
| 753 |
// - It may require correct/in-range values for request initialization. |
| 754 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 755 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 756 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 757 |
if err != nil { |
| 758 |
// TODO: Handle error. |
| 759 |
} |
| 760 |
defer c.Close() |
| 761 |
|
| 762 |
req := &visionaipb.UpdateApplicationStreamInputRequest{ |
| 763 |
// TODO: Fill request struct fields. |
| 764 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateApplicationStreamInputRequest. |
| 765 |
} |
| 766 |
op, err := c.UpdateApplicationStreamInput(ctx, req) |
| 767 |
if err != nil { |
| 768 |
// TODO: Handle error. |
| 769 |
} |
| 770 |
|
| 771 |
resp, err := op.Wait(ctx) |
| 772 |
if err != nil { |
| 773 |
// TODO: Handle error. |
| 774 |
} |
| 775 |
// TODO: Use resp. |
| 776 |
_ = resp |
| 777 |
} |
| 778 |
|
| 779 |
func ExampleAppPlatformClient_UpdateDraft() { |
| 780 |
ctx := context.Background() |
| 781 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 782 |
// It will require modifications to work: |
| 783 |
// - It may require correct/in-range values for request initialization. |
| 784 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 785 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 786 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 787 |
if err != nil { |
| 788 |
// TODO: Handle error. |
| 789 |
} |
| 790 |
defer c.Close() |
| 791 |
|
| 792 |
req := &visionaipb.UpdateDraftRequest{ |
| 793 |
// TODO: Fill request struct fields. |
| 794 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateDraftRequest. |
| 795 |
} |
| 796 |
op, err := c.UpdateDraft(ctx, req) |
| 797 |
if err != nil { |
| 798 |
// TODO: Handle error. |
| 799 |
} |
| 800 |
|
| 801 |
resp, err := op.Wait(ctx) |
| 802 |
if err != nil { |
| 803 |
// TODO: Handle error. |
| 804 |
} |
| 805 |
// TODO: Use resp. |
| 806 |
_ = resp |
| 807 |
} |
| 808 |
|
| 809 |
func ExampleAppPlatformClient_UpdateProcessor() { |
| 810 |
ctx := context.Background() |
| 811 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 812 |
// It will require modifications to work: |
| 813 |
// - It may require correct/in-range values for request initialization. |
| 814 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 815 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 816 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 817 |
if err != nil { |
| 818 |
// TODO: Handle error. |
| 819 |
} |
| 820 |
defer c.Close() |
| 821 |
|
| 822 |
req := &visionaipb.UpdateProcessorRequest{ |
| 823 |
// TODO: Fill request struct fields. |
| 824 |
// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#UpdateProcessorRequest. |
| 825 |
} |
| 826 |
op, err := c.UpdateProcessor(ctx, req) |
| 827 |
if err != nil { |
| 828 |
// TODO: Handle error. |
| 829 |
} |
| 830 |
|
| 831 |
resp, err := op.Wait(ctx) |
| 832 |
if err != nil { |
| 833 |
// TODO: Handle error. |
| 834 |
} |
| 835 |
// TODO: Use resp. |
| 836 |
_ = resp |
| 837 |
} |
| 838 |
|
| 839 |
func ExampleAppPlatformClient_CancelOperation() { |
| 840 |
ctx := context.Background() |
| 841 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 842 |
// It will require modifications to work: |
| 843 |
// - It may require correct/in-range values for request initialization. |
| 844 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 845 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 846 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 847 |
if err != nil { |
| 848 |
// TODO: Handle error. |
| 849 |
} |
| 850 |
defer c.Close() |
| 851 |
|
| 852 |
req := &longrunningpb.CancelOperationRequest{ |
| 853 |
// TODO: Fill request struct fields. |
| 854 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. |
| 855 |
} |
| 856 |
err = c.CancelOperation(ctx, req) |
| 857 |
if err != nil { |
| 858 |
// TODO: Handle error. |
| 859 |
} |
| 860 |
} |
| 861 |
|
| 862 |
func ExampleAppPlatformClient_DeleteOperation() { |
| 863 |
ctx := context.Background() |
| 864 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 865 |
// It will require modifications to work: |
| 866 |
// - It may require correct/in-range values for request initialization. |
| 867 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 868 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 869 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 870 |
if err != nil { |
| 871 |
// TODO: Handle error. |
| 872 |
} |
| 873 |
defer c.Close() |
| 874 |
|
| 875 |
req := &longrunningpb.DeleteOperationRequest{ |
| 876 |
// TODO: Fill request struct fields. |
| 877 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. |
| 878 |
} |
| 879 |
err = c.DeleteOperation(ctx, req) |
| 880 |
if err != nil { |
| 881 |
// TODO: Handle error. |
| 882 |
} |
| 883 |
} |
| 884 |
|
| 885 |
func ExampleAppPlatformClient_GetOperation() { |
| 886 |
ctx := context.Background() |
| 887 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 888 |
// It will require modifications to work: |
| 889 |
// - It may require correct/in-range values for request initialization. |
| 890 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 891 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 892 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 893 |
if err != nil { |
| 894 |
// TODO: Handle error. |
| 895 |
} |
| 896 |
defer c.Close() |
| 897 |
|
| 898 |
req := &longrunningpb.GetOperationRequest{ |
| 899 |
// TODO: Fill request struct fields. |
| 900 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. |
| 901 |
} |
| 902 |
resp, err := c.GetOperation(ctx, req) |
| 903 |
if err != nil { |
| 904 |
// TODO: Handle error. |
| 905 |
} |
| 906 |
// TODO: Use resp. |
| 907 |
_ = resp |
| 908 |
} |
| 909 |
|
| 910 |
func ExampleAppPlatformClient_ListOperations() { |
| 911 |
ctx := context.Background() |
| 912 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 913 |
// It will require modifications to work: |
| 914 |
// - It may require correct/in-range values for request initialization. |
| 915 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 916 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 917 |
c, err := visionai.NewAppPlatformClient(ctx) |
| 918 |
if err != nil { |
| 919 |
// TODO: Handle error. |
| 920 |
} |
| 921 |
defer c.Close() |
| 922 |
|
| 923 |
req := &longrunningpb.ListOperationsRequest{ |
| 924 |
// TODO: Fill request struct fields. |
| 925 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. |
| 926 |
} |
| 927 |
it := c.ListOperations(ctx, req) |
| 928 |
for { |
| 929 |
resp, err := it.Next() |
| 930 |
if err == iterator.Done { |
| 931 |
break |
| 932 |
} |
| 933 |
if err != nil { |
| 934 |
// TODO: Handle error. |
| 935 |
} |
| 936 |
// TODO: Use resp. |
| 937 |
_ = resp |
| 938 |
|
| 939 |
// If you need to access the underlying RPC response, |
| 940 |
// you can do so by casting the `Response` as below. |
| 941 |
// Otherwise, remove this line. Only populated after |
| 942 |
// first call to Next(). Not safe for concurrent access. |
| 943 |
_ = it.Response.(*longrunningpb.ListOperationsResponse) |
| 944 |
} |
| 945 |
} |