| 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 |
"context" |
| 21 |
"time" |
| 22 |
|
| 23 |
datacatalogpb "cloud.google.com/go/datacatalog/apiv1/datacatalogpb" |
| 24 |
"cloud.google.com/go/longrunning" |
| 25 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 26 |
gax "github.com/googleapis/gax-go/v2" |
| 27 |
"google.golang.org/api/iterator" |
| 28 |
) |
| 29 |
|
| 30 |
// ImportEntriesOperation manages a long-running operation from ImportEntries. |
| 31 |
type ImportEntriesOperation struct { |
| 32 |
lro *longrunning.Operation |
| 33 |
pollPath string |
| 34 |
} |
| 35 |
|
| 36 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 37 |
// |
| 38 |
// See documentation of Poll for error-handling information. |
| 39 |
func (op *ImportEntriesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*datacatalogpb.ImportEntriesResponse, error) { |
| 40 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 41 |
var resp datacatalogpb.ImportEntriesResponse |
| 42 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 43 |
return nil, err |
| 44 |
} |
| 45 |
return &resp, nil |
| 46 |
} |
| 47 |
|
| 48 |
// Poll fetches the latest state of the long-running operation. |
| 49 |
// |
| 50 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 51 |
// |
| 52 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 53 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 54 |
// If Poll succeeds and the operation has completed successfully, |
| 55 |
// op.Done will return true, and the response of the operation is returned. |
| 56 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 57 |
func (op *ImportEntriesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*datacatalogpb.ImportEntriesResponse, error) { |
| 58 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 59 |
var resp datacatalogpb.ImportEntriesResponse |
| 60 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 61 |
return nil, err |
| 62 |
} |
| 63 |
if !op.Done() { |
| 64 |
return nil, nil |
| 65 |
} |
| 66 |
return &resp, nil |
| 67 |
} |
| 68 |
|
| 69 |
// Metadata returns metadata associated with the long-running operation. |
| 70 |
// Metadata itself does not contact the server, but Poll does. |
| 71 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 72 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 73 |
func (op *ImportEntriesOperation) Metadata() (*datacatalogpb.ImportEntriesMetadata, error) { |
| 74 |
var meta datacatalogpb.ImportEntriesMetadata |
| 75 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 76 |
return nil, nil |
| 77 |
} else if err != nil { |
| 78 |
return nil, err |
| 79 |
} |
| 80 |
return &meta, nil |
| 81 |
} |
| 82 |
|
| 83 |
// Done reports whether the long-running operation has completed. |
| 84 |
func (op *ImportEntriesOperation) Done() bool { |
| 85 |
return op.lro.Done() |
| 86 |
} |
| 87 |
|
| 88 |
// Name returns the name of the long-running operation. |
| 89 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 90 |
func (op *ImportEntriesOperation) Name() string { |
| 91 |
return op.lro.Name() |
| 92 |
} |
| 93 |
|
| 94 |
// ReconcileTagsOperation manages a long-running operation from ReconcileTags. |
| 95 |
type ReconcileTagsOperation struct { |
| 96 |
lro *longrunning.Operation |
| 97 |
pollPath string |
| 98 |
} |
| 99 |
|
| 100 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 101 |
// |
| 102 |
// See documentation of Poll for error-handling information. |
| 103 |
func (op *ReconcileTagsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*datacatalogpb.ReconcileTagsResponse, error) { |
| 104 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 105 |
var resp datacatalogpb.ReconcileTagsResponse |
| 106 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 107 |
return nil, err |
| 108 |
} |
| 109 |
return &resp, nil |
| 110 |
} |
| 111 |
|
| 112 |
// Poll fetches the latest state of the long-running operation. |
| 113 |
// |
| 114 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 115 |
// |
| 116 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 117 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 118 |
// If Poll succeeds and the operation has completed successfully, |
| 119 |
// op.Done will return true, and the response of the operation is returned. |
| 120 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 121 |
func (op *ReconcileTagsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*datacatalogpb.ReconcileTagsResponse, error) { |
| 122 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 123 |
var resp datacatalogpb.ReconcileTagsResponse |
| 124 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 125 |
return nil, err |
| 126 |
} |
| 127 |
if !op.Done() { |
| 128 |
return nil, nil |
| 129 |
} |
| 130 |
return &resp, nil |
| 131 |
} |
| 132 |
|
| 133 |
// Metadata returns metadata associated with the long-running operation. |
| 134 |
// Metadata itself does not contact the server, but Poll does. |
| 135 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 136 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 137 |
func (op *ReconcileTagsOperation) Metadata() (*datacatalogpb.ReconcileTagsMetadata, error) { |
| 138 |
var meta datacatalogpb.ReconcileTagsMetadata |
| 139 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 140 |
return nil, nil |
| 141 |
} else if err != nil { |
| 142 |
return nil, err |
| 143 |
} |
| 144 |
return &meta, nil |
| 145 |
} |
| 146 |
|
| 147 |
// Done reports whether the long-running operation has completed. |
| 148 |
func (op *ReconcileTagsOperation) Done() bool { |
| 149 |
return op.lro.Done() |
| 150 |
} |
| 151 |
|
| 152 |
// Name returns the name of the long-running operation. |
| 153 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 154 |
func (op *ReconcileTagsOperation) Name() string { |
| 155 |
return op.lro.Name() |
| 156 |
} |
| 157 |
|
| 158 |
// EntryGroupIterator manages a stream of *datacatalogpb.EntryGroup. |
| 159 |
type EntryGroupIterator struct { |
| 160 |
items []*datacatalogpb.EntryGroup |
| 161 |
pageInfo *iterator.PageInfo |
| 162 |
nextFunc func() error |
| 163 |
|
| 164 |
// Response is the raw response for the current page. |
| 165 |
// It must be cast to the RPC response type. |
| 166 |
// Calling Next() or InternalFetch() updates this value. |
| 167 |
Response interface{} |
| 168 |
|
| 169 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 170 |
// It is not part of the stable interface of this package. |
| 171 |
// |
| 172 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 173 |
// The number of results is no greater than pageSize. |
| 174 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 175 |
InternalFetch func(pageSize int, pageToken string) (results []*datacatalogpb.EntryGroup, nextPageToken string, err error) |
| 176 |
} |
| 177 |
|
| 178 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 179 |
func (it *EntryGroupIterator) PageInfo() *iterator.PageInfo { |
| 180 |
return it.pageInfo |
| 181 |
} |
| 182 |
|
| 183 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 184 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 185 |
func (it *EntryGroupIterator) Next() (*datacatalogpb.EntryGroup, error) { |
| 186 |
var item *datacatalogpb.EntryGroup |
| 187 |
if err := it.nextFunc(); err != nil { |
| 188 |
return item, err |
| 189 |
} |
| 190 |
item = it.items[0] |
| 191 |
it.items = it.items[1:] |
| 192 |
return item, nil |
| 193 |
} |
| 194 |
|
| 195 |
func (it *EntryGroupIterator) bufLen() int { |
| 196 |
return len(it.items) |
| 197 |
} |
| 198 |
|
| 199 |
func (it *EntryGroupIterator) takeBuf() interface{} { |
| 200 |
b := it.items |
| 201 |
it.items = nil |
| 202 |
return b |
| 203 |
} |
| 204 |
|
| 205 |
// EntryIterator manages a stream of *datacatalogpb.Entry. |
| 206 |
type EntryIterator struct { |
| 207 |
items []*datacatalogpb.Entry |
| 208 |
pageInfo *iterator.PageInfo |
| 209 |
nextFunc func() error |
| 210 |
|
| 211 |
// Response is the raw response for the current page. |
| 212 |
// It must be cast to the RPC response type. |
| 213 |
// Calling Next() or InternalFetch() updates this value. |
| 214 |
Response interface{} |
| 215 |
|
| 216 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 217 |
// It is not part of the stable interface of this package. |
| 218 |
// |
| 219 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 220 |
// The number of results is no greater than pageSize. |
| 221 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 222 |
InternalFetch func(pageSize int, pageToken string) (results []*datacatalogpb.Entry, nextPageToken string, err error) |
| 223 |
} |
| 224 |
|
| 225 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 226 |
func (it *EntryIterator) PageInfo() *iterator.PageInfo { |
| 227 |
return it.pageInfo |
| 228 |
} |
| 229 |
|
| 230 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 231 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 232 |
func (it *EntryIterator) Next() (*datacatalogpb.Entry, error) { |
| 233 |
var item *datacatalogpb.Entry |
| 234 |
if err := it.nextFunc(); err != nil { |
| 235 |
return item, err |
| 236 |
} |
| 237 |
item = it.items[0] |
| 238 |
it.items = it.items[1:] |
| 239 |
return item, nil |
| 240 |
} |
| 241 |
|
| 242 |
func (it *EntryIterator) bufLen() int { |
| 243 |
return len(it.items) |
| 244 |
} |
| 245 |
|
| 246 |
func (it *EntryIterator) takeBuf() interface{} { |
| 247 |
b := it.items |
| 248 |
it.items = nil |
| 249 |
return b |
| 250 |
} |
| 251 |
|
| 252 |
// OperationIterator manages a stream of *longrunningpb.Operation. |
| 253 |
type OperationIterator struct { |
| 254 |
items []*longrunningpb.Operation |
| 255 |
pageInfo *iterator.PageInfo |
| 256 |
nextFunc func() error |
| 257 |
|
| 258 |
// Response is the raw response for the current page. |
| 259 |
// It must be cast to the RPC response type. |
| 260 |
// Calling Next() or InternalFetch() updates this value. |
| 261 |
Response interface{} |
| 262 |
|
| 263 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 264 |
// It is not part of the stable interface of this package. |
| 265 |
// |
| 266 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 267 |
// The number of results is no greater than pageSize. |
| 268 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 269 |
InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) |
| 270 |
} |
| 271 |
|
| 272 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 273 |
func (it *OperationIterator) PageInfo() *iterator.PageInfo { |
| 274 |
return it.pageInfo |
| 275 |
} |
| 276 |
|
| 277 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 278 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 279 |
func (it *OperationIterator) Next() (*longrunningpb.Operation, error) { |
| 280 |
var item *longrunningpb.Operation |
| 281 |
if err := it.nextFunc(); err != nil { |
| 282 |
return item, err |
| 283 |
} |
| 284 |
item = it.items[0] |
| 285 |
it.items = it.items[1:] |
| 286 |
return item, nil |
| 287 |
} |
| 288 |
|
| 289 |
func (it *OperationIterator) bufLen() int { |
| 290 |
return len(it.items) |
| 291 |
} |
| 292 |
|
| 293 |
func (it *OperationIterator) takeBuf() interface{} { |
| 294 |
b := it.items |
| 295 |
it.items = nil |
| 296 |
return b |
| 297 |
} |
| 298 |
|
| 299 |
// PolicyTagIterator manages a stream of *datacatalogpb.PolicyTag. |
| 300 |
type PolicyTagIterator struct { |
| 301 |
items []*datacatalogpb.PolicyTag |
| 302 |
pageInfo *iterator.PageInfo |
| 303 |
nextFunc func() error |
| 304 |
|
| 305 |
// Response is the raw response for the current page. |
| 306 |
// It must be cast to the RPC response type. |
| 307 |
// Calling Next() or InternalFetch() updates this value. |
| 308 |
Response interface{} |
| 309 |
|
| 310 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 311 |
// It is not part of the stable interface of this package. |
| 312 |
// |
| 313 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 314 |
// The number of results is no greater than pageSize. |
| 315 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 316 |
InternalFetch func(pageSize int, pageToken string) (results []*datacatalogpb.PolicyTag, nextPageToken string, err error) |
| 317 |
} |
| 318 |
|
| 319 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 320 |
func (it *PolicyTagIterator) PageInfo() *iterator.PageInfo { |
| 321 |
return it.pageInfo |
| 322 |
} |
| 323 |
|
| 324 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 325 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 326 |
func (it *PolicyTagIterator) Next() (*datacatalogpb.PolicyTag, error) { |
| 327 |
var item *datacatalogpb.PolicyTag |
| 328 |
if err := it.nextFunc(); err != nil { |
| 329 |
return item, err |
| 330 |
} |
| 331 |
item = it.items[0] |
| 332 |
it.items = it.items[1:] |
| 333 |
return item, nil |
| 334 |
} |
| 335 |
|
| 336 |
func (it *PolicyTagIterator) bufLen() int { |
| 337 |
return len(it.items) |
| 338 |
} |
| 339 |
|
| 340 |
func (it *PolicyTagIterator) takeBuf() interface{} { |
| 341 |
b := it.items |
| 342 |
it.items = nil |
| 343 |
return b |
| 344 |
} |
| 345 |
|
| 346 |
// SearchCatalogResultIterator manages a stream of *datacatalogpb.SearchCatalogResult. |
| 347 |
type SearchCatalogResultIterator struct { |
| 348 |
items []*datacatalogpb.SearchCatalogResult |
| 349 |
pageInfo *iterator.PageInfo |
| 350 |
nextFunc func() error |
| 351 |
|
| 352 |
// Response is the raw response for the current page. |
| 353 |
// It must be cast to the RPC response type. |
| 354 |
// Calling Next() or InternalFetch() updates this value. |
| 355 |
Response interface{} |
| 356 |
|
| 357 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 358 |
// It is not part of the stable interface of this package. |
| 359 |
// |
| 360 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 361 |
// The number of results is no greater than pageSize. |
| 362 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 363 |
InternalFetch func(pageSize int, pageToken string) (results []*datacatalogpb.SearchCatalogResult, nextPageToken string, err error) |
| 364 |
} |
| 365 |
|
| 366 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 367 |
func (it *SearchCatalogResultIterator) PageInfo() *iterator.PageInfo { |
| 368 |
return it.pageInfo |
| 369 |
} |
| 370 |
|
| 371 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 372 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 373 |
func (it *SearchCatalogResultIterator) Next() (*datacatalogpb.SearchCatalogResult, error) { |
| 374 |
var item *datacatalogpb.SearchCatalogResult |
| 375 |
if err := it.nextFunc(); err != nil { |
| 376 |
return item, err |
| 377 |
} |
| 378 |
item = it.items[0] |
| 379 |
it.items = it.items[1:] |
| 380 |
return item, nil |
| 381 |
} |
| 382 |
|
| 383 |
func (it *SearchCatalogResultIterator) bufLen() int { |
| 384 |
return len(it.items) |
| 385 |
} |
| 386 |
|
| 387 |
func (it *SearchCatalogResultIterator) takeBuf() interface{} { |
| 388 |
b := it.items |
| 389 |
it.items = nil |
| 390 |
return b |
| 391 |
} |
| 392 |
|
| 393 |
// TagIterator manages a stream of *datacatalogpb.Tag. |
| 394 |
type TagIterator struct { |
| 395 |
items []*datacatalogpb.Tag |
| 396 |
pageInfo *iterator.PageInfo |
| 397 |
nextFunc func() error |
| 398 |
|
| 399 |
// Response is the raw response for the current page. |
| 400 |
// It must be cast to the RPC response type. |
| 401 |
// Calling Next() or InternalFetch() updates this value. |
| 402 |
Response interface{} |
| 403 |
|
| 404 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 405 |
// It is not part of the stable interface of this package. |
| 406 |
// |
| 407 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 408 |
// The number of results is no greater than pageSize. |
| 409 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 410 |
InternalFetch func(pageSize int, pageToken string) (results []*datacatalogpb.Tag, nextPageToken string, err error) |
| 411 |
} |
| 412 |
|
| 413 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 414 |
func (it *TagIterator) PageInfo() *iterator.PageInfo { |
| 415 |
return it.pageInfo |
| 416 |
} |
| 417 |
|
| 418 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 419 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 420 |
func (it *TagIterator) Next() (*datacatalogpb.Tag, error) { |
| 421 |
var item *datacatalogpb.Tag |
| 422 |
if err := it.nextFunc(); err != nil { |
| 423 |
return item, err |
| 424 |
} |
| 425 |
item = it.items[0] |
| 426 |
it.items = it.items[1:] |
| 427 |
return item, nil |
| 428 |
} |
| 429 |
|
| 430 |
func (it *TagIterator) bufLen() int { |
| 431 |
return len(it.items) |
| 432 |
} |
| 433 |
|
| 434 |
func (it *TagIterator) takeBuf() interface{} { |
| 435 |
b := it.items |
| 436 |
it.items = nil |
| 437 |
return b |
| 438 |
} |
| 439 |
|
| 440 |
// TaxonomyIterator manages a stream of *datacatalogpb.Taxonomy. |
| 441 |
type TaxonomyIterator struct { |
| 442 |
items []*datacatalogpb.Taxonomy |
| 443 |
pageInfo *iterator.PageInfo |
| 444 |
nextFunc func() error |
| 445 |
|
| 446 |
// Response is the raw response for the current page. |
| 447 |
// It must be cast to the RPC response type. |
| 448 |
// Calling Next() or InternalFetch() updates this value. |
| 449 |
Response interface{} |
| 450 |
|
| 451 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 452 |
// It is not part of the stable interface of this package. |
| 453 |
// |
| 454 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 455 |
// The number of results is no greater than pageSize. |
| 456 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 457 |
InternalFetch func(pageSize int, pageToken string) (results []*datacatalogpb.Taxonomy, nextPageToken string, err error) |
| 458 |
} |
| 459 |
|
| 460 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 461 |
func (it *TaxonomyIterator) PageInfo() *iterator.PageInfo { |
| 462 |
return it.pageInfo |
| 463 |
} |
| 464 |
|
| 465 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 466 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 467 |
func (it *TaxonomyIterator) Next() (*datacatalogpb.Taxonomy, error) { |
| 468 |
var item *datacatalogpb.Taxonomy |
| 469 |
if err := it.nextFunc(); err != nil { |
| 470 |
return item, err |
| 471 |
} |
| 472 |
item = it.items[0] |
| 473 |
it.items = it.items[1:] |
| 474 |
return item, nil |
| 475 |
} |
| 476 |
|
| 477 |
func (it *TaxonomyIterator) bufLen() int { |
| 478 |
return len(it.items) |
| 479 |
} |
| 480 |
|
| 481 |
func (it *TaxonomyIterator) takeBuf() interface{} { |
| 482 |
b := it.items |
| 483 |
it.items = nil |
| 484 |
return b |
| 485 |
} |