...

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

Documentation: cloud.google.com/go/kms/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 kms
    18  
    19  import (
    20  	kmspb "cloud.google.com/go/kms/apiv1/kmspb"
    21  	"google.golang.org/api/iterator"
    22  	locationpb "google.golang.org/genproto/googleapis/cloud/location"
    23  )
    24  
    25  // CryptoKeyIterator manages a stream of *kmspb.CryptoKey.
    26  type CryptoKeyIterator struct {
    27  	items    []*kmspb.CryptoKey
    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 []*kmspb.CryptoKey, nextPageToken string, err error)
    43  }
    44  
    45  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
    46  func (it *CryptoKeyIterator) 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 *CryptoKeyIterator) Next() (*kmspb.CryptoKey, error) {
    53  	var item *kmspb.CryptoKey
    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 *CryptoKeyIterator) bufLen() int {
    63  	return len(it.items)
    64  }
    65  
    66  func (it *CryptoKeyIterator) takeBuf() interface{} {
    67  	b := it.items
    68  	it.items = nil
    69  	return b
    70  }
    71  
    72  // CryptoKeyVersionIterator manages a stream of *kmspb.CryptoKeyVersion.
    73  type CryptoKeyVersionIterator struct {
    74  	items    []*kmspb.CryptoKeyVersion
    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 []*kmspb.CryptoKeyVersion, nextPageToken string, err error)
    90  }
    91  
    92  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
    93  func (it *CryptoKeyVersionIterator) 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 *CryptoKeyVersionIterator) Next() (*kmspb.CryptoKeyVersion, error) {
   100  	var item *kmspb.CryptoKeyVersion
   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 *CryptoKeyVersionIterator) bufLen() int {
   110  	return len(it.items)
   111  }
   112  
   113  func (it *CryptoKeyVersionIterator) takeBuf() interface{} {
   114  	b := it.items
   115  	it.items = nil
   116  	return b
   117  }
   118  
   119  // EkmConnectionIterator manages a stream of *kmspb.EkmConnection.
   120  type EkmConnectionIterator struct {
   121  	items    []*kmspb.EkmConnection
   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 []*kmspb.EkmConnection, nextPageToken string, err error)
   137  }
   138  
   139  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   140  func (it *EkmConnectionIterator) 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 *EkmConnectionIterator) Next() (*kmspb.EkmConnection, error) {
   147  	var item *kmspb.EkmConnection
   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 *EkmConnectionIterator) bufLen() int {
   157  	return len(it.items)
   158  }
   159  
   160  func (it *EkmConnectionIterator) takeBuf() interface{} {
   161  	b := it.items
   162  	it.items = nil
   163  	return b
   164  }
   165  
   166  // ImportJobIterator manages a stream of *kmspb.ImportJob.
   167  type ImportJobIterator struct {
   168  	items    []*kmspb.ImportJob
   169  	pageInfo *iterator.PageInfo
   170  	nextFunc func() error
   171  
   172  	// Response is the raw response for the current page.
   173  	// It must be cast to the RPC response type.
   174  	// Calling Next() or InternalFetch() updates this value.
   175  	Response interface{}
   176  
   177  	// InternalFetch is for use by the Google Cloud Libraries only.
   178  	// It is not part of the stable interface of this package.
   179  	//
   180  	// InternalFetch returns results from a single call to the underlying RPC.
   181  	// The number of results is no greater than pageSize.
   182  	// If there are no more results, nextPageToken is empty and err is nil.
   183  	InternalFetch func(pageSize int, pageToken string) (results []*kmspb.ImportJob, nextPageToken string, err error)
   184  }
   185  
   186  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   187  func (it *ImportJobIterator) PageInfo() *iterator.PageInfo {
   188  	return it.pageInfo
   189  }
   190  
   191  // Next returns the next result. Its second return value is iterator.Done if there are no more
   192  // results. Once Next returns Done, all subsequent calls will return Done.
   193  func (it *ImportJobIterator) Next() (*kmspb.ImportJob, error) {
   194  	var item *kmspb.ImportJob
   195  	if err := it.nextFunc(); err != nil {
   196  		return item, err
   197  	}
   198  	item = it.items[0]
   199  	it.items = it.items[1:]
   200  	return item, nil
   201  }
   202  
   203  func (it *ImportJobIterator) bufLen() int {
   204  	return len(it.items)
   205  }
   206  
   207  func (it *ImportJobIterator) takeBuf() interface{} {
   208  	b := it.items
   209  	it.items = nil
   210  	return b
   211  }
   212  
   213  // KeyRingIterator manages a stream of *kmspb.KeyRing.
   214  type KeyRingIterator struct {
   215  	items    []*kmspb.KeyRing
   216  	pageInfo *iterator.PageInfo
   217  	nextFunc func() error
   218  
   219  	// Response is the raw response for the current page.
   220  	// It must be cast to the RPC response type.
   221  	// Calling Next() or InternalFetch() updates this value.
   222  	Response interface{}
   223  
   224  	// InternalFetch is for use by the Google Cloud Libraries only.
   225  	// It is not part of the stable interface of this package.
   226  	//
   227  	// InternalFetch returns results from a single call to the underlying RPC.
   228  	// The number of results is no greater than pageSize.
   229  	// If there are no more results, nextPageToken is empty and err is nil.
   230  	InternalFetch func(pageSize int, pageToken string) (results []*kmspb.KeyRing, nextPageToken string, err error)
   231  }
   232  
   233  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   234  func (it *KeyRingIterator) PageInfo() *iterator.PageInfo {
   235  	return it.pageInfo
   236  }
   237  
   238  // Next returns the next result. Its second return value is iterator.Done if there are no more
   239  // results. Once Next returns Done, all subsequent calls will return Done.
   240  func (it *KeyRingIterator) Next() (*kmspb.KeyRing, error) {
   241  	var item *kmspb.KeyRing
   242  	if err := it.nextFunc(); err != nil {
   243  		return item, err
   244  	}
   245  	item = it.items[0]
   246  	it.items = it.items[1:]
   247  	return item, nil
   248  }
   249  
   250  func (it *KeyRingIterator) bufLen() int {
   251  	return len(it.items)
   252  }
   253  
   254  func (it *KeyRingIterator) takeBuf() interface{} {
   255  	b := it.items
   256  	it.items = nil
   257  	return b
   258  }
   259  
   260  // LocationIterator manages a stream of *locationpb.Location.
   261  type LocationIterator struct {
   262  	items    []*locationpb.Location
   263  	pageInfo *iterator.PageInfo
   264  	nextFunc func() error
   265  
   266  	// Response is the raw response for the current page.
   267  	// It must be cast to the RPC response type.
   268  	// Calling Next() or InternalFetch() updates this value.
   269  	Response interface{}
   270  
   271  	// InternalFetch is for use by the Google Cloud Libraries only.
   272  	// It is not part of the stable interface of this package.
   273  	//
   274  	// InternalFetch returns results from a single call to the underlying RPC.
   275  	// The number of results is no greater than pageSize.
   276  	// If there are no more results, nextPageToken is empty and err is nil.
   277  	InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error)
   278  }
   279  
   280  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
   281  func (it *LocationIterator) PageInfo() *iterator.PageInfo {
   282  	return it.pageInfo
   283  }
   284  
   285  // Next returns the next result. Its second return value is iterator.Done if there are no more
   286  // results. Once Next returns Done, all subsequent calls will return Done.
   287  func (it *LocationIterator) Next() (*locationpb.Location, error) {
   288  	var item *locationpb.Location
   289  	if err := it.nextFunc(); err != nil {
   290  		return item, err
   291  	}
   292  	item = it.items[0]
   293  	it.items = it.items[1:]
   294  	return item, nil
   295  }
   296  
   297  func (it *LocationIterator) bufLen() int {
   298  	return len(it.items)
   299  }
   300  
   301  func (it *LocationIterator) takeBuf() interface{} {
   302  	b := it.items
   303  	it.items = nil
   304  	return b
   305  }
   306  

View as plain text