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 metastore
18
19import (
20	"context"
21	"fmt"
22	"math"
23	"net/url"
24	"time"
25
26	"cloud.google.com/go/longrunning"
27	lroauto "cloud.google.com/go/longrunning/autogen"
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	gtransport "google.golang.org/api/transport/grpc"
33	metastorepb "google.golang.org/genproto/googleapis/cloud/metastore/v1"
34	longrunningpb "google.golang.org/genproto/googleapis/longrunning"
35	"google.golang.org/grpc"
36	"google.golang.org/grpc/codes"
37	"google.golang.org/grpc/metadata"
38	"google.golang.org/protobuf/proto"
39)
40
41var newDataprocMetastoreClientHook clientHook
42
43// DataprocMetastoreCallOptions contains the retry settings for each method of DataprocMetastoreClient.
44type DataprocMetastoreCallOptions struct {
45	ListServices         []gax.CallOption
46	GetService           []gax.CallOption
47	CreateService        []gax.CallOption
48	UpdateService        []gax.CallOption
49	DeleteService        []gax.CallOption
50	ListMetadataImports  []gax.CallOption
51	GetMetadataImport    []gax.CallOption
52	CreateMetadataImport []gax.CallOption
53	UpdateMetadataImport []gax.CallOption
54	ExportMetadata       []gax.CallOption
55}
56
57func defaultDataprocMetastoreGRPCClientOptions() []option.ClientOption {
58	return []option.ClientOption{
59		internaloption.WithDefaultEndpoint("metastore.googleapis.com:443"),
60		internaloption.WithDefaultMTLSEndpoint("metastore.mtls.googleapis.com:443"),
61		internaloption.WithDefaultAudience("https://metastore.googleapis.com/"),
62		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
63		option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
64		option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
65			grpc.MaxCallRecvMsgSize(math.MaxInt32))),
66	}
67}
68
69func defaultDataprocMetastoreCallOptions() *DataprocMetastoreCallOptions {
70	return &DataprocMetastoreCallOptions{
71		ListServices: []gax.CallOption{
72			gax.WithRetry(func() gax.Retryer {
73				return gax.OnCodes([]codes.Code{
74					codes.Unavailable,
75				}, gax.Backoff{
76					Initial:    1000 * time.Millisecond,
77					Max:        10000 * time.Millisecond,
78					Multiplier: 1.30,
79				})
80			}),
81		},
82		GetService: []gax.CallOption{
83			gax.WithRetry(func() gax.Retryer {
84				return gax.OnCodes([]codes.Code{
85					codes.Unavailable,
86				}, gax.Backoff{
87					Initial:    1000 * time.Millisecond,
88					Max:        10000 * time.Millisecond,
89					Multiplier: 1.30,
90				})
91			}),
92		},
93		CreateService: []gax.CallOption{},
94		UpdateService: []gax.CallOption{},
95		DeleteService: []gax.CallOption{},
96		ListMetadataImports: []gax.CallOption{
97			gax.WithRetry(func() gax.Retryer {
98				return gax.OnCodes([]codes.Code{
99					codes.Unavailable,
100				}, gax.Backoff{
101					Initial:    1000 * time.Millisecond,
102					Max:        10000 * time.Millisecond,
103					Multiplier: 1.30,
104				})
105			}),
106		},
107		GetMetadataImport: []gax.CallOption{
108			gax.WithRetry(func() gax.Retryer {
109				return gax.OnCodes([]codes.Code{
110					codes.Unavailable,
111				}, gax.Backoff{
112					Initial:    1000 * time.Millisecond,
113					Max:        10000 * time.Millisecond,
114					Multiplier: 1.30,
115				})
116			}),
117		},
118		CreateMetadataImport: []gax.CallOption{},
119		UpdateMetadataImport: []gax.CallOption{},
120		ExportMetadata:       []gax.CallOption{},
121	}
122}
123
124// internalDataprocMetastoreClient is an interface that defines the methods availaible from Dataproc Metastore API.
125type internalDataprocMetastoreClient interface {
126	Close() error
127	setGoogleClientInfo(...string)
128	Connection() *grpc.ClientConn
129	ListServices(context.Context, *metastorepb.ListServicesRequest, ...gax.CallOption) *ServiceIterator
130	GetService(context.Context, *metastorepb.GetServiceRequest, ...gax.CallOption) (*metastorepb.Service, error)
131	CreateService(context.Context, *metastorepb.CreateServiceRequest, ...gax.CallOption) (*CreateServiceOperation, error)
132	CreateServiceOperation(name string) *CreateServiceOperation
133	UpdateService(context.Context, *metastorepb.UpdateServiceRequest, ...gax.CallOption) (*UpdateServiceOperation, error)
134	UpdateServiceOperation(name string) *UpdateServiceOperation
135	DeleteService(context.Context, *metastorepb.DeleteServiceRequest, ...gax.CallOption) (*DeleteServiceOperation, error)
136	DeleteServiceOperation(name string) *DeleteServiceOperation
137	ListMetadataImports(context.Context, *metastorepb.ListMetadataImportsRequest, ...gax.CallOption) *MetadataImportIterator
138	GetMetadataImport(context.Context, *metastorepb.GetMetadataImportRequest, ...gax.CallOption) (*metastorepb.MetadataImport, error)
139	CreateMetadataImport(context.Context, *metastorepb.CreateMetadataImportRequest, ...gax.CallOption) (*CreateMetadataImportOperation, error)
140	CreateMetadataImportOperation(name string) *CreateMetadataImportOperation
141	UpdateMetadataImport(context.Context, *metastorepb.UpdateMetadataImportRequest, ...gax.CallOption) (*UpdateMetadataImportOperation, error)
142	UpdateMetadataImportOperation(name string) *UpdateMetadataImportOperation
143	ExportMetadata(context.Context, *metastorepb.ExportMetadataRequest, ...gax.CallOption) (*ExportMetadataOperation, error)
144	ExportMetadataOperation(name string) *ExportMetadataOperation
145}
146
147// DataprocMetastoreClient is a client for interacting with Dataproc Metastore API.
148// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
149//
150// Configures and manages metastore services.
151// Metastore services are fully managed, highly available, auto-scaled,
152// auto-healing, OSS-native deployments of technical metadata management
153// software. Each metastore service exposes a network endpoint through which
154// metadata queries are served. Metadata queries can originate from a variety
155// of sources, including Apache Hive, Apache Presto, and Apache Spark.
156//
157// The Dataproc Metastore API defines the following resource model:
158//
159//   The service works with a collection of Google Cloud projects, named:
160//   /projects/*
161//
162//   Each project has a collection of available locations, named: /locations/*
163//   (a location must refer to a Google Cloud region)
164//
165//   Each location has a collection of services, named: /services/*
166//
167//   Dataproc Metastore services are resources with names of the form:
168//
169// /projects/{project_number}/locations/{location_id}/services/{service_id}.
170type DataprocMetastoreClient struct {
171	// The internal transport-dependent client.
172	internalClient internalDataprocMetastoreClient
173
174	// The call options for this service.
175	CallOptions *DataprocMetastoreCallOptions
176
177	// LROClient is used internally to handle long-running operations.
178	// It is exposed so that its CallOptions can be modified if required.
179	// Users should not Close this client.
180	LROClient *lroauto.OperationsClient
181}
182
183// Wrapper methods routed to the internal client.
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 *DataprocMetastoreClient) Close() error {
188	return c.internalClient.Close()
189}
190
191// setGoogleClientInfo sets the name and version of the application in
192// the `x-goog-api-client` header passed on each request. Intended for
193// use by Google-written clients.
194func (c *DataprocMetastoreClient) setGoogleClientInfo(keyval ...string) {
195	c.internalClient.setGoogleClientInfo(keyval...)
196}
197
198// Connection returns a connection to the API service.
199//
200// Deprecated.
201func (c *DataprocMetastoreClient) Connection() *grpc.ClientConn {
202	return c.internalClient.Connection()
203}
204
205// ListServices lists services in a project and location.
206func (c *DataprocMetastoreClient) ListServices(ctx context.Context, req *metastorepb.ListServicesRequest, opts ...gax.CallOption) *ServiceIterator {
207	return c.internalClient.ListServices(ctx, req, opts...)
208}
209
210// GetService gets the details of a single service.
211func (c *DataprocMetastoreClient) GetService(ctx context.Context, req *metastorepb.GetServiceRequest, opts ...gax.CallOption) (*metastorepb.Service, error) {
212	return c.internalClient.GetService(ctx, req, opts...)
213}
214
215// CreateService creates a metastore service in a project and location.
216func (c *DataprocMetastoreClient) CreateService(ctx context.Context, req *metastorepb.CreateServiceRequest, opts ...gax.CallOption) (*CreateServiceOperation, error) {
217	return c.internalClient.CreateService(ctx, req, opts...)
218}
219
220// CreateServiceOperation returns a new CreateServiceOperation from a given name.
221// The name must be that of a previously created CreateServiceOperation, possibly from a different process.
222func (c *DataprocMetastoreClient) CreateServiceOperation(name string) *CreateServiceOperation {
223	return c.internalClient.CreateServiceOperation(name)
224}
225
226// UpdateService updates the parameters of a single service.
227func (c *DataprocMetastoreClient) UpdateService(ctx context.Context, req *metastorepb.UpdateServiceRequest, opts ...gax.CallOption) (*UpdateServiceOperation, error) {
228	return c.internalClient.UpdateService(ctx, req, opts...)
229}
230
231// UpdateServiceOperation returns a new UpdateServiceOperation from a given name.
232// The name must be that of a previously created UpdateServiceOperation, possibly from a different process.
233func (c *DataprocMetastoreClient) UpdateServiceOperation(name string) *UpdateServiceOperation {
234	return c.internalClient.UpdateServiceOperation(name)
235}
236
237// DeleteService deletes a single service.
238func (c *DataprocMetastoreClient) DeleteService(ctx context.Context, req *metastorepb.DeleteServiceRequest, opts ...gax.CallOption) (*DeleteServiceOperation, error) {
239	return c.internalClient.DeleteService(ctx, req, opts...)
240}
241
242// DeleteServiceOperation returns a new DeleteServiceOperation from a given name.
243// The name must be that of a previously created DeleteServiceOperation, possibly from a different process.
244func (c *DataprocMetastoreClient) DeleteServiceOperation(name string) *DeleteServiceOperation {
245	return c.internalClient.DeleteServiceOperation(name)
246}
247
248// ListMetadataImports lists imports in a service.
249func (c *DataprocMetastoreClient) ListMetadataImports(ctx context.Context, req *metastorepb.ListMetadataImportsRequest, opts ...gax.CallOption) *MetadataImportIterator {
250	return c.internalClient.ListMetadataImports(ctx, req, opts...)
251}
252
253// GetMetadataImport gets details of a single import.
254func (c *DataprocMetastoreClient) GetMetadataImport(ctx context.Context, req *metastorepb.GetMetadataImportRequest, opts ...gax.CallOption) (*metastorepb.MetadataImport, error) {
255	return c.internalClient.GetMetadataImport(ctx, req, opts...)
256}
257
258// CreateMetadataImport creates a new MetadataImport in a given project and location.
259func (c *DataprocMetastoreClient) CreateMetadataImport(ctx context.Context, req *metastorepb.CreateMetadataImportRequest, opts ...gax.CallOption) (*CreateMetadataImportOperation, error) {
260	return c.internalClient.CreateMetadataImport(ctx, req, opts...)
261}
262
263// CreateMetadataImportOperation returns a new CreateMetadataImportOperation from a given name.
264// The name must be that of a previously created CreateMetadataImportOperation, possibly from a different process.
265func (c *DataprocMetastoreClient) CreateMetadataImportOperation(name string) *CreateMetadataImportOperation {
266	return c.internalClient.CreateMetadataImportOperation(name)
267}
268
269// UpdateMetadataImport updates a single import.
270// Only the description field of MetadataImport is supported to be updated.
271func (c *DataprocMetastoreClient) UpdateMetadataImport(ctx context.Context, req *metastorepb.UpdateMetadataImportRequest, opts ...gax.CallOption) (*UpdateMetadataImportOperation, error) {
272	return c.internalClient.UpdateMetadataImport(ctx, req, opts...)
273}
274
275// UpdateMetadataImportOperation returns a new UpdateMetadataImportOperation from a given name.
276// The name must be that of a previously created UpdateMetadataImportOperation, possibly from a different process.
277func (c *DataprocMetastoreClient) UpdateMetadataImportOperation(name string) *UpdateMetadataImportOperation {
278	return c.internalClient.UpdateMetadataImportOperation(name)
279}
280
281// ExportMetadata exports metadata from a service.
282func (c *DataprocMetastoreClient) ExportMetadata(ctx context.Context, req *metastorepb.ExportMetadataRequest, opts ...gax.CallOption) (*ExportMetadataOperation, error) {
283	return c.internalClient.ExportMetadata(ctx, req, opts...)
284}
285
286// ExportMetadataOperation returns a new ExportMetadataOperation from a given name.
287// The name must be that of a previously created ExportMetadataOperation, possibly from a different process.
288func (c *DataprocMetastoreClient) ExportMetadataOperation(name string) *ExportMetadataOperation {
289	return c.internalClient.ExportMetadataOperation(name)
290}
291
292// dataprocMetastoreGRPCClient is a client for interacting with Dataproc Metastore API over gRPC transport.
293//
294// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
295type dataprocMetastoreGRPCClient struct {
296	// Connection pool of gRPC connections to the service.
297	connPool gtransport.ConnPool
298
299	// flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE
300	disableDeadlines bool
301
302	// Points back to the CallOptions field of the containing DataprocMetastoreClient
303	CallOptions **DataprocMetastoreCallOptions
304
305	// The gRPC API client.
306	dataprocMetastoreClient metastorepb.DataprocMetastoreClient
307
308	// LROClient is used internally to handle long-running operations.
309	// It is exposed so that its CallOptions can be modified if required.
310	// Users should not Close this client.
311	LROClient **lroauto.OperationsClient
312
313	// The x-goog-* metadata to be sent with each request.
314	xGoogMetadata metadata.MD
315}
316
317// NewDataprocMetastoreClient creates a new dataproc metastore client based on gRPC.
318// The returned client must be Closed when it is done being used to clean up its underlying connections.
319//
320// Configures and manages metastore services.
321// Metastore services are fully managed, highly available, auto-scaled,
322// auto-healing, OSS-native deployments of technical metadata management
323// software. Each metastore service exposes a network endpoint through which
324// metadata queries are served. Metadata queries can originate from a variety
325// of sources, including Apache Hive, Apache Presto, and Apache Spark.
326//
327// The Dataproc Metastore API defines the following resource model:
328//
329//   The service works with a collection of Google Cloud projects, named:
330//   /projects/*
331//
332//   Each project has a collection of available locations, named: /locations/*
333//   (a location must refer to a Google Cloud region)
334//
335//   Each location has a collection of services, named: /services/*
336//
337//   Dataproc Metastore services are resources with names of the form:
338//
339// /projects/{project_number}/locations/{location_id}/services/{service_id}.
340func NewDataprocMetastoreClient(ctx context.Context, opts ...option.ClientOption) (*DataprocMetastoreClient, error) {
341	clientOpts := defaultDataprocMetastoreGRPCClientOptions()
342	if newDataprocMetastoreClientHook != nil {
343		hookOpts, err := newDataprocMetastoreClientHook(ctx, clientHookParams{})
344		if err != nil {
345			return nil, err
346		}
347		clientOpts = append(clientOpts, hookOpts...)
348	}
349
350	disableDeadlines, err := checkDisableDeadlines()
351	if err != nil {
352		return nil, err
353	}
354
355	connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
356	if err != nil {
357		return nil, err
358	}
359	client := DataprocMetastoreClient{CallOptions: defaultDataprocMetastoreCallOptions()}
360
361	c := &dataprocMetastoreGRPCClient{
362		connPool:                connPool,
363		disableDeadlines:        disableDeadlines,
364		dataprocMetastoreClient: metastorepb.NewDataprocMetastoreClient(connPool),
365		CallOptions:             &client.CallOptions,
366	}
367	c.setGoogleClientInfo()
368
369	client.internalClient = c
370
371	client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
372	if err != nil {
373		// This error "should not happen", since we are just reusing old connection pool
374		// and never actually need to dial.
375		// If this does happen, we could leak connp. However, we cannot close conn:
376		// If the user invoked the constructor with option.WithGRPCConn,
377		// we would close a connection that's still in use.
378		// TODO: investigate error conditions.
379		return nil, err
380	}
381	c.LROClient = &client.LROClient
382	return &client, nil
383}
384
385// Connection returns a connection to the API service.
386//
387// Deprecated.
388func (c *dataprocMetastoreGRPCClient) Connection() *grpc.ClientConn {
389	return c.connPool.Conn()
390}
391
392// setGoogleClientInfo sets the name and version of the application in
393// the `x-goog-api-client` header passed on each request. Intended for
394// use by Google-written clients.
395func (c *dataprocMetastoreGRPCClient) setGoogleClientInfo(keyval ...string) {
396	kv := append([]string{"gl-go", versionGo()}, keyval...)
397	kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
398	c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
399}
400
401// Close closes the connection to the API service. The user should invoke this when
402// the client is no longer required.
403func (c *dataprocMetastoreGRPCClient) Close() error {
404	return c.connPool.Close()
405}
406
407func (c *dataprocMetastoreGRPCClient) ListServices(ctx context.Context, req *metastorepb.ListServicesRequest, opts ...gax.CallOption) *ServiceIterator {
408	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
409	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
410	opts = append((*c.CallOptions).ListServices[0:len((*c.CallOptions).ListServices):len((*c.CallOptions).ListServices)], opts...)
411	it := &ServiceIterator{}
412	req = proto.Clone(req).(*metastorepb.ListServicesRequest)
413	it.InternalFetch = func(pageSize int, pageToken string) ([]*metastorepb.Service, string, error) {
414		var resp *metastorepb.ListServicesResponse
415		req.PageToken = pageToken
416		if pageSize > math.MaxInt32 {
417			req.PageSize = math.MaxInt32
418		} else {
419			req.PageSize = int32(pageSize)
420		}
421		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
422			var err error
423			resp, err = c.dataprocMetastoreClient.ListServices(ctx, req, settings.GRPC...)
424			return err
425		}, opts...)
426		if err != nil {
427			return nil, "", err
428		}
429
430		it.Response = resp
431		return resp.GetServices(), resp.GetNextPageToken(), nil
432	}
433	fetch := func(pageSize int, pageToken string) (string, error) {
434		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
435		if err != nil {
436			return "", err
437		}
438		it.items = append(it.items, items...)
439		return nextPageToken, nil
440	}
441	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
442	it.pageInfo.MaxSize = int(req.GetPageSize())
443	it.pageInfo.Token = req.GetPageToken()
444	return it
445}
446
447func (c *dataprocMetastoreGRPCClient) GetService(ctx context.Context, req *metastorepb.GetServiceRequest, opts ...gax.CallOption) (*metastorepb.Service, error) {
448	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
449		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
450		defer cancel()
451		ctx = cctx
452	}
453	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
454	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
455	opts = append((*c.CallOptions).GetService[0:len((*c.CallOptions).GetService):len((*c.CallOptions).GetService)], opts...)
456	var resp *metastorepb.Service
457	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
458		var err error
459		resp, err = c.dataprocMetastoreClient.GetService(ctx, req, settings.GRPC...)
460		return err
461	}, opts...)
462	if err != nil {
463		return nil, err
464	}
465	return resp, nil
466}
467
468func (c *dataprocMetastoreGRPCClient) CreateService(ctx context.Context, req *metastorepb.CreateServiceRequest, opts ...gax.CallOption) (*CreateServiceOperation, error) {
469	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
470		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
471		defer cancel()
472		ctx = cctx
473	}
474	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
475	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
476	opts = append((*c.CallOptions).CreateService[0:len((*c.CallOptions).CreateService):len((*c.CallOptions).CreateService)], opts...)
477	var resp *longrunningpb.Operation
478	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
479		var err error
480		resp, err = c.dataprocMetastoreClient.CreateService(ctx, req, settings.GRPC...)
481		return err
482	}, opts...)
483	if err != nil {
484		return nil, err
485	}
486	return &CreateServiceOperation{
487		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
488	}, nil
489}
490
491func (c *dataprocMetastoreGRPCClient) UpdateService(ctx context.Context, req *metastorepb.UpdateServiceRequest, opts ...gax.CallOption) (*UpdateServiceOperation, error) {
492	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
493		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
494		defer cancel()
495		ctx = cctx
496	}
497	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "service.name", url.QueryEscape(req.GetService().GetName())))
498	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
499	opts = append((*c.CallOptions).UpdateService[0:len((*c.CallOptions).UpdateService):len((*c.CallOptions).UpdateService)], opts...)
500	var resp *longrunningpb.Operation
501	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
502		var err error
503		resp, err = c.dataprocMetastoreClient.UpdateService(ctx, req, settings.GRPC...)
504		return err
505	}, opts...)
506	if err != nil {
507		return nil, err
508	}
509	return &UpdateServiceOperation{
510		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
511	}, nil
512}
513
514func (c *dataprocMetastoreGRPCClient) DeleteService(ctx context.Context, req *metastorepb.DeleteServiceRequest, opts ...gax.CallOption) (*DeleteServiceOperation, error) {
515	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
516		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
517		defer cancel()
518		ctx = cctx
519	}
520	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
521	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
522	opts = append((*c.CallOptions).DeleteService[0:len((*c.CallOptions).DeleteService):len((*c.CallOptions).DeleteService)], opts...)
523	var resp *longrunningpb.Operation
524	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
525		var err error
526		resp, err = c.dataprocMetastoreClient.DeleteService(ctx, req, settings.GRPC...)
527		return err
528	}, opts...)
529	if err != nil {
530		return nil, err
531	}
532	return &DeleteServiceOperation{
533		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
534	}, nil
535}
536
537func (c *dataprocMetastoreGRPCClient) ListMetadataImports(ctx context.Context, req *metastorepb.ListMetadataImportsRequest, opts ...gax.CallOption) *MetadataImportIterator {
538	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
539	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
540	opts = append((*c.CallOptions).ListMetadataImports[0:len((*c.CallOptions).ListMetadataImports):len((*c.CallOptions).ListMetadataImports)], opts...)
541	it := &MetadataImportIterator{}
542	req = proto.Clone(req).(*metastorepb.ListMetadataImportsRequest)
543	it.InternalFetch = func(pageSize int, pageToken string) ([]*metastorepb.MetadataImport, string, error) {
544		var resp *metastorepb.ListMetadataImportsResponse
545		req.PageToken = pageToken
546		if pageSize > math.MaxInt32 {
547			req.PageSize = math.MaxInt32
548		} else {
549			req.PageSize = int32(pageSize)
550		}
551		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
552			var err error
553			resp, err = c.dataprocMetastoreClient.ListMetadataImports(ctx, req, settings.GRPC...)
554			return err
555		}, opts...)
556		if err != nil {
557			return nil, "", err
558		}
559
560		it.Response = resp
561		return resp.GetMetadataImports(), resp.GetNextPageToken(), nil
562	}
563	fetch := func(pageSize int, pageToken string) (string, error) {
564		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
565		if err != nil {
566			return "", err
567		}
568		it.items = append(it.items, items...)
569		return nextPageToken, nil
570	}
571	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
572	it.pageInfo.MaxSize = int(req.GetPageSize())
573	it.pageInfo.Token = req.GetPageToken()
574	return it
575}
576
577func (c *dataprocMetastoreGRPCClient) GetMetadataImport(ctx context.Context, req *metastorepb.GetMetadataImportRequest, opts ...gax.CallOption) (*metastorepb.MetadataImport, error) {
578	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
579		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
580		defer cancel()
581		ctx = cctx
582	}
583	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
584	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
585	opts = append((*c.CallOptions).GetMetadataImport[0:len((*c.CallOptions).GetMetadataImport):len((*c.CallOptions).GetMetadataImport)], opts...)
586	var resp *metastorepb.MetadataImport
587	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
588		var err error
589		resp, err = c.dataprocMetastoreClient.GetMetadataImport(ctx, req, settings.GRPC...)
590		return err
591	}, opts...)
592	if err != nil {
593		return nil, err
594	}
595	return resp, nil
596}
597
598func (c *dataprocMetastoreGRPCClient) CreateMetadataImport(ctx context.Context, req *metastorepb.CreateMetadataImportRequest, opts ...gax.CallOption) (*CreateMetadataImportOperation, error) {
599	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
600		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
601		defer cancel()
602		ctx = cctx
603	}
604	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
605	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
606	opts = append((*c.CallOptions).CreateMetadataImport[0:len((*c.CallOptions).CreateMetadataImport):len((*c.CallOptions).CreateMetadataImport)], opts...)
607	var resp *longrunningpb.Operation
608	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
609		var err error
610		resp, err = c.dataprocMetastoreClient.CreateMetadataImport(ctx, req, settings.GRPC...)
611		return err
612	}, opts...)
613	if err != nil {
614		return nil, err
615	}
616	return &CreateMetadataImportOperation{
617		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
618	}, nil
619}
620
621func (c *dataprocMetastoreGRPCClient) UpdateMetadataImport(ctx context.Context, req *metastorepb.UpdateMetadataImportRequest, opts ...gax.CallOption) (*UpdateMetadataImportOperation, error) {
622	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
623		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
624		defer cancel()
625		ctx = cctx
626	}
627	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "metadata_import.name", url.QueryEscape(req.GetMetadataImport().GetName())))
628	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
629	opts = append((*c.CallOptions).UpdateMetadataImport[0:len((*c.CallOptions).UpdateMetadataImport):len((*c.CallOptions).UpdateMetadataImport)], opts...)
630	var resp *longrunningpb.Operation
631	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
632		var err error
633		resp, err = c.dataprocMetastoreClient.UpdateMetadataImport(ctx, req, settings.GRPC...)
634		return err
635	}, opts...)
636	if err != nil {
637		return nil, err
638	}
639	return &UpdateMetadataImportOperation{
640		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
641	}, nil
642}
643
644func (c *dataprocMetastoreGRPCClient) ExportMetadata(ctx context.Context, req *metastorepb.ExportMetadataRequest, opts ...gax.CallOption) (*ExportMetadataOperation, error) {
645	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
646		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
647		defer cancel()
648		ctx = cctx
649	}
650	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "service", url.QueryEscape(req.GetService())))
651	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
652	opts = append((*c.CallOptions).ExportMetadata[0:len((*c.CallOptions).ExportMetadata):len((*c.CallOptions).ExportMetadata)], opts...)
653	var resp *longrunningpb.Operation
654	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
655		var err error
656		resp, err = c.dataprocMetastoreClient.ExportMetadata(ctx, req, settings.GRPC...)
657		return err
658	}, opts...)
659	if err != nil {
660		return nil, err
661	}
662	return &ExportMetadataOperation{
663		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
664	}, nil
665}
666
667// CreateMetadataImportOperation manages a long-running operation from CreateMetadataImport.
668type CreateMetadataImportOperation struct {
669	lro *longrunning.Operation
670}
671
672// CreateMetadataImportOperation returns a new CreateMetadataImportOperation from a given name.
673// The name must be that of a previously created CreateMetadataImportOperation, possibly from a different process.
674func (c *dataprocMetastoreGRPCClient) CreateMetadataImportOperation(name string) *CreateMetadataImportOperation {
675	return &CreateMetadataImportOperation{
676		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
677	}
678}
679
680// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
681//
682// See documentation of Poll for error-handling information.
683func (op *CreateMetadataImportOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataImport, error) {
684	var resp metastorepb.MetadataImport
685	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
686		return nil, err
687	}
688	return &resp, nil
689}
690
691// Poll fetches the latest state of the long-running operation.
692//
693// Poll also fetches the latest metadata, which can be retrieved by Metadata.
694//
695// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
696// the operation has completed with failure, the error is returned and op.Done will return true.
697// If Poll succeeds and the operation has completed successfully,
698// op.Done will return true, and the response of the operation is returned.
699// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
700func (op *CreateMetadataImportOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataImport, error) {
701	var resp metastorepb.MetadataImport
702	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
703		return nil, err
704	}
705	if !op.Done() {
706		return nil, nil
707	}
708	return &resp, nil
709}
710
711// Metadata returns metadata associated with the long-running operation.
712// Metadata itself does not contact the server, but Poll does.
713// To get the latest metadata, call this method after a successful call to Poll.
714// If the metadata is not available, the returned metadata and error are both nil.
715func (op *CreateMetadataImportOperation) Metadata() (*metastorepb.OperationMetadata, error) {
716	var meta metastorepb.OperationMetadata
717	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
718		return nil, nil
719	} else if err != nil {
720		return nil, err
721	}
722	return &meta, nil
723}
724
725// Done reports whether the long-running operation has completed.
726func (op *CreateMetadataImportOperation) Done() bool {
727	return op.lro.Done()
728}
729
730// Name returns the name of the long-running operation.
731// The name is assigned by the server and is unique within the service from which the operation is created.
732func (op *CreateMetadataImportOperation) Name() string {
733	return op.lro.Name()
734}
735
736// CreateServiceOperation manages a long-running operation from CreateService.
737type CreateServiceOperation struct {
738	lro *longrunning.Operation
739}
740
741// CreateServiceOperation returns a new CreateServiceOperation from a given name.
742// The name must be that of a previously created CreateServiceOperation, possibly from a different process.
743func (c *dataprocMetastoreGRPCClient) CreateServiceOperation(name string) *CreateServiceOperation {
744	return &CreateServiceOperation{
745		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
746	}
747}
748
749// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
750//
751// See documentation of Poll for error-handling information.
752func (op *CreateServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Service, error) {
753	var resp metastorepb.Service
754	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
755		return nil, err
756	}
757	return &resp, nil
758}
759
760// Poll fetches the latest state of the long-running operation.
761//
762// Poll also fetches the latest metadata, which can be retrieved by Metadata.
763//
764// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
765// the operation has completed with failure, the error is returned and op.Done will return true.
766// If Poll succeeds and the operation has completed successfully,
767// op.Done will return true, and the response of the operation is returned.
768// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
769func (op *CreateServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Service, error) {
770	var resp metastorepb.Service
771	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
772		return nil, err
773	}
774	if !op.Done() {
775		return nil, nil
776	}
777	return &resp, nil
778}
779
780// Metadata returns metadata associated with the long-running operation.
781// Metadata itself does not contact the server, but Poll does.
782// To get the latest metadata, call this method after a successful call to Poll.
783// If the metadata is not available, the returned metadata and error are both nil.
784func (op *CreateServiceOperation) Metadata() (*metastorepb.OperationMetadata, error) {
785	var meta metastorepb.OperationMetadata
786	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
787		return nil, nil
788	} else if err != nil {
789		return nil, err
790	}
791	return &meta, nil
792}
793
794// Done reports whether the long-running operation has completed.
795func (op *CreateServiceOperation) Done() bool {
796	return op.lro.Done()
797}
798
799// Name returns the name of the long-running operation.
800// The name is assigned by the server and is unique within the service from which the operation is created.
801func (op *CreateServiceOperation) Name() string {
802	return op.lro.Name()
803}
804
805// DeleteServiceOperation manages a long-running operation from DeleteService.
806type DeleteServiceOperation struct {
807	lro *longrunning.Operation
808}
809
810// DeleteServiceOperation returns a new DeleteServiceOperation from a given name.
811// The name must be that of a previously created DeleteServiceOperation, possibly from a different process.
812func (c *dataprocMetastoreGRPCClient) DeleteServiceOperation(name string) *DeleteServiceOperation {
813	return &DeleteServiceOperation{
814		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
815	}
816}
817
818// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
819//
820// See documentation of Poll for error-handling information.
821func (op *DeleteServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
822	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
823}
824
825// Poll fetches the latest state of the long-running operation.
826//
827// Poll also fetches the latest metadata, which can be retrieved by Metadata.
828//
829// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
830// the operation has completed with failure, the error is returned and op.Done will return true.
831// If Poll succeeds and the operation has completed successfully,
832// op.Done will return true, and the response of the operation is returned.
833// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
834func (op *DeleteServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
835	return op.lro.Poll(ctx, nil, opts...)
836}
837
838// Metadata returns metadata associated with the long-running operation.
839// Metadata itself does not contact the server, but Poll does.
840// To get the latest metadata, call this method after a successful call to Poll.
841// If the metadata is not available, the returned metadata and error are both nil.
842func (op *DeleteServiceOperation) Metadata() (*metastorepb.OperationMetadata, error) {
843	var meta metastorepb.OperationMetadata
844	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
845		return nil, nil
846	} else if err != nil {
847		return nil, err
848	}
849	return &meta, nil
850}
851
852// Done reports whether the long-running operation has completed.
853func (op *DeleteServiceOperation) Done() bool {
854	return op.lro.Done()
855}
856
857// Name returns the name of the long-running operation.
858// The name is assigned by the server and is unique within the service from which the operation is created.
859func (op *DeleteServiceOperation) Name() string {
860	return op.lro.Name()
861}
862
863// ExportMetadataOperation manages a long-running operation from ExportMetadata.
864type ExportMetadataOperation struct {
865	lro *longrunning.Operation
866}
867
868// ExportMetadataOperation returns a new ExportMetadataOperation from a given name.
869// The name must be that of a previously created ExportMetadataOperation, possibly from a different process.
870func (c *dataprocMetastoreGRPCClient) ExportMetadataOperation(name string) *ExportMetadataOperation {
871	return &ExportMetadataOperation{
872		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
873	}
874}
875
876// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
877//
878// See documentation of Poll for error-handling information.
879func (op *ExportMetadataOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataExport, error) {
880	var resp metastorepb.MetadataExport
881	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
882		return nil, err
883	}
884	return &resp, nil
885}
886
887// Poll fetches the latest state of the long-running operation.
888//
889// Poll also fetches the latest metadata, which can be retrieved by Metadata.
890//
891// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
892// the operation has completed with failure, the error is returned and op.Done will return true.
893// If Poll succeeds and the operation has completed successfully,
894// op.Done will return true, and the response of the operation is returned.
895// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
896func (op *ExportMetadataOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataExport, error) {
897	var resp metastorepb.MetadataExport
898	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
899		return nil, err
900	}
901	if !op.Done() {
902		return nil, nil
903	}
904	return &resp, nil
905}
906
907// Metadata returns metadata associated with the long-running operation.
908// Metadata itself does not contact the server, but Poll does.
909// To get the latest metadata, call this method after a successful call to Poll.
910// If the metadata is not available, the returned metadata and error are both nil.
911func (op *ExportMetadataOperation) Metadata() (*metastorepb.OperationMetadata, error) {
912	var meta metastorepb.OperationMetadata
913	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
914		return nil, nil
915	} else if err != nil {
916		return nil, err
917	}
918	return &meta, nil
919}
920
921// Done reports whether the long-running operation has completed.
922func (op *ExportMetadataOperation) Done() bool {
923	return op.lro.Done()
924}
925
926// Name returns the name of the long-running operation.
927// The name is assigned by the server and is unique within the service from which the operation is created.
928func (op *ExportMetadataOperation) Name() string {
929	return op.lro.Name()
930}
931
932// UpdateMetadataImportOperation manages a long-running operation from UpdateMetadataImport.
933type UpdateMetadataImportOperation struct {
934	lro *longrunning.Operation
935}
936
937// UpdateMetadataImportOperation returns a new UpdateMetadataImportOperation from a given name.
938// The name must be that of a previously created UpdateMetadataImportOperation, possibly from a different process.
939func (c *dataprocMetastoreGRPCClient) UpdateMetadataImportOperation(name string) *UpdateMetadataImportOperation {
940	return &UpdateMetadataImportOperation{
941		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
942	}
943}
944
945// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
946//
947// See documentation of Poll for error-handling information.
948func (op *UpdateMetadataImportOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataImport, error) {
949	var resp metastorepb.MetadataImport
950	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
951		return nil, err
952	}
953	return &resp, nil
954}
955
956// Poll fetches the latest state of the long-running operation.
957//
958// Poll also fetches the latest metadata, which can be retrieved by Metadata.
959//
960// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
961// the operation has completed with failure, the error is returned and op.Done will return true.
962// If Poll succeeds and the operation has completed successfully,
963// op.Done will return true, and the response of the operation is returned.
964// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
965func (op *UpdateMetadataImportOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.MetadataImport, error) {
966	var resp metastorepb.MetadataImport
967	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
968		return nil, err
969	}
970	if !op.Done() {
971		return nil, nil
972	}
973	return &resp, nil
974}
975
976// Metadata returns metadata associated with the long-running operation.
977// Metadata itself does not contact the server, but Poll does.
978// To get the latest metadata, call this method after a successful call to Poll.
979// If the metadata is not available, the returned metadata and error are both nil.
980func (op *UpdateMetadataImportOperation) Metadata() (*metastorepb.OperationMetadata, error) {
981	var meta metastorepb.OperationMetadata
982	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
983		return nil, nil
984	} else if err != nil {
985		return nil, err
986	}
987	return &meta, nil
988}
989
990// Done reports whether the long-running operation has completed.
991func (op *UpdateMetadataImportOperation) Done() bool {
992	return op.lro.Done()
993}
994
995// Name returns the name of the long-running operation.
996// The name is assigned by the server and is unique within the service from which the operation is created.
997func (op *UpdateMetadataImportOperation) Name() string {
998	return op.lro.Name()
999}
1000
1001// UpdateServiceOperation manages a long-running operation from UpdateService.
1002type UpdateServiceOperation struct {
1003	lro *longrunning.Operation
1004}
1005
1006// UpdateServiceOperation returns a new UpdateServiceOperation from a given name.
1007// The name must be that of a previously created UpdateServiceOperation, possibly from a different process.
1008func (c *dataprocMetastoreGRPCClient) UpdateServiceOperation(name string) *UpdateServiceOperation {
1009	return &UpdateServiceOperation{
1010		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
1011	}
1012}
1013
1014// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
1015//
1016// See documentation of Poll for error-handling information.
1017func (op *UpdateServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Service, error) {
1018	var resp metastorepb.Service
1019	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
1020		return nil, err
1021	}
1022	return &resp, nil
1023}
1024
1025// Poll fetches the latest state of the long-running operation.
1026//
1027// Poll also fetches the latest metadata, which can be retrieved by Metadata.
1028//
1029// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
1030// the operation has completed with failure, the error is returned and op.Done will return true.
1031// If Poll succeeds and the operation has completed successfully,
1032// op.Done will return true, and the response of the operation is returned.
1033// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
1034func (op *UpdateServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*metastorepb.Service, error) {
1035	var resp metastorepb.Service
1036	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
1037		return nil, err
1038	}
1039	if !op.Done() {
1040		return nil, nil
1041	}
1042	return &resp, nil
1043}
1044
1045// Metadata returns metadata associated with the long-running operation.
1046// Metadata itself does not contact the server, but Poll does.
1047// To get the latest metadata, call this method after a successful call to Poll.
1048// If the metadata is not available, the returned metadata and error are both nil.
1049func (op *UpdateServiceOperation) Metadata() (*metastorepb.OperationMetadata, error) {
1050	var meta metastorepb.OperationMetadata
1051	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
1052		return nil, nil
1053	} else if err != nil {
1054		return nil, err
1055	}
1056	return &meta, nil
1057}
1058
1059// Done reports whether the long-running operation has completed.
1060func (op *UpdateServiceOperation) Done() bool {
1061	return op.lro.Done()
1062}
1063
1064// Name returns the name of the long-running operation.
1065// The name is assigned by the server and is unique within the service from which the operation is created.
1066func (op *UpdateServiceOperation) Name() string {
1067	return op.lro.Name()
1068}
1069
1070// MetadataImportIterator manages a stream of *metastorepb.MetadataImport.
1071type MetadataImportIterator struct {
1072	items    []*metastorepb.MetadataImport
1073	pageInfo *iterator.PageInfo
1074	nextFunc func() error
1075
1076	// Response is the raw response for the current page.
1077	// It must be cast to the RPC response type.
1078	// Calling Next() or InternalFetch() updates this value.
1079	Response interface{}
1080
1081	// InternalFetch is for use by the Google Cloud Libraries only.
1082	// It is not part of the stable interface of this package.
1083	//
1084	// InternalFetch returns results from a single call to the underlying RPC.
1085	// The number of results is no greater than pageSize.
1086	// If there are no more results, nextPageToken is empty and err is nil.
1087	InternalFetch func(pageSize int, pageToken string) (results []*metastorepb.MetadataImport, nextPageToken string, err error)
1088}
1089
1090// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
1091func (it *MetadataImportIterator) PageInfo() *iterator.PageInfo {
1092	return it.pageInfo
1093}
1094
1095// Next returns the next result. Its second return value is iterator.Done if there are no more
1096// results. Once Next returns Done, all subsequent calls will return Done.
1097func (it *MetadataImportIterator) Next() (*metastorepb.MetadataImport, error) {
1098	var item *metastorepb.MetadataImport
1099	if err := it.nextFunc(); err != nil {
1100		return item, err
1101	}
1102	item = it.items[0]
1103	it.items = it.items[1:]
1104	return item, nil
1105}
1106
1107func (it *MetadataImportIterator) bufLen() int {
1108	return len(it.items)
1109}
1110
1111func (it *MetadataImportIterator) takeBuf() interface{} {
1112	b := it.items
1113	it.items = nil
1114	return b
1115}
1116
1117// ServiceIterator manages a stream of *metastorepb.Service.
1118type ServiceIterator struct {
1119	items    []*metastorepb.Service
1120	pageInfo *iterator.PageInfo
1121	nextFunc func() error
1122
1123	// Response is the raw response for the current page.
1124	// It must be cast to the RPC response type.
1125	// Calling Next() or InternalFetch() updates this value.
1126	Response interface{}
1127
1128	// InternalFetch is for use by the Google Cloud Libraries only.
1129	// It is not part of the stable interface of this package.
1130	//
1131	// InternalFetch returns results from a single call to the underlying RPC.
1132	// The number of results is no greater than pageSize.
1133	// If there are no more results, nextPageToken is empty and err is nil.
1134	InternalFetch func(pageSize int, pageToken string) (results []*metastorepb.Service, nextPageToken string, err error)
1135}
1136
1137// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
1138func (it *ServiceIterator) PageInfo() *iterator.PageInfo {
1139	return it.pageInfo
1140}
1141
1142// Next returns the next result. Its second return value is iterator.Done if there are no more
1143// results. Once Next returns Done, all subsequent calls will return Done.
1144func (it *ServiceIterator) Next() (*metastorepb.Service, error) {
1145	var item *metastorepb.Service
1146	if err := it.nextFunc(); err != nil {
1147		return item, err
1148	}
1149	item = it.items[0]
1150	it.items = it.items[1:]
1151	return item, nil
1152}
1153
1154func (it *ServiceIterator) bufLen() int {
1155	return len(it.items)
1156}
1157
1158func (it *ServiceIterator) takeBuf() interface{} {
1159	b := it.items
1160	it.items = nil
1161	return b
1162}
1163