...

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

Documentation: cloud.google.com/go/secretmanager/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 secretmanager
    18  
    19  import (
    20  	secretmanagerpb "cloud.google.com/go/secretmanager/apiv1beta2/secretmanagerpb"
    21  	"google.golang.org/api/iterator"
    22  	locationpb "google.golang.org/genproto/googleapis/cloud/location"
    23  )
    24  
    25  // LocationIterator manages a stream of *locationpb.Location.
    26  type LocationIterator struct {
    27  	items    []*locationpb.Location
    28  	pageInfo *iterator.PageInfo
    29  	nextFunc func() error
    30  
    31  	// Response is the raw response for the current page.
    32  	// It must be cast to the RPC response type.
    33  	// Calling Next() or InternalFetch() updates this value.
    34  	Response interface{}
    35  
    36  	// InternalFetch is for use by the Google Cloud Libraries only.
    37  	// It is not part of the stable interface of this package.
    38  	//
    39  	// InternalFetch returns results from a single call to the underlying RPC.
    40  	// The number of results is no greater than pageSize.
    41  	// If there are no more results, nextPageToken is empty and err is nil.
    42  	InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error)
    43  }
    44  
    45  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
    46  func (it *LocationIterator) PageInfo() *iterator.PageInfo {
    47  	return it.pageInfo
    48  }
    49  
    50  // Next returns the next result. Its second return value is iterator.Done if there are no more
    51  // results. Once Next returns Done, all subsequent calls will return Done.
    52  func (it *LocationIterator) Next() (*locationpb.Location, error) {
    53  	var item *locationpb.Location
    54  	if err := it.nextFunc(); err != nil {
    55  		return item, err
    56  	}
    57  	item = it.items[0]
    58  	it.items = it.items[1:]
    59  	return item, nil
    60  }
    61  
    62  func (it *LocationIterator) bufLen() int {
    63  	return len(it.items)
    64  }
    65  
    66  func (it *LocationIterator) takeBuf() interface{} {
    67  	b := it.items
    68  	it.items = nil
    69  	return b
    70  }
    71  
    72  // SecretIterator manages a stream of *secretmanagerpb.Secret.
    73  type SecretIterator struct {
    74  	items    []*secretmanagerpb.Secret
    75  	pageInfo *iterator.PageInfo
    76  	nextFunc func() error
    77  
    78  	// Response is the raw response for the current page.
    79  	// It must be cast to the RPC response type.
    80  	// Calling Next() or InternalFetch() updates this value.
    81  	Response interface{}
    82  
    83  	// InternalFetch is for use by the Google Cloud Libraries only.
    84  	// It is not part of the stable interface of this package.
    85  	//
    86  	// InternalFetch returns results from a single call to the underlying RPC.
    87  	// The number of results is no greater than pageSize.
    88  	// If there are no more results, nextPageToken is empty and err is nil.
    89  	InternalFetch func(pageSize int, pageToken string) (results []*secretmanagerpb.Secret, nextPageToken string, err error)
    90  }
    91  
    92  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
    93  func (it *SecretIterator) PageInfo() *iterator.PageInfo {
    94  	return it.pageInfo
    95  }
    96  
    97  // Next returns the next result. Its second return value is iterator.Done if there are no more
    98  // results. Once Next returns Done, all subsequent calls will return Done.
    99  func (it *SecretIterator) Next() (*secretmanagerpb.Secret, error) {
   100  	var item *secretmanagerpb.Secret
   101  	if err := it.nextFunc(); err != nil {
   102  		return item, err
   103  	}
   104  	item = it.items[0]
   105  	it.items = it.items[1:]
   106  	return item, nil
   107  }
   108  
   109  func (it *SecretIterator) bufLen() int {
   110  	return len(it.items)
   111  }
   112  
   113  func (it *SecretIterator) takeBuf() interface{} {
   114  	b := it.items
   115  	it.items = nil
   116  	return b
   117  }
   118  
   119  // SecretVersionIterator manages a stream of *secretmanagerpb.SecretVersion.
   120  type SecretVersionIterator struct {
   121  	items    []*secretmanagerpb.SecretVersion
   122  	pageInfo *iterator.PageInfo
   123  	nextFunc func() error
   124  
   125  	// Response is the raw response for the current page.
   126  	// It must be cast to the RPC response type.
   127  	// Calling Next() or InternalFetch() updates this value.
   128  	Response interface{}
   129  
   130  	// InternalFetch is for use by the Google Cloud Libraries only.
   131  	// It is not part of the stable interface of this package.
   132  	//
   133  	// InternalFetch returns results from a single call to the underlying RPC.
   134  	// The number of results is no greater than pageSize.
   135  	// If there are no more results, nextPageToken is empty and err is nil.
   136  	InternalFetch func(pageSize int, pageToken string) (results []*secretmanagerpb.SecretVersion, nextPageToken string, err error)
   137  }
   138  
   139  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   140  func (it *SecretVersionIterator) PageInfo() *iterator.PageInfo {
   141  	return it.pageInfo
   142  }
   143  
   144  // Next returns the next result. Its second return value is iterator.Done if there are no more
   145  // results. Once Next returns Done, all subsequent calls will return Done.
   146  func (it *SecretVersionIterator) Next() (*secretmanagerpb.SecretVersion, error) {
   147  	var item *secretmanagerpb.SecretVersion
   148  	if err := it.nextFunc(); err != nil {
   149  		return item, err
   150  	}
   151  	item = it.items[0]
   152  	it.items = it.items[1:]
   153  	return item, nil
   154  }
   155  
   156  func (it *SecretVersionIterator) bufLen() int {
   157  	return len(it.items)
   158  }
   159  
   160  func (it *SecretVersionIterator) takeBuf() interface{} {
   161  	b := it.items
   162  	it.items = nil
   163  	return b
   164  }
   165  

View as plain text