1// Copyright 2021 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
17package compute
18
19import (
20	"bytes"
21	"context"
22	"fmt"
23	"io/ioutil"
24	"math"
25	"net/http"
26	"net/url"
27
28	gax "github.com/googleapis/gax-go/v2"
29	"google.golang.org/api/iterator"
30	"google.golang.org/api/option"
31	"google.golang.org/api/option/internaloption"
32	httptransport "google.golang.org/api/transport/http"
33	computepb "google.golang.org/genproto/googleapis/cloud/compute/v1"
34	"google.golang.org/grpc"
35	"google.golang.org/grpc/metadata"
36	"google.golang.org/protobuf/encoding/protojson"
37	"google.golang.org/protobuf/proto"
38)
39
40var newRegionUrlMapsClientHook clientHook
41
42// RegionUrlMapsCallOptions contains the retry settings for each method of RegionUrlMapsClient.
43type RegionUrlMapsCallOptions struct {
44	Delete   []gax.CallOption
45	Get      []gax.CallOption
46	Insert   []gax.CallOption
47	List     []gax.CallOption
48	Patch    []gax.CallOption
49	Update   []gax.CallOption
50	Validate []gax.CallOption
51}
52
53// internalRegionUrlMapsClient is an interface that defines the methods availaible from Google Compute Engine API.
54type internalRegionUrlMapsClient interface {
55	Close() error
56	setGoogleClientInfo(...string)
57	Connection() *grpc.ClientConn
58	Delete(context.Context, *computepb.DeleteRegionUrlMapRequest, ...gax.CallOption) (*Operation, error)
59	Get(context.Context, *computepb.GetRegionUrlMapRequest, ...gax.CallOption) (*computepb.UrlMap, error)
60	Insert(context.Context, *computepb.InsertRegionUrlMapRequest, ...gax.CallOption) (*Operation, error)
61	List(context.Context, *computepb.ListRegionUrlMapsRequest, ...gax.CallOption) *UrlMapIterator
62	Patch(context.Context, *computepb.PatchRegionUrlMapRequest, ...gax.CallOption) (*Operation, error)
63	Update(context.Context, *computepb.UpdateRegionUrlMapRequest, ...gax.CallOption) (*Operation, error)
64	Validate(context.Context, *computepb.ValidateRegionUrlMapRequest, ...gax.CallOption) (*computepb.UrlMapsValidateResponse, error)
65}
66
67// RegionUrlMapsClient is a client for interacting with Google Compute Engine API.
68// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
69//
70// The RegionUrlMaps API.
71type RegionUrlMapsClient struct {
72	// The internal transport-dependent client.
73	internalClient internalRegionUrlMapsClient
74
75	// The call options for this service.
76	CallOptions *RegionUrlMapsCallOptions
77}
78
79// Wrapper methods routed to the internal client.
80
81// Close closes the connection to the API service. The user should invoke this when
82// the client is no longer required.
83func (c *RegionUrlMapsClient) Close() error {
84	return c.internalClient.Close()
85}
86
87// setGoogleClientInfo sets the name and version of the application in
88// the `x-goog-api-client` header passed on each request. Intended for
89// use by Google-written clients.
90func (c *RegionUrlMapsClient) setGoogleClientInfo(keyval ...string) {
91	c.internalClient.setGoogleClientInfo(keyval...)
92}
93
94// Connection returns a connection to the API service.
95//
96// Deprecated.
97func (c *RegionUrlMapsClient) Connection() *grpc.ClientConn {
98	return c.internalClient.Connection()
99}
100
101// Delete deletes the specified UrlMap resource.
102func (c *RegionUrlMapsClient) Delete(ctx context.Context, req *computepb.DeleteRegionUrlMapRequest, opts ...gax.CallOption) (*Operation, error) {
103	return c.internalClient.Delete(ctx, req, opts...)
104}
105
106// Get returns the specified UrlMap resource. Gets a list of available URL maps by making a list() request.
107func (c *RegionUrlMapsClient) Get(ctx context.Context, req *computepb.GetRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMap, error) {
108	return c.internalClient.Get(ctx, req, opts...)
109}
110
111// Insert creates a UrlMap resource in the specified project using the data included in the request.
112func (c *RegionUrlMapsClient) Insert(ctx context.Context, req *computepb.InsertRegionUrlMapRequest, opts ...gax.CallOption) (*Operation, error) {
113	return c.internalClient.Insert(ctx, req, opts...)
114}
115
116// List retrieves the list of UrlMap resources available to the specified project in the specified region.
117func (c *RegionUrlMapsClient) List(ctx context.Context, req *computepb.ListRegionUrlMapsRequest, opts ...gax.CallOption) *UrlMapIterator {
118	return c.internalClient.List(ctx, req, opts...)
119}
120
121// Patch patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
122func (c *RegionUrlMapsClient) Patch(ctx context.Context, req *computepb.PatchRegionUrlMapRequest, opts ...gax.CallOption) (*Operation, error) {
123	return c.internalClient.Patch(ctx, req, opts...)
124}
125
126// Update updates the specified UrlMap resource with the data included in the request.
127func (c *RegionUrlMapsClient) Update(ctx context.Context, req *computepb.UpdateRegionUrlMapRequest, opts ...gax.CallOption) (*Operation, error) {
128	return c.internalClient.Update(ctx, req, opts...)
129}
130
131// Validate runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap.
132func (c *RegionUrlMapsClient) Validate(ctx context.Context, req *computepb.ValidateRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMapsValidateResponse, error) {
133	return c.internalClient.Validate(ctx, req, opts...)
134}
135
136// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
137type regionUrlMapsRESTClient struct {
138	// The http endpoint to connect to.
139	endpoint string
140
141	// The http client.
142	httpClient *http.Client
143
144	// The x-goog-* metadata to be sent with each request.
145	xGoogMetadata metadata.MD
146}
147
148// NewRegionUrlMapsRESTClient creates a new region url maps rest client.
149//
150// The RegionUrlMaps API.
151func NewRegionUrlMapsRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionUrlMapsClient, error) {
152	clientOpts := append(defaultRegionUrlMapsRESTClientOptions(), opts...)
153	httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
154	if err != nil {
155		return nil, err
156	}
157
158	c := &regionUrlMapsRESTClient{
159		endpoint:   endpoint,
160		httpClient: httpClient,
161	}
162	c.setGoogleClientInfo()
163
164	return &RegionUrlMapsClient{internalClient: c, CallOptions: &RegionUrlMapsCallOptions{}}, nil
165}
166
167func defaultRegionUrlMapsRESTClientOptions() []option.ClientOption {
168	return []option.ClientOption{
169		internaloption.WithDefaultEndpoint("https://compute.googleapis.com"),
170		internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"),
171		internaloption.WithDefaultAudience("https://compute.googleapis.com/"),
172		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
173	}
174}
175
176// setGoogleClientInfo sets the name and version of the application in
177// the `x-goog-api-client` header passed on each request. Intended for
178// use by Google-written clients.
179func (c *regionUrlMapsRESTClient) setGoogleClientInfo(keyval ...string) {
180	kv := append([]string{"gl-go", versionGo()}, keyval...)
181	kv = append(kv, "gapic", versionClient, "gax", gax.Version, "rest", "UNKNOWN")
182	c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
183}
184
185// Close closes the connection to the API service. The user should invoke this when
186// the client is no longer required.
187func (c *regionUrlMapsRESTClient) Close() error {
188	// Replace httpClient with nil to force cleanup.
189	c.httpClient = nil
190	return nil
191}
192
193// Connection returns a connection to the API service.
194//
195// Deprecated.
196func (c *regionUrlMapsRESTClient) Connection() *grpc.ClientConn {
197	return nil
198}
199
200// Delete deletes the specified UrlMap resource.
201func (c *regionUrlMapsRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionUrlMapRequest, opts ...gax.CallOption) (*Operation, error) {
202	baseUrl, _ := url.Parse(c.endpoint)
203	baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v", req.GetProject(), req.GetRegion(), req.GetUrlMap())
204
205	params := url.Values{}
206	if req != nil && req.RequestId != nil {
207		params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
208	}
209
210	baseUrl.RawQuery = params.Encode()
211
212	httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
213	if err != nil {
214		return nil, err
215	}
216	httpReq = httpReq.WithContext(ctx)
217	// Set the headers
218	for k, v := range c.xGoogMetadata {
219		httpReq.Header[k] = v
220	}
221	httpReq.Header["Content-Type"] = []string{"application/json"}
222
223	httpRsp, err := c.httpClient.Do(httpReq)
224	if err != nil {
225		return nil, err
226	}
227	defer httpRsp.Body.Close()
228
229	if httpRsp.StatusCode != http.StatusOK {
230		return nil, fmt.Errorf(httpRsp.Status)
231	}
232
233	buf, err := ioutil.ReadAll(httpRsp.Body)
234	if err != nil {
235		return nil, err
236	}
237
238	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
239	rsp := &computepb.Operation{}
240
241	if err := unm.Unmarshal(buf, rsp); err != nil {
242		return nil, err
243	}
244	op := &Operation{proto: rsp}
245	return op, err
246}
247
248// Get returns the specified UrlMap resource. Gets a list of available URL maps by making a list() request.
249func (c *regionUrlMapsRESTClient) Get(ctx context.Context, req *computepb.GetRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMap, error) {
250	baseUrl, _ := url.Parse(c.endpoint)
251	baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v", req.GetProject(), req.GetRegion(), req.GetUrlMap())
252
253	httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
254	if err != nil {
255		return nil, err
256	}
257	httpReq = httpReq.WithContext(ctx)
258	// Set the headers
259	for k, v := range c.xGoogMetadata {
260		httpReq.Header[k] = v
261	}
262	httpReq.Header["Content-Type"] = []string{"application/json"}
263
264	httpRsp, err := c.httpClient.Do(httpReq)
265	if err != nil {
266		return nil, err
267	}
268	defer httpRsp.Body.Close()
269
270	if httpRsp.StatusCode != http.StatusOK {
271		return nil, fmt.Errorf(httpRsp.Status)
272	}
273
274	buf, err := ioutil.ReadAll(httpRsp.Body)
275	if err != nil {
276		return nil, err
277	}
278
279	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
280	rsp := &computepb.UrlMap{}
281
282	return rsp, unm.Unmarshal(buf, rsp)
283}
284
285// Insert creates a UrlMap resource in the specified project using the data included in the request.
286func (c *regionUrlMapsRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionUrlMapRequest, opts ...gax.CallOption) (*Operation, error) {
287	m := protojson.MarshalOptions{AllowPartial: true}
288	body := req.GetUrlMapResource()
289	jsonReq, err := m.Marshal(body)
290	if err != nil {
291		return nil, err
292	}
293
294	baseUrl, _ := url.Parse(c.endpoint)
295	baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps", req.GetProject(), req.GetRegion())
296
297	params := url.Values{}
298	if req != nil && req.RequestId != nil {
299		params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
300	}
301
302	baseUrl.RawQuery = params.Encode()
303
304	httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
305	if err != nil {
306		return nil, err
307	}
308	httpReq = httpReq.WithContext(ctx)
309	// Set the headers
310	for k, v := range c.xGoogMetadata {
311		httpReq.Header[k] = v
312	}
313	httpReq.Header["Content-Type"] = []string{"application/json"}
314
315	httpRsp, err := c.httpClient.Do(httpReq)
316	if err != nil {
317		return nil, err
318	}
319	defer httpRsp.Body.Close()
320
321	if httpRsp.StatusCode != http.StatusOK {
322		return nil, fmt.Errorf(httpRsp.Status)
323	}
324
325	buf, err := ioutil.ReadAll(httpRsp.Body)
326	if err != nil {
327		return nil, err
328	}
329
330	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
331	rsp := &computepb.Operation{}
332
333	if err := unm.Unmarshal(buf, rsp); err != nil {
334		return nil, err
335	}
336	op := &Operation{proto: rsp}
337	return op, err
338}
339
340// List retrieves the list of UrlMap resources available to the specified project in the specified region.
341func (c *regionUrlMapsRESTClient) List(ctx context.Context, req *computepb.ListRegionUrlMapsRequest, opts ...gax.CallOption) *UrlMapIterator {
342	it := &UrlMapIterator{}
343	req = proto.Clone(req).(*computepb.ListRegionUrlMapsRequest)
344	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
345	it.InternalFetch = func(pageSize int, pageToken string) ([]*computepb.UrlMap, string, error) {
346		resp := &computepb.UrlMapList{}
347		if pageToken != "" {
348			req.PageToken = proto.String(pageToken)
349		}
350		if pageSize > math.MaxInt32 {
351			req.MaxResults = proto.Uint32(math.MaxInt32)
352		} else if pageSize != 0 {
353			req.MaxResults = proto.Uint32(uint32(pageSize))
354		}
355		baseUrl, _ := url.Parse(c.endpoint)
356		baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps", req.GetProject(), req.GetRegion())
357
358		params := url.Values{}
359		if req != nil && req.Filter != nil {
360			params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
361		}
362		if req != nil && req.MaxResults != nil {
363			params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults()))
364		}
365		if req != nil && req.OrderBy != nil {
366			params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
367		}
368		if req != nil && req.PageToken != nil {
369			params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
370		}
371		if req != nil && req.ReturnPartialSuccess != nil {
372			params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
373		}
374
375		baseUrl.RawQuery = params.Encode()
376
377		httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
378		if err != nil {
379			return nil, "", err
380		}
381
382		// Set the headers
383		for k, v := range c.xGoogMetadata {
384			httpReq.Header[k] = v
385		}
386
387		httpReq.Header["Content-Type"] = []string{"application/json"}
388		httpRsp, err := c.httpClient.Do(httpReq)
389		if err != nil {
390			return nil, "", err
391		}
392		defer httpRsp.Body.Close()
393
394		if httpRsp.StatusCode != http.StatusOK {
395			return nil, "", fmt.Errorf(httpRsp.Status)
396		}
397
398		buf, err := ioutil.ReadAll(httpRsp.Body)
399		if err != nil {
400			return nil, "", err
401		}
402
403		unm.Unmarshal(buf, resp)
404		it.Response = resp
405		return resp.GetItems(), resp.GetNextPageToken(), nil
406	}
407
408	fetch := func(pageSize int, pageToken string) (string, error) {
409		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
410		if err != nil {
411			return "", err
412		}
413		it.items = append(it.items, items...)
414		return nextPageToken, nil
415	}
416
417	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
418	it.pageInfo.MaxSize = int(req.GetMaxResults())
419	it.pageInfo.Token = req.GetPageToken()
420
421	return it
422}
423
424// Patch patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
425func (c *regionUrlMapsRESTClient) Patch(ctx context.Context, req *computepb.PatchRegionUrlMapRequest, opts ...gax.CallOption) (*Operation, error) {
426	m := protojson.MarshalOptions{AllowPartial: true}
427	body := req.GetUrlMapResource()
428	jsonReq, err := m.Marshal(body)
429	if err != nil {
430		return nil, err
431	}
432
433	baseUrl, _ := url.Parse(c.endpoint)
434	baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v", req.GetProject(), req.GetRegion(), req.GetUrlMap())
435
436	params := url.Values{}
437	if req != nil && req.RequestId != nil {
438		params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
439	}
440
441	baseUrl.RawQuery = params.Encode()
442
443	httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
444	if err != nil {
445		return nil, err
446	}
447	httpReq = httpReq.WithContext(ctx)
448	// Set the headers
449	for k, v := range c.xGoogMetadata {
450		httpReq.Header[k] = v
451	}
452	httpReq.Header["Content-Type"] = []string{"application/json"}
453
454	httpRsp, err := c.httpClient.Do(httpReq)
455	if err != nil {
456		return nil, err
457	}
458	defer httpRsp.Body.Close()
459
460	if httpRsp.StatusCode != http.StatusOK {
461		return nil, fmt.Errorf(httpRsp.Status)
462	}
463
464	buf, err := ioutil.ReadAll(httpRsp.Body)
465	if err != nil {
466		return nil, err
467	}
468
469	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
470	rsp := &computepb.Operation{}
471
472	if err := unm.Unmarshal(buf, rsp); err != nil {
473		return nil, err
474	}
475	op := &Operation{proto: rsp}
476	return op, err
477}
478
479// Update updates the specified UrlMap resource with the data included in the request.
480func (c *regionUrlMapsRESTClient) Update(ctx context.Context, req *computepb.UpdateRegionUrlMapRequest, opts ...gax.CallOption) (*Operation, error) {
481	m := protojson.MarshalOptions{AllowPartial: true}
482	body := req.GetUrlMapResource()
483	jsonReq, err := m.Marshal(body)
484	if err != nil {
485		return nil, err
486	}
487
488	baseUrl, _ := url.Parse(c.endpoint)
489	baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v", req.GetProject(), req.GetRegion(), req.GetUrlMap())
490
491	params := url.Values{}
492	if req != nil && req.RequestId != nil {
493		params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
494	}
495
496	baseUrl.RawQuery = params.Encode()
497
498	httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq))
499	if err != nil {
500		return nil, err
501	}
502	httpReq = httpReq.WithContext(ctx)
503	// Set the headers
504	for k, v := range c.xGoogMetadata {
505		httpReq.Header[k] = v
506	}
507	httpReq.Header["Content-Type"] = []string{"application/json"}
508
509	httpRsp, err := c.httpClient.Do(httpReq)
510	if err != nil {
511		return nil, err
512	}
513	defer httpRsp.Body.Close()
514
515	if httpRsp.StatusCode != http.StatusOK {
516		return nil, fmt.Errorf(httpRsp.Status)
517	}
518
519	buf, err := ioutil.ReadAll(httpRsp.Body)
520	if err != nil {
521		return nil, err
522	}
523
524	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
525	rsp := &computepb.Operation{}
526
527	if err := unm.Unmarshal(buf, rsp); err != nil {
528		return nil, err
529	}
530	op := &Operation{proto: rsp}
531	return op, err
532}
533
534// Validate runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap.
535func (c *regionUrlMapsRESTClient) Validate(ctx context.Context, req *computepb.ValidateRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMapsValidateResponse, error) {
536	m := protojson.MarshalOptions{AllowPartial: true}
537	body := req.GetRegionUrlMapsValidateRequestResource()
538	jsonReq, err := m.Marshal(body)
539	if err != nil {
540		return nil, err
541	}
542
543	baseUrl, _ := url.Parse(c.endpoint)
544	baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v/validate", req.GetProject(), req.GetRegion(), req.GetUrlMap())
545
546	httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
547	if err != nil {
548		return nil, err
549	}
550	httpReq = httpReq.WithContext(ctx)
551	// Set the headers
552	for k, v := range c.xGoogMetadata {
553		httpReq.Header[k] = v
554	}
555	httpReq.Header["Content-Type"] = []string{"application/json"}
556
557	httpRsp, err := c.httpClient.Do(httpReq)
558	if err != nil {
559		return nil, err
560	}
561	defer httpRsp.Body.Close()
562
563	if httpRsp.StatusCode != http.StatusOK {
564		return nil, fmt.Errorf(httpRsp.Status)
565	}
566
567	buf, err := ioutil.ReadAll(httpRsp.Body)
568	if err != nil {
569		return nil, err
570	}
571
572	unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
573	rsp := &computepb.UrlMapsValidateResponse{}
574
575	return rsp, unm.Unmarshal(buf, rsp)
576}
577
578// UrlMapIterator manages a stream of *computepb.UrlMap.
579type UrlMapIterator struct {
580	items    []*computepb.UrlMap
581	pageInfo *iterator.PageInfo
582	nextFunc func() error
583
584	// Response is the raw response for the current page.
585	// It must be cast to the RPC response type.
586	// Calling Next() or InternalFetch() updates this value.
587	Response interface{}
588
589	// InternalFetch is for use by the Google Cloud Libraries only.
590	// It is not part of the stable interface of this package.
591	//
592	// InternalFetch returns results from a single call to the underlying RPC.
593	// The number of results is no greater than pageSize.
594	// If there are no more results, nextPageToken is empty and err is nil.
595	InternalFetch func(pageSize int, pageToken string) (results []*computepb.UrlMap, nextPageToken string, err error)
596}
597
598// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
599func (it *UrlMapIterator) PageInfo() *iterator.PageInfo {
600	return it.pageInfo
601}
602
603// Next returns the next result. Its second return value is iterator.Done if there are no more
604// results. Once Next returns Done, all subsequent calls will return Done.
605func (it *UrlMapIterator) Next() (*computepb.UrlMap, error) {
606	var item *computepb.UrlMap
607	if err := it.nextFunc(); err != nil {
608		return item, err
609	}
610	item = it.items[0]
611	it.items = it.items[1:]
612	return item, nil
613}
614
615func (it *UrlMapIterator) bufLen() int {
616	return len(it.items)
617}
618
619func (it *UrlMapIterator) takeBuf() interface{} {
620	b := it.items
621	it.items = nil
622	return b
623}
624