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