| 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 apigeeregistry |
| 18 |
|
| 19 |
import ( |
| 20 |
"context" |
| 21 |
"fmt" |
| 22 |
"log/slog" |
| 23 |
"math" |
| 24 |
"net/url" |
| 25 |
"time" |
| 26 |
|
| 27 |
apigeeregistrypb "cloud.google.com/go/apigeeregistry/apiv1/apigeeregistrypb" |
| 28 |
iampb "cloud.google.com/go/iam/apiv1/iampb" |
| 29 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 30 |
gax "github.com/googleapis/gax-go/v2" |
| 31 |
"google.golang.org/api/iterator" |
| 32 |
"google.golang.org/api/option" |
| 33 |
"google.golang.org/api/option/internaloption" |
| 34 |
gtransport "google.golang.org/api/transport/grpc" |
| 35 |
httpbodypb "google.golang.org/genproto/googleapis/api/httpbody" |
| 36 |
locationpb "google.golang.org/genproto/googleapis/cloud/location" |
| 37 |
"google.golang.org/grpc" |
| 38 |
"google.golang.org/grpc/codes" |
| 39 |
"google.golang.org/protobuf/proto" |
| 40 |
) |
| 41 |
|
| 42 |
var newRegistryClientHook clientHook |
| 43 |
|
| 44 |
// RegistryCallOptions contains the retry settings for each method of RegistryClient. |
| 45 |
type RegistryCallOptions struct { |
| 46 |
ListApis []gax.CallOption |
| 47 |
GetApi []gax.CallOption |
| 48 |
CreateApi []gax.CallOption |
| 49 |
UpdateApi []gax.CallOption |
| 50 |
DeleteApi []gax.CallOption |
| 51 |
ListApiVersions []gax.CallOption |
| 52 |
GetApiVersion []gax.CallOption |
| 53 |
CreateApiVersion []gax.CallOption |
| 54 |
UpdateApiVersion []gax.CallOption |
| 55 |
DeleteApiVersion []gax.CallOption |
| 56 |
ListApiSpecs []gax.CallOption |
| 57 |
GetApiSpec []gax.CallOption |
| 58 |
GetApiSpecContents []gax.CallOption |
| 59 |
CreateApiSpec []gax.CallOption |
| 60 |
UpdateApiSpec []gax.CallOption |
| 61 |
DeleteApiSpec []gax.CallOption |
| 62 |
TagApiSpecRevision []gax.CallOption |
| 63 |
ListApiSpecRevisions []gax.CallOption |
| 64 |
RollbackApiSpec []gax.CallOption |
| 65 |
DeleteApiSpecRevision []gax.CallOption |
| 66 |
ListApiDeployments []gax.CallOption |
| 67 |
GetApiDeployment []gax.CallOption |
| 68 |
CreateApiDeployment []gax.CallOption |
| 69 |
UpdateApiDeployment []gax.CallOption |
| 70 |
DeleteApiDeployment []gax.CallOption |
| 71 |
TagApiDeploymentRevision []gax.CallOption |
| 72 |
ListApiDeploymentRevisions []gax.CallOption |
| 73 |
RollbackApiDeployment []gax.CallOption |
| 74 |
DeleteApiDeploymentRevision []gax.CallOption |
| 75 |
ListArtifacts []gax.CallOption |
| 76 |
GetArtifact []gax.CallOption |
| 77 |
GetArtifactContents []gax.CallOption |
| 78 |
CreateArtifact []gax.CallOption |
| 79 |
ReplaceArtifact []gax.CallOption |
| 80 |
DeleteArtifact []gax.CallOption |
| 81 |
GetLocation []gax.CallOption |
| 82 |
ListLocations []gax.CallOption |
| 83 |
GetIamPolicy []gax.CallOption |
| 84 |
SetIamPolicy []gax.CallOption |
| 85 |
TestIamPermissions []gax.CallOption |
| 86 |
CancelOperation []gax.CallOption |
| 87 |
DeleteOperation []gax.CallOption |
| 88 |
GetOperation []gax.CallOption |
| 89 |
ListOperations []gax.CallOption |
| 90 |
} |
| 91 |
|
| 92 |
func defaultRegistryGRPCClientOptions() []option.ClientOption { |
| 93 |
return []option.ClientOption{ |
| 94 |
internaloption.WithDefaultEndpoint("apigeeregistry.googleapis.com:443"), |
| 95 |
internaloption.WithDefaultEndpointTemplate("apigeeregistry.UNIVERSE_DOMAIN:443"), |
| 96 |
internaloption.WithDefaultMTLSEndpoint("apigeeregistry.mtls.googleapis.com:443"), |
| 97 |
internaloption.WithDefaultUniverseDomain("googleapis.com"), |
| 98 |
internaloption.WithDefaultAudience("https://apigeeregistry.googleapis.com/"), |
| 99 |
internaloption.WithDefaultScopes(DefaultAuthScopes()...), |
| 100 |
internaloption.EnableJwtWithScope(), |
| 101 |
internaloption.EnableNewAuthLibrary(), |
| 102 |
option.WithGRPCDialOption(grpc.WithDefaultCallOptions( |
| 103 |
grpc.MaxCallRecvMsgSize(math.MaxInt32))), |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
func defaultRegistryCallOptions() *RegistryCallOptions { |
| 108 |
return &RegistryCallOptions{ |
| 109 |
ListApis: []gax.CallOption{ |
| 110 |
gax.WithTimeout(60000 * time.Millisecond), |
| 111 |
gax.WithRetry(func() gax.Retryer { |
| 112 |
return gax.OnCodes([]codes.Code{ |
| 113 |
codes.Aborted, |
| 114 |
codes.Canceled, |
| 115 |
codes.DeadlineExceeded, |
| 116 |
codes.Unavailable, |
| 117 |
}, gax.Backoff{ |
| 118 |
Initial: 200 * time.Millisecond, |
| 119 |
Max: 60000 * time.Millisecond, |
| 120 |
Multiplier: 1.30, |
| 121 |
}) |
| 122 |
}), |
| 123 |
}, |
| 124 |
GetApi: []gax.CallOption{ |
| 125 |
gax.WithTimeout(60000 * time.Millisecond), |
| 126 |
gax.WithRetry(func() gax.Retryer { |
| 127 |
return gax.OnCodes([]codes.Code{ |
| 128 |
codes.Aborted, |
| 129 |
codes.Canceled, |
| 130 |
codes.DeadlineExceeded, |
| 131 |
codes.Unavailable, |
| 132 |
}, gax.Backoff{ |
| 133 |
Initial: 200 * time.Millisecond, |
| 134 |
Max: 60000 * time.Millisecond, |
| 135 |
Multiplier: 1.30, |
| 136 |
}) |
| 137 |
}), |
| 138 |
}, |
| 139 |
CreateApi: []gax.CallOption{ |
| 140 |
gax.WithTimeout(60000 * time.Millisecond), |
| 141 |
gax.WithRetry(func() gax.Retryer { |
| 142 |
return gax.OnCodes([]codes.Code{ |
| 143 |
codes.Aborted, |
| 144 |
codes.Canceled, |
| 145 |
codes.DeadlineExceeded, |
| 146 |
codes.Unavailable, |
| 147 |
}, gax.Backoff{ |
| 148 |
Initial: 200 * time.Millisecond, |
| 149 |
Max: 60000 * time.Millisecond, |
| 150 |
Multiplier: 1.30, |
| 151 |
}) |
| 152 |
}), |
| 153 |
}, |
| 154 |
UpdateApi: []gax.CallOption{ |
| 155 |
gax.WithTimeout(60000 * time.Millisecond), |
| 156 |
gax.WithRetry(func() gax.Retryer { |
| 157 |
return gax.OnCodes([]codes.Code{ |
| 158 |
codes.Aborted, |
| 159 |
codes.Canceled, |
| 160 |
codes.DeadlineExceeded, |
| 161 |
codes.Unavailable, |
| 162 |
}, gax.Backoff{ |
| 163 |
Initial: 200 * time.Millisecond, |
| 164 |
Max: 60000 * time.Millisecond, |
| 165 |
Multiplier: 1.30, |
| 166 |
}) |
| 167 |
}), |
| 168 |
}, |
| 169 |
DeleteApi: []gax.CallOption{ |
| 170 |
gax.WithTimeout(60000 * time.Millisecond), |
| 171 |
gax.WithRetry(func() gax.Retryer { |
| 172 |
return gax.OnCodes([]codes.Code{ |
| 173 |
codes.Aborted, |
| 174 |
codes.Canceled, |
| 175 |
codes.DeadlineExceeded, |
| 176 |
codes.Unavailable, |
| 177 |
}, gax.Backoff{ |
| 178 |
Initial: 200 * time.Millisecond, |
| 179 |
Max: 60000 * time.Millisecond, |
| 180 |
Multiplier: 1.30, |
| 181 |
}) |
| 182 |
}), |
| 183 |
}, |
| 184 |
ListApiVersions: []gax.CallOption{ |
| 185 |
gax.WithTimeout(60000 * time.Millisecond), |
| 186 |
gax.WithRetry(func() gax.Retryer { |
| 187 |
return gax.OnCodes([]codes.Code{ |
| 188 |
codes.Aborted, |
| 189 |
codes.Canceled, |
| 190 |
codes.DeadlineExceeded, |
| 191 |
codes.Unavailable, |
| 192 |
}, gax.Backoff{ |
| 193 |
Initial: 200 * time.Millisecond, |
| 194 |
Max: 60000 * time.Millisecond, |
| 195 |
Multiplier: 1.30, |
| 196 |
}) |
| 197 |
}), |
| 198 |
}, |
| 199 |
GetApiVersion: []gax.CallOption{ |
| 200 |
gax.WithTimeout(60000 * time.Millisecond), |
| 201 |
gax.WithRetry(func() gax.Retryer { |
| 202 |
return gax.OnCodes([]codes.Code{ |
| 203 |
codes.Aborted, |
| 204 |
codes.Canceled, |
| 205 |
codes.DeadlineExceeded, |
| 206 |
codes.Unavailable, |
| 207 |
}, gax.Backoff{ |
| 208 |
Initial: 200 * time.Millisecond, |
| 209 |
Max: 60000 * time.Millisecond, |
| 210 |
Multiplier: 1.30, |
| 211 |
}) |
| 212 |
}), |
| 213 |
}, |
| 214 |
CreateApiVersion: []gax.CallOption{ |
| 215 |
gax.WithTimeout(60000 * time.Millisecond), |
| 216 |
gax.WithRetry(func() gax.Retryer { |
| 217 |
return gax.OnCodes([]codes.Code{ |
| 218 |
codes.Aborted, |
| 219 |
codes.Canceled, |
| 220 |
codes.DeadlineExceeded, |
| 221 |
codes.Unavailable, |
| 222 |
}, gax.Backoff{ |
| 223 |
Initial: 200 * time.Millisecond, |
| 224 |
Max: 60000 * time.Millisecond, |
| 225 |
Multiplier: 1.30, |
| 226 |
}) |
| 227 |
}), |
| 228 |
}, |
| 229 |
UpdateApiVersion: []gax.CallOption{ |
| 230 |
gax.WithTimeout(60000 * time.Millisecond), |
| 231 |
gax.WithRetry(func() gax.Retryer { |
| 232 |
return gax.OnCodes([]codes.Code{ |
| 233 |
codes.Aborted, |
| 234 |
codes.Canceled, |
| 235 |
codes.DeadlineExceeded, |
| 236 |
codes.Unavailable, |
| 237 |
}, gax.Backoff{ |
| 238 |
Initial: 200 * time.Millisecond, |
| 239 |
Max: 60000 * time.Millisecond, |
| 240 |
Multiplier: 1.30, |
| 241 |
}) |
| 242 |
}), |
| 243 |
}, |
| 244 |
DeleteApiVersion: []gax.CallOption{ |
| 245 |
gax.WithTimeout(60000 * time.Millisecond), |
| 246 |
gax.WithRetry(func() gax.Retryer { |
| 247 |
return gax.OnCodes([]codes.Code{ |
| 248 |
codes.Aborted, |
| 249 |
codes.Canceled, |
| 250 |
codes.DeadlineExceeded, |
| 251 |
codes.Unavailable, |
| 252 |
}, gax.Backoff{ |
| 253 |
Initial: 200 * time.Millisecond, |
| 254 |
Max: 60000 * time.Millisecond, |
| 255 |
Multiplier: 1.30, |
| 256 |
}) |
| 257 |
}), |
| 258 |
}, |
| 259 |
ListApiSpecs: []gax.CallOption{ |
| 260 |
gax.WithTimeout(60000 * time.Millisecond), |
| 261 |
gax.WithRetry(func() gax.Retryer { |
| 262 |
return gax.OnCodes([]codes.Code{ |
| 263 |
codes.Aborted, |
| 264 |
codes.Canceled, |
| 265 |
codes.DeadlineExceeded, |
| 266 |
codes.Unavailable, |
| 267 |
}, gax.Backoff{ |
| 268 |
Initial: 200 * time.Millisecond, |
| 269 |
Max: 60000 * time.Millisecond, |
| 270 |
Multiplier: 1.30, |
| 271 |
}) |
| 272 |
}), |
| 273 |
}, |
| 274 |
GetApiSpec: []gax.CallOption{ |
| 275 |
gax.WithTimeout(60000 * time.Millisecond), |
| 276 |
gax.WithRetry(func() gax.Retryer { |
| 277 |
return gax.OnCodes([]codes.Code{ |
| 278 |
codes.Aborted, |
| 279 |
codes.Canceled, |
| 280 |
codes.DeadlineExceeded, |
| 281 |
codes.Unavailable, |
| 282 |
}, gax.Backoff{ |
| 283 |
Initial: 200 * time.Millisecond, |
| 284 |
Max: 60000 * time.Millisecond, |
| 285 |
Multiplier: 1.30, |
| 286 |
}) |
| 287 |
}), |
| 288 |
}, |
| 289 |
GetApiSpecContents: []gax.CallOption{ |
| 290 |
gax.WithTimeout(60000 * time.Millisecond), |
| 291 |
gax.WithRetry(func() gax.Retryer { |
| 292 |
return gax.OnCodes([]codes.Code{ |
| 293 |
codes.Aborted, |
| 294 |
codes.Canceled, |
| 295 |
codes.DeadlineExceeded, |
| 296 |
codes.Unavailable, |
| 297 |
}, gax.Backoff{ |
| 298 |
Initial: 200 * time.Millisecond, |
| 299 |
Max: 60000 * time.Millisecond, |
| 300 |
Multiplier: 1.30, |
| 301 |
}) |
| 302 |
}), |
| 303 |
}, |
| 304 |
CreateApiSpec: []gax.CallOption{ |
| 305 |
gax.WithTimeout(60000 * time.Millisecond), |
| 306 |
gax.WithRetry(func() gax.Retryer { |
| 307 |
return gax.OnCodes([]codes.Code{ |
| 308 |
codes.Aborted, |
| 309 |
codes.Canceled, |
| 310 |
codes.DeadlineExceeded, |
| 311 |
codes.Unavailable, |
| 312 |
}, gax.Backoff{ |
| 313 |
Initial: 200 * time.Millisecond, |
| 314 |
Max: 60000 * time.Millisecond, |
| 315 |
Multiplier: 1.30, |
| 316 |
}) |
| 317 |
}), |
| 318 |
}, |
| 319 |
UpdateApiSpec: []gax.CallOption{ |
| 320 |
gax.WithTimeout(60000 * time.Millisecond), |
| 321 |
gax.WithRetry(func() gax.Retryer { |
| 322 |
return gax.OnCodes([]codes.Code{ |
| 323 |
codes.Aborted, |
| 324 |
codes.Canceled, |
| 325 |
codes.DeadlineExceeded, |
| 326 |
codes.Unavailable, |
| 327 |
}, gax.Backoff{ |
| 328 |
Initial: 200 * time.Millisecond, |
| 329 |
Max: 60000 * time.Millisecond, |
| 330 |
Multiplier: 1.30, |
| 331 |
}) |
| 332 |
}), |
| 333 |
}, |
| 334 |
DeleteApiSpec: []gax.CallOption{ |
| 335 |
gax.WithTimeout(60000 * time.Millisecond), |
| 336 |
gax.WithRetry(func() gax.Retryer { |
| 337 |
return gax.OnCodes([]codes.Code{ |
| 338 |
codes.Aborted, |
| 339 |
codes.Canceled, |
| 340 |
codes.DeadlineExceeded, |
| 341 |
codes.Unavailable, |
| 342 |
}, gax.Backoff{ |
| 343 |
Initial: 200 * time.Millisecond, |
| 344 |
Max: 60000 * time.Millisecond, |
| 345 |
Multiplier: 1.30, |
| 346 |
}) |
| 347 |
}), |
| 348 |
}, |
| 349 |
TagApiSpecRevision: []gax.CallOption{ |
| 350 |
gax.WithTimeout(60000 * time.Millisecond), |
| 351 |
gax.WithRetry(func() gax.Retryer { |
| 352 |
return gax.OnCodes([]codes.Code{ |
| 353 |
codes.Aborted, |
| 354 |
codes.Canceled, |
| 355 |
codes.DeadlineExceeded, |
| 356 |
codes.Unavailable, |
| 357 |
}, gax.Backoff{ |
| 358 |
Initial: 200 * time.Millisecond, |
| 359 |
Max: 60000 * time.Millisecond, |
| 360 |
Multiplier: 1.30, |
| 361 |
}) |
| 362 |
}), |
| 363 |
}, |
| 364 |
ListApiSpecRevisions: []gax.CallOption{ |
| 365 |
gax.WithTimeout(60000 * time.Millisecond), |
| 366 |
gax.WithRetry(func() gax.Retryer { |
| 367 |
return gax.OnCodes([]codes.Code{ |
| 368 |
codes.Aborted, |
| 369 |
codes.Canceled, |
| 370 |
codes.DeadlineExceeded, |
| 371 |
codes.Unavailable, |
| 372 |
}, gax.Backoff{ |
| 373 |
Initial: 200 * time.Millisecond, |
| 374 |
Max: 60000 * time.Millisecond, |
| 375 |
Multiplier: 1.30, |
| 376 |
}) |
| 377 |
}), |
| 378 |
}, |
| 379 |
RollbackApiSpec: []gax.CallOption{ |
| 380 |
gax.WithTimeout(60000 * time.Millisecond), |
| 381 |
}, |
| 382 |
DeleteApiSpecRevision: []gax.CallOption{ |
| 383 |
gax.WithTimeout(60000 * time.Millisecond), |
| 384 |
gax.WithRetry(func() gax.Retryer { |
| 385 |
return gax.OnCodes([]codes.Code{ |
| 386 |
codes.Aborted, |
| 387 |
codes.Canceled, |
| 388 |
codes.DeadlineExceeded, |
| 389 |
codes.Unavailable, |
| 390 |
}, gax.Backoff{ |
| 391 |
Initial: 200 * time.Millisecond, |
| 392 |
Max: 60000 * time.Millisecond, |
| 393 |
Multiplier: 1.30, |
| 394 |
}) |
| 395 |
}), |
| 396 |
}, |
| 397 |
ListApiDeployments: []gax.CallOption{ |
| 398 |
gax.WithTimeout(60000 * time.Millisecond), |
| 399 |
gax.WithRetry(func() gax.Retryer { |
| 400 |
return gax.OnCodes([]codes.Code{ |
| 401 |
codes.Aborted, |
| 402 |
codes.Canceled, |
| 403 |
codes.DeadlineExceeded, |
| 404 |
codes.Unavailable, |
| 405 |
}, gax.Backoff{ |
| 406 |
Initial: 200 * time.Millisecond, |
| 407 |
Max: 60000 * time.Millisecond, |
| 408 |
Multiplier: 1.30, |
| 409 |
}) |
| 410 |
}), |
| 411 |
}, |
| 412 |
GetApiDeployment: []gax.CallOption{ |
| 413 |
gax.WithTimeout(60000 * time.Millisecond), |
| 414 |
gax.WithRetry(func() gax.Retryer { |
| 415 |
return gax.OnCodes([]codes.Code{ |
| 416 |
codes.Aborted, |
| 417 |
codes.Canceled, |
| 418 |
codes.DeadlineExceeded, |
| 419 |
codes.Unavailable, |
| 420 |
}, gax.Backoff{ |
| 421 |
Initial: 200 * time.Millisecond, |
| 422 |
Max: 60000 * time.Millisecond, |
| 423 |
Multiplier: 1.30, |
| 424 |
}) |
| 425 |
}), |
| 426 |
}, |
| 427 |
CreateApiDeployment: []gax.CallOption{ |
| 428 |
gax.WithTimeout(60000 * time.Millisecond), |
| 429 |
gax.WithRetry(func() gax.Retryer { |
| 430 |
return gax.OnCodes([]codes.Code{ |
| 431 |
codes.Aborted, |
| 432 |
codes.Canceled, |
| 433 |
codes.DeadlineExceeded, |
| 434 |
codes.Unavailable, |
| 435 |
}, gax.Backoff{ |
| 436 |
Initial: 200 * time.Millisecond, |
| 437 |
Max: 60000 * time.Millisecond, |
| 438 |
Multiplier: 1.30, |
| 439 |
}) |
| 440 |
}), |
| 441 |
}, |
| 442 |
UpdateApiDeployment: []gax.CallOption{ |
| 443 |
gax.WithTimeout(60000 * time.Millisecond), |
| 444 |
gax.WithRetry(func() gax.Retryer { |
| 445 |
return gax.OnCodes([]codes.Code{ |
| 446 |
codes.Aborted, |
| 447 |
codes.Canceled, |
| 448 |
codes.DeadlineExceeded, |
| 449 |
codes.Unavailable, |
| 450 |
}, gax.Backoff{ |
| 451 |
Initial: 200 * time.Millisecond, |
| 452 |
Max: 60000 * time.Millisecond, |
| 453 |
Multiplier: 1.30, |
| 454 |
}) |
| 455 |
}), |
| 456 |
}, |
| 457 |
DeleteApiDeployment: []gax.CallOption{ |
| 458 |
gax.WithTimeout(60000 * time.Millisecond), |
| 459 |
gax.WithRetry(func() gax.Retryer { |
| 460 |
return gax.OnCodes([]codes.Code{ |
| 461 |
codes.Aborted, |
| 462 |
codes.Canceled, |
| 463 |
codes.DeadlineExceeded, |
| 464 |
codes.Unavailable, |
| 465 |
}, gax.Backoff{ |
| 466 |
Initial: 200 * time.Millisecond, |
| 467 |
Max: 60000 * time.Millisecond, |
| 468 |
Multiplier: 1.30, |
| 469 |
}) |
| 470 |
}), |
| 471 |
}, |
| 472 |
TagApiDeploymentRevision: []gax.CallOption{ |
| 473 |
gax.WithTimeout(60000 * time.Millisecond), |
| 474 |
gax.WithRetry(func() gax.Retryer { |
| 475 |
return gax.OnCodes([]codes.Code{ |
| 476 |
codes.Aborted, |
| 477 |
codes.Canceled, |
| 478 |
codes.DeadlineExceeded, |
| 479 |
codes.Unavailable, |
| 480 |
}, gax.Backoff{ |
| 481 |
Initial: 200 * time.Millisecond, |
| 482 |
Max: 60000 * time.Millisecond, |
| 483 |
Multiplier: 1.30, |
| 484 |
}) |
| 485 |
}), |
| 486 |
}, |
| 487 |
ListApiDeploymentRevisions: []gax.CallOption{ |
| 488 |
gax.WithTimeout(60000 * time.Millisecond), |
| 489 |
gax.WithRetry(func() gax.Retryer { |
| 490 |
return gax.OnCodes([]codes.Code{ |
| 491 |
codes.Aborted, |
| 492 |
codes.Canceled, |
| 493 |
codes.DeadlineExceeded, |
| 494 |
codes.Unavailable, |
| 495 |
}, gax.Backoff{ |
| 496 |
Initial: 200 * time.Millisecond, |
| 497 |
Max: 60000 * time.Millisecond, |
| 498 |
Multiplier: 1.30, |
| 499 |
}) |
| 500 |
}), |
| 501 |
}, |
| 502 |
RollbackApiDeployment: []gax.CallOption{ |
| 503 |
gax.WithTimeout(60000 * time.Millisecond), |
| 504 |
}, |
| 505 |
DeleteApiDeploymentRevision: []gax.CallOption{ |
| 506 |
gax.WithTimeout(60000 * time.Millisecond), |
| 507 |
gax.WithRetry(func() gax.Retryer { |
| 508 |
return gax.OnCodes([]codes.Code{ |
| 509 |
codes.Aborted, |
| 510 |
codes.Canceled, |
| 511 |
codes.DeadlineExceeded, |
| 512 |
codes.Unavailable, |
| 513 |
}, gax.Backoff{ |
| 514 |
Initial: 200 * time.Millisecond, |
| 515 |
Max: 60000 * time.Millisecond, |
| 516 |
Multiplier: 1.30, |
| 517 |
}) |
| 518 |
}), |
| 519 |
}, |
| 520 |
ListArtifacts: []gax.CallOption{ |
| 521 |
gax.WithTimeout(60000 * time.Millisecond), |
| 522 |
gax.WithRetry(func() gax.Retryer { |
| 523 |
return gax.OnCodes([]codes.Code{ |
| 524 |
codes.Aborted, |
| 525 |
codes.Canceled, |
| 526 |
codes.DeadlineExceeded, |
| 527 |
codes.Unavailable, |
| 528 |
}, gax.Backoff{ |
| 529 |
Initial: 200 * time.Millisecond, |
| 530 |
Max: 60000 * time.Millisecond, |
| 531 |
Multiplier: 1.30, |
| 532 |
}) |
| 533 |
}), |
| 534 |
}, |
| 535 |
GetArtifact: []gax.CallOption{ |
| 536 |
gax.WithTimeout(60000 * time.Millisecond), |
| 537 |
gax.WithRetry(func() gax.Retryer { |
| 538 |
return gax.OnCodes([]codes.Code{ |
| 539 |
codes.Aborted, |
| 540 |
codes.Canceled, |
| 541 |
codes.DeadlineExceeded, |
| 542 |
codes.Unavailable, |
| 543 |
}, gax.Backoff{ |
| 544 |
Initial: 200 * time.Millisecond, |
| 545 |
Max: 60000 * time.Millisecond, |
| 546 |
Multiplier: 1.30, |
| 547 |
}) |
| 548 |
}), |
| 549 |
}, |
| 550 |
GetArtifactContents: []gax.CallOption{ |
| 551 |
gax.WithTimeout(60000 * time.Millisecond), |
| 552 |
gax.WithRetry(func() gax.Retryer { |
| 553 |
return gax.OnCodes([]codes.Code{ |
| 554 |
codes.Aborted, |
| 555 |
codes.Canceled, |
| 556 |
codes.DeadlineExceeded, |
| 557 |
codes.Unavailable, |
| 558 |
}, gax.Backoff{ |
| 559 |
Initial: 200 * time.Millisecond, |
| 560 |
Max: 60000 * time.Millisecond, |
| 561 |
Multiplier: 1.30, |
| 562 |
}) |
| 563 |
}), |
| 564 |
}, |
| 565 |
CreateArtifact: []gax.CallOption{ |
| 566 |
gax.WithTimeout(60000 * time.Millisecond), |
| 567 |
gax.WithRetry(func() gax.Retryer { |
| 568 |
return gax.OnCodes([]codes.Code{ |
| 569 |
codes.Aborted, |
| 570 |
codes.Canceled, |
| 571 |
codes.DeadlineExceeded, |
| 572 |
codes.Unavailable, |
| 573 |
}, gax.Backoff{ |
| 574 |
Initial: 200 * time.Millisecond, |
| 575 |
Max: 60000 * time.Millisecond, |
| 576 |
Multiplier: 1.30, |
| 577 |
}) |
| 578 |
}), |
| 579 |
}, |
| 580 |
ReplaceArtifact: []gax.CallOption{ |
| 581 |
gax.WithTimeout(60000 * time.Millisecond), |
| 582 |
gax.WithRetry(func() gax.Retryer { |
| 583 |
return gax.OnCodes([]codes.Code{ |
| 584 |
codes.Aborted, |
| 585 |
codes.Canceled, |
| 586 |
codes.DeadlineExceeded, |
| 587 |
codes.Unavailable, |
| 588 |
}, gax.Backoff{ |
| 589 |
Initial: 200 * time.Millisecond, |
| 590 |
Max: 60000 * time.Millisecond, |
| 591 |
Multiplier: 1.30, |
| 592 |
}) |
| 593 |
}), |
| 594 |
}, |
| 595 |
DeleteArtifact: []gax.CallOption{ |
| 596 |
gax.WithTimeout(60000 * time.Millisecond), |
| 597 |
gax.WithRetry(func() gax.Retryer { |
| 598 |
return gax.OnCodes([]codes.Code{ |
| 599 |
codes.Aborted, |
| 600 |
codes.Canceled, |
| 601 |
codes.DeadlineExceeded, |
| 602 |
codes.Unavailable, |
| 603 |
}, gax.Backoff{ |
| 604 |
Initial: 200 * time.Millisecond, |
| 605 |
Max: 60000 * time.Millisecond, |
| 606 |
Multiplier: 1.30, |
| 607 |
}) |
| 608 |
}), |
| 609 |
}, |
| 610 |
GetLocation: []gax.CallOption{}, |
| 611 |
ListLocations: []gax.CallOption{}, |
| 612 |
GetIamPolicy: []gax.CallOption{}, |
| 613 |
SetIamPolicy: []gax.CallOption{}, |
| 614 |
TestIamPermissions: []gax.CallOption{}, |
| 615 |
CancelOperation: []gax.CallOption{}, |
| 616 |
DeleteOperation: []gax.CallOption{}, |
| 617 |
GetOperation: []gax.CallOption{}, |
| 618 |
ListOperations: []gax.CallOption{}, |
| 619 |
} |
| 620 |
} |
| 621 |
|
| 622 |
// internalRegistryClient is an interface that defines the methods available from Apigee Registry API. |
| 623 |
type internalRegistryClient interface { |
| 624 |
Close() error |
| 625 |
setGoogleClientInfo(...string) |
| 626 |
Connection() *grpc.ClientConn |
| 627 |
ListApis(context.Context, *apigeeregistrypb.ListApisRequest, ...gax.CallOption) *ApiIterator |
| 628 |
GetApi(context.Context, *apigeeregistrypb.GetApiRequest, ...gax.CallOption) (*apigeeregistrypb.Api, error) |
| 629 |
CreateApi(context.Context, *apigeeregistrypb.CreateApiRequest, ...gax.CallOption) (*apigeeregistrypb.Api, error) |
| 630 |
UpdateApi(context.Context, *apigeeregistrypb.UpdateApiRequest, ...gax.CallOption) (*apigeeregistrypb.Api, error) |
| 631 |
DeleteApi(context.Context, *apigeeregistrypb.DeleteApiRequest, ...gax.CallOption) error |
| 632 |
ListApiVersions(context.Context, *apigeeregistrypb.ListApiVersionsRequest, ...gax.CallOption) *ApiVersionIterator |
| 633 |
GetApiVersion(context.Context, *apigeeregistrypb.GetApiVersionRequest, ...gax.CallOption) (*apigeeregistrypb.ApiVersion, error) |
| 634 |
CreateApiVersion(context.Context, *apigeeregistrypb.CreateApiVersionRequest, ...gax.CallOption) (*apigeeregistrypb.ApiVersion, error) |
| 635 |
UpdateApiVersion(context.Context, *apigeeregistrypb.UpdateApiVersionRequest, ...gax.CallOption) (*apigeeregistrypb.ApiVersion, error) |
| 636 |
DeleteApiVersion(context.Context, *apigeeregistrypb.DeleteApiVersionRequest, ...gax.CallOption) error |
| 637 |
ListApiSpecs(context.Context, *apigeeregistrypb.ListApiSpecsRequest, ...gax.CallOption) *ApiSpecIterator |
| 638 |
GetApiSpec(context.Context, *apigeeregistrypb.GetApiSpecRequest, ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) |
| 639 |
GetApiSpecContents(context.Context, *apigeeregistrypb.GetApiSpecContentsRequest, ...gax.CallOption) (*httpbodypb.HttpBody, error) |
| 640 |
CreateApiSpec(context.Context, *apigeeregistrypb.CreateApiSpecRequest, ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) |
| 641 |
UpdateApiSpec(context.Context, *apigeeregistrypb.UpdateApiSpecRequest, ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) |
| 642 |
DeleteApiSpec(context.Context, *apigeeregistrypb.DeleteApiSpecRequest, ...gax.CallOption) error |
| 643 |
TagApiSpecRevision(context.Context, *apigeeregistrypb.TagApiSpecRevisionRequest, ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) |
| 644 |
ListApiSpecRevisions(context.Context, *apigeeregistrypb.ListApiSpecRevisionsRequest, ...gax.CallOption) *ApiSpecIterator |
| 645 |
RollbackApiSpec(context.Context, *apigeeregistrypb.RollbackApiSpecRequest, ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) |
| 646 |
DeleteApiSpecRevision(context.Context, *apigeeregistrypb.DeleteApiSpecRevisionRequest, ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) |
| 647 |
ListApiDeployments(context.Context, *apigeeregistrypb.ListApiDeploymentsRequest, ...gax.CallOption) *ApiDeploymentIterator |
| 648 |
GetApiDeployment(context.Context, *apigeeregistrypb.GetApiDeploymentRequest, ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) |
| 649 |
CreateApiDeployment(context.Context, *apigeeregistrypb.CreateApiDeploymentRequest, ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) |
| 650 |
UpdateApiDeployment(context.Context, *apigeeregistrypb.UpdateApiDeploymentRequest, ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) |
| 651 |
DeleteApiDeployment(context.Context, *apigeeregistrypb.DeleteApiDeploymentRequest, ...gax.CallOption) error |
| 652 |
TagApiDeploymentRevision(context.Context, *apigeeregistrypb.TagApiDeploymentRevisionRequest, ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) |
| 653 |
ListApiDeploymentRevisions(context.Context, *apigeeregistrypb.ListApiDeploymentRevisionsRequest, ...gax.CallOption) *ApiDeploymentIterator |
| 654 |
RollbackApiDeployment(context.Context, *apigeeregistrypb.RollbackApiDeploymentRequest, ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) |
| 655 |
DeleteApiDeploymentRevision(context.Context, *apigeeregistrypb.DeleteApiDeploymentRevisionRequest, ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) |
| 656 |
ListArtifacts(context.Context, *apigeeregistrypb.ListArtifactsRequest, ...gax.CallOption) *ArtifactIterator |
| 657 |
GetArtifact(context.Context, *apigeeregistrypb.GetArtifactRequest, ...gax.CallOption) (*apigeeregistrypb.Artifact, error) |
| 658 |
GetArtifactContents(context.Context, *apigeeregistrypb.GetArtifactContentsRequest, ...gax.CallOption) (*httpbodypb.HttpBody, error) |
| 659 |
CreateArtifact(context.Context, *apigeeregistrypb.CreateArtifactRequest, ...gax.CallOption) (*apigeeregistrypb.Artifact, error) |
| 660 |
ReplaceArtifact(context.Context, *apigeeregistrypb.ReplaceArtifactRequest, ...gax.CallOption) (*apigeeregistrypb.Artifact, error) |
| 661 |
DeleteArtifact(context.Context, *apigeeregistrypb.DeleteArtifactRequest, ...gax.CallOption) error |
| 662 |
GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error) |
| 663 |
ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator |
| 664 |
GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) |
| 665 |
SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error) |
| 666 |
TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) |
| 667 |
CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error |
| 668 |
DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error |
| 669 |
GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) |
| 670 |
ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator |
| 671 |
} |
| 672 |
|
| 673 |
// RegistryClient is a client for interacting with Apigee Registry API. |
| 674 |
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. |
| 675 |
// |
| 676 |
// The Registry service allows teams to manage descriptions of APIs. |
| 677 |
type RegistryClient struct { |
| 678 |
// The internal transport-dependent client. |
| 679 |
internalClient internalRegistryClient |
| 680 |
|
| 681 |
// The call options for this service. |
| 682 |
CallOptions *RegistryCallOptions |
| 683 |
} |
| 684 |
|
| 685 |
// Wrapper methods routed to the internal client. |
| 686 |
|
| 687 |
// Close closes the connection to the API service. The user should invoke this when |
| 688 |
// the client is no longer required. |
| 689 |
func (c *RegistryClient) Close() error { |
| 690 |
return c.internalClient.Close() |
| 691 |
} |
| 692 |
|
| 693 |
// setGoogleClientInfo sets the name and version of the application in |
| 694 |
// the `x-goog-api-client` header passed on each request. Intended for |
| 695 |
// use by Google-written clients. |
| 696 |
func (c *RegistryClient) setGoogleClientInfo(keyval ...string) { |
| 697 |
c.internalClient.setGoogleClientInfo(keyval...) |
| 698 |
} |
| 699 |
|
| 700 |
// Connection returns a connection to the API service. |
| 701 |
// |
| 702 |
// Deprecated: Connections are now pooled so this method does not always |
| 703 |
// return the same resource. |
| 704 |
func (c *RegistryClient) Connection() *grpc.ClientConn { |
| 705 |
return c.internalClient.Connection() |
| 706 |
} |
| 707 |
|
| 708 |
// ListApis returns matching APIs. |
| 709 |
func (c *RegistryClient) ListApis(ctx context.Context, req *apigeeregistrypb.ListApisRequest, opts ...gax.CallOption) *ApiIterator { |
| 710 |
return c.internalClient.ListApis(ctx, req, opts...) |
| 711 |
} |
| 712 |
|
| 713 |
// GetApi returns a specified API. |
| 714 |
func (c *RegistryClient) GetApi(ctx context.Context, req *apigeeregistrypb.GetApiRequest, opts ...gax.CallOption) (*apigeeregistrypb.Api, error) { |
| 715 |
return c.internalClient.GetApi(ctx, req, opts...) |
| 716 |
} |
| 717 |
|
| 718 |
// CreateApi creates a specified API. |
| 719 |
func (c *RegistryClient) CreateApi(ctx context.Context, req *apigeeregistrypb.CreateApiRequest, opts ...gax.CallOption) (*apigeeregistrypb.Api, error) { |
| 720 |
return c.internalClient.CreateApi(ctx, req, opts...) |
| 721 |
} |
| 722 |
|
| 723 |
// UpdateApi used to modify a specified API. |
| 724 |
func (c *RegistryClient) UpdateApi(ctx context.Context, req *apigeeregistrypb.UpdateApiRequest, opts ...gax.CallOption) (*apigeeregistrypb.Api, error) { |
| 725 |
return c.internalClient.UpdateApi(ctx, req, opts...) |
| 726 |
} |
| 727 |
|
| 728 |
// DeleteApi removes a specified API and all of the resources that it |
| 729 |
// owns. |
| 730 |
func (c *RegistryClient) DeleteApi(ctx context.Context, req *apigeeregistrypb.DeleteApiRequest, opts ...gax.CallOption) error { |
| 731 |
return c.internalClient.DeleteApi(ctx, req, opts...) |
| 732 |
} |
| 733 |
|
| 734 |
// ListApiVersions returns matching versions. |
| 735 |
func (c *RegistryClient) ListApiVersions(ctx context.Context, req *apigeeregistrypb.ListApiVersionsRequest, opts ...gax.CallOption) *ApiVersionIterator { |
| 736 |
return c.internalClient.ListApiVersions(ctx, req, opts...) |
| 737 |
} |
| 738 |
|
| 739 |
// GetApiVersion returns a specified version. |
| 740 |
func (c *RegistryClient) GetApiVersion(ctx context.Context, req *apigeeregistrypb.GetApiVersionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiVersion, error) { |
| 741 |
return c.internalClient.GetApiVersion(ctx, req, opts...) |
| 742 |
} |
| 743 |
|
| 744 |
// CreateApiVersion creates a specified version. |
| 745 |
func (c *RegistryClient) CreateApiVersion(ctx context.Context, req *apigeeregistrypb.CreateApiVersionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiVersion, error) { |
| 746 |
return c.internalClient.CreateApiVersion(ctx, req, opts...) |
| 747 |
} |
| 748 |
|
| 749 |
// UpdateApiVersion used to modify a specified version. |
| 750 |
func (c *RegistryClient) UpdateApiVersion(ctx context.Context, req *apigeeregistrypb.UpdateApiVersionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiVersion, error) { |
| 751 |
return c.internalClient.UpdateApiVersion(ctx, req, opts...) |
| 752 |
} |
| 753 |
|
| 754 |
// DeleteApiVersion removes a specified version and all of the resources that |
| 755 |
// it owns. |
| 756 |
func (c *RegistryClient) DeleteApiVersion(ctx context.Context, req *apigeeregistrypb.DeleteApiVersionRequest, opts ...gax.CallOption) error { |
| 757 |
return c.internalClient.DeleteApiVersion(ctx, req, opts...) |
| 758 |
} |
| 759 |
|
| 760 |
// ListApiSpecs returns matching specs. |
| 761 |
func (c *RegistryClient) ListApiSpecs(ctx context.Context, req *apigeeregistrypb.ListApiSpecsRequest, opts ...gax.CallOption) *ApiSpecIterator { |
| 762 |
return c.internalClient.ListApiSpecs(ctx, req, opts...) |
| 763 |
} |
| 764 |
|
| 765 |
// GetApiSpec returns a specified spec. |
| 766 |
func (c *RegistryClient) GetApiSpec(ctx context.Context, req *apigeeregistrypb.GetApiSpecRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 767 |
return c.internalClient.GetApiSpec(ctx, req, opts...) |
| 768 |
} |
| 769 |
|
| 770 |
// GetApiSpecContents returns the contents of a specified spec. |
| 771 |
// If specs are stored with GZip compression, the default behavior |
| 772 |
// is to return the spec uncompressed (the mime_type response field |
| 773 |
// indicates the exact format returned). |
| 774 |
func (c *RegistryClient) GetApiSpecContents(ctx context.Context, req *apigeeregistrypb.GetApiSpecContentsRequest, opts ...gax.CallOption) (*httpbodypb.HttpBody, error) { |
| 775 |
return c.internalClient.GetApiSpecContents(ctx, req, opts...) |
| 776 |
} |
| 777 |
|
| 778 |
// CreateApiSpec creates a specified spec. |
| 779 |
func (c *RegistryClient) CreateApiSpec(ctx context.Context, req *apigeeregistrypb.CreateApiSpecRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 780 |
return c.internalClient.CreateApiSpec(ctx, req, opts...) |
| 781 |
} |
| 782 |
|
| 783 |
// UpdateApiSpec used to modify a specified spec. |
| 784 |
func (c *RegistryClient) UpdateApiSpec(ctx context.Context, req *apigeeregistrypb.UpdateApiSpecRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 785 |
return c.internalClient.UpdateApiSpec(ctx, req, opts...) |
| 786 |
} |
| 787 |
|
| 788 |
// DeleteApiSpec removes a specified spec, all revisions, and all child |
| 789 |
// resources (e.g., artifacts). |
| 790 |
func (c *RegistryClient) DeleteApiSpec(ctx context.Context, req *apigeeregistrypb.DeleteApiSpecRequest, opts ...gax.CallOption) error { |
| 791 |
return c.internalClient.DeleteApiSpec(ctx, req, opts...) |
| 792 |
} |
| 793 |
|
| 794 |
// TagApiSpecRevision adds a tag to a specified revision of a spec. |
| 795 |
func (c *RegistryClient) TagApiSpecRevision(ctx context.Context, req *apigeeregistrypb.TagApiSpecRevisionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 796 |
return c.internalClient.TagApiSpecRevision(ctx, req, opts...) |
| 797 |
} |
| 798 |
|
| 799 |
// ListApiSpecRevisions lists all revisions of a spec. |
| 800 |
// Revisions are returned in descending order of revision creation time. |
| 801 |
func (c *RegistryClient) ListApiSpecRevisions(ctx context.Context, req *apigeeregistrypb.ListApiSpecRevisionsRequest, opts ...gax.CallOption) *ApiSpecIterator { |
| 802 |
return c.internalClient.ListApiSpecRevisions(ctx, req, opts...) |
| 803 |
} |
| 804 |
|
| 805 |
// RollbackApiSpec sets the current revision to a specified prior revision. |
| 806 |
// Note that this creates a new revision with a new revision ID. |
| 807 |
func (c *RegistryClient) RollbackApiSpec(ctx context.Context, req *apigeeregistrypb.RollbackApiSpecRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 808 |
return c.internalClient.RollbackApiSpec(ctx, req, opts...) |
| 809 |
} |
| 810 |
|
| 811 |
// DeleteApiSpecRevision deletes a revision of a spec. |
| 812 |
func (c *RegistryClient) DeleteApiSpecRevision(ctx context.Context, req *apigeeregistrypb.DeleteApiSpecRevisionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 813 |
return c.internalClient.DeleteApiSpecRevision(ctx, req, opts...) |
| 814 |
} |
| 815 |
|
| 816 |
// ListApiDeployments returns matching deployments. |
| 817 |
func (c *RegistryClient) ListApiDeployments(ctx context.Context, req *apigeeregistrypb.ListApiDeploymentsRequest, opts ...gax.CallOption) *ApiDeploymentIterator { |
| 818 |
return c.internalClient.ListApiDeployments(ctx, req, opts...) |
| 819 |
} |
| 820 |
|
| 821 |
// GetApiDeployment returns a specified deployment. |
| 822 |
func (c *RegistryClient) GetApiDeployment(ctx context.Context, req *apigeeregistrypb.GetApiDeploymentRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 823 |
return c.internalClient.GetApiDeployment(ctx, req, opts...) |
| 824 |
} |
| 825 |
|
| 826 |
// CreateApiDeployment creates a specified deployment. |
| 827 |
func (c *RegistryClient) CreateApiDeployment(ctx context.Context, req *apigeeregistrypb.CreateApiDeploymentRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 828 |
return c.internalClient.CreateApiDeployment(ctx, req, opts...) |
| 829 |
} |
| 830 |
|
| 831 |
// UpdateApiDeployment used to modify a specified deployment. |
| 832 |
func (c *RegistryClient) UpdateApiDeployment(ctx context.Context, req *apigeeregistrypb.UpdateApiDeploymentRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 833 |
return c.internalClient.UpdateApiDeployment(ctx, req, opts...) |
| 834 |
} |
| 835 |
|
| 836 |
// DeleteApiDeployment removes a specified deployment, all revisions, and all |
| 837 |
// child resources (e.g., artifacts). |
| 838 |
func (c *RegistryClient) DeleteApiDeployment(ctx context.Context, req *apigeeregistrypb.DeleteApiDeploymentRequest, opts ...gax.CallOption) error { |
| 839 |
return c.internalClient.DeleteApiDeployment(ctx, req, opts...) |
| 840 |
} |
| 841 |
|
| 842 |
// TagApiDeploymentRevision adds a tag to a specified revision of a |
| 843 |
// deployment. |
| 844 |
func (c *RegistryClient) TagApiDeploymentRevision(ctx context.Context, req *apigeeregistrypb.TagApiDeploymentRevisionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 845 |
return c.internalClient.TagApiDeploymentRevision(ctx, req, opts...) |
| 846 |
} |
| 847 |
|
| 848 |
// ListApiDeploymentRevisions lists all revisions of a deployment. |
| 849 |
// Revisions are returned in descending order of revision creation time. |
| 850 |
func (c *RegistryClient) ListApiDeploymentRevisions(ctx context.Context, req *apigeeregistrypb.ListApiDeploymentRevisionsRequest, opts ...gax.CallOption) *ApiDeploymentIterator { |
| 851 |
return c.internalClient.ListApiDeploymentRevisions(ctx, req, opts...) |
| 852 |
} |
| 853 |
|
| 854 |
// RollbackApiDeployment sets the current revision to a specified prior |
| 855 |
// revision. Note that this creates a new revision with a new revision ID. |
| 856 |
func (c *RegistryClient) RollbackApiDeployment(ctx context.Context, req *apigeeregistrypb.RollbackApiDeploymentRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 857 |
return c.internalClient.RollbackApiDeployment(ctx, req, opts...) |
| 858 |
} |
| 859 |
|
| 860 |
// DeleteApiDeploymentRevision deletes a revision of a deployment. |
| 861 |
func (c *RegistryClient) DeleteApiDeploymentRevision(ctx context.Context, req *apigeeregistrypb.DeleteApiDeploymentRevisionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 862 |
return c.internalClient.DeleteApiDeploymentRevision(ctx, req, opts...) |
| 863 |
} |
| 864 |
|
| 865 |
// ListArtifacts returns matching artifacts. |
| 866 |
func (c *RegistryClient) ListArtifacts(ctx context.Context, req *apigeeregistrypb.ListArtifactsRequest, opts ...gax.CallOption) *ArtifactIterator { |
| 867 |
return c.internalClient.ListArtifacts(ctx, req, opts...) |
| 868 |
} |
| 869 |
|
| 870 |
// GetArtifact returns a specified artifact. |
| 871 |
func (c *RegistryClient) GetArtifact(ctx context.Context, req *apigeeregistrypb.GetArtifactRequest, opts ...gax.CallOption) (*apigeeregistrypb.Artifact, error) { |
| 872 |
return c.internalClient.GetArtifact(ctx, req, opts...) |
| 873 |
} |
| 874 |
|
| 875 |
// GetArtifactContents returns the contents of a specified artifact. |
| 876 |
// If artifacts are stored with GZip compression, the default behavior |
| 877 |
// is to return the artifact uncompressed (the mime_type response field |
| 878 |
// indicates the exact format returned). |
| 879 |
func (c *RegistryClient) GetArtifactContents(ctx context.Context, req *apigeeregistrypb.GetArtifactContentsRequest, opts ...gax.CallOption) (*httpbodypb.HttpBody, error) { |
| 880 |
return c.internalClient.GetArtifactContents(ctx, req, opts...) |
| 881 |
} |
| 882 |
|
| 883 |
// CreateArtifact creates a specified artifact. |
| 884 |
func (c *RegistryClient) CreateArtifact(ctx context.Context, req *apigeeregistrypb.CreateArtifactRequest, opts ...gax.CallOption) (*apigeeregistrypb.Artifact, error) { |
| 885 |
return c.internalClient.CreateArtifact(ctx, req, opts...) |
| 886 |
} |
| 887 |
|
| 888 |
// ReplaceArtifact used to replace a specified artifact. |
| 889 |
func (c *RegistryClient) ReplaceArtifact(ctx context.Context, req *apigeeregistrypb.ReplaceArtifactRequest, opts ...gax.CallOption) (*apigeeregistrypb.Artifact, error) { |
| 890 |
return c.internalClient.ReplaceArtifact(ctx, req, opts...) |
| 891 |
} |
| 892 |
|
| 893 |
// DeleteArtifact removes a specified artifact. |
| 894 |
func (c *RegistryClient) DeleteArtifact(ctx context.Context, req *apigeeregistrypb.DeleteArtifactRequest, opts ...gax.CallOption) error { |
| 895 |
return c.internalClient.DeleteArtifact(ctx, req, opts...) |
| 896 |
} |
| 897 |
|
| 898 |
// GetLocation gets information about a location. |
| 899 |
func (c *RegistryClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { |
| 900 |
return c.internalClient.GetLocation(ctx, req, opts...) |
| 901 |
} |
| 902 |
|
| 903 |
// ListLocations lists information about the supported locations for this service. |
| 904 |
func (c *RegistryClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { |
| 905 |
return c.internalClient.ListLocations(ctx, req, opts...) |
| 906 |
} |
| 907 |
|
| 908 |
// GetIamPolicy gets the access control policy for a resource. Returns an empty policy |
| 909 |
// if the resource exists and does not have a policy set. |
| 910 |
func (c *RegistryClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { |
| 911 |
return c.internalClient.GetIamPolicy(ctx, req, opts...) |
| 912 |
} |
| 913 |
|
| 914 |
// SetIamPolicy sets the access control policy on the specified resource. Replaces |
| 915 |
// any existing policy. |
| 916 |
// |
| 917 |
// Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED |
| 918 |
// errors. |
| 919 |
func (c *RegistryClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { |
| 920 |
return c.internalClient.SetIamPolicy(ctx, req, opts...) |
| 921 |
} |
| 922 |
|
| 923 |
// TestIamPermissions returns permissions that a caller has on the specified resource. If the |
| 924 |
// resource does not exist, this will return an empty set of |
| 925 |
// permissions, not a NOT_FOUND error. |
| 926 |
// |
| 927 |
// Note: This operation is designed to be used for building |
| 928 |
// permission-aware UIs and command-line tools, not for authorization |
| 929 |
// checking. This operation may “fail open” without warning. |
| 930 |
func (c *RegistryClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { |
| 931 |
return c.internalClient.TestIamPermissions(ctx, req, opts...) |
| 932 |
} |
| 933 |
|
| 934 |
// CancelOperation is a utility method from google.longrunning.Operations. |
| 935 |
func (c *RegistryClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { |
| 936 |
return c.internalClient.CancelOperation(ctx, req, opts...) |
| 937 |
} |
| 938 |
|
| 939 |
// DeleteOperation is a utility method from google.longrunning.Operations. |
| 940 |
func (c *RegistryClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { |
| 941 |
return c.internalClient.DeleteOperation(ctx, req, opts...) |
| 942 |
} |
| 943 |
|
| 944 |
// GetOperation is a utility method from google.longrunning.Operations. |
| 945 |
func (c *RegistryClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { |
| 946 |
return c.internalClient.GetOperation(ctx, req, opts...) |
| 947 |
} |
| 948 |
|
| 949 |
// ListOperations is a utility method from google.longrunning.Operations. |
| 950 |
func (c *RegistryClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { |
| 951 |
return c.internalClient.ListOperations(ctx, req, opts...) |
| 952 |
} |
| 953 |
|
| 954 |
// registryGRPCClient is a client for interacting with Apigee Registry API over gRPC transport. |
| 955 |
// |
| 956 |
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. |
| 957 |
type registryGRPCClient struct { |
| 958 |
// Connection pool of gRPC connections to the service. |
| 959 |
connPool gtransport.ConnPool |
| 960 |
|
| 961 |
// Points back to the CallOptions field of the containing RegistryClient |
| 962 |
CallOptions **RegistryCallOptions |
| 963 |
|
| 964 |
// The gRPC API client. |
| 965 |
registryClient apigeeregistrypb.RegistryClient |
| 966 |
|
| 967 |
operationsClient longrunningpb.OperationsClient |
| 968 |
|
| 969 |
iamPolicyClient iampb.IAMPolicyClient |
| 970 |
|
| 971 |
locationsClient locationpb.LocationsClient |
| 972 |
|
| 973 |
// The x-goog-* metadata to be sent with each request. |
| 974 |
xGoogHeaders []string |
| 975 |
|
| 976 |
logger *slog.Logger |
| 977 |
} |
| 978 |
|
| 979 |
// NewRegistryClient creates a new registry client based on gRPC. |
| 980 |
// The returned client must be Closed when it is done being used to clean up its underlying connections. |
| 981 |
// |
| 982 |
// The Registry service allows teams to manage descriptions of APIs. |
| 983 |
func NewRegistryClient(ctx context.Context, opts ...option.ClientOption) (*RegistryClient, error) { |
| 984 |
clientOpts := defaultRegistryGRPCClientOptions() |
| 985 |
if newRegistryClientHook != nil { |
| 986 |
hookOpts, err := newRegistryClientHook(ctx, clientHookParams{}) |
| 987 |
if err != nil { |
| 988 |
return nil, err |
| 989 |
} |
| 990 |
clientOpts = append(clientOpts, hookOpts...) |
| 991 |
} |
| 992 |
|
| 993 |
connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) |
| 994 |
if err != nil { |
| 995 |
return nil, err |
| 996 |
} |
| 997 |
client := RegistryClient{CallOptions: defaultRegistryCallOptions()} |
| 998 |
|
| 999 |
c := ®istryGRPCClient{ |
| 1000 |
connPool: connPool, |
| 1001 |
registryClient: apigeeregistrypb.NewRegistryClient(connPool), |
| 1002 |
CallOptions: &client.CallOptions, |
| 1003 |
logger: internaloption.GetLogger(opts), |
| 1004 |
operationsClient: longrunningpb.NewOperationsClient(connPool), |
| 1005 |
iamPolicyClient: iampb.NewIAMPolicyClient(connPool), |
| 1006 |
locationsClient: locationpb.NewLocationsClient(connPool), |
| 1007 |
} |
| 1008 |
c.setGoogleClientInfo() |
| 1009 |
|
| 1010 |
client.internalClient = c |
| 1011 |
|
| 1012 |
return &client, nil |
| 1013 |
} |
| 1014 |
|
| 1015 |
// Connection returns a connection to the API service. |
| 1016 |
// |
| 1017 |
// Deprecated: Connections are now pooled so this method does not always |
| 1018 |
// return the same resource. |
| 1019 |
func (c *registryGRPCClient) Connection() *grpc.ClientConn { |
| 1020 |
return c.connPool.Conn() |
| 1021 |
} |
| 1022 |
|
| 1023 |
// setGoogleClientInfo sets the name and version of the application in |
| 1024 |
// the `x-goog-api-client` header passed on each request. Intended for |
| 1025 |
// use by Google-written clients. |
| 1026 |
func (c *registryGRPCClient) setGoogleClientInfo(keyval ...string) { |
| 1027 |
kv := append([]string{"gl-go", gax.GoVersion}, keyval...) |
| 1028 |
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion) |
| 1029 |
c.xGoogHeaders = []string{ |
| 1030 |
"x-goog-api-client", gax.XGoogHeader(kv...), |
| 1031 |
} |
| 1032 |
} |
| 1033 |
|
| 1034 |
// Close closes the connection to the API service. The user should invoke this when |
| 1035 |
// the client is no longer required. |
| 1036 |
func (c *registryGRPCClient) Close() error { |
| 1037 |
return c.connPool.Close() |
| 1038 |
} |
| 1039 |
|
| 1040 |
func (c *registryGRPCClient) ListApis(ctx context.Context, req *apigeeregistrypb.ListApisRequest, opts ...gax.CallOption) *ApiIterator { |
| 1041 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1042 |
|
| 1043 |
hds = append(c.xGoogHeaders, hds...) |
| 1044 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1045 |
opts = append((*c.CallOptions).ListApis[0:len((*c.CallOptions).ListApis):len((*c.CallOptions).ListApis)], opts...) |
| 1046 |
it := &ApiIterator{} |
| 1047 |
req = proto.Clone(req).(*apigeeregistrypb.ListApisRequest) |
| 1048 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*apigeeregistrypb.Api, string, error) { |
| 1049 |
resp := &apigeeregistrypb.ListApisResponse{} |
| 1050 |
if pageToken != "" { |
| 1051 |
req.PageToken = pageToken |
| 1052 |
} |
| 1053 |
if pageSize > math.MaxInt32 { |
| 1054 |
req.PageSize = math.MaxInt32 |
| 1055 |
} else if pageSize != 0 { |
| 1056 |
req.PageSize = int32(pageSize) |
| 1057 |
} |
| 1058 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1059 |
var err error |
| 1060 |
resp, err = executeRPC(ctx, c.registryClient.ListApis, req, settings.GRPC, c.logger, "ListApis") |
| 1061 |
return err |
| 1062 |
}, opts...) |
| 1063 |
if err != nil { |
| 1064 |
return nil, "", err |
| 1065 |
} |
| 1066 |
|
| 1067 |
it.Response = resp |
| 1068 |
return resp.GetApis(), resp.GetNextPageToken(), nil |
| 1069 |
} |
| 1070 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1071 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1072 |
if err != nil { |
| 1073 |
return "", err |
| 1074 |
} |
| 1075 |
it.items = append(it.items, items...) |
| 1076 |
return nextPageToken, nil |
| 1077 |
} |
| 1078 |
|
| 1079 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1080 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1081 |
it.pageInfo.Token = req.GetPageToken() |
| 1082 |
|
| 1083 |
return it |
| 1084 |
} |
| 1085 |
|
| 1086 |
func (c *registryGRPCClient) GetApi(ctx context.Context, req *apigeeregistrypb.GetApiRequest, opts ...gax.CallOption) (*apigeeregistrypb.Api, error) { |
| 1087 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1088 |
|
| 1089 |
hds = append(c.xGoogHeaders, hds...) |
| 1090 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1091 |
opts = append((*c.CallOptions).GetApi[0:len((*c.CallOptions).GetApi):len((*c.CallOptions).GetApi)], opts...) |
| 1092 |
var resp *apigeeregistrypb.Api |
| 1093 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1094 |
var err error |
| 1095 |
resp, err = executeRPC(ctx, c.registryClient.GetApi, req, settings.GRPC, c.logger, "GetApi") |
| 1096 |
return err |
| 1097 |
}, opts...) |
| 1098 |
if err != nil { |
| 1099 |
return nil, err |
| 1100 |
} |
| 1101 |
return resp, nil |
| 1102 |
} |
| 1103 |
|
| 1104 |
func (c *registryGRPCClient) CreateApi(ctx context.Context, req *apigeeregistrypb.CreateApiRequest, opts ...gax.CallOption) (*apigeeregistrypb.Api, error) { |
| 1105 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1106 |
|
| 1107 |
hds = append(c.xGoogHeaders, hds...) |
| 1108 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1109 |
opts = append((*c.CallOptions).CreateApi[0:len((*c.CallOptions).CreateApi):len((*c.CallOptions).CreateApi)], opts...) |
| 1110 |
var resp *apigeeregistrypb.Api |
| 1111 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1112 |
var err error |
| 1113 |
resp, err = executeRPC(ctx, c.registryClient.CreateApi, req, settings.GRPC, c.logger, "CreateApi") |
| 1114 |
return err |
| 1115 |
}, opts...) |
| 1116 |
if err != nil { |
| 1117 |
return nil, err |
| 1118 |
} |
| 1119 |
return resp, nil |
| 1120 |
} |
| 1121 |
|
| 1122 |
func (c *registryGRPCClient) UpdateApi(ctx context.Context, req *apigeeregistrypb.UpdateApiRequest, opts ...gax.CallOption) (*apigeeregistrypb.Api, error) { |
| 1123 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "api.name", url.QueryEscape(req.GetApi().GetName()))} |
| 1124 |
|
| 1125 |
hds = append(c.xGoogHeaders, hds...) |
| 1126 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1127 |
opts = append((*c.CallOptions).UpdateApi[0:len((*c.CallOptions).UpdateApi):len((*c.CallOptions).UpdateApi)], opts...) |
| 1128 |
var resp *apigeeregistrypb.Api |
| 1129 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1130 |
var err error |
| 1131 |
resp, err = executeRPC(ctx, c.registryClient.UpdateApi, req, settings.GRPC, c.logger, "UpdateApi") |
| 1132 |
return err |
| 1133 |
}, opts...) |
| 1134 |
if err != nil { |
| 1135 |
return nil, err |
| 1136 |
} |
| 1137 |
return resp, nil |
| 1138 |
} |
| 1139 |
|
| 1140 |
func (c *registryGRPCClient) DeleteApi(ctx context.Context, req *apigeeregistrypb.DeleteApiRequest, opts ...gax.CallOption) error { |
| 1141 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1142 |
|
| 1143 |
hds = append(c.xGoogHeaders, hds...) |
| 1144 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1145 |
opts = append((*c.CallOptions).DeleteApi[0:len((*c.CallOptions).DeleteApi):len((*c.CallOptions).DeleteApi)], opts...) |
| 1146 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1147 |
var err error |
| 1148 |
_, err = executeRPC(ctx, c.registryClient.DeleteApi, req, settings.GRPC, c.logger, "DeleteApi") |
| 1149 |
return err |
| 1150 |
}, opts...) |
| 1151 |
return err |
| 1152 |
} |
| 1153 |
|
| 1154 |
func (c *registryGRPCClient) ListApiVersions(ctx context.Context, req *apigeeregistrypb.ListApiVersionsRequest, opts ...gax.CallOption) *ApiVersionIterator { |
| 1155 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1156 |
|
| 1157 |
hds = append(c.xGoogHeaders, hds...) |
| 1158 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1159 |
opts = append((*c.CallOptions).ListApiVersions[0:len((*c.CallOptions).ListApiVersions):len((*c.CallOptions).ListApiVersions)], opts...) |
| 1160 |
it := &ApiVersionIterator{} |
| 1161 |
req = proto.Clone(req).(*apigeeregistrypb.ListApiVersionsRequest) |
| 1162 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*apigeeregistrypb.ApiVersion, string, error) { |
| 1163 |
resp := &apigeeregistrypb.ListApiVersionsResponse{} |
| 1164 |
if pageToken != "" { |
| 1165 |
req.PageToken = pageToken |
| 1166 |
} |
| 1167 |
if pageSize > math.MaxInt32 { |
| 1168 |
req.PageSize = math.MaxInt32 |
| 1169 |
} else if pageSize != 0 { |
| 1170 |
req.PageSize = int32(pageSize) |
| 1171 |
} |
| 1172 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1173 |
var err error |
| 1174 |
resp, err = executeRPC(ctx, c.registryClient.ListApiVersions, req, settings.GRPC, c.logger, "ListApiVersions") |
| 1175 |
return err |
| 1176 |
}, opts...) |
| 1177 |
if err != nil { |
| 1178 |
return nil, "", err |
| 1179 |
} |
| 1180 |
|
| 1181 |
it.Response = resp |
| 1182 |
return resp.GetApiVersions(), resp.GetNextPageToken(), nil |
| 1183 |
} |
| 1184 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1185 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1186 |
if err != nil { |
| 1187 |
return "", err |
| 1188 |
} |
| 1189 |
it.items = append(it.items, items...) |
| 1190 |
return nextPageToken, nil |
| 1191 |
} |
| 1192 |
|
| 1193 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1194 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1195 |
it.pageInfo.Token = req.GetPageToken() |
| 1196 |
|
| 1197 |
return it |
| 1198 |
} |
| 1199 |
|
| 1200 |
func (c *registryGRPCClient) GetApiVersion(ctx context.Context, req *apigeeregistrypb.GetApiVersionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiVersion, error) { |
| 1201 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1202 |
|
| 1203 |
hds = append(c.xGoogHeaders, hds...) |
| 1204 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1205 |
opts = append((*c.CallOptions).GetApiVersion[0:len((*c.CallOptions).GetApiVersion):len((*c.CallOptions).GetApiVersion)], opts...) |
| 1206 |
var resp *apigeeregistrypb.ApiVersion |
| 1207 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1208 |
var err error |
| 1209 |
resp, err = executeRPC(ctx, c.registryClient.GetApiVersion, req, settings.GRPC, c.logger, "GetApiVersion") |
| 1210 |
return err |
| 1211 |
}, opts...) |
| 1212 |
if err != nil { |
| 1213 |
return nil, err |
| 1214 |
} |
| 1215 |
return resp, nil |
| 1216 |
} |
| 1217 |
|
| 1218 |
func (c *registryGRPCClient) CreateApiVersion(ctx context.Context, req *apigeeregistrypb.CreateApiVersionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiVersion, error) { |
| 1219 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1220 |
|
| 1221 |
hds = append(c.xGoogHeaders, hds...) |
| 1222 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1223 |
opts = append((*c.CallOptions).CreateApiVersion[0:len((*c.CallOptions).CreateApiVersion):len((*c.CallOptions).CreateApiVersion)], opts...) |
| 1224 |
var resp *apigeeregistrypb.ApiVersion |
| 1225 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1226 |
var err error |
| 1227 |
resp, err = executeRPC(ctx, c.registryClient.CreateApiVersion, req, settings.GRPC, c.logger, "CreateApiVersion") |
| 1228 |
return err |
| 1229 |
}, opts...) |
| 1230 |
if err != nil { |
| 1231 |
return nil, err |
| 1232 |
} |
| 1233 |
return resp, nil |
| 1234 |
} |
| 1235 |
|
| 1236 |
func (c *registryGRPCClient) UpdateApiVersion(ctx context.Context, req *apigeeregistrypb.UpdateApiVersionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiVersion, error) { |
| 1237 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "api_version.name", url.QueryEscape(req.GetApiVersion().GetName()))} |
| 1238 |
|
| 1239 |
hds = append(c.xGoogHeaders, hds...) |
| 1240 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1241 |
opts = append((*c.CallOptions).UpdateApiVersion[0:len((*c.CallOptions).UpdateApiVersion):len((*c.CallOptions).UpdateApiVersion)], opts...) |
| 1242 |
var resp *apigeeregistrypb.ApiVersion |
| 1243 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1244 |
var err error |
| 1245 |
resp, err = executeRPC(ctx, c.registryClient.UpdateApiVersion, req, settings.GRPC, c.logger, "UpdateApiVersion") |
| 1246 |
return err |
| 1247 |
}, opts...) |
| 1248 |
if err != nil { |
| 1249 |
return nil, err |
| 1250 |
} |
| 1251 |
return resp, nil |
| 1252 |
} |
| 1253 |
|
| 1254 |
func (c *registryGRPCClient) DeleteApiVersion(ctx context.Context, req *apigeeregistrypb.DeleteApiVersionRequest, opts ...gax.CallOption) error { |
| 1255 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1256 |
|
| 1257 |
hds = append(c.xGoogHeaders, hds...) |
| 1258 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1259 |
opts = append((*c.CallOptions).DeleteApiVersion[0:len((*c.CallOptions).DeleteApiVersion):len((*c.CallOptions).DeleteApiVersion)], opts...) |
| 1260 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1261 |
var err error |
| 1262 |
_, err = executeRPC(ctx, c.registryClient.DeleteApiVersion, req, settings.GRPC, c.logger, "DeleteApiVersion") |
| 1263 |
return err |
| 1264 |
}, opts...) |
| 1265 |
return err |
| 1266 |
} |
| 1267 |
|
| 1268 |
func (c *registryGRPCClient) ListApiSpecs(ctx context.Context, req *apigeeregistrypb.ListApiSpecsRequest, opts ...gax.CallOption) *ApiSpecIterator { |
| 1269 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1270 |
|
| 1271 |
hds = append(c.xGoogHeaders, hds...) |
| 1272 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1273 |
opts = append((*c.CallOptions).ListApiSpecs[0:len((*c.CallOptions).ListApiSpecs):len((*c.CallOptions).ListApiSpecs)], opts...) |
| 1274 |
it := &ApiSpecIterator{} |
| 1275 |
req = proto.Clone(req).(*apigeeregistrypb.ListApiSpecsRequest) |
| 1276 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*apigeeregistrypb.ApiSpec, string, error) { |
| 1277 |
resp := &apigeeregistrypb.ListApiSpecsResponse{} |
| 1278 |
if pageToken != "" { |
| 1279 |
req.PageToken = pageToken |
| 1280 |
} |
| 1281 |
if pageSize > math.MaxInt32 { |
| 1282 |
req.PageSize = math.MaxInt32 |
| 1283 |
} else if pageSize != 0 { |
| 1284 |
req.PageSize = int32(pageSize) |
| 1285 |
} |
| 1286 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1287 |
var err error |
| 1288 |
resp, err = executeRPC(ctx, c.registryClient.ListApiSpecs, req, settings.GRPC, c.logger, "ListApiSpecs") |
| 1289 |
return err |
| 1290 |
}, opts...) |
| 1291 |
if err != nil { |
| 1292 |
return nil, "", err |
| 1293 |
} |
| 1294 |
|
| 1295 |
it.Response = resp |
| 1296 |
return resp.GetApiSpecs(), resp.GetNextPageToken(), nil |
| 1297 |
} |
| 1298 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1299 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1300 |
if err != nil { |
| 1301 |
return "", err |
| 1302 |
} |
| 1303 |
it.items = append(it.items, items...) |
| 1304 |
return nextPageToken, nil |
| 1305 |
} |
| 1306 |
|
| 1307 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1308 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1309 |
it.pageInfo.Token = req.GetPageToken() |
| 1310 |
|
| 1311 |
return it |
| 1312 |
} |
| 1313 |
|
| 1314 |
func (c *registryGRPCClient) GetApiSpec(ctx context.Context, req *apigeeregistrypb.GetApiSpecRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 1315 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1316 |
|
| 1317 |
hds = append(c.xGoogHeaders, hds...) |
| 1318 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1319 |
opts = append((*c.CallOptions).GetApiSpec[0:len((*c.CallOptions).GetApiSpec):len((*c.CallOptions).GetApiSpec)], opts...) |
| 1320 |
var resp *apigeeregistrypb.ApiSpec |
| 1321 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1322 |
var err error |
| 1323 |
resp, err = executeRPC(ctx, c.registryClient.GetApiSpec, req, settings.GRPC, c.logger, "GetApiSpec") |
| 1324 |
return err |
| 1325 |
}, opts...) |
| 1326 |
if err != nil { |
| 1327 |
return nil, err |
| 1328 |
} |
| 1329 |
return resp, nil |
| 1330 |
} |
| 1331 |
|
| 1332 |
func (c *registryGRPCClient) GetApiSpecContents(ctx context.Context, req *apigeeregistrypb.GetApiSpecContentsRequest, opts ...gax.CallOption) (*httpbodypb.HttpBody, error) { |
| 1333 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1334 |
|
| 1335 |
hds = append(c.xGoogHeaders, hds...) |
| 1336 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1337 |
opts = append((*c.CallOptions).GetApiSpecContents[0:len((*c.CallOptions).GetApiSpecContents):len((*c.CallOptions).GetApiSpecContents)], opts...) |
| 1338 |
var resp *httpbodypb.HttpBody |
| 1339 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1340 |
var err error |
| 1341 |
resp, err = executeRPC(ctx, c.registryClient.GetApiSpecContents, req, settings.GRPC, c.logger, "GetApiSpecContents") |
| 1342 |
return err |
| 1343 |
}, opts...) |
| 1344 |
if err != nil { |
| 1345 |
return nil, err |
| 1346 |
} |
| 1347 |
return resp, nil |
| 1348 |
} |
| 1349 |
|
| 1350 |
func (c *registryGRPCClient) CreateApiSpec(ctx context.Context, req *apigeeregistrypb.CreateApiSpecRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 1351 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1352 |
|
| 1353 |
hds = append(c.xGoogHeaders, hds...) |
| 1354 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1355 |
opts = append((*c.CallOptions).CreateApiSpec[0:len((*c.CallOptions).CreateApiSpec):len((*c.CallOptions).CreateApiSpec)], opts...) |
| 1356 |
var resp *apigeeregistrypb.ApiSpec |
| 1357 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1358 |
var err error |
| 1359 |
resp, err = executeRPC(ctx, c.registryClient.CreateApiSpec, req, settings.GRPC, c.logger, "CreateApiSpec") |
| 1360 |
return err |
| 1361 |
}, opts...) |
| 1362 |
if err != nil { |
| 1363 |
return nil, err |
| 1364 |
} |
| 1365 |
return resp, nil |
| 1366 |
} |
| 1367 |
|
| 1368 |
func (c *registryGRPCClient) UpdateApiSpec(ctx context.Context, req *apigeeregistrypb.UpdateApiSpecRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 1369 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "api_spec.name", url.QueryEscape(req.GetApiSpec().GetName()))} |
| 1370 |
|
| 1371 |
hds = append(c.xGoogHeaders, hds...) |
| 1372 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1373 |
opts = append((*c.CallOptions).UpdateApiSpec[0:len((*c.CallOptions).UpdateApiSpec):len((*c.CallOptions).UpdateApiSpec)], opts...) |
| 1374 |
var resp *apigeeregistrypb.ApiSpec |
| 1375 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1376 |
var err error |
| 1377 |
resp, err = executeRPC(ctx, c.registryClient.UpdateApiSpec, req, settings.GRPC, c.logger, "UpdateApiSpec") |
| 1378 |
return err |
| 1379 |
}, opts...) |
| 1380 |
if err != nil { |
| 1381 |
return nil, err |
| 1382 |
} |
| 1383 |
return resp, nil |
| 1384 |
} |
| 1385 |
|
| 1386 |
func (c *registryGRPCClient) DeleteApiSpec(ctx context.Context, req *apigeeregistrypb.DeleteApiSpecRequest, opts ...gax.CallOption) error { |
| 1387 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1388 |
|
| 1389 |
hds = append(c.xGoogHeaders, hds...) |
| 1390 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1391 |
opts = append((*c.CallOptions).DeleteApiSpec[0:len((*c.CallOptions).DeleteApiSpec):len((*c.CallOptions).DeleteApiSpec)], opts...) |
| 1392 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1393 |
var err error |
| 1394 |
_, err = executeRPC(ctx, c.registryClient.DeleteApiSpec, req, settings.GRPC, c.logger, "DeleteApiSpec") |
| 1395 |
return err |
| 1396 |
}, opts...) |
| 1397 |
return err |
| 1398 |
} |
| 1399 |
|
| 1400 |
func (c *registryGRPCClient) TagApiSpecRevision(ctx context.Context, req *apigeeregistrypb.TagApiSpecRevisionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 1401 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1402 |
|
| 1403 |
hds = append(c.xGoogHeaders, hds...) |
| 1404 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1405 |
opts = append((*c.CallOptions).TagApiSpecRevision[0:len((*c.CallOptions).TagApiSpecRevision):len((*c.CallOptions).TagApiSpecRevision)], opts...) |
| 1406 |
var resp *apigeeregistrypb.ApiSpec |
| 1407 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1408 |
var err error |
| 1409 |
resp, err = executeRPC(ctx, c.registryClient.TagApiSpecRevision, req, settings.GRPC, c.logger, "TagApiSpecRevision") |
| 1410 |
return err |
| 1411 |
}, opts...) |
| 1412 |
if err != nil { |
| 1413 |
return nil, err |
| 1414 |
} |
| 1415 |
return resp, nil |
| 1416 |
} |
| 1417 |
|
| 1418 |
func (c *registryGRPCClient) ListApiSpecRevisions(ctx context.Context, req *apigeeregistrypb.ListApiSpecRevisionsRequest, opts ...gax.CallOption) *ApiSpecIterator { |
| 1419 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1420 |
|
| 1421 |
hds = append(c.xGoogHeaders, hds...) |
| 1422 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1423 |
opts = append((*c.CallOptions).ListApiSpecRevisions[0:len((*c.CallOptions).ListApiSpecRevisions):len((*c.CallOptions).ListApiSpecRevisions)], opts...) |
| 1424 |
it := &ApiSpecIterator{} |
| 1425 |
req = proto.Clone(req).(*apigeeregistrypb.ListApiSpecRevisionsRequest) |
| 1426 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*apigeeregistrypb.ApiSpec, string, error) { |
| 1427 |
resp := &apigeeregistrypb.ListApiSpecRevisionsResponse{} |
| 1428 |
if pageToken != "" { |
| 1429 |
req.PageToken = pageToken |
| 1430 |
} |
| 1431 |
if pageSize > math.MaxInt32 { |
| 1432 |
req.PageSize = math.MaxInt32 |
| 1433 |
} else if pageSize != 0 { |
| 1434 |
req.PageSize = int32(pageSize) |
| 1435 |
} |
| 1436 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1437 |
var err error |
| 1438 |
resp, err = executeRPC(ctx, c.registryClient.ListApiSpecRevisions, req, settings.GRPC, c.logger, "ListApiSpecRevisions") |
| 1439 |
return err |
| 1440 |
}, opts...) |
| 1441 |
if err != nil { |
| 1442 |
return nil, "", err |
| 1443 |
} |
| 1444 |
|
| 1445 |
it.Response = resp |
| 1446 |
return resp.GetApiSpecs(), resp.GetNextPageToken(), nil |
| 1447 |
} |
| 1448 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1449 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1450 |
if err != nil { |
| 1451 |
return "", err |
| 1452 |
} |
| 1453 |
it.items = append(it.items, items...) |
| 1454 |
return nextPageToken, nil |
| 1455 |
} |
| 1456 |
|
| 1457 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1458 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1459 |
it.pageInfo.Token = req.GetPageToken() |
| 1460 |
|
| 1461 |
return it |
| 1462 |
} |
| 1463 |
|
| 1464 |
func (c *registryGRPCClient) RollbackApiSpec(ctx context.Context, req *apigeeregistrypb.RollbackApiSpecRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 1465 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1466 |
|
| 1467 |
hds = append(c.xGoogHeaders, hds...) |
| 1468 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1469 |
opts = append((*c.CallOptions).RollbackApiSpec[0:len((*c.CallOptions).RollbackApiSpec):len((*c.CallOptions).RollbackApiSpec)], opts...) |
| 1470 |
var resp *apigeeregistrypb.ApiSpec |
| 1471 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1472 |
var err error |
| 1473 |
resp, err = executeRPC(ctx, c.registryClient.RollbackApiSpec, req, settings.GRPC, c.logger, "RollbackApiSpec") |
| 1474 |
return err |
| 1475 |
}, opts...) |
| 1476 |
if err != nil { |
| 1477 |
return nil, err |
| 1478 |
} |
| 1479 |
return resp, nil |
| 1480 |
} |
| 1481 |
|
| 1482 |
func (c *registryGRPCClient) DeleteApiSpecRevision(ctx context.Context, req *apigeeregistrypb.DeleteApiSpecRevisionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiSpec, error) { |
| 1483 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1484 |
|
| 1485 |
hds = append(c.xGoogHeaders, hds...) |
| 1486 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1487 |
opts = append((*c.CallOptions).DeleteApiSpecRevision[0:len((*c.CallOptions).DeleteApiSpecRevision):len((*c.CallOptions).DeleteApiSpecRevision)], opts...) |
| 1488 |
var resp *apigeeregistrypb.ApiSpec |
| 1489 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1490 |
var err error |
| 1491 |
resp, err = executeRPC(ctx, c.registryClient.DeleteApiSpecRevision, req, settings.GRPC, c.logger, "DeleteApiSpecRevision") |
| 1492 |
return err |
| 1493 |
}, opts...) |
| 1494 |
if err != nil { |
| 1495 |
return nil, err |
| 1496 |
} |
| 1497 |
return resp, nil |
| 1498 |
} |
| 1499 |
|
| 1500 |
func (c *registryGRPCClient) ListApiDeployments(ctx context.Context, req *apigeeregistrypb.ListApiDeploymentsRequest, opts ...gax.CallOption) *ApiDeploymentIterator { |
| 1501 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1502 |
|
| 1503 |
hds = append(c.xGoogHeaders, hds...) |
| 1504 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1505 |
opts = append((*c.CallOptions).ListApiDeployments[0:len((*c.CallOptions).ListApiDeployments):len((*c.CallOptions).ListApiDeployments)], opts...) |
| 1506 |
it := &ApiDeploymentIterator{} |
| 1507 |
req = proto.Clone(req).(*apigeeregistrypb.ListApiDeploymentsRequest) |
| 1508 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*apigeeregistrypb.ApiDeployment, string, error) { |
| 1509 |
resp := &apigeeregistrypb.ListApiDeploymentsResponse{} |
| 1510 |
if pageToken != "" { |
| 1511 |
req.PageToken = pageToken |
| 1512 |
} |
| 1513 |
if pageSize > math.MaxInt32 { |
| 1514 |
req.PageSize = math.MaxInt32 |
| 1515 |
} else if pageSize != 0 { |
| 1516 |
req.PageSize = int32(pageSize) |
| 1517 |
} |
| 1518 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1519 |
var err error |
| 1520 |
resp, err = executeRPC(ctx, c.registryClient.ListApiDeployments, req, settings.GRPC, c.logger, "ListApiDeployments") |
| 1521 |
return err |
| 1522 |
}, opts...) |
| 1523 |
if err != nil { |
| 1524 |
return nil, "", err |
| 1525 |
} |
| 1526 |
|
| 1527 |
it.Response = resp |
| 1528 |
return resp.GetApiDeployments(), resp.GetNextPageToken(), nil |
| 1529 |
} |
| 1530 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1531 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1532 |
if err != nil { |
| 1533 |
return "", err |
| 1534 |
} |
| 1535 |
it.items = append(it.items, items...) |
| 1536 |
return nextPageToken, nil |
| 1537 |
} |
| 1538 |
|
| 1539 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1540 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1541 |
it.pageInfo.Token = req.GetPageToken() |
| 1542 |
|
| 1543 |
return it |
| 1544 |
} |
| 1545 |
|
| 1546 |
func (c *registryGRPCClient) GetApiDeployment(ctx context.Context, req *apigeeregistrypb.GetApiDeploymentRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 1547 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1548 |
|
| 1549 |
hds = append(c.xGoogHeaders, hds...) |
| 1550 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1551 |
opts = append((*c.CallOptions).GetApiDeployment[0:len((*c.CallOptions).GetApiDeployment):len((*c.CallOptions).GetApiDeployment)], opts...) |
| 1552 |
var resp *apigeeregistrypb.ApiDeployment |
| 1553 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1554 |
var err error |
| 1555 |
resp, err = executeRPC(ctx, c.registryClient.GetApiDeployment, req, settings.GRPC, c.logger, "GetApiDeployment") |
| 1556 |
return err |
| 1557 |
}, opts...) |
| 1558 |
if err != nil { |
| 1559 |
return nil, err |
| 1560 |
} |
| 1561 |
return resp, nil |
| 1562 |
} |
| 1563 |
|
| 1564 |
func (c *registryGRPCClient) CreateApiDeployment(ctx context.Context, req *apigeeregistrypb.CreateApiDeploymentRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 1565 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1566 |
|
| 1567 |
hds = append(c.xGoogHeaders, hds...) |
| 1568 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1569 |
opts = append((*c.CallOptions).CreateApiDeployment[0:len((*c.CallOptions).CreateApiDeployment):len((*c.CallOptions).CreateApiDeployment)], opts...) |
| 1570 |
var resp *apigeeregistrypb.ApiDeployment |
| 1571 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1572 |
var err error |
| 1573 |
resp, err = executeRPC(ctx, c.registryClient.CreateApiDeployment, req, settings.GRPC, c.logger, "CreateApiDeployment") |
| 1574 |
return err |
| 1575 |
}, opts...) |
| 1576 |
if err != nil { |
| 1577 |
return nil, err |
| 1578 |
} |
| 1579 |
return resp, nil |
| 1580 |
} |
| 1581 |
|
| 1582 |
func (c *registryGRPCClient) UpdateApiDeployment(ctx context.Context, req *apigeeregistrypb.UpdateApiDeploymentRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 1583 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "api_deployment.name", url.QueryEscape(req.GetApiDeployment().GetName()))} |
| 1584 |
|
| 1585 |
hds = append(c.xGoogHeaders, hds...) |
| 1586 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1587 |
opts = append((*c.CallOptions).UpdateApiDeployment[0:len((*c.CallOptions).UpdateApiDeployment):len((*c.CallOptions).UpdateApiDeployment)], opts...) |
| 1588 |
var resp *apigeeregistrypb.ApiDeployment |
| 1589 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1590 |
var err error |
| 1591 |
resp, err = executeRPC(ctx, c.registryClient.UpdateApiDeployment, req, settings.GRPC, c.logger, "UpdateApiDeployment") |
| 1592 |
return err |
| 1593 |
}, opts...) |
| 1594 |
if err != nil { |
| 1595 |
return nil, err |
| 1596 |
} |
| 1597 |
return resp, nil |
| 1598 |
} |
| 1599 |
|
| 1600 |
func (c *registryGRPCClient) DeleteApiDeployment(ctx context.Context, req *apigeeregistrypb.DeleteApiDeploymentRequest, opts ...gax.CallOption) error { |
| 1601 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1602 |
|
| 1603 |
hds = append(c.xGoogHeaders, hds...) |
| 1604 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1605 |
opts = append((*c.CallOptions).DeleteApiDeployment[0:len((*c.CallOptions).DeleteApiDeployment):len((*c.CallOptions).DeleteApiDeployment)], opts...) |
| 1606 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1607 |
var err error |
| 1608 |
_, err = executeRPC(ctx, c.registryClient.DeleteApiDeployment, req, settings.GRPC, c.logger, "DeleteApiDeployment") |
| 1609 |
return err |
| 1610 |
}, opts...) |
| 1611 |
return err |
| 1612 |
} |
| 1613 |
|
| 1614 |
func (c *registryGRPCClient) TagApiDeploymentRevision(ctx context.Context, req *apigeeregistrypb.TagApiDeploymentRevisionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 1615 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1616 |
|
| 1617 |
hds = append(c.xGoogHeaders, hds...) |
| 1618 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1619 |
opts = append((*c.CallOptions).TagApiDeploymentRevision[0:len((*c.CallOptions).TagApiDeploymentRevision):len((*c.CallOptions).TagApiDeploymentRevision)], opts...) |
| 1620 |
var resp *apigeeregistrypb.ApiDeployment |
| 1621 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1622 |
var err error |
| 1623 |
resp, err = executeRPC(ctx, c.registryClient.TagApiDeploymentRevision, req, settings.GRPC, c.logger, "TagApiDeploymentRevision") |
| 1624 |
return err |
| 1625 |
}, opts...) |
| 1626 |
if err != nil { |
| 1627 |
return nil, err |
| 1628 |
} |
| 1629 |
return resp, nil |
| 1630 |
} |
| 1631 |
|
| 1632 |
func (c *registryGRPCClient) ListApiDeploymentRevisions(ctx context.Context, req *apigeeregistrypb.ListApiDeploymentRevisionsRequest, opts ...gax.CallOption) *ApiDeploymentIterator { |
| 1633 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1634 |
|
| 1635 |
hds = append(c.xGoogHeaders, hds...) |
| 1636 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1637 |
opts = append((*c.CallOptions).ListApiDeploymentRevisions[0:len((*c.CallOptions).ListApiDeploymentRevisions):len((*c.CallOptions).ListApiDeploymentRevisions)], opts...) |
| 1638 |
it := &ApiDeploymentIterator{} |
| 1639 |
req = proto.Clone(req).(*apigeeregistrypb.ListApiDeploymentRevisionsRequest) |
| 1640 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*apigeeregistrypb.ApiDeployment, string, error) { |
| 1641 |
resp := &apigeeregistrypb.ListApiDeploymentRevisionsResponse{} |
| 1642 |
if pageToken != "" { |
| 1643 |
req.PageToken = pageToken |
| 1644 |
} |
| 1645 |
if pageSize > math.MaxInt32 { |
| 1646 |
req.PageSize = math.MaxInt32 |
| 1647 |
} else if pageSize != 0 { |
| 1648 |
req.PageSize = int32(pageSize) |
| 1649 |
} |
| 1650 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1651 |
var err error |
| 1652 |
resp, err = executeRPC(ctx, c.registryClient.ListApiDeploymentRevisions, req, settings.GRPC, c.logger, "ListApiDeploymentRevisions") |
| 1653 |
return err |
| 1654 |
}, opts...) |
| 1655 |
if err != nil { |
| 1656 |
return nil, "", err |
| 1657 |
} |
| 1658 |
|
| 1659 |
it.Response = resp |
| 1660 |
return resp.GetApiDeployments(), resp.GetNextPageToken(), nil |
| 1661 |
} |
| 1662 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1663 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1664 |
if err != nil { |
| 1665 |
return "", err |
| 1666 |
} |
| 1667 |
it.items = append(it.items, items...) |
| 1668 |
return nextPageToken, nil |
| 1669 |
} |
| 1670 |
|
| 1671 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1672 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1673 |
it.pageInfo.Token = req.GetPageToken() |
| 1674 |
|
| 1675 |
return it |
| 1676 |
} |
| 1677 |
|
| 1678 |
func (c *registryGRPCClient) RollbackApiDeployment(ctx context.Context, req *apigeeregistrypb.RollbackApiDeploymentRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 1679 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1680 |
|
| 1681 |
hds = append(c.xGoogHeaders, hds...) |
| 1682 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1683 |
opts = append((*c.CallOptions).RollbackApiDeployment[0:len((*c.CallOptions).RollbackApiDeployment):len((*c.CallOptions).RollbackApiDeployment)], opts...) |
| 1684 |
var resp *apigeeregistrypb.ApiDeployment |
| 1685 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1686 |
var err error |
| 1687 |
resp, err = executeRPC(ctx, c.registryClient.RollbackApiDeployment, req, settings.GRPC, c.logger, "RollbackApiDeployment") |
| 1688 |
return err |
| 1689 |
}, opts...) |
| 1690 |
if err != nil { |
| 1691 |
return nil, err |
| 1692 |
} |
| 1693 |
return resp, nil |
| 1694 |
} |
| 1695 |
|
| 1696 |
func (c *registryGRPCClient) DeleteApiDeploymentRevision(ctx context.Context, req *apigeeregistrypb.DeleteApiDeploymentRevisionRequest, opts ...gax.CallOption) (*apigeeregistrypb.ApiDeployment, error) { |
| 1697 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1698 |
|
| 1699 |
hds = append(c.xGoogHeaders, hds...) |
| 1700 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1701 |
opts = append((*c.CallOptions).DeleteApiDeploymentRevision[0:len((*c.CallOptions).DeleteApiDeploymentRevision):len((*c.CallOptions).DeleteApiDeploymentRevision)], opts...) |
| 1702 |
var resp *apigeeregistrypb.ApiDeployment |
| 1703 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1704 |
var err error |
| 1705 |
resp, err = executeRPC(ctx, c.registryClient.DeleteApiDeploymentRevision, req, settings.GRPC, c.logger, "DeleteApiDeploymentRevision") |
| 1706 |
return err |
| 1707 |
}, opts...) |
| 1708 |
if err != nil { |
| 1709 |
return nil, err |
| 1710 |
} |
| 1711 |
return resp, nil |
| 1712 |
} |
| 1713 |
|
| 1714 |
func (c *registryGRPCClient) ListArtifacts(ctx context.Context, req *apigeeregistrypb.ListArtifactsRequest, opts ...gax.CallOption) *ArtifactIterator { |
| 1715 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1716 |
|
| 1717 |
hds = append(c.xGoogHeaders, hds...) |
| 1718 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1719 |
opts = append((*c.CallOptions).ListArtifacts[0:len((*c.CallOptions).ListArtifacts):len((*c.CallOptions).ListArtifacts)], opts...) |
| 1720 |
it := &ArtifactIterator{} |
| 1721 |
req = proto.Clone(req).(*apigeeregistrypb.ListArtifactsRequest) |
| 1722 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*apigeeregistrypb.Artifact, string, error) { |
| 1723 |
resp := &apigeeregistrypb.ListArtifactsResponse{} |
| 1724 |
if pageToken != "" { |
| 1725 |
req.PageToken = pageToken |
| 1726 |
} |
| 1727 |
if pageSize > math.MaxInt32 { |
| 1728 |
req.PageSize = math.MaxInt32 |
| 1729 |
} else if pageSize != 0 { |
| 1730 |
req.PageSize = int32(pageSize) |
| 1731 |
} |
| 1732 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1733 |
var err error |
| 1734 |
resp, err = executeRPC(ctx, c.registryClient.ListArtifacts, req, settings.GRPC, c.logger, "ListArtifacts") |
| 1735 |
return err |
| 1736 |
}, opts...) |
| 1737 |
if err != nil { |
| 1738 |
return nil, "", err |
| 1739 |
} |
| 1740 |
|
| 1741 |
it.Response = resp |
| 1742 |
return resp.GetArtifacts(), resp.GetNextPageToken(), nil |
| 1743 |
} |
| 1744 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1745 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1746 |
if err != nil { |
| 1747 |
return "", err |
| 1748 |
} |
| 1749 |
it.items = append(it.items, items...) |
| 1750 |
return nextPageToken, nil |
| 1751 |
} |
| 1752 |
|
| 1753 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1754 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1755 |
it.pageInfo.Token = req.GetPageToken() |
| 1756 |
|
| 1757 |
return it |
| 1758 |
} |
| 1759 |
|
| 1760 |
func (c *registryGRPCClient) GetArtifact(ctx context.Context, req *apigeeregistrypb.GetArtifactRequest, opts ...gax.CallOption) (*apigeeregistrypb.Artifact, error) { |
| 1761 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1762 |
|
| 1763 |
hds = append(c.xGoogHeaders, hds...) |
| 1764 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1765 |
opts = append((*c.CallOptions).GetArtifact[0:len((*c.CallOptions).GetArtifact):len((*c.CallOptions).GetArtifact)], opts...) |
| 1766 |
var resp *apigeeregistrypb.Artifact |
| 1767 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1768 |
var err error |
| 1769 |
resp, err = executeRPC(ctx, c.registryClient.GetArtifact, req, settings.GRPC, c.logger, "GetArtifact") |
| 1770 |
return err |
| 1771 |
}, opts...) |
| 1772 |
if err != nil { |
| 1773 |
return nil, err |
| 1774 |
} |
| 1775 |
return resp, nil |
| 1776 |
} |
| 1777 |
|
| 1778 |
func (c *registryGRPCClient) GetArtifactContents(ctx context.Context, req *apigeeregistrypb.GetArtifactContentsRequest, opts ...gax.CallOption) (*httpbodypb.HttpBody, error) { |
| 1779 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1780 |
|
| 1781 |
hds = append(c.xGoogHeaders, hds...) |
| 1782 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1783 |
opts = append((*c.CallOptions).GetArtifactContents[0:len((*c.CallOptions).GetArtifactContents):len((*c.CallOptions).GetArtifactContents)], opts...) |
| 1784 |
var resp *httpbodypb.HttpBody |
| 1785 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1786 |
var err error |
| 1787 |
resp, err = executeRPC(ctx, c.registryClient.GetArtifactContents, req, settings.GRPC, c.logger, "GetArtifactContents") |
| 1788 |
return err |
| 1789 |
}, opts...) |
| 1790 |
if err != nil { |
| 1791 |
return nil, err |
| 1792 |
} |
| 1793 |
return resp, nil |
| 1794 |
} |
| 1795 |
|
| 1796 |
func (c *registryGRPCClient) CreateArtifact(ctx context.Context, req *apigeeregistrypb.CreateArtifactRequest, opts ...gax.CallOption) (*apigeeregistrypb.Artifact, error) { |
| 1797 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1798 |
|
| 1799 |
hds = append(c.xGoogHeaders, hds...) |
| 1800 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1801 |
opts = append((*c.CallOptions).CreateArtifact[0:len((*c.CallOptions).CreateArtifact):len((*c.CallOptions).CreateArtifact)], opts...) |
| 1802 |
var resp *apigeeregistrypb.Artifact |
| 1803 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1804 |
var err error |
| 1805 |
resp, err = executeRPC(ctx, c.registryClient.CreateArtifact, req, settings.GRPC, c.logger, "CreateArtifact") |
| 1806 |
return err |
| 1807 |
}, opts...) |
| 1808 |
if err != nil { |
| 1809 |
return nil, err |
| 1810 |
} |
| 1811 |
return resp, nil |
| 1812 |
} |
| 1813 |
|
| 1814 |
func (c *registryGRPCClient) ReplaceArtifact(ctx context.Context, req *apigeeregistrypb.ReplaceArtifactRequest, opts ...gax.CallOption) (*apigeeregistrypb.Artifact, error) { |
| 1815 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "artifact.name", url.QueryEscape(req.GetArtifact().GetName()))} |
| 1816 |
|
| 1817 |
hds = append(c.xGoogHeaders, hds...) |
| 1818 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1819 |
opts = append((*c.CallOptions).ReplaceArtifact[0:len((*c.CallOptions).ReplaceArtifact):len((*c.CallOptions).ReplaceArtifact)], opts...) |
| 1820 |
var resp *apigeeregistrypb.Artifact |
| 1821 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1822 |
var err error |
| 1823 |
resp, err = executeRPC(ctx, c.registryClient.ReplaceArtifact, req, settings.GRPC, c.logger, "ReplaceArtifact") |
| 1824 |
return err |
| 1825 |
}, opts...) |
| 1826 |
if err != nil { |
| 1827 |
return nil, err |
| 1828 |
} |
| 1829 |
return resp, nil |
| 1830 |
} |
| 1831 |
|
| 1832 |
func (c *registryGRPCClient) DeleteArtifact(ctx context.Context, req *apigeeregistrypb.DeleteArtifactRequest, opts ...gax.CallOption) error { |
| 1833 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1834 |
|
| 1835 |
hds = append(c.xGoogHeaders, hds...) |
| 1836 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1837 |
opts = append((*c.CallOptions).DeleteArtifact[0:len((*c.CallOptions).DeleteArtifact):len((*c.CallOptions).DeleteArtifact)], opts...) |
| 1838 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1839 |
var err error |
| 1840 |
_, err = executeRPC(ctx, c.registryClient.DeleteArtifact, req, settings.GRPC, c.logger, "DeleteArtifact") |
| 1841 |
return err |
| 1842 |
}, opts...) |
| 1843 |
return err |
| 1844 |
} |
| 1845 |
|
| 1846 |
func (c *registryGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { |
| 1847 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1848 |
|
| 1849 |
hds = append(c.xGoogHeaders, hds...) |
| 1850 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1851 |
opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) |
| 1852 |
var resp *locationpb.Location |
| 1853 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1854 |
var err error |
| 1855 |
resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation") |
| 1856 |
return err |
| 1857 |
}, opts...) |
| 1858 |
if err != nil { |
| 1859 |
return nil, err |
| 1860 |
} |
| 1861 |
return resp, nil |
| 1862 |
} |
| 1863 |
|
| 1864 |
func (c *registryGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { |
| 1865 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1866 |
|
| 1867 |
hds = append(c.xGoogHeaders, hds...) |
| 1868 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1869 |
opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...) |
| 1870 |
it := &LocationIterator{} |
| 1871 |
req = proto.Clone(req).(*locationpb.ListLocationsRequest) |
| 1872 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { |
| 1873 |
resp := &locationpb.ListLocationsResponse{} |
| 1874 |
if pageToken != "" { |
| 1875 |
req.PageToken = pageToken |
| 1876 |
} |
| 1877 |
if pageSize > math.MaxInt32 { |
| 1878 |
req.PageSize = math.MaxInt32 |
| 1879 |
} else if pageSize != 0 { |
| 1880 |
req.PageSize = int32(pageSize) |
| 1881 |
} |
| 1882 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1883 |
var err error |
| 1884 |
resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations") |
| 1885 |
return err |
| 1886 |
}, opts...) |
| 1887 |
if err != nil { |
| 1888 |
return nil, "", err |
| 1889 |
} |
| 1890 |
|
| 1891 |
it.Response = resp |
| 1892 |
return resp.GetLocations(), resp.GetNextPageToken(), nil |
| 1893 |
} |
| 1894 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1895 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1896 |
if err != nil { |
| 1897 |
return "", err |
| 1898 |
} |
| 1899 |
it.items = append(it.items, items...) |
| 1900 |
return nextPageToken, nil |
| 1901 |
} |
| 1902 |
|
| 1903 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1904 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1905 |
it.pageInfo.Token = req.GetPageToken() |
| 1906 |
|
| 1907 |
return it |
| 1908 |
} |
| 1909 |
|
| 1910 |
func (c *registryGRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { |
| 1911 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} |
| 1912 |
|
| 1913 |
hds = append(c.xGoogHeaders, hds...) |
| 1914 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1915 |
opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...) |
| 1916 |
var resp *iampb.Policy |
| 1917 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1918 |
var err error |
| 1919 |
resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy") |
| 1920 |
return err |
| 1921 |
}, opts...) |
| 1922 |
if err != nil { |
| 1923 |
return nil, err |
| 1924 |
} |
| 1925 |
return resp, nil |
| 1926 |
} |
| 1927 |
|
| 1928 |
func (c *registryGRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { |
| 1929 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} |
| 1930 |
|
| 1931 |
hds = append(c.xGoogHeaders, hds...) |
| 1932 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1933 |
opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...) |
| 1934 |
var resp *iampb.Policy |
| 1935 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1936 |
var err error |
| 1937 |
resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy") |
| 1938 |
return err |
| 1939 |
}, opts...) |
| 1940 |
if err != nil { |
| 1941 |
return nil, err |
| 1942 |
} |
| 1943 |
return resp, nil |
| 1944 |
} |
| 1945 |
|
| 1946 |
func (c *registryGRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { |
| 1947 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))} |
| 1948 |
|
| 1949 |
hds = append(c.xGoogHeaders, hds...) |
| 1950 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1951 |
opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...) |
| 1952 |
var resp *iampb.TestIamPermissionsResponse |
| 1953 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1954 |
var err error |
| 1955 |
resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions") |
| 1956 |
return err |
| 1957 |
}, opts...) |
| 1958 |
if err != nil { |
| 1959 |
return nil, err |
| 1960 |
} |
| 1961 |
return resp, nil |
| 1962 |
} |
| 1963 |
|
| 1964 |
func (c *registryGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { |
| 1965 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1966 |
|
| 1967 |
hds = append(c.xGoogHeaders, hds...) |
| 1968 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1969 |
opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...) |
| 1970 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1971 |
var err error |
| 1972 |
_, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation") |
| 1973 |
return err |
| 1974 |
}, opts...) |
| 1975 |
return err |
| 1976 |
} |
| 1977 |
|
| 1978 |
func (c *registryGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { |
| 1979 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1980 |
|
| 1981 |
hds = append(c.xGoogHeaders, hds...) |
| 1982 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1983 |
opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...) |
| 1984 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1985 |
var err error |
| 1986 |
_, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation") |
| 1987 |
return err |
| 1988 |
}, opts...) |
| 1989 |
return err |
| 1990 |
} |
| 1991 |
|
| 1992 |
func (c *registryGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { |
| 1993 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1994 |
|
| 1995 |
hds = append(c.xGoogHeaders, hds...) |
| 1996 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1997 |
opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) |
| 1998 |
var resp *longrunningpb.Operation |
| 1999 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2000 |
var err error |
| 2001 |
resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation") |
| 2002 |
return err |
| 2003 |
}, opts...) |
| 2004 |
if err != nil { |
| 2005 |
return nil, err |
| 2006 |
} |
| 2007 |
return resp, nil |
| 2008 |
} |
| 2009 |
|
| 2010 |
func (c *registryGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { |
| 2011 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 2012 |
|
| 2013 |
hds = append(c.xGoogHeaders, hds...) |
| 2014 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 2015 |
opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...) |
| 2016 |
it := &OperationIterator{} |
| 2017 |
req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) |
| 2018 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { |
| 2019 |
resp := &longrunningpb.ListOperationsResponse{} |
| 2020 |
if pageToken != "" { |
| 2021 |
req.PageToken = pageToken |
| 2022 |
} |
| 2023 |
if pageSize > math.MaxInt32 { |
| 2024 |
req.PageSize = math.MaxInt32 |
| 2025 |
} else if pageSize != 0 { |
| 2026 |
req.PageSize = int32(pageSize) |
| 2027 |
} |
| 2028 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2029 |
var err error |
| 2030 |
resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations") |
| 2031 |
return err |
| 2032 |
}, opts...) |
| 2033 |
if err != nil { |
| 2034 |
return nil, "", err |
| 2035 |
} |
| 2036 |
|
| 2037 |
it.Response = resp |
| 2038 |
return resp.GetOperations(), resp.GetNextPageToken(), nil |
| 2039 |
} |
| 2040 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 2041 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 2042 |
if err != nil { |
| 2043 |
return "", err |
| 2044 |
} |
| 2045 |
it.items = append(it.items, items...) |
| 2046 |
return nextPageToken, nil |
| 2047 |
} |
| 2048 |
|
| 2049 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 2050 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 2051 |
it.pageInfo.Token = req.GetPageToken() |
| 2052 |
|
| 2053 |
return it |
| 2054 |
} |