...

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

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

     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/apiv1/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  // BatchDeleteVersionsOperation manages a long-running operation from BatchDeleteVersions.
    31  type BatchDeleteVersionsOperation 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 *BatchDeleteVersionsOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
    40  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
    41  	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
    42  }
    43  
    44  // Poll fetches the latest state of the long-running operation.
    45  //
    46  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
    47  //
    48  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
    49  // the operation has completed with failure, the error is returned and op.Done will return true.
    50  // If Poll succeeds and the operation has completed successfully,
    51  // op.Done will return true, and the response of the operation is returned.
    52  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
    53  func (op *BatchDeleteVersionsOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
    54  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
    55  	return op.lro.Poll(ctx, nil, opts...)
    56  }
    57  
    58  // Metadata returns metadata associated with the long-running operation.
    59  // Metadata itself does not contact the server, but Poll does.
    60  // To get the latest metadata, call this method after a successful call to Poll.
    61  // If the metadata is not available, the returned metadata and error are both nil.
    62  func (op *BatchDeleteVersionsOperation) Metadata() (*artifactregistrypb.BatchDeleteVersionsMetadata, error) {
    63  	var meta artifactregistrypb.BatchDeleteVersionsMetadata
    64  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
    65  		return nil, nil
    66  	} else if err != nil {
    67  		return nil, err
    68  	}
    69  	return &meta, nil
    70  }
    71  
    72  // Done reports whether the long-running operation has completed.
    73  func (op *BatchDeleteVersionsOperation) Done() bool {
    74  	return op.lro.Done()
    75  }
    76  
    77  // Name returns the name of the long-running operation.
    78  // The name is assigned by the server and is unique within the service from which the operation is created.
    79  func (op *BatchDeleteVersionsOperation) Name() string {
    80  	return op.lro.Name()
    81  }
    82  
    83  // CreateRepositoryOperation manages a long-running operation from CreateRepository.
    84  type CreateRepositoryOperation struct {
    85  	lro      *longrunning.Operation
    86  	pollPath string
    87  }
    88  
    89  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
    90  //
    91  // See documentation of Poll for error-handling information.
    92  func (op *CreateRepositoryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
    93  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
    94  	var resp artifactregistrypb.Repository
    95  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
    96  		return nil, err
    97  	}
    98  	return &resp, nil
    99  }
   100  
   101  // Poll fetches the latest state of the long-running operation.
   102  //
   103  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   104  //
   105  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   106  // the operation has completed with failure, the error is returned and op.Done will return true.
   107  // If Poll succeeds and the operation has completed successfully,
   108  // op.Done will return true, and the response of the operation is returned.
   109  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   110  func (op *CreateRepositoryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
   111  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   112  	var resp artifactregistrypb.Repository
   113  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   114  		return nil, err
   115  	}
   116  	if !op.Done() {
   117  		return nil, nil
   118  	}
   119  	return &resp, nil
   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 *CreateRepositoryOperation) 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 *CreateRepositoryOperation) 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 *CreateRepositoryOperation) Name() string {
   144  	return op.lro.Name()
   145  }
   146  
   147  // DeletePackageOperation manages a long-running operation from DeletePackage.
   148  type DeletePackageOperation 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 *DeletePackageOperation) 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 *DeletePackageOperation) 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 *DeletePackageOperation) 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 *DeletePackageOperation) 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 *DeletePackageOperation) Name() string {
   197  	return op.lro.Name()
   198  }
   199  
   200  // DeleteRepositoryOperation manages a long-running operation from DeleteRepository.
   201  type DeleteRepositoryOperation 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 *DeleteRepositoryOperation) 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 *DeleteRepositoryOperation) 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 *DeleteRepositoryOperation) 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 *DeleteRepositoryOperation) 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 *DeleteRepositoryOperation) Name() string {
   250  	return op.lro.Name()
   251  }
   252  
   253  // DeleteVersionOperation manages a long-running operation from DeleteVersion.
   254  type DeleteVersionOperation 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 *DeleteVersionOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
   263  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   264  	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
   265  }
   266  
   267  // Poll fetches the latest state of the long-running operation.
   268  //
   269  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   270  //
   271  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   272  // the operation has completed with failure, the error is returned and op.Done will return true.
   273  // If Poll succeeds and the operation has completed successfully,
   274  // op.Done will return true, and the response of the operation is returned.
   275  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   276  func (op *DeleteVersionOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
   277  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   278  	return op.lro.Poll(ctx, nil, opts...)
   279  }
   280  
   281  // Metadata returns metadata associated with the long-running operation.
   282  // Metadata itself does not contact the server, but Poll does.
   283  // To get the latest metadata, call this method after a successful call to Poll.
   284  // If the metadata is not available, the returned metadata and error are both nil.
   285  func (op *DeleteVersionOperation) Metadata() (*artifactregistrypb.OperationMetadata, error) {
   286  	var meta artifactregistrypb.OperationMetadata
   287  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   288  		return nil, nil
   289  	} else if err != nil {
   290  		return nil, err
   291  	}
   292  	return &meta, nil
   293  }
   294  
   295  // Done reports whether the long-running operation has completed.
   296  func (op *DeleteVersionOperation) Done() bool {
   297  	return op.lro.Done()
   298  }
   299  
   300  // Name returns the name of the long-running operation.
   301  // The name is assigned by the server and is unique within the service from which the operation is created.
   302  func (op *DeleteVersionOperation) Name() string {
   303  	return op.lro.Name()
   304  }
   305  
   306  // ImportAptArtifactsOperation manages a long-running operation from ImportAptArtifacts.
   307  type ImportAptArtifactsOperation struct {
   308  	lro      *longrunning.Operation
   309  	pollPath string
   310  }
   311  
   312  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   313  //
   314  // See documentation of Poll for error-handling information.
   315  func (op *ImportAptArtifactsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportAptArtifactsResponse, error) {
   316  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   317  	var resp artifactregistrypb.ImportAptArtifactsResponse
   318  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   319  		return nil, err
   320  	}
   321  	return &resp, nil
   322  }
   323  
   324  // Poll fetches the latest state of the long-running operation.
   325  //
   326  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   327  //
   328  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   329  // the operation has completed with failure, the error is returned and op.Done will return true.
   330  // If Poll succeeds and the operation has completed successfully,
   331  // op.Done will return true, and the response of the operation is returned.
   332  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   333  func (op *ImportAptArtifactsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportAptArtifactsResponse, error) {
   334  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   335  	var resp artifactregistrypb.ImportAptArtifactsResponse
   336  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   337  		return nil, err
   338  	}
   339  	if !op.Done() {
   340  		return nil, nil
   341  	}
   342  	return &resp, nil
   343  }
   344  
   345  // Metadata returns metadata associated with the long-running operation.
   346  // Metadata itself does not contact the server, but Poll does.
   347  // To get the latest metadata, call this method after a successful call to Poll.
   348  // If the metadata is not available, the returned metadata and error are both nil.
   349  func (op *ImportAptArtifactsOperation) Metadata() (*artifactregistrypb.ImportAptArtifactsMetadata, error) {
   350  	var meta artifactregistrypb.ImportAptArtifactsMetadata
   351  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   352  		return nil, nil
   353  	} else if err != nil {
   354  		return nil, err
   355  	}
   356  	return &meta, nil
   357  }
   358  
   359  // Done reports whether the long-running operation has completed.
   360  func (op *ImportAptArtifactsOperation) Done() bool {
   361  	return op.lro.Done()
   362  }
   363  
   364  // Name returns the name of the long-running operation.
   365  // The name is assigned by the server and is unique within the service from which the operation is created.
   366  func (op *ImportAptArtifactsOperation) Name() string {
   367  	return op.lro.Name()
   368  }
   369  
   370  // ImportYumArtifactsOperation manages a long-running operation from ImportYumArtifacts.
   371  type ImportYumArtifactsOperation struct {
   372  	lro      *longrunning.Operation
   373  	pollPath string
   374  }
   375  
   376  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   377  //
   378  // See documentation of Poll for error-handling information.
   379  func (op *ImportYumArtifactsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportYumArtifactsResponse, error) {
   380  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   381  	var resp artifactregistrypb.ImportYumArtifactsResponse
   382  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   383  		return nil, err
   384  	}
   385  	return &resp, nil
   386  }
   387  
   388  // Poll fetches the latest state of the long-running operation.
   389  //
   390  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   391  //
   392  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   393  // the operation has completed with failure, the error is returned and op.Done will return true.
   394  // If Poll succeeds and the operation has completed successfully,
   395  // op.Done will return true, and the response of the operation is returned.
   396  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   397  func (op *ImportYumArtifactsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportYumArtifactsResponse, error) {
   398  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   399  	var resp artifactregistrypb.ImportYumArtifactsResponse
   400  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   401  		return nil, err
   402  	}
   403  	if !op.Done() {
   404  		return nil, nil
   405  	}
   406  	return &resp, nil
   407  }
   408  
   409  // Metadata returns metadata associated with the long-running operation.
   410  // Metadata itself does not contact the server, but Poll does.
   411  // To get the latest metadata, call this method after a successful call to Poll.
   412  // If the metadata is not available, the returned metadata and error are both nil.
   413  func (op *ImportYumArtifactsOperation) Metadata() (*artifactregistrypb.ImportYumArtifactsMetadata, error) {
   414  	var meta artifactregistrypb.ImportYumArtifactsMetadata
   415  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   416  		return nil, nil
   417  	} else if err != nil {
   418  		return nil, err
   419  	}
   420  	return &meta, nil
   421  }
   422  
   423  // Done reports whether the long-running operation has completed.
   424  func (op *ImportYumArtifactsOperation) Done() bool {
   425  	return op.lro.Done()
   426  }
   427  
   428  // Name returns the name of the long-running operation.
   429  // The name is assigned by the server and is unique within the service from which the operation is created.
   430  func (op *ImportYumArtifactsOperation) Name() string {
   431  	return op.lro.Name()
   432  }
   433  
   434  // DockerImageIterator manages a stream of *artifactregistrypb.DockerImage.
   435  type DockerImageIterator struct {
   436  	items    []*artifactregistrypb.DockerImage
   437  	pageInfo *iterator.PageInfo
   438  	nextFunc func() error
   439  
   440  	// Response is the raw response for the current page.
   441  	// It must be cast to the RPC response type.
   442  	// Calling Next() or InternalFetch() updates this value.
   443  	Response interface{}
   444  
   445  	// InternalFetch is for use by the Google Cloud Libraries only.
   446  	// It is not part of the stable interface of this package.
   447  	//
   448  	// InternalFetch returns results from a single call to the underlying RPC.
   449  	// The number of results is no greater than pageSize.
   450  	// If there are no more results, nextPageToken is empty and err is nil.
   451  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.DockerImage, nextPageToken string, err error)
   452  }
   453  
   454  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   455  func (it *DockerImageIterator) PageInfo() *iterator.PageInfo {
   456  	return it.pageInfo
   457  }
   458  
   459  // Next returns the next result. Its second return value is iterator.Done if there are no more
   460  // results. Once Next returns Done, all subsequent calls will return Done.
   461  func (it *DockerImageIterator) Next() (*artifactregistrypb.DockerImage, error) {
   462  	var item *artifactregistrypb.DockerImage
   463  	if err := it.nextFunc(); err != nil {
   464  		return item, err
   465  	}
   466  	item = it.items[0]
   467  	it.items = it.items[1:]
   468  	return item, nil
   469  }
   470  
   471  func (it *DockerImageIterator) bufLen() int {
   472  	return len(it.items)
   473  }
   474  
   475  func (it *DockerImageIterator) takeBuf() interface{} {
   476  	b := it.items
   477  	it.items = nil
   478  	return b
   479  }
   480  
   481  // FileIterator manages a stream of *artifactregistrypb.File.
   482  type FileIterator struct {
   483  	items    []*artifactregistrypb.File
   484  	pageInfo *iterator.PageInfo
   485  	nextFunc func() error
   486  
   487  	// Response is the raw response for the current page.
   488  	// It must be cast to the RPC response type.
   489  	// Calling Next() or InternalFetch() updates this value.
   490  	Response interface{}
   491  
   492  	// InternalFetch is for use by the Google Cloud Libraries only.
   493  	// It is not part of the stable interface of this package.
   494  	//
   495  	// InternalFetch returns results from a single call to the underlying RPC.
   496  	// The number of results is no greater than pageSize.
   497  	// If there are no more results, nextPageToken is empty and err is nil.
   498  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.File, nextPageToken string, err error)
   499  }
   500  
   501  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   502  func (it *FileIterator) PageInfo() *iterator.PageInfo {
   503  	return it.pageInfo
   504  }
   505  
   506  // Next returns the next result. Its second return value is iterator.Done if there are no more
   507  // results. Once Next returns Done, all subsequent calls will return Done.
   508  func (it *FileIterator) Next() (*artifactregistrypb.File, error) {
   509  	var item *artifactregistrypb.File
   510  	if err := it.nextFunc(); err != nil {
   511  		return item, err
   512  	}
   513  	item = it.items[0]
   514  	it.items = it.items[1:]
   515  	return item, nil
   516  }
   517  
   518  func (it *FileIterator) bufLen() int {
   519  	return len(it.items)
   520  }
   521  
   522  func (it *FileIterator) takeBuf() interface{} {
   523  	b := it.items
   524  	it.items = nil
   525  	return b
   526  }
   527  
   528  // LocationIterator manages a stream of *locationpb.Location.
   529  type LocationIterator struct {
   530  	items    []*locationpb.Location
   531  	pageInfo *iterator.PageInfo
   532  	nextFunc func() error
   533  
   534  	// Response is the raw response for the current page.
   535  	// It must be cast to the RPC response type.
   536  	// Calling Next() or InternalFetch() updates this value.
   537  	Response interface{}
   538  
   539  	// InternalFetch is for use by the Google Cloud Libraries only.
   540  	// It is not part of the stable interface of this package.
   541  	//
   542  	// InternalFetch returns results from a single call to the underlying RPC.
   543  	// The number of results is no greater than pageSize.
   544  	// If there are no more results, nextPageToken is empty and err is nil.
   545  	InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error)
   546  }
   547  
   548  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   549  func (it *LocationIterator) PageInfo() *iterator.PageInfo {
   550  	return it.pageInfo
   551  }
   552  
   553  // Next returns the next result. Its second return value is iterator.Done if there are no more
   554  // results. Once Next returns Done, all subsequent calls will return Done.
   555  func (it *LocationIterator) Next() (*locationpb.Location, error) {
   556  	var item *locationpb.Location
   557  	if err := it.nextFunc(); err != nil {
   558  		return item, err
   559  	}
   560  	item = it.items[0]
   561  	it.items = it.items[1:]
   562  	return item, nil
   563  }
   564  
   565  func (it *LocationIterator) bufLen() int {
   566  	return len(it.items)
   567  }
   568  
   569  func (it *LocationIterator) takeBuf() interface{} {
   570  	b := it.items
   571  	it.items = nil
   572  	return b
   573  }
   574  
   575  // MavenArtifactIterator manages a stream of *artifactregistrypb.MavenArtifact.
   576  type MavenArtifactIterator struct {
   577  	items    []*artifactregistrypb.MavenArtifact
   578  	pageInfo *iterator.PageInfo
   579  	nextFunc func() error
   580  
   581  	// Response is the raw response for the current page.
   582  	// It must be cast to the RPC response type.
   583  	// Calling Next() or InternalFetch() updates this value.
   584  	Response interface{}
   585  
   586  	// InternalFetch is for use by the Google Cloud Libraries only.
   587  	// It is not part of the stable interface of this package.
   588  	//
   589  	// InternalFetch returns results from a single call to the underlying RPC.
   590  	// The number of results is no greater than pageSize.
   591  	// If there are no more results, nextPageToken is empty and err is nil.
   592  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.MavenArtifact, nextPageToken string, err error)
   593  }
   594  
   595  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   596  func (it *MavenArtifactIterator) PageInfo() *iterator.PageInfo {
   597  	return it.pageInfo
   598  }
   599  
   600  // Next returns the next result. Its second return value is iterator.Done if there are no more
   601  // results. Once Next returns Done, all subsequent calls will return Done.
   602  func (it *MavenArtifactIterator) Next() (*artifactregistrypb.MavenArtifact, error) {
   603  	var item *artifactregistrypb.MavenArtifact
   604  	if err := it.nextFunc(); err != nil {
   605  		return item, err
   606  	}
   607  	item = it.items[0]
   608  	it.items = it.items[1:]
   609  	return item, nil
   610  }
   611  
   612  func (it *MavenArtifactIterator) bufLen() int {
   613  	return len(it.items)
   614  }
   615  
   616  func (it *MavenArtifactIterator) takeBuf() interface{} {
   617  	b := it.items
   618  	it.items = nil
   619  	return b
   620  }
   621  
   622  // NpmPackageIterator manages a stream of *artifactregistrypb.NpmPackage.
   623  type NpmPackageIterator struct {
   624  	items    []*artifactregistrypb.NpmPackage
   625  	pageInfo *iterator.PageInfo
   626  	nextFunc func() error
   627  
   628  	// Response is the raw response for the current page.
   629  	// It must be cast to the RPC response type.
   630  	// Calling Next() or InternalFetch() updates this value.
   631  	Response interface{}
   632  
   633  	// InternalFetch is for use by the Google Cloud Libraries only.
   634  	// It is not part of the stable interface of this package.
   635  	//
   636  	// InternalFetch returns results from a single call to the underlying RPC.
   637  	// The number of results is no greater than pageSize.
   638  	// If there are no more results, nextPageToken is empty and err is nil.
   639  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.NpmPackage, nextPageToken string, err error)
   640  }
   641  
   642  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   643  func (it *NpmPackageIterator) PageInfo() *iterator.PageInfo {
   644  	return it.pageInfo
   645  }
   646  
   647  // Next returns the next result. Its second return value is iterator.Done if there are no more
   648  // results. Once Next returns Done, all subsequent calls will return Done.
   649  func (it *NpmPackageIterator) Next() (*artifactregistrypb.NpmPackage, error) {
   650  	var item *artifactregistrypb.NpmPackage
   651  	if err := it.nextFunc(); err != nil {
   652  		return item, err
   653  	}
   654  	item = it.items[0]
   655  	it.items = it.items[1:]
   656  	return item, nil
   657  }
   658  
   659  func (it *NpmPackageIterator) bufLen() int {
   660  	return len(it.items)
   661  }
   662  
   663  func (it *NpmPackageIterator) takeBuf() interface{} {
   664  	b := it.items
   665  	it.items = nil
   666  	return b
   667  }
   668  
   669  // PackageIterator manages a stream of *artifactregistrypb.Package.
   670  type PackageIterator struct {
   671  	items    []*artifactregistrypb.Package
   672  	pageInfo *iterator.PageInfo
   673  	nextFunc func() error
   674  
   675  	// Response is the raw response for the current page.
   676  	// It must be cast to the RPC response type.
   677  	// Calling Next() or InternalFetch() updates this value.
   678  	Response interface{}
   679  
   680  	// InternalFetch is for use by the Google Cloud Libraries only.
   681  	// It is not part of the stable interface of this package.
   682  	//
   683  	// InternalFetch returns results from a single call to the underlying RPC.
   684  	// The number of results is no greater than pageSize.
   685  	// If there are no more results, nextPageToken is empty and err is nil.
   686  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Package, nextPageToken string, err error)
   687  }
   688  
   689  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   690  func (it *PackageIterator) PageInfo() *iterator.PageInfo {
   691  	return it.pageInfo
   692  }
   693  
   694  // Next returns the next result. Its second return value is iterator.Done if there are no more
   695  // results. Once Next returns Done, all subsequent calls will return Done.
   696  func (it *PackageIterator) Next() (*artifactregistrypb.Package, error) {
   697  	var item *artifactregistrypb.Package
   698  	if err := it.nextFunc(); err != nil {
   699  		return item, err
   700  	}
   701  	item = it.items[0]
   702  	it.items = it.items[1:]
   703  	return item, nil
   704  }
   705  
   706  func (it *PackageIterator) bufLen() int {
   707  	return len(it.items)
   708  }
   709  
   710  func (it *PackageIterator) takeBuf() interface{} {
   711  	b := it.items
   712  	it.items = nil
   713  	return b
   714  }
   715  
   716  // PythonPackageIterator manages a stream of *artifactregistrypb.PythonPackage.
   717  type PythonPackageIterator struct {
   718  	items    []*artifactregistrypb.PythonPackage
   719  	pageInfo *iterator.PageInfo
   720  	nextFunc func() error
   721  
   722  	// Response is the raw response for the current page.
   723  	// It must be cast to the RPC response type.
   724  	// Calling Next() or InternalFetch() updates this value.
   725  	Response interface{}
   726  
   727  	// InternalFetch is for use by the Google Cloud Libraries only.
   728  	// It is not part of the stable interface of this package.
   729  	//
   730  	// InternalFetch returns results from a single call to the underlying RPC.
   731  	// The number of results is no greater than pageSize.
   732  	// If there are no more results, nextPageToken is empty and err is nil.
   733  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.PythonPackage, nextPageToken string, err error)
   734  }
   735  
   736  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   737  func (it *PythonPackageIterator) PageInfo() *iterator.PageInfo {
   738  	return it.pageInfo
   739  }
   740  
   741  // Next returns the next result. Its second return value is iterator.Done if there are no more
   742  // results. Once Next returns Done, all subsequent calls will return Done.
   743  func (it *PythonPackageIterator) Next() (*artifactregistrypb.PythonPackage, error) {
   744  	var item *artifactregistrypb.PythonPackage
   745  	if err := it.nextFunc(); err != nil {
   746  		return item, err
   747  	}
   748  	item = it.items[0]
   749  	it.items = it.items[1:]
   750  	return item, nil
   751  }
   752  
   753  func (it *PythonPackageIterator) bufLen() int {
   754  	return len(it.items)
   755  }
   756  
   757  func (it *PythonPackageIterator) takeBuf() interface{} {
   758  	b := it.items
   759  	it.items = nil
   760  	return b
   761  }
   762  
   763  // RepositoryIterator manages a stream of *artifactregistrypb.Repository.
   764  type RepositoryIterator struct {
   765  	items    []*artifactregistrypb.Repository
   766  	pageInfo *iterator.PageInfo
   767  	nextFunc func() error
   768  
   769  	// Response is the raw response for the current page.
   770  	// It must be cast to the RPC response type.
   771  	// Calling Next() or InternalFetch() updates this value.
   772  	Response interface{}
   773  
   774  	// InternalFetch is for use by the Google Cloud Libraries only.
   775  	// It is not part of the stable interface of this package.
   776  	//
   777  	// InternalFetch returns results from a single call to the underlying RPC.
   778  	// The number of results is no greater than pageSize.
   779  	// If there are no more results, nextPageToken is empty and err is nil.
   780  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Repository, nextPageToken string, err error)
   781  }
   782  
   783  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   784  func (it *RepositoryIterator) PageInfo() *iterator.PageInfo {
   785  	return it.pageInfo
   786  }
   787  
   788  // Next returns the next result. Its second return value is iterator.Done if there are no more
   789  // results. Once Next returns Done, all subsequent calls will return Done.
   790  func (it *RepositoryIterator) Next() (*artifactregistrypb.Repository, error) {
   791  	var item *artifactregistrypb.Repository
   792  	if err := it.nextFunc(); err != nil {
   793  		return item, err
   794  	}
   795  	item = it.items[0]
   796  	it.items = it.items[1:]
   797  	return item, nil
   798  }
   799  
   800  func (it *RepositoryIterator) bufLen() int {
   801  	return len(it.items)
   802  }
   803  
   804  func (it *RepositoryIterator) takeBuf() interface{} {
   805  	b := it.items
   806  	it.items = nil
   807  	return b
   808  }
   809  
   810  // TagIterator manages a stream of *artifactregistrypb.Tag.
   811  type TagIterator struct {
   812  	items    []*artifactregistrypb.Tag
   813  	pageInfo *iterator.PageInfo
   814  	nextFunc func() error
   815  
   816  	// Response is the raw response for the current page.
   817  	// It must be cast to the RPC response type.
   818  	// Calling Next() or InternalFetch() updates this value.
   819  	Response interface{}
   820  
   821  	// InternalFetch is for use by the Google Cloud Libraries only.
   822  	// It is not part of the stable interface of this package.
   823  	//
   824  	// InternalFetch returns results from a single call to the underlying RPC.
   825  	// The number of results is no greater than pageSize.
   826  	// If there are no more results, nextPageToken is empty and err is nil.
   827  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Tag, nextPageToken string, err error)
   828  }
   829  
   830  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   831  func (it *TagIterator) PageInfo() *iterator.PageInfo {
   832  	return it.pageInfo
   833  }
   834  
   835  // Next returns the next result. Its second return value is iterator.Done if there are no more
   836  // results. Once Next returns Done, all subsequent calls will return Done.
   837  func (it *TagIterator) Next() (*artifactregistrypb.Tag, error) {
   838  	var item *artifactregistrypb.Tag
   839  	if err := it.nextFunc(); err != nil {
   840  		return item, err
   841  	}
   842  	item = it.items[0]
   843  	it.items = it.items[1:]
   844  	return item, nil
   845  }
   846  
   847  func (it *TagIterator) bufLen() int {
   848  	return len(it.items)
   849  }
   850  
   851  func (it *TagIterator) takeBuf() interface{} {
   852  	b := it.items
   853  	it.items = nil
   854  	return b
   855  }
   856  
   857  // VersionIterator manages a stream of *artifactregistrypb.Version.
   858  type VersionIterator struct {
   859  	items    []*artifactregistrypb.Version
   860  	pageInfo *iterator.PageInfo
   861  	nextFunc func() error
   862  
   863  	// Response is the raw response for the current page.
   864  	// It must be cast to the RPC response type.
   865  	// Calling Next() or InternalFetch() updates this value.
   866  	Response interface{}
   867  
   868  	// InternalFetch is for use by the Google Cloud Libraries only.
   869  	// It is not part of the stable interface of this package.
   870  	//
   871  	// InternalFetch returns results from a single call to the underlying RPC.
   872  	// The number of results is no greater than pageSize.
   873  	// If there are no more results, nextPageToken is empty and err is nil.
   874  	InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Version, nextPageToken string, err error)
   875  }
   876  
   877  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   878  func (it *VersionIterator) PageInfo() *iterator.PageInfo {
   879  	return it.pageInfo
   880  }
   881  
   882  // Next returns the next result. Its second return value is iterator.Done if there are no more
   883  // results. Once Next returns Done, all subsequent calls will return Done.
   884  func (it *VersionIterator) Next() (*artifactregistrypb.Version, error) {
   885  	var item *artifactregistrypb.Version
   886  	if err := it.nextFunc(); err != nil {
   887  		return item, err
   888  	}
   889  	item = it.items[0]
   890  	it.items = it.items[1:]
   891  	return item, nil
   892  }
   893  
   894  func (it *VersionIterator) bufLen() int {
   895  	return len(it.items)
   896  }
   897  
   898  func (it *VersionIterator) takeBuf() interface{} {
   899  	b := it.items
   900  	it.items = nil
   901  	return b
   902  }
   903  

View as plain text