...

Source file src/cloud.google.com/go/artifactregistry/apiv1beta2/auxiliary.go

Documentation: cloud.google.com/go/artifactregistry/apiv1beta2

     1  // Copyright 2024 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 artifactregistry
    18  
    19  import (
    20  	"context"
    21  	"time"
    22  
    23  	artifactregistrypb "cloud.google.com/go/artifactregistry/apiv1beta2/artifactregistrypb"
    24  	"cloud.google.com/go/longrunning"
    25  	gax "github.com/googleapis/gax-go/v2"
    26  	"google.golang.org/api/iterator"
    27  	locationpb "google.golang.org/genproto/googleapis/cloud/location"
    28  )
    29  
    30  // CreateRepositoryOperation manages a long-running operation from CreateRepository.
    31  type CreateRepositoryOperation 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 *CreateRepositoryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
    40  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
    41  	var resp artifactregistrypb.Repository
    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 *CreateRepositoryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
    58  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
    59  	var resp artifactregistrypb.Repository
    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 *CreateRepositoryOperation) Metadata() (*artifactregistrypb.OperationMetadata, error) {
    74  	var meta artifactregistrypb.OperationMetadata
    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 *CreateRepositoryOperation) 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 *CreateRepositoryOperation) Name() string {
    91  	return op.lro.Name()
    92  }
    93  
    94  // DeletePackageOperation manages a long-running operation from DeletePackage.
    95  type DeletePackageOperation 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 *DeletePackageOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
   104  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   105  	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
   106  }
   107  
   108  // Poll fetches the latest state of the long-running operation.
   109  //
   110  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   111  //
   112  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   113  // the operation has completed with failure, the error is returned and op.Done will return true.
   114  // If Poll succeeds and the operation has completed successfully,
   115  // op.Done will return true, and the response of the operation is returned.
   116  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   117  func (op *DeletePackageOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
   118  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   119  	return op.lro.Poll(ctx, nil, opts...)
   120  }
   121  
   122  // Metadata returns metadata associated with the long-running operation.
   123  // Metadata itself does not contact the server, but Poll does.
   124  // To get the latest metadata, call this method after a successful call to Poll.
   125  // If the metadata is not available, the returned metadata and error are both nil.
   126  func (op *DeletePackageOperation) Metadata() (*artifactregistrypb.OperationMetadata, error) {
   127  	var meta artifactregistrypb.OperationMetadata
   128  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   129  		return nil, nil
   130  	} else if err != nil {
   131  		return nil, err
   132  	}
   133  	return &meta, nil
   134  }
   135  
   136  // Done reports whether the long-running operation has completed.
   137  func (op *DeletePackageOperation) Done() bool {
   138  	return op.lro.Done()
   139  }
   140  
   141  // Name returns the name of the long-running operation.
   142  // The name is assigned by the server and is unique within the service from which the operation is created.
   143  func (op *DeletePackageOperation) Name() string {
   144  	return op.lro.Name()
   145  }
   146  
   147  // DeleteRepositoryOperation manages a long-running operation from DeleteRepository.
   148  type DeleteRepositoryOperation struct {
   149  	lro      *longrunning.Operation
   150  	pollPath string
   151  }
   152  
   153  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   154  //
   155  // See documentation of Poll for error-handling information.
   156  func (op *DeleteRepositoryOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
   157  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   158  	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
   159  }
   160  
   161  // Poll fetches the latest state of the long-running operation.
   162  //
   163  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   164  //
   165  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   166  // the operation has completed with failure, the error is returned and op.Done will return true.
   167  // If Poll succeeds and the operation has completed successfully,
   168  // op.Done will return true, and the response of the operation is returned.
   169  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   170  func (op *DeleteRepositoryOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
   171  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   172  	return op.lro.Poll(ctx, nil, opts...)
   173  }
   174  
   175  // Metadata returns metadata associated with the long-running operation.
   176  // Metadata itself does not contact the server, but Poll does.
   177  // To get the latest metadata, call this method after a successful call to Poll.
   178  // If the metadata is not available, the returned metadata and error are both nil.
   179  func (op *DeleteRepositoryOperation) Metadata() (*artifactregistrypb.OperationMetadata, error) {
   180  	var meta artifactregistrypb.OperationMetadata
   181  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   182  		return nil, nil
   183  	} else if err != nil {
   184  		return nil, err
   185  	}
   186  	return &meta, nil
   187  }
   188  
   189  // Done reports whether the long-running operation has completed.
   190  func (op *DeleteRepositoryOperation) Done() bool {
   191  	return op.lro.Done()
   192  }
   193  
   194  // Name returns the name of the long-running operation.
   195  // The name is assigned by the server and is unique within the service from which the operation is created.
   196  func (op *DeleteRepositoryOperation) Name() string {
   197  	return op.lro.Name()
   198  }
   199  
   200  // DeleteVersionOperation manages a long-running operation from DeleteVersion.
   201  type DeleteVersionOperation struct {
   202  	lro      *longrunning.Operation
   203  	pollPath string
   204  }
   205  
   206  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   207  //
   208  // See documentation of Poll for error-handling information.
   209  func (op *DeleteVersionOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
   210  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   211  	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
   212  }
   213  
   214  // Poll fetches the latest state of the long-running operation.
   215  //
   216  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   217  //
   218  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   219  // the operation has completed with failure, the error is returned and op.Done will return true.
   220  // If Poll succeeds and the operation has completed successfully,
   221  // op.Done will return true, and the response of the operation is returned.
   222  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   223  func (op *DeleteVersionOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
   224  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   225  	return op.lro.Poll(ctx, nil, opts...)
   226  }
   227  
   228  // Metadata returns metadata associated with the long-running operation.
   229  // Metadata itself does not contact the server, but Poll does.
   230  // To get the latest metadata, call this method after a successful call to Poll.
   231  // If the metadata is not available, the returned metadata and error are both nil.
   232  func (op *DeleteVersionOperation) Metadata() (*artifactregistrypb.OperationMetadata, error) {
   233  	var meta artifactregistrypb.OperationMetadata
   234  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   235  		return nil, nil
   236  	} else if err != nil {
   237  		return nil, err
   238  	}
   239  	return &meta, nil
   240  }
   241  
   242  // Done reports whether the long-running operation has completed.
   243  func (op *DeleteVersionOperation) Done() bool {
   244  	return op.lro.Done()
   245  }
   246  
   247  // Name returns the name of the long-running operation.
   248  // The name is assigned by the server and is unique within the service from which the operation is created.
   249  func (op *DeleteVersionOperation) Name() string {
   250  	return op.lro.Name()
   251  }
   252  
   253  // ImportAptArtifactsOperation manages a long-running operation from ImportAptArtifacts.
   254  type ImportAptArtifactsOperation struct {
   255  	lro      *longrunning.Operation
   256  	pollPath string
   257  }
   258  
   259  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   260  //
   261  // See documentation of Poll for error-handling information.
   262  func (op *ImportAptArtifactsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportAptArtifactsResponse, error) {
   263  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   264  	var resp artifactregistrypb.ImportAptArtifactsResponse
   265  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   266  		return nil, err
   267  	}
   268  	return &resp, nil
   269  }
   270  
   271  // Poll fetches the latest state of the long-running operation.
   272  //
   273  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   274  //
   275  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   276  // the operation has completed with failure, the error is returned and op.Done will return true.
   277  // If Poll succeeds and the operation has completed successfully,
   278  // op.Done will return true, and the response of the operation is returned.
   279  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   280  func (op *ImportAptArtifactsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportAptArtifactsResponse, error) {
   281  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   282  	var resp artifactregistrypb.ImportAptArtifactsResponse
   283  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   284  		return nil, err
   285  	}
   286  	if !op.Done() {
   287  		return nil, nil
   288  	}
   289  	return &resp, nil
   290  }
   291  
   292  // Metadata returns metadata associated with the long-running operation.
   293  // Metadata itself does not contact the server, but Poll does.
   294  // To get the latest metadata, call this method after a successful call to Poll.
   295  // If the metadata is not available, the returned metadata and error are both nil.
   296  func (op *ImportAptArtifactsOperation) Metadata() (*artifactregistrypb.ImportAptArtifactsMetadata, error) {
   297  	var meta artifactregistrypb.ImportAptArtifactsMetadata
   298  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   299  		return nil, nil
   300  	} else if err != nil {
   301  		return nil, err
   302  	}
   303  	return &meta, nil
   304  }
   305  
   306  // Done reports whether the long-running operation has completed.
   307  func (op *ImportAptArtifactsOperation) Done() bool {
   308  	return op.lro.Done()
   309  }
   310  
   311  // Name returns the name of the long-running operation.
   312  // The name is assigned by the server and is unique within the service from which the operation is created.
   313  func (op *ImportAptArtifactsOperation) Name() string {
   314  	return op.lro.Name()
   315  }
   316  
   317  // ImportYumArtifactsOperation manages a long-running operation from ImportYumArtifacts.
   318  type ImportYumArtifactsOperation struct {
   319  	lro      *longrunning.Operation
   320  	pollPath string
   321  }
   322  
   323  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   324  //
   325  // See documentation of Poll for error-handling information.
   326  func (op *ImportYumArtifactsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportYumArtifactsResponse, error) {
   327  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   328  	var resp artifactregistrypb.ImportYumArtifactsResponse
   329  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   330  		return nil, err
   331  	}
   332  	return &resp, nil
   333  }
   334  
   335  // Poll fetches the latest state of the long-running operation.
   336  //
   337  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   338  //
   339  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   340  // the operation has completed with failure, the error is returned and op.Done will return true.
   341  // If Poll succeeds and the operation has completed successfully,
   342  // op.Done will return true, and the response of the operation is returned.
   343  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   344  func (op *ImportYumArtifactsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportYumArtifactsResponse, error) {
   345  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   346  	var resp artifactregistrypb.ImportYumArtifactsResponse
   347  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   348  		return nil, err
   349  	}
   350  	if !op.Done() {
   351  		return nil, nil
   352  	}
   353  	return &resp, nil
   354  }
   355  
   356  // Metadata returns metadata associated with the long-running operation.
   357  // Metadata itself does not contact the server, but Poll does.
   358  // To get the latest metadata, call this method after a successful call to Poll.
   359  // If the metadata is not available, the returned metadata and error are both nil.
   360  func (op *ImportYumArtifactsOperation) Metadata() (*artifactregistrypb.ImportYumArtifactsMetadata, error) {
   361  	var meta artifactregistrypb.ImportYumArtifactsMetadata
   362  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   363  		return nil, nil
   364  	} else if err != nil {
   365  		return nil, err
   366  	}
   367  	return &meta, nil
   368  }
   369  
   370  // Done reports whether the long-running operation has completed.
   371  func (op *ImportYumArtifactsOperation) Done() bool {
   372  	return op.lro.Done()
   373  }
   374  
   375  // Name returns the name of the long-running operation.
   376  // The name is assigned by the server and is unique within the service from which the operation is created.
   377  func (op *ImportYumArtifactsOperation) Name() string {
   378  	return op.lro.Name()
   379  }
   380  
   381  // FileIterator manages a stream of *artifactregistrypb.File.
   382  type FileIterator struct {
   383  	items    []*artifactregistrypb.File
   384  	pageInfo *iterator.PageInfo
   385  	nextFunc func() error
   386  
   387  	// Response is the raw response for the current page.
   388  	// It must be cast to the RPC response type.
   389  	// Calling Next() or InternalFetch() updates this value.
   390  	Response interface{}
   391  
   392  	// InternalFetch is for use by the Google Cloud Libraries only.
   393  	// It is not part of the stable interface of this package.
   394  	//
   395  	// InternalFetch returns results from a single call to the underlying RPC.
   396  	// The number of results is no greater than pageSize.
   397  	// If there are no more results, nextPageToken is empty and err is nil.
   398  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.File, nextPageToken string, err error)
   399  }
   400  
   401  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   402  func (it *FileIterator) PageInfo() *iterator.PageInfo {
   403  	return it.pageInfo
   404  }
   405  
   406  // Next returns the next result. Its second return value is iterator.Done if there are no more
   407  // results. Once Next returns Done, all subsequent calls will return Done.
   408  func (it *FileIterator) Next() (*artifactregistrypb.File, error) {
   409  	var item *artifactregistrypb.File
   410  	if err := it.nextFunc(); err != nil {
   411  		return item, err
   412  	}
   413  	item = it.items[0]
   414  	it.items = it.items[1:]
   415  	return item, nil
   416  }
   417  
   418  func (it *FileIterator) bufLen() int {
   419  	return len(it.items)
   420  }
   421  
   422  func (it *FileIterator) takeBuf() interface{} {
   423  	b := it.items
   424  	it.items = nil
   425  	return b
   426  }
   427  
   428  // LocationIterator manages a stream of *locationpb.Location.
   429  type LocationIterator struct {
   430  	items    []*locationpb.Location
   431  	pageInfo *iterator.PageInfo
   432  	nextFunc func() error
   433  
   434  	// Response is the raw response for the current page.
   435  	// It must be cast to the RPC response type.
   436  	// Calling Next() or InternalFetch() updates this value.
   437  	Response interface{}
   438  
   439  	// InternalFetch is for use by the Google Cloud Libraries only.
   440  	// It is not part of the stable interface of this package.
   441  	//
   442  	// InternalFetch returns results from a single call to the underlying RPC.
   443  	// The number of results is no greater than pageSize.
   444  	// If there are no more results, nextPageToken is empty and err is nil.
   445  	InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error)
   446  }
   447  
   448  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   449  func (it *LocationIterator) PageInfo() *iterator.PageInfo {
   450  	return it.pageInfo
   451  }
   452  
   453  // Next returns the next result. Its second return value is iterator.Done if there are no more
   454  // results. Once Next returns Done, all subsequent calls will return Done.
   455  func (it *LocationIterator) Next() (*locationpb.Location, error) {
   456  	var item *locationpb.Location
   457  	if err := it.nextFunc(); err != nil {
   458  		return item, err
   459  	}
   460  	item = it.items[0]
   461  	it.items = it.items[1:]
   462  	return item, nil
   463  }
   464  
   465  func (it *LocationIterator) bufLen() int {
   466  	return len(it.items)
   467  }
   468  
   469  func (it *LocationIterator) takeBuf() interface{} {
   470  	b := it.items
   471  	it.items = nil
   472  	return b
   473  }
   474  
   475  // PackageIterator manages a stream of *artifactregistrypb.Package.
   476  type PackageIterator struct {
   477  	items    []*artifactregistrypb.Package
   478  	pageInfo *iterator.PageInfo
   479  	nextFunc func() error
   480  
   481  	// Response is the raw response for the current page.
   482  	// It must be cast to the RPC response type.
   483  	// Calling Next() or InternalFetch() updates this value.
   484  	Response interface{}
   485  
   486  	// InternalFetch is for use by the Google Cloud Libraries only.
   487  	// It is not part of the stable interface of this package.
   488  	//
   489  	// InternalFetch returns results from a single call to the underlying RPC.
   490  	// The number of results is no greater than pageSize.
   491  	// If there are no more results, nextPageToken is empty and err is nil.
   492  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Package, nextPageToken string, err error)
   493  }
   494  
   495  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   496  func (it *PackageIterator) PageInfo() *iterator.PageInfo {
   497  	return it.pageInfo
   498  }
   499  
   500  // Next returns the next result. Its second return value is iterator.Done if there are no more
   501  // results. Once Next returns Done, all subsequent calls will return Done.
   502  func (it *PackageIterator) Next() (*artifactregistrypb.Package, error) {
   503  	var item *artifactregistrypb.Package
   504  	if err := it.nextFunc(); err != nil {
   505  		return item, err
   506  	}
   507  	item = it.items[0]
   508  	it.items = it.items[1:]
   509  	return item, nil
   510  }
   511  
   512  func (it *PackageIterator) bufLen() int {
   513  	return len(it.items)
   514  }
   515  
   516  func (it *PackageIterator) takeBuf() interface{} {
   517  	b := it.items
   518  	it.items = nil
   519  	return b
   520  }
   521  
   522  // RepositoryIterator manages a stream of *artifactregistrypb.Repository.
   523  type RepositoryIterator struct {
   524  	items    []*artifactregistrypb.Repository
   525  	pageInfo *iterator.PageInfo
   526  	nextFunc func() error
   527  
   528  	// Response is the raw response for the current page.
   529  	// It must be cast to the RPC response type.
   530  	// Calling Next() or InternalFetch() updates this value.
   531  	Response interface{}
   532  
   533  	// InternalFetch is for use by the Google Cloud Libraries only.
   534  	// It is not part of the stable interface of this package.
   535  	//
   536  	// InternalFetch returns results from a single call to the underlying RPC.
   537  	// The number of results is no greater than pageSize.
   538  	// If there are no more results, nextPageToken is empty and err is nil.
   539  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Repository, nextPageToken string, err error)
   540  }
   541  
   542  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   543  func (it *RepositoryIterator) PageInfo() *iterator.PageInfo {
   544  	return it.pageInfo
   545  }
   546  
   547  // Next returns the next result. Its second return value is iterator.Done if there are no more
   548  // results. Once Next returns Done, all subsequent calls will return Done.
   549  func (it *RepositoryIterator) Next() (*artifactregistrypb.Repository, error) {
   550  	var item *artifactregistrypb.Repository
   551  	if err := it.nextFunc(); err != nil {
   552  		return item, err
   553  	}
   554  	item = it.items[0]
   555  	it.items = it.items[1:]
   556  	return item, nil
   557  }
   558  
   559  func (it *RepositoryIterator) bufLen() int {
   560  	return len(it.items)
   561  }
   562  
   563  func (it *RepositoryIterator) takeBuf() interface{} {
   564  	b := it.items
   565  	it.items = nil
   566  	return b
   567  }
   568  
   569  // TagIterator manages a stream of *artifactregistrypb.Tag.
   570  type TagIterator struct {
   571  	items    []*artifactregistrypb.Tag
   572  	pageInfo *iterator.PageInfo
   573  	nextFunc func() error
   574  
   575  	// Response is the raw response for the current page.
   576  	// It must be cast to the RPC response type.
   577  	// Calling Next() or InternalFetch() updates this value.
   578  	Response interface{}
   579  
   580  	// InternalFetch is for use by the Google Cloud Libraries only.
   581  	// It is not part of the stable interface of this package.
   582  	//
   583  	// InternalFetch returns results from a single call to the underlying RPC.
   584  	// The number of results is no greater than pageSize.
   585  	// If there are no more results, nextPageToken is empty and err is nil.
   586  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Tag, nextPageToken string, err error)
   587  }
   588  
   589  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   590  func (it *TagIterator) PageInfo() *iterator.PageInfo {
   591  	return it.pageInfo
   592  }
   593  
   594  // Next returns the next result. Its second return value is iterator.Done if there are no more
   595  // results. Once Next returns Done, all subsequent calls will return Done.
   596  func (it *TagIterator) Next() (*artifactregistrypb.Tag, error) {
   597  	var item *artifactregistrypb.Tag
   598  	if err := it.nextFunc(); err != nil {
   599  		return item, err
   600  	}
   601  	item = it.items[0]
   602  	it.items = it.items[1:]
   603  	return item, nil
   604  }
   605  
   606  func (it *TagIterator) bufLen() int {
   607  	return len(it.items)
   608  }
   609  
   610  func (it *TagIterator) takeBuf() interface{} {
   611  	b := it.items
   612  	it.items = nil
   613  	return b
   614  }
   615  
   616  // VersionIterator manages a stream of *artifactregistrypb.Version.
   617  type VersionIterator struct {
   618  	items    []*artifactregistrypb.Version
   619  	pageInfo *iterator.PageInfo
   620  	nextFunc func() error
   621  
   622  	// Response is the raw response for the current page.
   623  	// It must be cast to the RPC response type.
   624  	// Calling Next() or InternalFetch() updates this value.
   625  	Response interface{}
   626  
   627  	// InternalFetch is for use by the Google Cloud Libraries only.
   628  	// It is not part of the stable interface of this package.
   629  	//
   630  	// InternalFetch returns results from a single call to the underlying RPC.
   631  	// The number of results is no greater than pageSize.
   632  	// If there are no more results, nextPageToken is empty and err is nil.
   633  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Version, nextPageToken string, err error)
   634  }
   635  
   636  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   637  func (it *VersionIterator) PageInfo() *iterator.PageInfo {
   638  	return it.pageInfo
   639  }
   640  
   641  // Next returns the next result. Its second return value is iterator.Done if there are no more
   642  // results. Once Next returns Done, all subsequent calls will return Done.
   643  func (it *VersionIterator) Next() (*artifactregistrypb.Version, error) {
   644  	var item *artifactregistrypb.Version
   645  	if err := it.nextFunc(); err != nil {
   646  		return item, err
   647  	}
   648  	item = it.items[0]
   649  	it.items = it.items[1:]
   650  	return item, nil
   651  }
   652  
   653  func (it *VersionIterator) bufLen() int {
   654  	return len(it.items)
   655  }
   656  
   657  func (it *VersionIterator) takeBuf() interface{} {
   658  	b := it.items
   659  	it.items = nil
   660  	return b
   661  }
   662  

View as plain text