| 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 apihub_test |
| 18 |
|
| 19 |
import ( |
| 20 |
"context" |
| 21 |
|
| 22 |
apihub "cloud.google.com/go/apihub/apiv1" |
| 23 |
apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb" |
| 24 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 25 |
"google.golang.org/api/iterator" |
| 26 |
locationpb "google.golang.org/genproto/googleapis/cloud/location" |
| 27 |
) |
| 28 |
|
| 29 |
func ExampleNewRESTClient() { |
| 30 |
ctx := context.Background() |
| 31 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 32 |
// It will require modifications to work: |
| 33 |
// - It may require correct/in-range values for request initialization. |
| 34 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 35 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 36 |
c, err := apihub.NewRESTClient(ctx) |
| 37 |
if err != nil { |
| 38 |
// TODO: Handle error. |
| 39 |
} |
| 40 |
defer c.Close() |
| 41 |
|
| 42 |
// TODO: Use client. |
| 43 |
_ = c |
| 44 |
} |
| 45 |
|
| 46 |
func ExampleClient_CreateApi() { |
| 47 |
ctx := context.Background() |
| 48 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 49 |
// It will require modifications to work: |
| 50 |
// - It may require correct/in-range values for request initialization. |
| 51 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 52 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 53 |
c, err := apihub.NewRESTClient(ctx) |
| 54 |
if err != nil { |
| 55 |
// TODO: Handle error. |
| 56 |
} |
| 57 |
defer c.Close() |
| 58 |
|
| 59 |
req := &apihubpb.CreateApiRequest{ |
| 60 |
// TODO: Fill request struct fields. |
| 61 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateApiRequest. |
| 62 |
} |
| 63 |
resp, err := c.CreateApi(ctx, req) |
| 64 |
if err != nil { |
| 65 |
// TODO: Handle error. |
| 66 |
} |
| 67 |
// TODO: Use resp. |
| 68 |
_ = resp |
| 69 |
} |
| 70 |
|
| 71 |
func ExampleClient_CreateApiOperation() { |
| 72 |
ctx := context.Background() |
| 73 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 74 |
// It will require modifications to work: |
| 75 |
// - It may require correct/in-range values for request initialization. |
| 76 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 77 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 78 |
c, err := apihub.NewRESTClient(ctx) |
| 79 |
if err != nil { |
| 80 |
// TODO: Handle error. |
| 81 |
} |
| 82 |
defer c.Close() |
| 83 |
|
| 84 |
req := &apihubpb.CreateApiOperationRequest{ |
| 85 |
// TODO: Fill request struct fields. |
| 86 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateApiOperationRequest. |
| 87 |
} |
| 88 |
resp, err := c.CreateApiOperation(ctx, req) |
| 89 |
if err != nil { |
| 90 |
// TODO: Handle error. |
| 91 |
} |
| 92 |
// TODO: Use resp. |
| 93 |
_ = resp |
| 94 |
} |
| 95 |
|
| 96 |
func ExampleClient_CreateAttribute() { |
| 97 |
ctx := context.Background() |
| 98 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 99 |
// It will require modifications to work: |
| 100 |
// - It may require correct/in-range values for request initialization. |
| 101 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 102 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 103 |
c, err := apihub.NewRESTClient(ctx) |
| 104 |
if err != nil { |
| 105 |
// TODO: Handle error. |
| 106 |
} |
| 107 |
defer c.Close() |
| 108 |
|
| 109 |
req := &apihubpb.CreateAttributeRequest{ |
| 110 |
// TODO: Fill request struct fields. |
| 111 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateAttributeRequest. |
| 112 |
} |
| 113 |
resp, err := c.CreateAttribute(ctx, req) |
| 114 |
if err != nil { |
| 115 |
// TODO: Handle error. |
| 116 |
} |
| 117 |
// TODO: Use resp. |
| 118 |
_ = resp |
| 119 |
} |
| 120 |
|
| 121 |
func ExampleClient_CreateDeployment() { |
| 122 |
ctx := context.Background() |
| 123 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 124 |
// It will require modifications to work: |
| 125 |
// - It may require correct/in-range values for request initialization. |
| 126 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 127 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 128 |
c, err := apihub.NewRESTClient(ctx) |
| 129 |
if err != nil { |
| 130 |
// TODO: Handle error. |
| 131 |
} |
| 132 |
defer c.Close() |
| 133 |
|
| 134 |
req := &apihubpb.CreateDeploymentRequest{ |
| 135 |
// TODO: Fill request struct fields. |
| 136 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateDeploymentRequest. |
| 137 |
} |
| 138 |
resp, err := c.CreateDeployment(ctx, req) |
| 139 |
if err != nil { |
| 140 |
// TODO: Handle error. |
| 141 |
} |
| 142 |
// TODO: Use resp. |
| 143 |
_ = resp |
| 144 |
} |
| 145 |
|
| 146 |
func ExampleClient_CreateExternalApi() { |
| 147 |
ctx := context.Background() |
| 148 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 149 |
// It will require modifications to work: |
| 150 |
// - It may require correct/in-range values for request initialization. |
| 151 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 152 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 153 |
c, err := apihub.NewRESTClient(ctx) |
| 154 |
if err != nil { |
| 155 |
// TODO: Handle error. |
| 156 |
} |
| 157 |
defer c.Close() |
| 158 |
|
| 159 |
req := &apihubpb.CreateExternalApiRequest{ |
| 160 |
// TODO: Fill request struct fields. |
| 161 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateExternalApiRequest. |
| 162 |
} |
| 163 |
resp, err := c.CreateExternalApi(ctx, req) |
| 164 |
if err != nil { |
| 165 |
// TODO: Handle error. |
| 166 |
} |
| 167 |
// TODO: Use resp. |
| 168 |
_ = resp |
| 169 |
} |
| 170 |
|
| 171 |
func ExampleClient_CreateSpec() { |
| 172 |
ctx := context.Background() |
| 173 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 174 |
// It will require modifications to work: |
| 175 |
// - It may require correct/in-range values for request initialization. |
| 176 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 177 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 178 |
c, err := apihub.NewRESTClient(ctx) |
| 179 |
if err != nil { |
| 180 |
// TODO: Handle error. |
| 181 |
} |
| 182 |
defer c.Close() |
| 183 |
|
| 184 |
req := &apihubpb.CreateSpecRequest{ |
| 185 |
// TODO: Fill request struct fields. |
| 186 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateSpecRequest. |
| 187 |
} |
| 188 |
resp, err := c.CreateSpec(ctx, req) |
| 189 |
if err != nil { |
| 190 |
// TODO: Handle error. |
| 191 |
} |
| 192 |
// TODO: Use resp. |
| 193 |
_ = resp |
| 194 |
} |
| 195 |
|
| 196 |
func ExampleClient_CreateVersion() { |
| 197 |
ctx := context.Background() |
| 198 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 199 |
// It will require modifications to work: |
| 200 |
// - It may require correct/in-range values for request initialization. |
| 201 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 202 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 203 |
c, err := apihub.NewRESTClient(ctx) |
| 204 |
if err != nil { |
| 205 |
// TODO: Handle error. |
| 206 |
} |
| 207 |
defer c.Close() |
| 208 |
|
| 209 |
req := &apihubpb.CreateVersionRequest{ |
| 210 |
// TODO: Fill request struct fields. |
| 211 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateVersionRequest. |
| 212 |
} |
| 213 |
resp, err := c.CreateVersion(ctx, req) |
| 214 |
if err != nil { |
| 215 |
// TODO: Handle error. |
| 216 |
} |
| 217 |
// TODO: Use resp. |
| 218 |
_ = resp |
| 219 |
} |
| 220 |
|
| 221 |
func ExampleClient_DeleteApi() { |
| 222 |
ctx := context.Background() |
| 223 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 224 |
// It will require modifications to work: |
| 225 |
// - It may require correct/in-range values for request initialization. |
| 226 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 227 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 228 |
c, err := apihub.NewRESTClient(ctx) |
| 229 |
if err != nil { |
| 230 |
// TODO: Handle error. |
| 231 |
} |
| 232 |
defer c.Close() |
| 233 |
|
| 234 |
req := &apihubpb.DeleteApiRequest{ |
| 235 |
// TODO: Fill request struct fields. |
| 236 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteApiRequest. |
| 237 |
} |
| 238 |
err = c.DeleteApi(ctx, req) |
| 239 |
if err != nil { |
| 240 |
// TODO: Handle error. |
| 241 |
} |
| 242 |
} |
| 243 |
|
| 244 |
func ExampleClient_DeleteApiOperation() { |
| 245 |
ctx := context.Background() |
| 246 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 247 |
// It will require modifications to work: |
| 248 |
// - It may require correct/in-range values for request initialization. |
| 249 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 250 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 251 |
c, err := apihub.NewRESTClient(ctx) |
| 252 |
if err != nil { |
| 253 |
// TODO: Handle error. |
| 254 |
} |
| 255 |
defer c.Close() |
| 256 |
|
| 257 |
req := &apihubpb.DeleteApiOperationRequest{ |
| 258 |
// TODO: Fill request struct fields. |
| 259 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteApiOperationRequest. |
| 260 |
} |
| 261 |
err = c.DeleteApiOperation(ctx, req) |
| 262 |
if err != nil { |
| 263 |
// TODO: Handle error. |
| 264 |
} |
| 265 |
} |
| 266 |
|
| 267 |
func ExampleClient_DeleteAttribute() { |
| 268 |
ctx := context.Background() |
| 269 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 270 |
// It will require modifications to work: |
| 271 |
// - It may require correct/in-range values for request initialization. |
| 272 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 273 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 274 |
c, err := apihub.NewRESTClient(ctx) |
| 275 |
if err != nil { |
| 276 |
// TODO: Handle error. |
| 277 |
} |
| 278 |
defer c.Close() |
| 279 |
|
| 280 |
req := &apihubpb.DeleteAttributeRequest{ |
| 281 |
// TODO: Fill request struct fields. |
| 282 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteAttributeRequest. |
| 283 |
} |
| 284 |
err = c.DeleteAttribute(ctx, req) |
| 285 |
if err != nil { |
| 286 |
// TODO: Handle error. |
| 287 |
} |
| 288 |
} |
| 289 |
|
| 290 |
func ExampleClient_DeleteDeployment() { |
| 291 |
ctx := context.Background() |
| 292 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 293 |
// It will require modifications to work: |
| 294 |
// - It may require correct/in-range values for request initialization. |
| 295 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 296 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 297 |
c, err := apihub.NewRESTClient(ctx) |
| 298 |
if err != nil { |
| 299 |
// TODO: Handle error. |
| 300 |
} |
| 301 |
defer c.Close() |
| 302 |
|
| 303 |
req := &apihubpb.DeleteDeploymentRequest{ |
| 304 |
// TODO: Fill request struct fields. |
| 305 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteDeploymentRequest. |
| 306 |
} |
| 307 |
err = c.DeleteDeployment(ctx, req) |
| 308 |
if err != nil { |
| 309 |
// TODO: Handle error. |
| 310 |
} |
| 311 |
} |
| 312 |
|
| 313 |
func ExampleClient_DeleteExternalApi() { |
| 314 |
ctx := context.Background() |
| 315 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 316 |
// It will require modifications to work: |
| 317 |
// - It may require correct/in-range values for request initialization. |
| 318 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 319 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 320 |
c, err := apihub.NewRESTClient(ctx) |
| 321 |
if err != nil { |
| 322 |
// TODO: Handle error. |
| 323 |
} |
| 324 |
defer c.Close() |
| 325 |
|
| 326 |
req := &apihubpb.DeleteExternalApiRequest{ |
| 327 |
// TODO: Fill request struct fields. |
| 328 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteExternalApiRequest. |
| 329 |
} |
| 330 |
err = c.DeleteExternalApi(ctx, req) |
| 331 |
if err != nil { |
| 332 |
// TODO: Handle error. |
| 333 |
} |
| 334 |
} |
| 335 |
|
| 336 |
func ExampleClient_DeleteSpec() { |
| 337 |
ctx := context.Background() |
| 338 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 339 |
// It will require modifications to work: |
| 340 |
// - It may require correct/in-range values for request initialization. |
| 341 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 342 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 343 |
c, err := apihub.NewRESTClient(ctx) |
| 344 |
if err != nil { |
| 345 |
// TODO: Handle error. |
| 346 |
} |
| 347 |
defer c.Close() |
| 348 |
|
| 349 |
req := &apihubpb.DeleteSpecRequest{ |
| 350 |
// TODO: Fill request struct fields. |
| 351 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteSpecRequest. |
| 352 |
} |
| 353 |
err = c.DeleteSpec(ctx, req) |
| 354 |
if err != nil { |
| 355 |
// TODO: Handle error. |
| 356 |
} |
| 357 |
} |
| 358 |
|
| 359 |
func ExampleClient_DeleteVersion() { |
| 360 |
ctx := context.Background() |
| 361 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 362 |
// It will require modifications to work: |
| 363 |
// - It may require correct/in-range values for request initialization. |
| 364 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 365 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 366 |
c, err := apihub.NewRESTClient(ctx) |
| 367 |
if err != nil { |
| 368 |
// TODO: Handle error. |
| 369 |
} |
| 370 |
defer c.Close() |
| 371 |
|
| 372 |
req := &apihubpb.DeleteVersionRequest{ |
| 373 |
// TODO: Fill request struct fields. |
| 374 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteVersionRequest. |
| 375 |
} |
| 376 |
err = c.DeleteVersion(ctx, req) |
| 377 |
if err != nil { |
| 378 |
// TODO: Handle error. |
| 379 |
} |
| 380 |
} |
| 381 |
|
| 382 |
func ExampleClient_GetApi() { |
| 383 |
ctx := context.Background() |
| 384 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 385 |
// It will require modifications to work: |
| 386 |
// - It may require correct/in-range values for request initialization. |
| 387 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 388 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 389 |
c, err := apihub.NewRESTClient(ctx) |
| 390 |
if err != nil { |
| 391 |
// TODO: Handle error. |
| 392 |
} |
| 393 |
defer c.Close() |
| 394 |
|
| 395 |
req := &apihubpb.GetApiRequest{ |
| 396 |
// TODO: Fill request struct fields. |
| 397 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetApiRequest. |
| 398 |
} |
| 399 |
resp, err := c.GetApi(ctx, req) |
| 400 |
if err != nil { |
| 401 |
// TODO: Handle error. |
| 402 |
} |
| 403 |
// TODO: Use resp. |
| 404 |
_ = resp |
| 405 |
} |
| 406 |
|
| 407 |
func ExampleClient_GetApiOperation() { |
| 408 |
ctx := context.Background() |
| 409 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 410 |
// It will require modifications to work: |
| 411 |
// - It may require correct/in-range values for request initialization. |
| 412 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 413 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 414 |
c, err := apihub.NewRESTClient(ctx) |
| 415 |
if err != nil { |
| 416 |
// TODO: Handle error. |
| 417 |
} |
| 418 |
defer c.Close() |
| 419 |
|
| 420 |
req := &apihubpb.GetApiOperationRequest{ |
| 421 |
// TODO: Fill request struct fields. |
| 422 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetApiOperationRequest. |
| 423 |
} |
| 424 |
resp, err := c.GetApiOperation(ctx, req) |
| 425 |
if err != nil { |
| 426 |
// TODO: Handle error. |
| 427 |
} |
| 428 |
// TODO: Use resp. |
| 429 |
_ = resp |
| 430 |
} |
| 431 |
|
| 432 |
func ExampleClient_GetAttribute() { |
| 433 |
ctx := context.Background() |
| 434 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 435 |
// It will require modifications to work: |
| 436 |
// - It may require correct/in-range values for request initialization. |
| 437 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 438 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 439 |
c, err := apihub.NewRESTClient(ctx) |
| 440 |
if err != nil { |
| 441 |
// TODO: Handle error. |
| 442 |
} |
| 443 |
defer c.Close() |
| 444 |
|
| 445 |
req := &apihubpb.GetAttributeRequest{ |
| 446 |
// TODO: Fill request struct fields. |
| 447 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetAttributeRequest. |
| 448 |
} |
| 449 |
resp, err := c.GetAttribute(ctx, req) |
| 450 |
if err != nil { |
| 451 |
// TODO: Handle error. |
| 452 |
} |
| 453 |
// TODO: Use resp. |
| 454 |
_ = resp |
| 455 |
} |
| 456 |
|
| 457 |
func ExampleClient_GetDefinition() { |
| 458 |
ctx := context.Background() |
| 459 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 460 |
// It will require modifications to work: |
| 461 |
// - It may require correct/in-range values for request initialization. |
| 462 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 463 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 464 |
c, err := apihub.NewRESTClient(ctx) |
| 465 |
if err != nil { |
| 466 |
// TODO: Handle error. |
| 467 |
} |
| 468 |
defer c.Close() |
| 469 |
|
| 470 |
req := &apihubpb.GetDefinitionRequest{ |
| 471 |
// TODO: Fill request struct fields. |
| 472 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetDefinitionRequest. |
| 473 |
} |
| 474 |
resp, err := c.GetDefinition(ctx, req) |
| 475 |
if err != nil { |
| 476 |
// TODO: Handle error. |
| 477 |
} |
| 478 |
// TODO: Use resp. |
| 479 |
_ = resp |
| 480 |
} |
| 481 |
|
| 482 |
func ExampleClient_GetDeployment() { |
| 483 |
ctx := context.Background() |
| 484 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 485 |
// It will require modifications to work: |
| 486 |
// - It may require correct/in-range values for request initialization. |
| 487 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 488 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 489 |
c, err := apihub.NewRESTClient(ctx) |
| 490 |
if err != nil { |
| 491 |
// TODO: Handle error. |
| 492 |
} |
| 493 |
defer c.Close() |
| 494 |
|
| 495 |
req := &apihubpb.GetDeploymentRequest{ |
| 496 |
// TODO: Fill request struct fields. |
| 497 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetDeploymentRequest. |
| 498 |
} |
| 499 |
resp, err := c.GetDeployment(ctx, req) |
| 500 |
if err != nil { |
| 501 |
// TODO: Handle error. |
| 502 |
} |
| 503 |
// TODO: Use resp. |
| 504 |
_ = resp |
| 505 |
} |
| 506 |
|
| 507 |
func ExampleClient_GetExternalApi() { |
| 508 |
ctx := context.Background() |
| 509 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 510 |
// It will require modifications to work: |
| 511 |
// - It may require correct/in-range values for request initialization. |
| 512 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 513 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 514 |
c, err := apihub.NewRESTClient(ctx) |
| 515 |
if err != nil { |
| 516 |
// TODO: Handle error. |
| 517 |
} |
| 518 |
defer c.Close() |
| 519 |
|
| 520 |
req := &apihubpb.GetExternalApiRequest{ |
| 521 |
// TODO: Fill request struct fields. |
| 522 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetExternalApiRequest. |
| 523 |
} |
| 524 |
resp, err := c.GetExternalApi(ctx, req) |
| 525 |
if err != nil { |
| 526 |
// TODO: Handle error. |
| 527 |
} |
| 528 |
// TODO: Use resp. |
| 529 |
_ = resp |
| 530 |
} |
| 531 |
|
| 532 |
func ExampleClient_GetSpec() { |
| 533 |
ctx := context.Background() |
| 534 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 535 |
// It will require modifications to work: |
| 536 |
// - It may require correct/in-range values for request initialization. |
| 537 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 538 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 539 |
c, err := apihub.NewRESTClient(ctx) |
| 540 |
if err != nil { |
| 541 |
// TODO: Handle error. |
| 542 |
} |
| 543 |
defer c.Close() |
| 544 |
|
| 545 |
req := &apihubpb.GetSpecRequest{ |
| 546 |
// TODO: Fill request struct fields. |
| 547 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetSpecRequest. |
| 548 |
} |
| 549 |
resp, err := c.GetSpec(ctx, req) |
| 550 |
if err != nil { |
| 551 |
// TODO: Handle error. |
| 552 |
} |
| 553 |
// TODO: Use resp. |
| 554 |
_ = resp |
| 555 |
} |
| 556 |
|
| 557 |
func ExampleClient_GetSpecContents() { |
| 558 |
ctx := context.Background() |
| 559 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 560 |
// It will require modifications to work: |
| 561 |
// - It may require correct/in-range values for request initialization. |
| 562 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 563 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 564 |
c, err := apihub.NewRESTClient(ctx) |
| 565 |
if err != nil { |
| 566 |
// TODO: Handle error. |
| 567 |
} |
| 568 |
defer c.Close() |
| 569 |
|
| 570 |
req := &apihubpb.GetSpecContentsRequest{ |
| 571 |
// TODO: Fill request struct fields. |
| 572 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetSpecContentsRequest. |
| 573 |
} |
| 574 |
resp, err := c.GetSpecContents(ctx, req) |
| 575 |
if err != nil { |
| 576 |
// TODO: Handle error. |
| 577 |
} |
| 578 |
// TODO: Use resp. |
| 579 |
_ = resp |
| 580 |
} |
| 581 |
|
| 582 |
func ExampleClient_GetVersion() { |
| 583 |
ctx := context.Background() |
| 584 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 585 |
// It will require modifications to work: |
| 586 |
// - It may require correct/in-range values for request initialization. |
| 587 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 588 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 589 |
c, err := apihub.NewRESTClient(ctx) |
| 590 |
if err != nil { |
| 591 |
// TODO: Handle error. |
| 592 |
} |
| 593 |
defer c.Close() |
| 594 |
|
| 595 |
req := &apihubpb.GetVersionRequest{ |
| 596 |
// TODO: Fill request struct fields. |
| 597 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetVersionRequest. |
| 598 |
} |
| 599 |
resp, err := c.GetVersion(ctx, req) |
| 600 |
if err != nil { |
| 601 |
// TODO: Handle error. |
| 602 |
} |
| 603 |
// TODO: Use resp. |
| 604 |
_ = resp |
| 605 |
} |
| 606 |
|
| 607 |
func ExampleClient_ListApiOperations() { |
| 608 |
ctx := context.Background() |
| 609 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 610 |
// It will require modifications to work: |
| 611 |
// - It may require correct/in-range values for request initialization. |
| 612 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 613 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 614 |
c, err := apihub.NewRESTClient(ctx) |
| 615 |
if err != nil { |
| 616 |
// TODO: Handle error. |
| 617 |
} |
| 618 |
defer c.Close() |
| 619 |
|
| 620 |
req := &apihubpb.ListApiOperationsRequest{ |
| 621 |
// TODO: Fill request struct fields. |
| 622 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListApiOperationsRequest. |
| 623 |
} |
| 624 |
it := c.ListApiOperations(ctx, req) |
| 625 |
for { |
| 626 |
resp, err := it.Next() |
| 627 |
if err == iterator.Done { |
| 628 |
break |
| 629 |
} |
| 630 |
if err != nil { |
| 631 |
// TODO: Handle error. |
| 632 |
} |
| 633 |
// TODO: Use resp. |
| 634 |
_ = resp |
| 635 |
|
| 636 |
// If you need to access the underlying RPC response, |
| 637 |
// you can do so by casting the `Response` as below. |
| 638 |
// Otherwise, remove this line. Only populated after |
| 639 |
// first call to Next(). Not safe for concurrent access. |
| 640 |
_ = it.Response.(*apihubpb.ListApiOperationsResponse) |
| 641 |
} |
| 642 |
} |
| 643 |
|
| 644 |
func ExampleClient_ListApis() { |
| 645 |
ctx := context.Background() |
| 646 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 647 |
// It will require modifications to work: |
| 648 |
// - It may require correct/in-range values for request initialization. |
| 649 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 650 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 651 |
c, err := apihub.NewRESTClient(ctx) |
| 652 |
if err != nil { |
| 653 |
// TODO: Handle error. |
| 654 |
} |
| 655 |
defer c.Close() |
| 656 |
|
| 657 |
req := &apihubpb.ListApisRequest{ |
| 658 |
// TODO: Fill request struct fields. |
| 659 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListApisRequest. |
| 660 |
} |
| 661 |
it := c.ListApis(ctx, req) |
| 662 |
for { |
| 663 |
resp, err := it.Next() |
| 664 |
if err == iterator.Done { |
| 665 |
break |
| 666 |
} |
| 667 |
if err != nil { |
| 668 |
// TODO: Handle error. |
| 669 |
} |
| 670 |
// TODO: Use resp. |
| 671 |
_ = resp |
| 672 |
|
| 673 |
// If you need to access the underlying RPC response, |
| 674 |
// you can do so by casting the `Response` as below. |
| 675 |
// Otherwise, remove this line. Only populated after |
| 676 |
// first call to Next(). Not safe for concurrent access. |
| 677 |
_ = it.Response.(*apihubpb.ListApisResponse) |
| 678 |
} |
| 679 |
} |
| 680 |
|
| 681 |
func ExampleClient_ListAttributes() { |
| 682 |
ctx := context.Background() |
| 683 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 684 |
// It will require modifications to work: |
| 685 |
// - It may require correct/in-range values for request initialization. |
| 686 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 687 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 688 |
c, err := apihub.NewRESTClient(ctx) |
| 689 |
if err != nil { |
| 690 |
// TODO: Handle error. |
| 691 |
} |
| 692 |
defer c.Close() |
| 693 |
|
| 694 |
req := &apihubpb.ListAttributesRequest{ |
| 695 |
// TODO: Fill request struct fields. |
| 696 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListAttributesRequest. |
| 697 |
} |
| 698 |
it := c.ListAttributes(ctx, req) |
| 699 |
for { |
| 700 |
resp, err := it.Next() |
| 701 |
if err == iterator.Done { |
| 702 |
break |
| 703 |
} |
| 704 |
if err != nil { |
| 705 |
// TODO: Handle error. |
| 706 |
} |
| 707 |
// TODO: Use resp. |
| 708 |
_ = resp |
| 709 |
|
| 710 |
// If you need to access the underlying RPC response, |
| 711 |
// you can do so by casting the `Response` as below. |
| 712 |
// Otherwise, remove this line. Only populated after |
| 713 |
// first call to Next(). Not safe for concurrent access. |
| 714 |
_ = it.Response.(*apihubpb.ListAttributesResponse) |
| 715 |
} |
| 716 |
} |
| 717 |
|
| 718 |
func ExampleClient_ListDeployments() { |
| 719 |
ctx := context.Background() |
| 720 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 721 |
// It will require modifications to work: |
| 722 |
// - It may require correct/in-range values for request initialization. |
| 723 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 724 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 725 |
c, err := apihub.NewRESTClient(ctx) |
| 726 |
if err != nil { |
| 727 |
// TODO: Handle error. |
| 728 |
} |
| 729 |
defer c.Close() |
| 730 |
|
| 731 |
req := &apihubpb.ListDeploymentsRequest{ |
| 732 |
// TODO: Fill request struct fields. |
| 733 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListDeploymentsRequest. |
| 734 |
} |
| 735 |
it := c.ListDeployments(ctx, req) |
| 736 |
for { |
| 737 |
resp, err := it.Next() |
| 738 |
if err == iterator.Done { |
| 739 |
break |
| 740 |
} |
| 741 |
if err != nil { |
| 742 |
// TODO: Handle error. |
| 743 |
} |
| 744 |
// TODO: Use resp. |
| 745 |
_ = resp |
| 746 |
|
| 747 |
// If you need to access the underlying RPC response, |
| 748 |
// you can do so by casting the `Response` as below. |
| 749 |
// Otherwise, remove this line. Only populated after |
| 750 |
// first call to Next(). Not safe for concurrent access. |
| 751 |
_ = it.Response.(*apihubpb.ListDeploymentsResponse) |
| 752 |
} |
| 753 |
} |
| 754 |
|
| 755 |
func ExampleClient_ListExternalApis() { |
| 756 |
ctx := context.Background() |
| 757 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 758 |
// It will require modifications to work: |
| 759 |
// - It may require correct/in-range values for request initialization. |
| 760 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 761 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 762 |
c, err := apihub.NewRESTClient(ctx) |
| 763 |
if err != nil { |
| 764 |
// TODO: Handle error. |
| 765 |
} |
| 766 |
defer c.Close() |
| 767 |
|
| 768 |
req := &apihubpb.ListExternalApisRequest{ |
| 769 |
// TODO: Fill request struct fields. |
| 770 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListExternalApisRequest. |
| 771 |
} |
| 772 |
it := c.ListExternalApis(ctx, req) |
| 773 |
for { |
| 774 |
resp, err := it.Next() |
| 775 |
if err == iterator.Done { |
| 776 |
break |
| 777 |
} |
| 778 |
if err != nil { |
| 779 |
// TODO: Handle error. |
| 780 |
} |
| 781 |
// TODO: Use resp. |
| 782 |
_ = resp |
| 783 |
|
| 784 |
// If you need to access the underlying RPC response, |
| 785 |
// you can do so by casting the `Response` as below. |
| 786 |
// Otherwise, remove this line. Only populated after |
| 787 |
// first call to Next(). Not safe for concurrent access. |
| 788 |
_ = it.Response.(*apihubpb.ListExternalApisResponse) |
| 789 |
} |
| 790 |
} |
| 791 |
|
| 792 |
func ExampleClient_ListSpecs() { |
| 793 |
ctx := context.Background() |
| 794 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 795 |
// It will require modifications to work: |
| 796 |
// - It may require correct/in-range values for request initialization. |
| 797 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 798 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 799 |
c, err := apihub.NewRESTClient(ctx) |
| 800 |
if err != nil { |
| 801 |
// TODO: Handle error. |
| 802 |
} |
| 803 |
defer c.Close() |
| 804 |
|
| 805 |
req := &apihubpb.ListSpecsRequest{ |
| 806 |
// TODO: Fill request struct fields. |
| 807 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListSpecsRequest. |
| 808 |
} |
| 809 |
it := c.ListSpecs(ctx, req) |
| 810 |
for { |
| 811 |
resp, err := it.Next() |
| 812 |
if err == iterator.Done { |
| 813 |
break |
| 814 |
} |
| 815 |
if err != nil { |
| 816 |
// TODO: Handle error. |
| 817 |
} |
| 818 |
// TODO: Use resp. |
| 819 |
_ = resp |
| 820 |
|
| 821 |
// If you need to access the underlying RPC response, |
| 822 |
// you can do so by casting the `Response` as below. |
| 823 |
// Otherwise, remove this line. Only populated after |
| 824 |
// first call to Next(). Not safe for concurrent access. |
| 825 |
_ = it.Response.(*apihubpb.ListSpecsResponse) |
| 826 |
} |
| 827 |
} |
| 828 |
|
| 829 |
func ExampleClient_ListVersions() { |
| 830 |
ctx := context.Background() |
| 831 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 832 |
// It will require modifications to work: |
| 833 |
// - It may require correct/in-range values for request initialization. |
| 834 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 835 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 836 |
c, err := apihub.NewRESTClient(ctx) |
| 837 |
if err != nil { |
| 838 |
// TODO: Handle error. |
| 839 |
} |
| 840 |
defer c.Close() |
| 841 |
|
| 842 |
req := &apihubpb.ListVersionsRequest{ |
| 843 |
// TODO: Fill request struct fields. |
| 844 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListVersionsRequest. |
| 845 |
} |
| 846 |
it := c.ListVersions(ctx, req) |
| 847 |
for { |
| 848 |
resp, err := it.Next() |
| 849 |
if err == iterator.Done { |
| 850 |
break |
| 851 |
} |
| 852 |
if err != nil { |
| 853 |
// TODO: Handle error. |
| 854 |
} |
| 855 |
// TODO: Use resp. |
| 856 |
_ = resp |
| 857 |
|
| 858 |
// If you need to access the underlying RPC response, |
| 859 |
// you can do so by casting the `Response` as below. |
| 860 |
// Otherwise, remove this line. Only populated after |
| 861 |
// first call to Next(). Not safe for concurrent access. |
| 862 |
_ = it.Response.(*apihubpb.ListVersionsResponse) |
| 863 |
} |
| 864 |
} |
| 865 |
|
| 866 |
func ExampleClient_SearchResources() { |
| 867 |
ctx := context.Background() |
| 868 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 869 |
// It will require modifications to work: |
| 870 |
// - It may require correct/in-range values for request initialization. |
| 871 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 872 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 873 |
c, err := apihub.NewRESTClient(ctx) |
| 874 |
if err != nil { |
| 875 |
// TODO: Handle error. |
| 876 |
} |
| 877 |
defer c.Close() |
| 878 |
|
| 879 |
req := &apihubpb.SearchResourcesRequest{ |
| 880 |
// TODO: Fill request struct fields. |
| 881 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#SearchResourcesRequest. |
| 882 |
} |
| 883 |
it := c.SearchResources(ctx, req) |
| 884 |
for { |
| 885 |
resp, err := it.Next() |
| 886 |
if err == iterator.Done { |
| 887 |
break |
| 888 |
} |
| 889 |
if err != nil { |
| 890 |
// TODO: Handle error. |
| 891 |
} |
| 892 |
// TODO: Use resp. |
| 893 |
_ = resp |
| 894 |
|
| 895 |
// If you need to access the underlying RPC response, |
| 896 |
// you can do so by casting the `Response` as below. |
| 897 |
// Otherwise, remove this line. Only populated after |
| 898 |
// first call to Next(). Not safe for concurrent access. |
| 899 |
_ = it.Response.(*apihubpb.SearchResourcesResponse) |
| 900 |
} |
| 901 |
} |
| 902 |
|
| 903 |
func ExampleClient_UpdateApi() { |
| 904 |
ctx := context.Background() |
| 905 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 906 |
// It will require modifications to work: |
| 907 |
// - It may require correct/in-range values for request initialization. |
| 908 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 909 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 910 |
c, err := apihub.NewRESTClient(ctx) |
| 911 |
if err != nil { |
| 912 |
// TODO: Handle error. |
| 913 |
} |
| 914 |
defer c.Close() |
| 915 |
|
| 916 |
req := &apihubpb.UpdateApiRequest{ |
| 917 |
// TODO: Fill request struct fields. |
| 918 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateApiRequest. |
| 919 |
} |
| 920 |
resp, err := c.UpdateApi(ctx, req) |
| 921 |
if err != nil { |
| 922 |
// TODO: Handle error. |
| 923 |
} |
| 924 |
// TODO: Use resp. |
| 925 |
_ = resp |
| 926 |
} |
| 927 |
|
| 928 |
func ExampleClient_UpdateApiOperation() { |
| 929 |
ctx := context.Background() |
| 930 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 931 |
// It will require modifications to work: |
| 932 |
// - It may require correct/in-range values for request initialization. |
| 933 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 934 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 935 |
c, err := apihub.NewRESTClient(ctx) |
| 936 |
if err != nil { |
| 937 |
// TODO: Handle error. |
| 938 |
} |
| 939 |
defer c.Close() |
| 940 |
|
| 941 |
req := &apihubpb.UpdateApiOperationRequest{ |
| 942 |
// TODO: Fill request struct fields. |
| 943 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateApiOperationRequest. |
| 944 |
} |
| 945 |
resp, err := c.UpdateApiOperation(ctx, req) |
| 946 |
if err != nil { |
| 947 |
// TODO: Handle error. |
| 948 |
} |
| 949 |
// TODO: Use resp. |
| 950 |
_ = resp |
| 951 |
} |
| 952 |
|
| 953 |
func ExampleClient_UpdateAttribute() { |
| 954 |
ctx := context.Background() |
| 955 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 956 |
// It will require modifications to work: |
| 957 |
// - It may require correct/in-range values for request initialization. |
| 958 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 959 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 960 |
c, err := apihub.NewRESTClient(ctx) |
| 961 |
if err != nil { |
| 962 |
// TODO: Handle error. |
| 963 |
} |
| 964 |
defer c.Close() |
| 965 |
|
| 966 |
req := &apihubpb.UpdateAttributeRequest{ |
| 967 |
// TODO: Fill request struct fields. |
| 968 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateAttributeRequest. |
| 969 |
} |
| 970 |
resp, err := c.UpdateAttribute(ctx, req) |
| 971 |
if err != nil { |
| 972 |
// TODO: Handle error. |
| 973 |
} |
| 974 |
// TODO: Use resp. |
| 975 |
_ = resp |
| 976 |
} |
| 977 |
|
| 978 |
func ExampleClient_UpdateDeployment() { |
| 979 |
ctx := context.Background() |
| 980 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 981 |
// It will require modifications to work: |
| 982 |
// - It may require correct/in-range values for request initialization. |
| 983 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 984 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 985 |
c, err := apihub.NewRESTClient(ctx) |
| 986 |
if err != nil { |
| 987 |
// TODO: Handle error. |
| 988 |
} |
| 989 |
defer c.Close() |
| 990 |
|
| 991 |
req := &apihubpb.UpdateDeploymentRequest{ |
| 992 |
// TODO: Fill request struct fields. |
| 993 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateDeploymentRequest. |
| 994 |
} |
| 995 |
resp, err := c.UpdateDeployment(ctx, req) |
| 996 |
if err != nil { |
| 997 |
// TODO: Handle error. |
| 998 |
} |
| 999 |
// TODO: Use resp. |
| 1000 |
_ = resp |
| 1001 |
} |
| 1002 |
|
| 1003 |
func ExampleClient_UpdateExternalApi() { |
| 1004 |
ctx := context.Background() |
| 1005 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 1006 |
// It will require modifications to work: |
| 1007 |
// - It may require correct/in-range values for request initialization. |
| 1008 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 1009 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 1010 |
c, err := apihub.NewRESTClient(ctx) |
| 1011 |
if err != nil { |
| 1012 |
// TODO: Handle error. |
| 1013 |
} |
| 1014 |
defer c.Close() |
| 1015 |
|
| 1016 |
req := &apihubpb.UpdateExternalApiRequest{ |
| 1017 |
// TODO: Fill request struct fields. |
| 1018 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateExternalApiRequest. |
| 1019 |
} |
| 1020 |
resp, err := c.UpdateExternalApi(ctx, req) |
| 1021 |
if err != nil { |
| 1022 |
// TODO: Handle error. |
| 1023 |
} |
| 1024 |
// TODO: Use resp. |
| 1025 |
_ = resp |
| 1026 |
} |
| 1027 |
|
| 1028 |
func ExampleClient_UpdateSpec() { |
| 1029 |
ctx := context.Background() |
| 1030 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 1031 |
// It will require modifications to work: |
| 1032 |
// - It may require correct/in-range values for request initialization. |
| 1033 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 1034 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 1035 |
c, err := apihub.NewRESTClient(ctx) |
| 1036 |
if err != nil { |
| 1037 |
// TODO: Handle error. |
| 1038 |
} |
| 1039 |
defer c.Close() |
| 1040 |
|
| 1041 |
req := &apihubpb.UpdateSpecRequest{ |
| 1042 |
// TODO: Fill request struct fields. |
| 1043 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateSpecRequest. |
| 1044 |
} |
| 1045 |
resp, err := c.UpdateSpec(ctx, req) |
| 1046 |
if err != nil { |
| 1047 |
// TODO: Handle error. |
| 1048 |
} |
| 1049 |
// TODO: Use resp. |
| 1050 |
_ = resp |
| 1051 |
} |
| 1052 |
|
| 1053 |
func ExampleClient_UpdateVersion() { |
| 1054 |
ctx := context.Background() |
| 1055 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 1056 |
// It will require modifications to work: |
| 1057 |
// - It may require correct/in-range values for request initialization. |
| 1058 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 1059 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 1060 |
c, err := apihub.NewRESTClient(ctx) |
| 1061 |
if err != nil { |
| 1062 |
// TODO: Handle error. |
| 1063 |
} |
| 1064 |
defer c.Close() |
| 1065 |
|
| 1066 |
req := &apihubpb.UpdateVersionRequest{ |
| 1067 |
// TODO: Fill request struct fields. |
| 1068 |
// See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateVersionRequest. |
| 1069 |
} |
| 1070 |
resp, err := c.UpdateVersion(ctx, req) |
| 1071 |
if err != nil { |
| 1072 |
// TODO: Handle error. |
| 1073 |
} |
| 1074 |
// TODO: Use resp. |
| 1075 |
_ = resp |
| 1076 |
} |
| 1077 |
|
| 1078 |
func ExampleClient_GetLocation() { |
| 1079 |
ctx := context.Background() |
| 1080 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 1081 |
// It will require modifications to work: |
| 1082 |
// - It may require correct/in-range values for request initialization. |
| 1083 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 1084 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 1085 |
c, err := apihub.NewRESTClient(ctx) |
| 1086 |
if err != nil { |
| 1087 |
// TODO: Handle error. |
| 1088 |
} |
| 1089 |
defer c.Close() |
| 1090 |
|
| 1091 |
req := &locationpb.GetLocationRequest{ |
| 1092 |
// TODO: Fill request struct fields. |
| 1093 |
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. |
| 1094 |
} |
| 1095 |
resp, err := c.GetLocation(ctx, req) |
| 1096 |
if err != nil { |
| 1097 |
// TODO: Handle error. |
| 1098 |
} |
| 1099 |
// TODO: Use resp. |
| 1100 |
_ = resp |
| 1101 |
} |
| 1102 |
|
| 1103 |
func ExampleClient_ListLocations() { |
| 1104 |
ctx := context.Background() |
| 1105 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 1106 |
// It will require modifications to work: |
| 1107 |
// - It may require correct/in-range values for request initialization. |
| 1108 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 1109 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 1110 |
c, err := apihub.NewRESTClient(ctx) |
| 1111 |
if err != nil { |
| 1112 |
// TODO: Handle error. |
| 1113 |
} |
| 1114 |
defer c.Close() |
| 1115 |
|
| 1116 |
req := &locationpb.ListLocationsRequest{ |
| 1117 |
// TODO: Fill request struct fields. |
| 1118 |
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. |
| 1119 |
} |
| 1120 |
it := c.ListLocations(ctx, req) |
| 1121 |
for { |
| 1122 |
resp, err := it.Next() |
| 1123 |
if err == iterator.Done { |
| 1124 |
break |
| 1125 |
} |
| 1126 |
if err != nil { |
| 1127 |
// TODO: Handle error. |
| 1128 |
} |
| 1129 |
// TODO: Use resp. |
| 1130 |
_ = resp |
| 1131 |
|
| 1132 |
// If you need to access the underlying RPC response, |
| 1133 |
// you can do so by casting the `Response` as below. |
| 1134 |
// Otherwise, remove this line. Only populated after |
| 1135 |
// first call to Next(). Not safe for concurrent access. |
| 1136 |
_ = it.Response.(*locationpb.ListLocationsResponse) |
| 1137 |
} |
| 1138 |
} |
| 1139 |
|
| 1140 |
func ExampleClient_CancelOperation() { |
| 1141 |
ctx := context.Background() |
| 1142 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 1143 |
// It will require modifications to work: |
| 1144 |
// - It may require correct/in-range values for request initialization. |
| 1145 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 1146 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 1147 |
c, err := apihub.NewRESTClient(ctx) |
| 1148 |
if err != nil { |
| 1149 |
// TODO: Handle error. |
| 1150 |
} |
| 1151 |
defer c.Close() |
| 1152 |
|
| 1153 |
req := &longrunningpb.CancelOperationRequest{ |
| 1154 |
// TODO: Fill request struct fields. |
| 1155 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. |
| 1156 |
} |
| 1157 |
err = c.CancelOperation(ctx, req) |
| 1158 |
if err != nil { |
| 1159 |
// TODO: Handle error. |
| 1160 |
} |
| 1161 |
} |
| 1162 |
|
| 1163 |
func ExampleClient_DeleteOperation() { |
| 1164 |
ctx := context.Background() |
| 1165 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 1166 |
// It will require modifications to work: |
| 1167 |
// - It may require correct/in-range values for request initialization. |
| 1168 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 1169 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 1170 |
c, err := apihub.NewRESTClient(ctx) |
| 1171 |
if err != nil { |
| 1172 |
// TODO: Handle error. |
| 1173 |
} |
| 1174 |
defer c.Close() |
| 1175 |
|
| 1176 |
req := &longrunningpb.DeleteOperationRequest{ |
| 1177 |
// TODO: Fill request struct fields. |
| 1178 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. |
| 1179 |
} |
| 1180 |
err = c.DeleteOperation(ctx, req) |
| 1181 |
if err != nil { |
| 1182 |
// TODO: Handle error. |
| 1183 |
} |
| 1184 |
} |
| 1185 |
|
| 1186 |
func ExampleClient_GetOperation() { |
| 1187 |
ctx := context.Background() |
| 1188 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 1189 |
// It will require modifications to work: |
| 1190 |
// - It may require correct/in-range values for request initialization. |
| 1191 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 1192 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 1193 |
c, err := apihub.NewRESTClient(ctx) |
| 1194 |
if err != nil { |
| 1195 |
// TODO: Handle error. |
| 1196 |
} |
| 1197 |
defer c.Close() |
| 1198 |
|
| 1199 |
req := &longrunningpb.GetOperationRequest{ |
| 1200 |
// TODO: Fill request struct fields. |
| 1201 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. |
| 1202 |
} |
| 1203 |
resp, err := c.GetOperation(ctx, req) |
| 1204 |
if err != nil { |
| 1205 |
// TODO: Handle error. |
| 1206 |
} |
| 1207 |
// TODO: Use resp. |
| 1208 |
_ = resp |
| 1209 |
} |
| 1210 |
|
| 1211 |
func ExampleClient_ListOperations() { |
| 1212 |
ctx := context.Background() |
| 1213 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 1214 |
// It will require modifications to work: |
| 1215 |
// - It may require correct/in-range values for request initialization. |
| 1216 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 1217 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 1218 |
c, err := apihub.NewRESTClient(ctx) |
| 1219 |
if err != nil { |
| 1220 |
// TODO: Handle error. |
| 1221 |
} |
| 1222 |
defer c.Close() |
| 1223 |
|
| 1224 |
req := &longrunningpb.ListOperationsRequest{ |
| 1225 |
// TODO: Fill request struct fields. |
| 1226 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. |
| 1227 |
} |
| 1228 |
it := c.ListOperations(ctx, req) |
| 1229 |
for { |
| 1230 |
resp, err := it.Next() |
| 1231 |
if err == iterator.Done { |
| 1232 |
break |
| 1233 |
} |
| 1234 |
if err != nil { |
| 1235 |
// TODO: Handle error. |
| 1236 |
} |
| 1237 |
// TODO: Use resp. |
| 1238 |
_ = resp |
| 1239 |
|
| 1240 |
// If you need to access the underlying RPC response, |
| 1241 |
// you can do so by casting the `Response` as below. |
| 1242 |
// Otherwise, remove this line. Only populated after |
| 1243 |
// first call to Next(). Not safe for concurrent access. |
| 1244 |
_ = it.Response.(*longrunningpb.ListOperationsResponse) |
| 1245 |
} |
| 1246 |
} |