Debian Codegraph @

filestore/apiv1/cloud_filestore_manager_client.go

raw
1 // Copyright 2025 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 filestore
18
19 import (
20 "bytes"
21 "context"
22 "fmt"
23 "log/slog"
24 "math"
25 "net/http"
26 "net/url"
27 "time"
28
29 filestorepb "cloud.google.com/go/filestore/apiv1/filestorepb"
30 "cloud.google.com/go/longrunning"
31 lroauto "cloud.google.com/go/longrunning/autogen"
32 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
33 gax "github.com/googleapis/gax-go/v2"
34 "google.golang.org/api/iterator"
35 "google.golang.org/api/option"
36 "google.golang.org/api/option/internaloption"
37 gtransport "google.golang.org/api/transport/grpc"
38 httptransport "google.golang.org/api/transport/http"
39 locationpb "google.golang.org/genproto/googleapis/cloud/location"
40 "google.golang.org/grpc"
41 "google.golang.org/grpc/codes"
42 "google.golang.org/protobuf/encoding/protojson"
43 "google.golang.org/protobuf/proto"
44 )
45
46 var newCloudFilestoreManagerClientHook clientHook
47
48 // CloudFilestoreManagerCallOptions contains the retry settings for each method of CloudFilestoreManagerClient.
49 type CloudFilestoreManagerCallOptions struct {
50 ListInstances []gax.CallOption
51 GetInstance []gax.CallOption
52 CreateInstance []gax.CallOption
53 UpdateInstance []gax.CallOption
54 RestoreInstance []gax.CallOption
55 RevertInstance []gax.CallOption
56 DeleteInstance []gax.CallOption
57 ListSnapshots []gax.CallOption
58 GetSnapshot []gax.CallOption
59 CreateSnapshot []gax.CallOption
60 DeleteSnapshot []gax.CallOption
61 UpdateSnapshot []gax.CallOption
62 ListBackups []gax.CallOption
63 GetBackup []gax.CallOption
64 CreateBackup []gax.CallOption
65 DeleteBackup []gax.CallOption
66 UpdateBackup []gax.CallOption
67 PromoteReplica []gax.CallOption
68 GetLocation []gax.CallOption
69 ListLocations []gax.CallOption
70 CancelOperation []gax.CallOption
71 DeleteOperation []gax.CallOption
72 GetOperation []gax.CallOption
73 ListOperations []gax.CallOption
74 }
75
76 func defaultCloudFilestoreManagerGRPCClientOptions() []option.ClientOption {
77 return []option.ClientOption{
78 internaloption.WithDefaultEndpoint("file.googleapis.com:443"),
79 internaloption.WithDefaultEndpointTemplate("file.UNIVERSE_DOMAIN:443"),
80 internaloption.WithDefaultMTLSEndpoint("file.mtls.googleapis.com:443"),
81 internaloption.WithDefaultUniverseDomain("googleapis.com"),
82 internaloption.WithDefaultAudience("https://file.googleapis.com/"),
83 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
84 internaloption.EnableJwtWithScope(),
85 internaloption.EnableNewAuthLibrary(),
86 option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
87 grpc.MaxCallRecvMsgSize(math.MaxInt32))),
88 }
89 }
90
91 func defaultCloudFilestoreManagerCallOptions() *CloudFilestoreManagerCallOptions {
92 return &CloudFilestoreManagerCallOptions{
93 ListInstances: []gax.CallOption{
94 gax.WithTimeout(60000 * time.Millisecond),
95 gax.WithRetry(func() gax.Retryer {
96 return gax.OnCodes([]codes.Code{
97 codes.Unavailable,
98 }, gax.Backoff{
99 Initial: 250 * time.Millisecond,
100 Max: 32000 * time.Millisecond,
101 Multiplier: 1.30,
102 })
103 }),
104 },
105 GetInstance: []gax.CallOption{
106 gax.WithTimeout(60000 * time.Millisecond),
107 gax.WithRetry(func() gax.Retryer {
108 return gax.OnCodes([]codes.Code{
109 codes.Unavailable,
110 }, gax.Backoff{
111 Initial: 250 * time.Millisecond,
112 Max: 32000 * time.Millisecond,
113 Multiplier: 1.30,
114 })
115 }),
116 },
117 CreateInstance: []gax.CallOption{
118 gax.WithTimeout(60000000 * time.Millisecond),
119 },
120 UpdateInstance: []gax.CallOption{
121 gax.WithTimeout(14400000 * time.Millisecond),
122 },
123 RestoreInstance: []gax.CallOption{
124 gax.WithTimeout(60000000 * time.Millisecond),
125 },
126 RevertInstance: []gax.CallOption{},
127 DeleteInstance: []gax.CallOption{
128 gax.WithTimeout(600000 * time.Millisecond),
129 },
130 ListSnapshots: []gax.CallOption{},
131 GetSnapshot: []gax.CallOption{},
132 CreateSnapshot: []gax.CallOption{},
133 DeleteSnapshot: []gax.CallOption{},
134 UpdateSnapshot: []gax.CallOption{},
135 ListBackups: []gax.CallOption{
136 gax.WithTimeout(60000 * time.Millisecond),
137 gax.WithRetry(func() gax.Retryer {
138 return gax.OnCodes([]codes.Code{
139 codes.Unavailable,
140 }, gax.Backoff{
141 Initial: 250 * time.Millisecond,
142 Max: 32000 * time.Millisecond,
143 Multiplier: 1.30,
144 })
145 }),
146 },
147 GetBackup: []gax.CallOption{
148 gax.WithTimeout(60000 * time.Millisecond),
149 gax.WithRetry(func() gax.Retryer {
150 return gax.OnCodes([]codes.Code{
151 codes.Unavailable,
152 }, gax.Backoff{
153 Initial: 250 * time.Millisecond,
154 Max: 32000 * time.Millisecond,
155 Multiplier: 1.30,
156 })
157 }),
158 },
159 CreateBackup: []gax.CallOption{
160 gax.WithTimeout(60000000 * time.Millisecond),
161 },
162 DeleteBackup: []gax.CallOption{
163 gax.WithTimeout(600000 * time.Millisecond),
164 },
165 UpdateBackup: []gax.CallOption{
166 gax.WithTimeout(600000 * time.Millisecond),
167 },
168 PromoteReplica: []gax.CallOption{},
169 GetLocation: []gax.CallOption{},
170 ListLocations: []gax.CallOption{},
171 CancelOperation: []gax.CallOption{},
172 DeleteOperation: []gax.CallOption{},
173 GetOperation: []gax.CallOption{},
174 ListOperations: []gax.CallOption{},
175 }
176 }
177
178 func defaultCloudFilestoreManagerRESTCallOptions() *CloudFilestoreManagerCallOptions {
179 return &CloudFilestoreManagerCallOptions{
180 ListInstances: []gax.CallOption{
181 gax.WithTimeout(60000 * time.Millisecond),
182 gax.WithRetry(func() gax.Retryer {
183 return gax.OnHTTPCodes(gax.Backoff{
184 Initial: 250 * time.Millisecond,
185 Max: 32000 * time.Millisecond,
186 Multiplier: 1.30,
187 },
188 http.StatusServiceUnavailable)
189 }),
190 },
191 GetInstance: []gax.CallOption{
192 gax.WithTimeout(60000 * time.Millisecond),
193 gax.WithRetry(func() gax.Retryer {
194 return gax.OnHTTPCodes(gax.Backoff{
195 Initial: 250 * time.Millisecond,
196 Max: 32000 * time.Millisecond,
197 Multiplier: 1.30,
198 },
199 http.StatusServiceUnavailable)
200 }),
201 },
202 CreateInstance: []gax.CallOption{
203 gax.WithTimeout(60000000 * time.Millisecond),
204 },
205 UpdateInstance: []gax.CallOption{
206 gax.WithTimeout(14400000 * time.Millisecond),
207 },
208 RestoreInstance: []gax.CallOption{
209 gax.WithTimeout(60000000 * time.Millisecond),
210 },
211 RevertInstance: []gax.CallOption{},
212 DeleteInstance: []gax.CallOption{
213 gax.WithTimeout(600000 * time.Millisecond),
214 },
215 ListSnapshots: []gax.CallOption{},
216 GetSnapshot: []gax.CallOption{},
217 CreateSnapshot: []gax.CallOption{},
218 DeleteSnapshot: []gax.CallOption{},
219 UpdateSnapshot: []gax.CallOption{},
220 ListBackups: []gax.CallOption{
221 gax.WithTimeout(60000 * time.Millisecond),
222 gax.WithRetry(func() gax.Retryer {
223 return gax.OnHTTPCodes(gax.Backoff{
224 Initial: 250 * time.Millisecond,
225 Max: 32000 * time.Millisecond,
226 Multiplier: 1.30,
227 },
228 http.StatusServiceUnavailable)
229 }),
230 },
231 GetBackup: []gax.CallOption{
232 gax.WithTimeout(60000 * time.Millisecond),
233 gax.WithRetry(func() gax.Retryer {
234 return gax.OnHTTPCodes(gax.Backoff{
235 Initial: 250 * time.Millisecond,
236 Max: 32000 * time.Millisecond,
237 Multiplier: 1.30,
238 },
239 http.StatusServiceUnavailable)
240 }),
241 },
242 CreateBackup: []gax.CallOption{
243 gax.WithTimeout(60000000 * time.Millisecond),
244 },
245 DeleteBackup: []gax.CallOption{
246 gax.WithTimeout(600000 * time.Millisecond),
247 },
248 UpdateBackup: []gax.CallOption{
249 gax.WithTimeout(600000 * time.Millisecond),
250 },
251 PromoteReplica: []gax.CallOption{},
252 GetLocation: []gax.CallOption{},
253 ListLocations: []gax.CallOption{},
254 CancelOperation: []gax.CallOption{},
255 DeleteOperation: []gax.CallOption{},
256 GetOperation: []gax.CallOption{},
257 ListOperations: []gax.CallOption{},
258 }
259 }
260
261 // internalCloudFilestoreManagerClient is an interface that defines the methods available from Cloud Filestore API.
262 type internalCloudFilestoreManagerClient interface {
263 Close() error
264 setGoogleClientInfo(...string)
265 Connection() *grpc.ClientConn
266 ListInstances(context.Context, *filestorepb.ListInstancesRequest, ...gax.CallOption) *InstanceIterator
267 GetInstance(context.Context, *filestorepb.GetInstanceRequest, ...gax.CallOption) (*filestorepb.Instance, error)
268 CreateInstance(context.Context, *filestorepb.CreateInstanceRequest, ...gax.CallOption) (*CreateInstanceOperation, error)
269 CreateInstanceOperation(name string) *CreateInstanceOperation
270 UpdateInstance(context.Context, *filestorepb.UpdateInstanceRequest, ...gax.CallOption) (*UpdateInstanceOperation, error)
271 UpdateInstanceOperation(name string) *UpdateInstanceOperation
272 RestoreInstance(context.Context, *filestorepb.RestoreInstanceRequest, ...gax.CallOption) (*RestoreInstanceOperation, error)
273 RestoreInstanceOperation(name string) *RestoreInstanceOperation
274 RevertInstance(context.Context, *filestorepb.RevertInstanceRequest, ...gax.CallOption) (*RevertInstanceOperation, error)
275 RevertInstanceOperation(name string) *RevertInstanceOperation
276 DeleteInstance(context.Context, *filestorepb.DeleteInstanceRequest, ...gax.CallOption) (*DeleteInstanceOperation, error)
277 DeleteInstanceOperation(name string) *DeleteInstanceOperation
278 ListSnapshots(context.Context, *filestorepb.ListSnapshotsRequest, ...gax.CallOption) *SnapshotIterator
279 GetSnapshot(context.Context, *filestorepb.GetSnapshotRequest, ...gax.CallOption) (*filestorepb.Snapshot, error)
280 CreateSnapshot(context.Context, *filestorepb.CreateSnapshotRequest, ...gax.CallOption) (*CreateSnapshotOperation, error)
281 CreateSnapshotOperation(name string) *CreateSnapshotOperation
282 DeleteSnapshot(context.Context, *filestorepb.DeleteSnapshotRequest, ...gax.CallOption) (*DeleteSnapshotOperation, error)
283 DeleteSnapshotOperation(name string) *DeleteSnapshotOperation
284 UpdateSnapshot(context.Context, *filestorepb.UpdateSnapshotRequest, ...gax.CallOption) (*UpdateSnapshotOperation, error)
285 UpdateSnapshotOperation(name string) *UpdateSnapshotOperation
286 ListBackups(context.Context, *filestorepb.ListBackupsRequest, ...gax.CallOption) *BackupIterator
287 GetBackup(context.Context, *filestorepb.GetBackupRequest, ...gax.CallOption) (*filestorepb.Backup, error)
288 CreateBackup(context.Context, *filestorepb.CreateBackupRequest, ...gax.CallOption) (*CreateBackupOperation, error)
289 CreateBackupOperation(name string) *CreateBackupOperation
290 DeleteBackup(context.Context, *filestorepb.DeleteBackupRequest, ...gax.CallOption) (*DeleteBackupOperation, error)
291 DeleteBackupOperation(name string) *DeleteBackupOperation
292 UpdateBackup(context.Context, *filestorepb.UpdateBackupRequest, ...gax.CallOption) (*UpdateBackupOperation, error)
293 UpdateBackupOperation(name string) *UpdateBackupOperation
294 PromoteReplica(context.Context, *filestorepb.PromoteReplicaRequest, ...gax.CallOption) (*PromoteReplicaOperation, error)
295 PromoteReplicaOperation(name string) *PromoteReplicaOperation
296 GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error)
297 ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator
298 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
299 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
300 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
301 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
302 }
303
304 // CloudFilestoreManagerClient is a client for interacting with Cloud Filestore API.
305 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
306 //
307 // Configures and manages Filestore resources.
308 //
309 // Filestore Manager v1.
310 //
311 // The file.googleapis.com service implements the Filestore API and
312 // defines the following resource model for managing instances:
313 //
314 // The service works with a collection of cloud projects, named: /projects/*
315 //
316 // Each project has a collection of available locations, named: /locations/*
317 //
318 // Each location has a collection of instances and backups, named:
319 // /instances/* and /backups/* respectively.
320 //
321 // As such, Filestore instances are resources of the form:
322 // /projects/{project_number}/locations/{location_id}/instances/{instance_id}
323 // and backups are resources of the form:
324 // /projects/{project_number}/locations/{location_id}/backup/{backup_id}
325 //
326 // Note that location_id must be a Google Cloud zone for instances, but
327 // a Google Cloud region for backups; for example:
328 //
329 // projects/12345/locations/us-central1-c/instances/my-filestore
330 //
331 // projects/12345/locations/us-central1/backups/my-backup
332 type CloudFilestoreManagerClient struct {
333 // The internal transport-dependent client.
334 internalClient internalCloudFilestoreManagerClient
335
336 // The call options for this service.
337 CallOptions *CloudFilestoreManagerCallOptions
338
339 // LROClient is used internally to handle long-running operations.
340 // It is exposed so that its CallOptions can be modified if required.
341 // Users should not Close this client.
342 LROClient *lroauto.OperationsClient
343 }
344
345 // Wrapper methods routed to the internal client.
346
347 // Close closes the connection to the API service. The user should invoke this when
348 // the client is no longer required.
349 func (c *CloudFilestoreManagerClient) Close() error {
350 return c.internalClient.Close()
351 }
352
353 // setGoogleClientInfo sets the name and version of the application in
354 // the `x-goog-api-client` header passed on each request. Intended for
355 // use by Google-written clients.
356 func (c *CloudFilestoreManagerClient) setGoogleClientInfo(keyval ...string) {
357 c.internalClient.setGoogleClientInfo(keyval...)
358 }
359
360 // Connection returns a connection to the API service.
361 //
362 // Deprecated: Connections are now pooled so this method does not always
363 // return the same resource.
364 func (c *CloudFilestoreManagerClient) Connection() *grpc.ClientConn {
365 return c.internalClient.Connection()
366 }
367
368 // ListInstances lists all instances in a project for either a specified location
369 // or for all locations.
370 func (c *CloudFilestoreManagerClient) ListInstances(ctx context.Context, req *filestorepb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator {
371 return c.internalClient.ListInstances(ctx, req, opts...)
372 }
373
374 // GetInstance gets the details of a specific instance.
375 func (c *CloudFilestoreManagerClient) GetInstance(ctx context.Context, req *filestorepb.GetInstanceRequest, opts ...gax.CallOption) (*filestorepb.Instance, error) {
376 return c.internalClient.GetInstance(ctx, req, opts...)
377 }
378
379 // CreateInstance creates an instance.
380 // When creating from a backup, the capacity of the new instance needs to be
381 // equal to or larger than the capacity of the backup (and also equal to or
382 // larger than the minimum capacity of the tier).
383 func (c *CloudFilestoreManagerClient) CreateInstance(ctx context.Context, req *filestorepb.CreateInstanceRequest, opts ...gax.CallOption) (*CreateInstanceOperation, error) {
384 return c.internalClient.CreateInstance(ctx, req, opts...)
385 }
386
387 // CreateInstanceOperation returns a new CreateInstanceOperation from a given name.
388 // The name must be that of a previously created CreateInstanceOperation, possibly from a different process.
389 func (c *CloudFilestoreManagerClient) CreateInstanceOperation(name string) *CreateInstanceOperation {
390 return c.internalClient.CreateInstanceOperation(name)
391 }
392
393 // UpdateInstance updates the settings of a specific instance.
394 func (c *CloudFilestoreManagerClient) UpdateInstance(ctx context.Context, req *filestorepb.UpdateInstanceRequest, opts ...gax.CallOption) (*UpdateInstanceOperation, error) {
395 return c.internalClient.UpdateInstance(ctx, req, opts...)
396 }
397
398 // UpdateInstanceOperation returns a new UpdateInstanceOperation from a given name.
399 // The name must be that of a previously created UpdateInstanceOperation, possibly from a different process.
400 func (c *CloudFilestoreManagerClient) UpdateInstanceOperation(name string) *UpdateInstanceOperation {
401 return c.internalClient.UpdateInstanceOperation(name)
402 }
403
404 // RestoreInstance restores an existing instance’s file share from a backup.
405 //
406 // The capacity of the instance needs to be equal to or larger than the
407 // capacity of the backup (and also equal to or larger than the minimum
408 // capacity of the tier).
409 func (c *CloudFilestoreManagerClient) RestoreInstance(ctx context.Context, req *filestorepb.RestoreInstanceRequest, opts ...gax.CallOption) (*RestoreInstanceOperation, error) {
410 return c.internalClient.RestoreInstance(ctx, req, opts...)
411 }
412
413 // RestoreInstanceOperation returns a new RestoreInstanceOperation from a given name.
414 // The name must be that of a previously created RestoreInstanceOperation, possibly from a different process.
415 func (c *CloudFilestoreManagerClient) RestoreInstanceOperation(name string) *RestoreInstanceOperation {
416 return c.internalClient.RestoreInstanceOperation(name)
417 }
418
419 // RevertInstance revert an existing instance’s file system to a specified snapshot.
420 func (c *CloudFilestoreManagerClient) RevertInstance(ctx context.Context, req *filestorepb.RevertInstanceRequest, opts ...gax.CallOption) (*RevertInstanceOperation, error) {
421 return c.internalClient.RevertInstance(ctx, req, opts...)
422 }
423
424 // RevertInstanceOperation returns a new RevertInstanceOperation from a given name.
425 // The name must be that of a previously created RevertInstanceOperation, possibly from a different process.
426 func (c *CloudFilestoreManagerClient) RevertInstanceOperation(name string) *RevertInstanceOperation {
427 return c.internalClient.RevertInstanceOperation(name)
428 }
429
430 // DeleteInstance deletes an instance.
431 func (c *CloudFilestoreManagerClient) DeleteInstance(ctx context.Context, req *filestorepb.DeleteInstanceRequest, opts ...gax.CallOption) (*DeleteInstanceOperation, error) {
432 return c.internalClient.DeleteInstance(ctx, req, opts...)
433 }
434
435 // DeleteInstanceOperation returns a new DeleteInstanceOperation from a given name.
436 // The name must be that of a previously created DeleteInstanceOperation, possibly from a different process.
437 func (c *CloudFilestoreManagerClient) DeleteInstanceOperation(name string) *DeleteInstanceOperation {
438 return c.internalClient.DeleteInstanceOperation(name)
439 }
440
441 // ListSnapshots lists all snapshots in a project for either a specified location
442 // or for all locations.
443 func (c *CloudFilestoreManagerClient) ListSnapshots(ctx context.Context, req *filestorepb.ListSnapshotsRequest, opts ...gax.CallOption) *SnapshotIterator {
444 return c.internalClient.ListSnapshots(ctx, req, opts...)
445 }
446
447 // GetSnapshot gets the details of a specific snapshot.
448 func (c *CloudFilestoreManagerClient) GetSnapshot(ctx context.Context, req *filestorepb.GetSnapshotRequest, opts ...gax.CallOption) (*filestorepb.Snapshot, error) {
449 return c.internalClient.GetSnapshot(ctx, req, opts...)
450 }
451
452 // CreateSnapshot creates a snapshot.
453 func (c *CloudFilestoreManagerClient) CreateSnapshot(ctx context.Context, req *filestorepb.CreateSnapshotRequest, opts ...gax.CallOption) (*CreateSnapshotOperation, error) {
454 return c.internalClient.CreateSnapshot(ctx, req, opts...)
455 }
456
457 // CreateSnapshotOperation returns a new CreateSnapshotOperation from a given name.
458 // The name must be that of a previously created CreateSnapshotOperation, possibly from a different process.
459 func (c *CloudFilestoreManagerClient) CreateSnapshotOperation(name string) *CreateSnapshotOperation {
460 return c.internalClient.CreateSnapshotOperation(name)
461 }
462
463 // DeleteSnapshot deletes a snapshot.
464 func (c *CloudFilestoreManagerClient) DeleteSnapshot(ctx context.Context, req *filestorepb.DeleteSnapshotRequest, opts ...gax.CallOption) (*DeleteSnapshotOperation, error) {
465 return c.internalClient.DeleteSnapshot(ctx, req, opts...)
466 }
467
468 // DeleteSnapshotOperation returns a new DeleteSnapshotOperation from a given name.
469 // The name must be that of a previously created DeleteSnapshotOperation, possibly from a different process.
470 func (c *CloudFilestoreManagerClient) DeleteSnapshotOperation(name string) *DeleteSnapshotOperation {
471 return c.internalClient.DeleteSnapshotOperation(name)
472 }
473
474 // UpdateSnapshot updates the settings of a specific snapshot.
475 func (c *CloudFilestoreManagerClient) UpdateSnapshot(ctx context.Context, req *filestorepb.UpdateSnapshotRequest, opts ...gax.CallOption) (*UpdateSnapshotOperation, error) {
476 return c.internalClient.UpdateSnapshot(ctx, req, opts...)
477 }
478
479 // UpdateSnapshotOperation returns a new UpdateSnapshotOperation from a given name.
480 // The name must be that of a previously created UpdateSnapshotOperation, possibly from a different process.
481 func (c *CloudFilestoreManagerClient) UpdateSnapshotOperation(name string) *UpdateSnapshotOperation {
482 return c.internalClient.UpdateSnapshotOperation(name)
483 }
484
485 // ListBackups lists all backups in a project for either a specified location or for all
486 // locations.
487 func (c *CloudFilestoreManagerClient) ListBackups(ctx context.Context, req *filestorepb.ListBackupsRequest, opts ...gax.CallOption) *BackupIterator {
488 return c.internalClient.ListBackups(ctx, req, opts...)
489 }
490
491 // GetBackup gets the details of a specific backup.
492 func (c *CloudFilestoreManagerClient) GetBackup(ctx context.Context, req *filestorepb.GetBackupRequest, opts ...gax.CallOption) (*filestorepb.Backup, error) {
493 return c.internalClient.GetBackup(ctx, req, opts...)
494 }
495
496 // CreateBackup creates a backup.
497 func (c *CloudFilestoreManagerClient) CreateBackup(ctx context.Context, req *filestorepb.CreateBackupRequest, opts ...gax.CallOption) (*CreateBackupOperation, error) {
498 return c.internalClient.CreateBackup(ctx, req, opts...)
499 }
500
501 // CreateBackupOperation returns a new CreateBackupOperation from a given name.
502 // The name must be that of a previously created CreateBackupOperation, possibly from a different process.
503 func (c *CloudFilestoreManagerClient) CreateBackupOperation(name string) *CreateBackupOperation {
504 return c.internalClient.CreateBackupOperation(name)
505 }
506
507 // DeleteBackup deletes a backup.
508 func (c *CloudFilestoreManagerClient) DeleteBackup(ctx context.Context, req *filestorepb.DeleteBackupRequest, opts ...gax.CallOption) (*DeleteBackupOperation, error) {
509 return c.internalClient.DeleteBackup(ctx, req, opts...)
510 }
511
512 // DeleteBackupOperation returns a new DeleteBackupOperation from a given name.
513 // The name must be that of a previously created DeleteBackupOperation, possibly from a different process.
514 func (c *CloudFilestoreManagerClient) DeleteBackupOperation(name string) *DeleteBackupOperation {
515 return c.internalClient.DeleteBackupOperation(name)
516 }
517
518 // UpdateBackup updates the settings of a specific backup.
519 func (c *CloudFilestoreManagerClient) UpdateBackup(ctx context.Context, req *filestorepb.UpdateBackupRequest, opts ...gax.CallOption) (*UpdateBackupOperation, error) {
520 return c.internalClient.UpdateBackup(ctx, req, opts...)
521 }
522
523 // UpdateBackupOperation returns a new UpdateBackupOperation from a given name.
524 // The name must be that of a previously created UpdateBackupOperation, possibly from a different process.
525 func (c *CloudFilestoreManagerClient) UpdateBackupOperation(name string) *UpdateBackupOperation {
526 return c.internalClient.UpdateBackupOperation(name)
527 }
528
529 // PromoteReplica promote the standby instance (replica).
530 func (c *CloudFilestoreManagerClient) PromoteReplica(ctx context.Context, req *filestorepb.PromoteReplicaRequest, opts ...gax.CallOption) (*PromoteReplicaOperation, error) {
531 return c.internalClient.PromoteReplica(ctx, req, opts...)
532 }
533
534 // PromoteReplicaOperation returns a new PromoteReplicaOperation from a given name.
535 // The name must be that of a previously created PromoteReplicaOperation, possibly from a different process.
536 func (c *CloudFilestoreManagerClient) PromoteReplicaOperation(name string) *PromoteReplicaOperation {
537 return c.internalClient.PromoteReplicaOperation(name)
538 }
539
540 // GetLocation gets information about a location.
541 func (c *CloudFilestoreManagerClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
542 return c.internalClient.GetLocation(ctx, req, opts...)
543 }
544
545 // ListLocations lists information about the supported locations for this service.
546 func (c *CloudFilestoreManagerClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
547 return c.internalClient.ListLocations(ctx, req, opts...)
548 }
549
550 // CancelOperation is a utility method from google.longrunning.Operations.
551 func (c *CloudFilestoreManagerClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
552 return c.internalClient.CancelOperation(ctx, req, opts...)
553 }
554
555 // DeleteOperation is a utility method from google.longrunning.Operations.
556 func (c *CloudFilestoreManagerClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
557 return c.internalClient.DeleteOperation(ctx, req, opts...)
558 }
559
560 // GetOperation is a utility method from google.longrunning.Operations.
561 func (c *CloudFilestoreManagerClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
562 return c.internalClient.GetOperation(ctx, req, opts...)
563 }
564
565 // ListOperations is a utility method from google.longrunning.Operations.
566 func (c *CloudFilestoreManagerClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
567 return c.internalClient.ListOperations(ctx, req, opts...)
568 }
569
570 // cloudFilestoreManagerGRPCClient is a client for interacting with Cloud Filestore API over gRPC transport.
571 //
572 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
573 type cloudFilestoreManagerGRPCClient struct {
574 // Connection pool of gRPC connections to the service.
575 connPool gtransport.ConnPool
576
577 // Points back to the CallOptions field of the containing CloudFilestoreManagerClient
578 CallOptions **CloudFilestoreManagerCallOptions
579
580 // The gRPC API client.
581 cloudFilestoreManagerClient filestorepb.CloudFilestoreManagerClient
582
583 // LROClient is used internally to handle long-running operations.
584 // It is exposed so that its CallOptions can be modified if required.
585 // Users should not Close this client.
586 LROClient **lroauto.OperationsClient
587
588 operationsClient longrunningpb.OperationsClient
589
590 locationsClient locationpb.LocationsClient
591
592 // The x-goog-* metadata to be sent with each request.
593 xGoogHeaders []string
594
595 logger *slog.Logger
596 }
597
598 // NewCloudFilestoreManagerClient creates a new cloud filestore manager client based on gRPC.
599 // The returned client must be Closed when it is done being used to clean up its underlying connections.
600 //
601 // Configures and manages Filestore resources.
602 //
603 // Filestore Manager v1.
604 //
605 // The file.googleapis.com service implements the Filestore API and
606 // defines the following resource model for managing instances:
607 //
608 // The service works with a collection of cloud projects, named: /projects/*
609 //
610 // Each project has a collection of available locations, named: /locations/*
611 //
612 // Each location has a collection of instances and backups, named:
613 // /instances/* and /backups/* respectively.
614 //
615 // As such, Filestore instances are resources of the form:
616 // /projects/{project_number}/locations/{location_id}/instances/{instance_id}
617 // and backups are resources of the form:
618 // /projects/{project_number}/locations/{location_id}/backup/{backup_id}
619 //
620 // Note that location_id must be a Google Cloud zone for instances, but
621 // a Google Cloud region for backups; for example:
622 //
623 // projects/12345/locations/us-central1-c/instances/my-filestore
624 //
625 // projects/12345/locations/us-central1/backups/my-backup
626 func NewCloudFilestoreManagerClient(ctx context.Context, opts ...option.ClientOption) (*CloudFilestoreManagerClient, error) {
627 clientOpts := defaultCloudFilestoreManagerGRPCClientOptions()
628 if newCloudFilestoreManagerClientHook != nil {
629 hookOpts, err := newCloudFilestoreManagerClientHook(ctx, clientHookParams{})
630 if err != nil {
631 return nil, err
632 }
633 clientOpts = append(clientOpts, hookOpts...)
634 }
635
636 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
637 if err != nil {
638 return nil, err
639 }
640 client := CloudFilestoreManagerClient{CallOptions: defaultCloudFilestoreManagerCallOptions()}
641
642 c := &cloudFilestoreManagerGRPCClient{
643 connPool: connPool,
644 cloudFilestoreManagerClient: filestorepb.NewCloudFilestoreManagerClient(connPool),
645 CallOptions: &client.CallOptions,
646 logger: internaloption.GetLogger(opts),
647 operationsClient: longrunningpb.NewOperationsClient(connPool),
648 locationsClient: locationpb.NewLocationsClient(connPool),
649 }
650 c.setGoogleClientInfo()
651
652 client.internalClient = c
653
654 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
655 if err != nil {
656 // This error "should not happen", since we are just reusing old connection pool
657 // and never actually need to dial.
658 // If this does happen, we could leak connp. However, we cannot close conn:
659 // If the user invoked the constructor with option.WithGRPCConn,
660 // we would close a connection that's still in use.
661 // TODO: investigate error conditions.
662 return nil, err
663 }
664 c.LROClient = &client.LROClient
665 return &client, nil
666 }
667
668 // Connection returns a connection to the API service.
669 //
670 // Deprecated: Connections are now pooled so this method does not always
671 // return the same resource.
672 func (c *cloudFilestoreManagerGRPCClient) Connection() *grpc.ClientConn {
673 return c.connPool.Conn()
674 }
675
676 // setGoogleClientInfo sets the name and version of the application in
677 // the `x-goog-api-client` header passed on each request. Intended for
678 // use by Google-written clients.
679 func (c *cloudFilestoreManagerGRPCClient) setGoogleClientInfo(keyval ...string) {
680 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
681 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
682 c.xGoogHeaders = []string{
683 "x-goog-api-client", gax.XGoogHeader(kv...),
684 }
685 }
686
687 // Close closes the connection to the API service. The user should invoke this when
688 // the client is no longer required.
689 func (c *cloudFilestoreManagerGRPCClient) Close() error {
690 return c.connPool.Close()
691 }
692
693 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
694 type cloudFilestoreManagerRESTClient struct {
695 // The http endpoint to connect to.
696 endpoint string
697
698 // The http client.
699 httpClient *http.Client
700
701 // LROClient is used internally to handle long-running operations.
702 // It is exposed so that its CallOptions can be modified if required.
703 // Users should not Close this client.
704 LROClient **lroauto.OperationsClient
705
706 // The x-goog-* headers to be sent with each request.
707 xGoogHeaders []string
708
709 // Points back to the CallOptions field of the containing CloudFilestoreManagerClient
710 CallOptions **CloudFilestoreManagerCallOptions
711
712 logger *slog.Logger
713 }
714
715 // NewCloudFilestoreManagerRESTClient creates a new cloud filestore manager rest client.
716 //
717 // Configures and manages Filestore resources.
718 //
719 // Filestore Manager v1.
720 //
721 // The file.googleapis.com service implements the Filestore API and
722 // defines the following resource model for managing instances:
723 //
724 // The service works with a collection of cloud projects, named: /projects/*
725 //
726 // Each project has a collection of available locations, named: /locations/*
727 //
728 // Each location has a collection of instances and backups, named:
729 // /instances/* and /backups/* respectively.
730 //
731 // As such, Filestore instances are resources of the form:
732 // /projects/{project_number}/locations/{location_id}/instances/{instance_id}
733 // and backups are resources of the form:
734 // /projects/{project_number}/locations/{location_id}/backup/{backup_id}
735 //
736 // Note that location_id must be a Google Cloud zone for instances, but
737 // a Google Cloud region for backups; for example:
738 //
739 // projects/12345/locations/us-central1-c/instances/my-filestore
740 //
741 // projects/12345/locations/us-central1/backups/my-backup
742 func NewCloudFilestoreManagerRESTClient(ctx context.Context, opts ...option.ClientOption) (*CloudFilestoreManagerClient, error) {
743 clientOpts := append(defaultCloudFilestoreManagerRESTClientOptions(), opts...)
744 httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
745 if err != nil {
746 return nil, err
747 }
748
749 callOpts := defaultCloudFilestoreManagerRESTCallOptions()
750 c := &cloudFilestoreManagerRESTClient{
751 endpoint: endpoint,
752 httpClient: httpClient,
753 CallOptions: &callOpts,
754 logger: internaloption.GetLogger(opts),
755 }
756 c.setGoogleClientInfo()
757
758 lroOpts := []option.ClientOption{
759 option.WithHTTPClient(httpClient),
760 option.WithEndpoint(endpoint),
761 }
762 opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
763 if err != nil {
764 return nil, err
765 }
766 c.LROClient = &opClient
767
768 return &CloudFilestoreManagerClient{internalClient: c, CallOptions: callOpts}, nil
769 }
770
771 func defaultCloudFilestoreManagerRESTClientOptions() []option.ClientOption {
772 return []option.ClientOption{
773 internaloption.WithDefaultEndpoint("https://file.googleapis.com"),
774 internaloption.WithDefaultEndpointTemplate("https://file.UNIVERSE_DOMAIN"),
775 internaloption.WithDefaultMTLSEndpoint("https://file.mtls.googleapis.com"),
776 internaloption.WithDefaultUniverseDomain("googleapis.com"),
777 internaloption.WithDefaultAudience("https://file.googleapis.com/"),
778 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
779 internaloption.EnableNewAuthLibrary(),
780 }
781 }
782
783 // setGoogleClientInfo sets the name and version of the application in
784 // the `x-goog-api-client` header passed on each request. Intended for
785 // use by Google-written clients.
786 func (c *cloudFilestoreManagerRESTClient) setGoogleClientInfo(keyval ...string) {
787 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
788 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion)
789 c.xGoogHeaders = []string{
790 "x-goog-api-client", gax.XGoogHeader(kv...),
791 }
792 }
793
794 // Close closes the connection to the API service. The user should invoke this when
795 // the client is no longer required.
796 func (c *cloudFilestoreManagerRESTClient) Close() error {
797 // Replace httpClient with nil to force cleanup.
798 c.httpClient = nil
799 return nil
800 }
801
802 // Connection returns a connection to the API service.
803 //
804 // Deprecated: This method always returns nil.
805 func (c *cloudFilestoreManagerRESTClient) Connection() *grpc.ClientConn {
806 return nil
807 }
808 func (c *cloudFilestoreManagerGRPCClient) ListInstances(ctx context.Context, req *filestorepb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator {
809 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
810
811 hds = append(c.xGoogHeaders, hds...)
812 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
813 opts = append((*c.CallOptions).ListInstances[0:len((*c.CallOptions).ListInstances):len((*c.CallOptions).ListInstances)], opts...)
814 it := &InstanceIterator{}
815 req = proto.Clone(req).(*filestorepb.ListInstancesRequest)
816 it.InternalFetch = func(pageSize int, pageToken string) ([]*filestorepb.Instance, string, error) {
817 resp := &filestorepb.ListInstancesResponse{}
818 if pageToken != "" {
819 req.PageToken = pageToken
820 }
821 if pageSize > math.MaxInt32 {
822 req.PageSize = math.MaxInt32
823 } else if pageSize != 0 {
824 req.PageSize = int32(pageSize)
825 }
826 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
827 var err error
828 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.ListInstances, req, settings.GRPC, c.logger, "ListInstances")
829 return err
830 }, opts...)
831 if err != nil {
832 return nil, "", err
833 }
834
835 it.Response = resp
836 return resp.GetInstances(), resp.GetNextPageToken(), nil
837 }
838 fetch := func(pageSize int, pageToken string) (string, error) {
839 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
840 if err != nil {
841 return "", err
842 }
843 it.items = append(it.items, items...)
844 return nextPageToken, nil
845 }
846
847 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
848 it.pageInfo.MaxSize = int(req.GetPageSize())
849 it.pageInfo.Token = req.GetPageToken()
850
851 return it
852 }
853
854 func (c *cloudFilestoreManagerGRPCClient) GetInstance(ctx context.Context, req *filestorepb.GetInstanceRequest, opts ...gax.CallOption) (*filestorepb.Instance, error) {
855 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
856
857 hds = append(c.xGoogHeaders, hds...)
858 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
859 opts = append((*c.CallOptions).GetInstance[0:len((*c.CallOptions).GetInstance):len((*c.CallOptions).GetInstance)], opts...)
860 var resp *filestorepb.Instance
861 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
862 var err error
863 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.GetInstance, req, settings.GRPC, c.logger, "GetInstance")
864 return err
865 }, opts...)
866 if err != nil {
867 return nil, err
868 }
869 return resp, nil
870 }
871
872 func (c *cloudFilestoreManagerGRPCClient) CreateInstance(ctx context.Context, req *filestorepb.CreateInstanceRequest, opts ...gax.CallOption) (*CreateInstanceOperation, error) {
873 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
874
875 hds = append(c.xGoogHeaders, hds...)
876 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
877 opts = append((*c.CallOptions).CreateInstance[0:len((*c.CallOptions).CreateInstance):len((*c.CallOptions).CreateInstance)], opts...)
878 var resp *longrunningpb.Operation
879 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
880 var err error
881 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.CreateInstance, req, settings.GRPC, c.logger, "CreateInstance")
882 return err
883 }, opts...)
884 if err != nil {
885 return nil, err
886 }
887 return &CreateInstanceOperation{
888 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
889 }, nil
890 }
891
892 func (c *cloudFilestoreManagerGRPCClient) UpdateInstance(ctx context.Context, req *filestorepb.UpdateInstanceRequest, opts ...gax.CallOption) (*UpdateInstanceOperation, error) {
893 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "instance.name", url.QueryEscape(req.GetInstance().GetName()))}
894
895 hds = append(c.xGoogHeaders, hds...)
896 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
897 opts = append((*c.CallOptions).UpdateInstance[0:len((*c.CallOptions).UpdateInstance):len((*c.CallOptions).UpdateInstance)], opts...)
898 var resp *longrunningpb.Operation
899 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
900 var err error
901 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.UpdateInstance, req, settings.GRPC, c.logger, "UpdateInstance")
902 return err
903 }, opts...)
904 if err != nil {
905 return nil, err
906 }
907 return &UpdateInstanceOperation{
908 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
909 }, nil
910 }
911
912 func (c *cloudFilestoreManagerGRPCClient) RestoreInstance(ctx context.Context, req *filestorepb.RestoreInstanceRequest, opts ...gax.CallOption) (*RestoreInstanceOperation, error) {
913 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
914
915 hds = append(c.xGoogHeaders, hds...)
916 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
917 opts = append((*c.CallOptions).RestoreInstance[0:len((*c.CallOptions).RestoreInstance):len((*c.CallOptions).RestoreInstance)], opts...)
918 var resp *longrunningpb.Operation
919 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
920 var err error
921 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.RestoreInstance, req, settings.GRPC, c.logger, "RestoreInstance")
922 return err
923 }, opts...)
924 if err != nil {
925 return nil, err
926 }
927 return &RestoreInstanceOperation{
928 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
929 }, nil
930 }
931
932 func (c *cloudFilestoreManagerGRPCClient) RevertInstance(ctx context.Context, req *filestorepb.RevertInstanceRequest, opts ...gax.CallOption) (*RevertInstanceOperation, error) {
933 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
934
935 hds = append(c.xGoogHeaders, hds...)
936 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
937 opts = append((*c.CallOptions).RevertInstance[0:len((*c.CallOptions).RevertInstance):len((*c.CallOptions).RevertInstance)], opts...)
938 var resp *longrunningpb.Operation
939 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
940 var err error
941 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.RevertInstance, req, settings.GRPC, c.logger, "RevertInstance")
942 return err
943 }, opts...)
944 if err != nil {
945 return nil, err
946 }
947 return &RevertInstanceOperation{
948 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
949 }, nil
950 }
951
952 func (c *cloudFilestoreManagerGRPCClient) DeleteInstance(ctx context.Context, req *filestorepb.DeleteInstanceRequest, opts ...gax.CallOption) (*DeleteInstanceOperation, error) {
953 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
954
955 hds = append(c.xGoogHeaders, hds...)
956 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
957 opts = append((*c.CallOptions).DeleteInstance[0:len((*c.CallOptions).DeleteInstance):len((*c.CallOptions).DeleteInstance)], opts...)
958 var resp *longrunningpb.Operation
959 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
960 var err error
961 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.DeleteInstance, req, settings.GRPC, c.logger, "DeleteInstance")
962 return err
963 }, opts...)
964 if err != nil {
965 return nil, err
966 }
967 return &DeleteInstanceOperation{
968 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
969 }, nil
970 }
971
972 func (c *cloudFilestoreManagerGRPCClient) ListSnapshots(ctx context.Context, req *filestorepb.ListSnapshotsRequest, opts ...gax.CallOption) *SnapshotIterator {
973 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
974
975 hds = append(c.xGoogHeaders, hds...)
976 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
977 opts = append((*c.CallOptions).ListSnapshots[0:len((*c.CallOptions).ListSnapshots):len((*c.CallOptions).ListSnapshots)], opts...)
978 it := &SnapshotIterator{}
979 req = proto.Clone(req).(*filestorepb.ListSnapshotsRequest)
980 it.InternalFetch = func(pageSize int, pageToken string) ([]*filestorepb.Snapshot, string, error) {
981 resp := &filestorepb.ListSnapshotsResponse{}
982 if pageToken != "" {
983 req.PageToken = pageToken
984 }
985 if pageSize > math.MaxInt32 {
986 req.PageSize = math.MaxInt32
987 } else if pageSize != 0 {
988 req.PageSize = int32(pageSize)
989 }
990 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
991 var err error
992 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.ListSnapshots, req, settings.GRPC, c.logger, "ListSnapshots")
993 return err
994 }, opts...)
995 if err != nil {
996 return nil, "", err
997 }
998
999 it.Response = resp
1000 return resp.GetSnapshots(), resp.GetNextPageToken(), nil
1001 }
1002 fetch := func(pageSize int, pageToken string) (string, error) {
1003 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1004 if err != nil {
1005 return "", err
1006 }
1007 it.items = append(it.items, items...)
1008 return nextPageToken, nil
1009 }
1010
1011 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1012 it.pageInfo.MaxSize = int(req.GetPageSize())
1013 it.pageInfo.Token = req.GetPageToken()
1014
1015 return it
1016 }
1017
1018 func (c *cloudFilestoreManagerGRPCClient) GetSnapshot(ctx context.Context, req *filestorepb.GetSnapshotRequest, opts ...gax.CallOption) (*filestorepb.Snapshot, error) {
1019 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1020
1021 hds = append(c.xGoogHeaders, hds...)
1022 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1023 opts = append((*c.CallOptions).GetSnapshot[0:len((*c.CallOptions).GetSnapshot):len((*c.CallOptions).GetSnapshot)], opts...)
1024 var resp *filestorepb.Snapshot
1025 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1026 var err error
1027 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.GetSnapshot, req, settings.GRPC, c.logger, "GetSnapshot")
1028 return err
1029 }, opts...)
1030 if err != nil {
1031 return nil, err
1032 }
1033 return resp, nil
1034 }
1035
1036 func (c *cloudFilestoreManagerGRPCClient) CreateSnapshot(ctx context.Context, req *filestorepb.CreateSnapshotRequest, opts ...gax.CallOption) (*CreateSnapshotOperation, error) {
1037 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1038
1039 hds = append(c.xGoogHeaders, hds...)
1040 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1041 opts = append((*c.CallOptions).CreateSnapshot[0:len((*c.CallOptions).CreateSnapshot):len((*c.CallOptions).CreateSnapshot)], opts...)
1042 var resp *longrunningpb.Operation
1043 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1044 var err error
1045 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.CreateSnapshot, req, settings.GRPC, c.logger, "CreateSnapshot")
1046 return err
1047 }, opts...)
1048 if err != nil {
1049 return nil, err
1050 }
1051 return &CreateSnapshotOperation{
1052 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1053 }, nil
1054 }
1055
1056 func (c *cloudFilestoreManagerGRPCClient) DeleteSnapshot(ctx context.Context, req *filestorepb.DeleteSnapshotRequest, opts ...gax.CallOption) (*DeleteSnapshotOperation, error) {
1057 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1058
1059 hds = append(c.xGoogHeaders, hds...)
1060 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1061 opts = append((*c.CallOptions).DeleteSnapshot[0:len((*c.CallOptions).DeleteSnapshot):len((*c.CallOptions).DeleteSnapshot)], opts...)
1062 var resp *longrunningpb.Operation
1063 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1064 var err error
1065 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.DeleteSnapshot, req, settings.GRPC, c.logger, "DeleteSnapshot")
1066 return err
1067 }, opts...)
1068 if err != nil {
1069 return nil, err
1070 }
1071 return &DeleteSnapshotOperation{
1072 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1073 }, nil
1074 }
1075
1076 func (c *cloudFilestoreManagerGRPCClient) UpdateSnapshot(ctx context.Context, req *filestorepb.UpdateSnapshotRequest, opts ...gax.CallOption) (*UpdateSnapshotOperation, error) {
1077 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "snapshot.name", url.QueryEscape(req.GetSnapshot().GetName()))}
1078
1079 hds = append(c.xGoogHeaders, hds...)
1080 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1081 opts = append((*c.CallOptions).UpdateSnapshot[0:len((*c.CallOptions).UpdateSnapshot):len((*c.CallOptions).UpdateSnapshot)], opts...)
1082 var resp *longrunningpb.Operation
1083 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1084 var err error
1085 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.UpdateSnapshot, req, settings.GRPC, c.logger, "UpdateSnapshot")
1086 return err
1087 }, opts...)
1088 if err != nil {
1089 return nil, err
1090 }
1091 return &UpdateSnapshotOperation{
1092 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1093 }, nil
1094 }
1095
1096 func (c *cloudFilestoreManagerGRPCClient) ListBackups(ctx context.Context, req *filestorepb.ListBackupsRequest, opts ...gax.CallOption) *BackupIterator {
1097 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1098
1099 hds = append(c.xGoogHeaders, hds...)
1100 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1101 opts = append((*c.CallOptions).ListBackups[0:len((*c.CallOptions).ListBackups):len((*c.CallOptions).ListBackups)], opts...)
1102 it := &BackupIterator{}
1103 req = proto.Clone(req).(*filestorepb.ListBackupsRequest)
1104 it.InternalFetch = func(pageSize int, pageToken string) ([]*filestorepb.Backup, string, error) {
1105 resp := &filestorepb.ListBackupsResponse{}
1106 if pageToken != "" {
1107 req.PageToken = pageToken
1108 }
1109 if pageSize > math.MaxInt32 {
1110 req.PageSize = math.MaxInt32
1111 } else if pageSize != 0 {
1112 req.PageSize = int32(pageSize)
1113 }
1114 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1115 var err error
1116 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.ListBackups, req, settings.GRPC, c.logger, "ListBackups")
1117 return err
1118 }, opts...)
1119 if err != nil {
1120 return nil, "", err
1121 }
1122
1123 it.Response = resp
1124 return resp.GetBackups(), resp.GetNextPageToken(), nil
1125 }
1126 fetch := func(pageSize int, pageToken string) (string, error) {
1127 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1128 if err != nil {
1129 return "", err
1130 }
1131 it.items = append(it.items, items...)
1132 return nextPageToken, nil
1133 }
1134
1135 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1136 it.pageInfo.MaxSize = int(req.GetPageSize())
1137 it.pageInfo.Token = req.GetPageToken()
1138
1139 return it
1140 }
1141
1142 func (c *cloudFilestoreManagerGRPCClient) GetBackup(ctx context.Context, req *filestorepb.GetBackupRequest, opts ...gax.CallOption) (*filestorepb.Backup, error) {
1143 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1144
1145 hds = append(c.xGoogHeaders, hds...)
1146 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1147 opts = append((*c.CallOptions).GetBackup[0:len((*c.CallOptions).GetBackup):len((*c.CallOptions).GetBackup)], opts...)
1148 var resp *filestorepb.Backup
1149 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1150 var err error
1151 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.GetBackup, req, settings.GRPC, c.logger, "GetBackup")
1152 return err
1153 }, opts...)
1154 if err != nil {
1155 return nil, err
1156 }
1157 return resp, nil
1158 }
1159
1160 func (c *cloudFilestoreManagerGRPCClient) CreateBackup(ctx context.Context, req *filestorepb.CreateBackupRequest, opts ...gax.CallOption) (*CreateBackupOperation, error) {
1161 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1162
1163 hds = append(c.xGoogHeaders, hds...)
1164 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1165 opts = append((*c.CallOptions).CreateBackup[0:len((*c.CallOptions).CreateBackup):len((*c.CallOptions).CreateBackup)], opts...)
1166 var resp *longrunningpb.Operation
1167 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1168 var err error
1169 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.CreateBackup, req, settings.GRPC, c.logger, "CreateBackup")
1170 return err
1171 }, opts...)
1172 if err != nil {
1173 return nil, err
1174 }
1175 return &CreateBackupOperation{
1176 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1177 }, nil
1178 }
1179
1180 func (c *cloudFilestoreManagerGRPCClient) DeleteBackup(ctx context.Context, req *filestorepb.DeleteBackupRequest, opts ...gax.CallOption) (*DeleteBackupOperation, error) {
1181 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1182
1183 hds = append(c.xGoogHeaders, hds...)
1184 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1185 opts = append((*c.CallOptions).DeleteBackup[0:len((*c.CallOptions).DeleteBackup):len((*c.CallOptions).DeleteBackup)], opts...)
1186 var resp *longrunningpb.Operation
1187 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1188 var err error
1189 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.DeleteBackup, req, settings.GRPC, c.logger, "DeleteBackup")
1190 return err
1191 }, opts...)
1192 if err != nil {
1193 return nil, err
1194 }
1195 return &DeleteBackupOperation{
1196 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1197 }, nil
1198 }
1199
1200 func (c *cloudFilestoreManagerGRPCClient) UpdateBackup(ctx context.Context, req *filestorepb.UpdateBackupRequest, opts ...gax.CallOption) (*UpdateBackupOperation, error) {
1201 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "backup.name", url.QueryEscape(req.GetBackup().GetName()))}
1202
1203 hds = append(c.xGoogHeaders, hds...)
1204 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1205 opts = append((*c.CallOptions).UpdateBackup[0:len((*c.CallOptions).UpdateBackup):len((*c.CallOptions).UpdateBackup)], opts...)
1206 var resp *longrunningpb.Operation
1207 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1208 var err error
1209 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.UpdateBackup, req, settings.GRPC, c.logger, "UpdateBackup")
1210 return err
1211 }, opts...)
1212 if err != nil {
1213 return nil, err
1214 }
1215 return &UpdateBackupOperation{
1216 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1217 }, nil
1218 }
1219
1220 func (c *cloudFilestoreManagerGRPCClient) PromoteReplica(ctx context.Context, req *filestorepb.PromoteReplicaRequest, opts ...gax.CallOption) (*PromoteReplicaOperation, error) {
1221 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1222
1223 hds = append(c.xGoogHeaders, hds...)
1224 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1225 opts = append((*c.CallOptions).PromoteReplica[0:len((*c.CallOptions).PromoteReplica):len((*c.CallOptions).PromoteReplica)], opts...)
1226 var resp *longrunningpb.Operation
1227 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1228 var err error
1229 resp, err = executeRPC(ctx, c.cloudFilestoreManagerClient.PromoteReplica, req, settings.GRPC, c.logger, "PromoteReplica")
1230 return err
1231 }, opts...)
1232 if err != nil {
1233 return nil, err
1234 }
1235 return &PromoteReplicaOperation{
1236 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1237 }, nil
1238 }
1239
1240 func (c *cloudFilestoreManagerGRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
1241 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1242
1243 hds = append(c.xGoogHeaders, hds...)
1244 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1245 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
1246 var resp *locationpb.Location
1247 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1248 var err error
1249 resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation")
1250 return err
1251 }, opts...)
1252 if err != nil {
1253 return nil, err
1254 }
1255 return resp, nil
1256 }
1257
1258 func (c *cloudFilestoreManagerGRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
1259 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1260
1261 hds = append(c.xGoogHeaders, hds...)
1262 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1263 opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...)
1264 it := &LocationIterator{}
1265 req = proto.Clone(req).(*locationpb.ListLocationsRequest)
1266 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
1267 resp := &locationpb.ListLocationsResponse{}
1268 if pageToken != "" {
1269 req.PageToken = pageToken
1270 }
1271 if pageSize > math.MaxInt32 {
1272 req.PageSize = math.MaxInt32
1273 } else if pageSize != 0 {
1274 req.PageSize = int32(pageSize)
1275 }
1276 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1277 var err error
1278 resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations")
1279 return err
1280 }, opts...)
1281 if err != nil {
1282 return nil, "", err
1283 }
1284
1285 it.Response = resp
1286 return resp.GetLocations(), resp.GetNextPageToken(), nil
1287 }
1288 fetch := func(pageSize int, pageToken string) (string, error) {
1289 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1290 if err != nil {
1291 return "", err
1292 }
1293 it.items = append(it.items, items...)
1294 return nextPageToken, nil
1295 }
1296
1297 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1298 it.pageInfo.MaxSize = int(req.GetPageSize())
1299 it.pageInfo.Token = req.GetPageToken()
1300
1301 return it
1302 }
1303
1304 func (c *cloudFilestoreManagerGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
1305 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1306
1307 hds = append(c.xGoogHeaders, hds...)
1308 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1309 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
1310 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1311 var err error
1312 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
1313 return err
1314 }, opts...)
1315 return err
1316 }
1317
1318 func (c *cloudFilestoreManagerGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
1319 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1320
1321 hds = append(c.xGoogHeaders, hds...)
1322 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1323 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
1324 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1325 var err error
1326 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
1327 return err
1328 }, opts...)
1329 return err
1330 }
1331
1332 func (c *cloudFilestoreManagerGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
1333 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1334
1335 hds = append(c.xGoogHeaders, hds...)
1336 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1337 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
1338 var resp *longrunningpb.Operation
1339 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1340 var err error
1341 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
1342 return err
1343 }, opts...)
1344 if err != nil {
1345 return nil, err
1346 }
1347 return resp, nil
1348 }
1349
1350 func (c *cloudFilestoreManagerGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
1351 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1352
1353 hds = append(c.xGoogHeaders, hds...)
1354 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1355 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
1356 it := &OperationIterator{}
1357 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
1358 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
1359 resp := &longrunningpb.ListOperationsResponse{}
1360 if pageToken != "" {
1361 req.PageToken = pageToken
1362 }
1363 if pageSize > math.MaxInt32 {
1364 req.PageSize = math.MaxInt32
1365 } else if pageSize != 0 {
1366 req.PageSize = int32(pageSize)
1367 }
1368 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1369 var err error
1370 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
1371 return err
1372 }, opts...)
1373 if err != nil {
1374 return nil, "", err
1375 }
1376
1377 it.Response = resp
1378 return resp.GetOperations(), resp.GetNextPageToken(), nil
1379 }
1380 fetch := func(pageSize int, pageToken string) (string, error) {
1381 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1382 if err != nil {
1383 return "", err
1384 }
1385 it.items = append(it.items, items...)
1386 return nextPageToken, nil
1387 }
1388
1389 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1390 it.pageInfo.MaxSize = int(req.GetPageSize())
1391 it.pageInfo.Token = req.GetPageToken()
1392
1393 return it
1394 }
1395
1396 // ListInstances lists all instances in a project for either a specified location
1397 // or for all locations.
1398 func (c *cloudFilestoreManagerRESTClient) ListInstances(ctx context.Context, req *filestorepb.ListInstancesRequest, opts ...gax.CallOption) *InstanceIterator {
1399 it := &InstanceIterator{}
1400 req = proto.Clone(req).(*filestorepb.ListInstancesRequest)
1401 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1402 it.InternalFetch = func(pageSize int, pageToken string) ([]*filestorepb.Instance, string, error) {
1403 resp := &filestorepb.ListInstancesResponse{}
1404 if pageToken != "" {
1405 req.PageToken = pageToken
1406 }
1407 if pageSize > math.MaxInt32 {
1408 req.PageSize = math.MaxInt32
1409 } else if pageSize != 0 {
1410 req.PageSize = int32(pageSize)
1411 }
1412 baseUrl, err := url.Parse(c.endpoint)
1413 if err != nil {
1414 return nil, "", err
1415 }
1416 baseUrl.Path += fmt.Sprintf("/v1/%v/instances", req.GetParent())
1417
1418 params := url.Values{}
1419 params.Add("$alt", "json;enum-encoding=int")
1420 if req.GetFilter() != "" {
1421 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
1422 }
1423 if req.GetOrderBy() != "" {
1424 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
1425 }
1426 if req.GetPageSize() != 0 {
1427 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
1428 }
1429 if req.GetPageToken() != "" {
1430 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
1431 }
1432
1433 baseUrl.RawQuery = params.Encode()
1434
1435 // Build HTTP headers from client and context metadata.
1436 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
1437 headers := gax.BuildHeaders(ctx, hds...)
1438 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1439 if settings.Path != "" {
1440 baseUrl.Path = settings.Path
1441 }
1442 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1443 if err != nil {
1444 return err
1445 }
1446 httpReq.Header = headers
1447
1448 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListInstances")
1449 if err != nil {
1450 return err
1451 }
1452 if err := unm.Unmarshal(buf, resp); err != nil {
1453 return err
1454 }
1455
1456 return nil
1457 }, opts...)
1458 if e != nil {
1459 return nil, "", e
1460 }
1461 it.Response = resp
1462 return resp.GetInstances(), resp.GetNextPageToken(), nil
1463 }
1464
1465 fetch := func(pageSize int, pageToken string) (string, error) {
1466 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1467 if err != nil {
1468 return "", err
1469 }
1470 it.items = append(it.items, items...)
1471 return nextPageToken, nil
1472 }
1473
1474 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1475 it.pageInfo.MaxSize = int(req.GetPageSize())
1476 it.pageInfo.Token = req.GetPageToken()
1477
1478 return it
1479 }
1480
1481 // GetInstance gets the details of a specific instance.
1482 func (c *cloudFilestoreManagerRESTClient) GetInstance(ctx context.Context, req *filestorepb.GetInstanceRequest, opts ...gax.CallOption) (*filestorepb.Instance, error) {
1483 baseUrl, err := url.Parse(c.endpoint)
1484 if err != nil {
1485 return nil, err
1486 }
1487 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
1488
1489 params := url.Values{}
1490 params.Add("$alt", "json;enum-encoding=int")
1491
1492 baseUrl.RawQuery = params.Encode()
1493
1494 // Build HTTP headers from client and context metadata.
1495 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1496
1497 hds = append(c.xGoogHeaders, hds...)
1498 hds = append(hds, "Content-Type", "application/json")
1499 headers := gax.BuildHeaders(ctx, hds...)
1500 opts = append((*c.CallOptions).GetInstance[0:len((*c.CallOptions).GetInstance):len((*c.CallOptions).GetInstance)], opts...)
1501 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1502 resp := &filestorepb.Instance{}
1503 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1504 if settings.Path != "" {
1505 baseUrl.Path = settings.Path
1506 }
1507 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1508 if err != nil {
1509 return err
1510 }
1511 httpReq = httpReq.WithContext(ctx)
1512 httpReq.Header = headers
1513
1514 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetInstance")
1515 if err != nil {
1516 return err
1517 }
1518
1519 if err := unm.Unmarshal(buf, resp); err != nil {
1520 return err
1521 }
1522
1523 return nil
1524 }, opts...)
1525 if e != nil {
1526 return nil, e
1527 }
1528 return resp, nil
1529 }
1530
1531 // CreateInstance creates an instance.
1532 // When creating from a backup, the capacity of the new instance needs to be
1533 // equal to or larger than the capacity of the backup (and also equal to or
1534 // larger than the minimum capacity of the tier).
1535 func (c *cloudFilestoreManagerRESTClient) CreateInstance(ctx context.Context, req *filestorepb.CreateInstanceRequest, opts ...gax.CallOption) (*CreateInstanceOperation, error) {
1536 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1537 body := req.GetInstance()
1538 jsonReq, err := m.Marshal(body)
1539 if err != nil {
1540 return nil, err
1541 }
1542
1543 baseUrl, err := url.Parse(c.endpoint)
1544 if err != nil {
1545 return nil, err
1546 }
1547 baseUrl.Path += fmt.Sprintf("/v1/%v/instances", req.GetParent())
1548
1549 params := url.Values{}
1550 params.Add("$alt", "json;enum-encoding=int")
1551 params.Add("instanceId", fmt.Sprintf("%v", req.GetInstanceId()))
1552
1553 baseUrl.RawQuery = params.Encode()
1554
1555 // Build HTTP headers from client and context metadata.
1556 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1557
1558 hds = append(c.xGoogHeaders, hds...)
1559 hds = append(hds, "Content-Type", "application/json")
1560 headers := gax.BuildHeaders(ctx, hds...)
1561 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1562 resp := &longrunningpb.Operation{}
1563 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1564 if settings.Path != "" {
1565 baseUrl.Path = settings.Path
1566 }
1567 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1568 if err != nil {
1569 return err
1570 }
1571 httpReq = httpReq.WithContext(ctx)
1572 httpReq.Header = headers
1573
1574 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateInstance")
1575 if err != nil {
1576 return err
1577 }
1578 if err := unm.Unmarshal(buf, resp); err != nil {
1579 return err
1580 }
1581
1582 return nil
1583 }, opts...)
1584 if e != nil {
1585 return nil, e
1586 }
1587
1588 override := fmt.Sprintf("/v1/%s", resp.GetName())
1589 return &CreateInstanceOperation{
1590 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1591 pollPath: override,
1592 }, nil
1593 }
1594
1595 // UpdateInstance updates the settings of a specific instance.
1596 func (c *cloudFilestoreManagerRESTClient) UpdateInstance(ctx context.Context, req *filestorepb.UpdateInstanceRequest, opts ...gax.CallOption) (*UpdateInstanceOperation, error) {
1597 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1598 body := req.GetInstance()
1599 jsonReq, err := m.Marshal(body)
1600 if err != nil {
1601 return nil, err
1602 }
1603
1604 baseUrl, err := url.Parse(c.endpoint)
1605 if err != nil {
1606 return nil, err
1607 }
1608 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetInstance().GetName())
1609
1610 params := url.Values{}
1611 params.Add("$alt", "json;enum-encoding=int")
1612 if req.GetUpdateMask() != nil {
1613 field, err := protojson.Marshal(req.GetUpdateMask())
1614 if err != nil {
1615 return nil, err
1616 }
1617 params.Add("updateMask", string(field[1:len(field)-1]))
1618 }
1619
1620 baseUrl.RawQuery = params.Encode()
1621
1622 // Build HTTP headers from client and context metadata.
1623 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "instance.name", url.QueryEscape(req.GetInstance().GetName()))}
1624
1625 hds = append(c.xGoogHeaders, hds...)
1626 hds = append(hds, "Content-Type", "application/json")
1627 headers := gax.BuildHeaders(ctx, hds...)
1628 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1629 resp := &longrunningpb.Operation{}
1630 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1631 if settings.Path != "" {
1632 baseUrl.Path = settings.Path
1633 }
1634 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
1635 if err != nil {
1636 return err
1637 }
1638 httpReq = httpReq.WithContext(ctx)
1639 httpReq.Header = headers
1640
1641 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateInstance")
1642 if err != nil {
1643 return err
1644 }
1645 if err := unm.Unmarshal(buf, resp); err != nil {
1646 return err
1647 }
1648
1649 return nil
1650 }, opts...)
1651 if e != nil {
1652 return nil, e
1653 }
1654
1655 override := fmt.Sprintf("/v1/%s", resp.GetName())
1656 return &UpdateInstanceOperation{
1657 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1658 pollPath: override,
1659 }, nil
1660 }
1661
1662 // RestoreInstance restores an existing instance’s file share from a backup.
1663 //
1664 // The capacity of the instance needs to be equal to or larger than the
1665 // capacity of the backup (and also equal to or larger than the minimum
1666 // capacity of the tier).
1667 func (c *cloudFilestoreManagerRESTClient) RestoreInstance(ctx context.Context, req *filestorepb.RestoreInstanceRequest, opts ...gax.CallOption) (*RestoreInstanceOperation, error) {
1668 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1669 jsonReq, err := m.Marshal(req)
1670 if err != nil {
1671 return nil, err
1672 }
1673
1674 baseUrl, err := url.Parse(c.endpoint)
1675 if err != nil {
1676 return nil, err
1677 }
1678 baseUrl.Path += fmt.Sprintf("/v1/%v:restore", req.GetName())
1679
1680 params := url.Values{}
1681 params.Add("$alt", "json;enum-encoding=int")
1682
1683 baseUrl.RawQuery = params.Encode()
1684
1685 // Build HTTP headers from client and context metadata.
1686 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1687
1688 hds = append(c.xGoogHeaders, hds...)
1689 hds = append(hds, "Content-Type", "application/json")
1690 headers := gax.BuildHeaders(ctx, hds...)
1691 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1692 resp := &longrunningpb.Operation{}
1693 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1694 if settings.Path != "" {
1695 baseUrl.Path = settings.Path
1696 }
1697 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1698 if err != nil {
1699 return err
1700 }
1701 httpReq = httpReq.WithContext(ctx)
1702 httpReq.Header = headers
1703
1704 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "RestoreInstance")
1705 if err != nil {
1706 return err
1707 }
1708 if err := unm.Unmarshal(buf, resp); err != nil {
1709 return err
1710 }
1711
1712 return nil
1713 }, opts...)
1714 if e != nil {
1715 return nil, e
1716 }
1717
1718 override := fmt.Sprintf("/v1/%s", resp.GetName())
1719 return &RestoreInstanceOperation{
1720 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1721 pollPath: override,
1722 }, nil
1723 }
1724
1725 // RevertInstance revert an existing instance’s file system to a specified snapshot.
1726 func (c *cloudFilestoreManagerRESTClient) RevertInstance(ctx context.Context, req *filestorepb.RevertInstanceRequest, opts ...gax.CallOption) (*RevertInstanceOperation, error) {
1727 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1728 jsonReq, err := m.Marshal(req)
1729 if err != nil {
1730 return nil, err
1731 }
1732
1733 baseUrl, err := url.Parse(c.endpoint)
1734 if err != nil {
1735 return nil, err
1736 }
1737 baseUrl.Path += fmt.Sprintf("/v1/%v:revert", req.GetName())
1738
1739 params := url.Values{}
1740 params.Add("$alt", "json;enum-encoding=int")
1741
1742 baseUrl.RawQuery = params.Encode()
1743
1744 // Build HTTP headers from client and context metadata.
1745 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1746
1747 hds = append(c.xGoogHeaders, hds...)
1748 hds = append(hds, "Content-Type", "application/json")
1749 headers := gax.BuildHeaders(ctx, hds...)
1750 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1751 resp := &longrunningpb.Operation{}
1752 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1753 if settings.Path != "" {
1754 baseUrl.Path = settings.Path
1755 }
1756 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1757 if err != nil {
1758 return err
1759 }
1760 httpReq = httpReq.WithContext(ctx)
1761 httpReq.Header = headers
1762
1763 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "RevertInstance")
1764 if err != nil {
1765 return err
1766 }
1767 if err := unm.Unmarshal(buf, resp); err != nil {
1768 return err
1769 }
1770
1771 return nil
1772 }, opts...)
1773 if e != nil {
1774 return nil, e
1775 }
1776
1777 override := fmt.Sprintf("/v1/%s", resp.GetName())
1778 return &RevertInstanceOperation{
1779 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1780 pollPath: override,
1781 }, nil
1782 }
1783
1784 // DeleteInstance deletes an instance.
1785 func (c *cloudFilestoreManagerRESTClient) DeleteInstance(ctx context.Context, req *filestorepb.DeleteInstanceRequest, opts ...gax.CallOption) (*DeleteInstanceOperation, error) {
1786 baseUrl, err := url.Parse(c.endpoint)
1787 if err != nil {
1788 return nil, err
1789 }
1790 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
1791
1792 params := url.Values{}
1793 params.Add("$alt", "json;enum-encoding=int")
1794 if req.GetForce() {
1795 params.Add("force", fmt.Sprintf("%v", req.GetForce()))
1796 }
1797
1798 baseUrl.RawQuery = params.Encode()
1799
1800 // Build HTTP headers from client and context metadata.
1801 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1802
1803 hds = append(c.xGoogHeaders, hds...)
1804 hds = append(hds, "Content-Type", "application/json")
1805 headers := gax.BuildHeaders(ctx, hds...)
1806 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1807 resp := &longrunningpb.Operation{}
1808 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1809 if settings.Path != "" {
1810 baseUrl.Path = settings.Path
1811 }
1812 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
1813 if err != nil {
1814 return err
1815 }
1816 httpReq = httpReq.WithContext(ctx)
1817 httpReq.Header = headers
1818
1819 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteInstance")
1820 if err != nil {
1821 return err
1822 }
1823 if err := unm.Unmarshal(buf, resp); err != nil {
1824 return err
1825 }
1826
1827 return nil
1828 }, opts...)
1829 if e != nil {
1830 return nil, e
1831 }
1832
1833 override := fmt.Sprintf("/v1/%s", resp.GetName())
1834 return &DeleteInstanceOperation{
1835 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1836 pollPath: override,
1837 }, nil
1838 }
1839
1840 // ListSnapshots lists all snapshots in a project for either a specified location
1841 // or for all locations.
1842 func (c *cloudFilestoreManagerRESTClient) ListSnapshots(ctx context.Context, req *filestorepb.ListSnapshotsRequest, opts ...gax.CallOption) *SnapshotIterator {
1843 it := &SnapshotIterator{}
1844 req = proto.Clone(req).(*filestorepb.ListSnapshotsRequest)
1845 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1846 it.InternalFetch = func(pageSize int, pageToken string) ([]*filestorepb.Snapshot, string, error) {
1847 resp := &filestorepb.ListSnapshotsResponse{}
1848 if pageToken != "" {
1849 req.PageToken = pageToken
1850 }
1851 if pageSize > math.MaxInt32 {
1852 req.PageSize = math.MaxInt32
1853 } else if pageSize != 0 {
1854 req.PageSize = int32(pageSize)
1855 }
1856 baseUrl, err := url.Parse(c.endpoint)
1857 if err != nil {
1858 return nil, "", err
1859 }
1860 baseUrl.Path += fmt.Sprintf("/v1/%v/snapshots", req.GetParent())
1861
1862 params := url.Values{}
1863 params.Add("$alt", "json;enum-encoding=int")
1864 if req.GetFilter() != "" {
1865 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
1866 }
1867 if req.GetOrderBy() != "" {
1868 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
1869 }
1870 if req.GetPageSize() != 0 {
1871 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
1872 }
1873 if req.GetPageToken() != "" {
1874 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
1875 }
1876 if req.GetReturnPartialSuccess() {
1877 params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
1878 }
1879
1880 baseUrl.RawQuery = params.Encode()
1881
1882 // Build HTTP headers from client and context metadata.
1883 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
1884 headers := gax.BuildHeaders(ctx, hds...)
1885 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1886 if settings.Path != "" {
1887 baseUrl.Path = settings.Path
1888 }
1889 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1890 if err != nil {
1891 return err
1892 }
1893 httpReq.Header = headers
1894
1895 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListSnapshots")
1896 if err != nil {
1897 return err
1898 }
1899 if err := unm.Unmarshal(buf, resp); err != nil {
1900 return err
1901 }
1902
1903 return nil
1904 }, opts...)
1905 if e != nil {
1906 return nil, "", e
1907 }
1908 it.Response = resp
1909 return resp.GetSnapshots(), resp.GetNextPageToken(), nil
1910 }
1911
1912 fetch := func(pageSize int, pageToken string) (string, error) {
1913 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1914 if err != nil {
1915 return "", err
1916 }
1917 it.items = append(it.items, items...)
1918 return nextPageToken, nil
1919 }
1920
1921 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1922 it.pageInfo.MaxSize = int(req.GetPageSize())
1923 it.pageInfo.Token = req.GetPageToken()
1924
1925 return it
1926 }
1927
1928 // GetSnapshot gets the details of a specific snapshot.
1929 func (c *cloudFilestoreManagerRESTClient) GetSnapshot(ctx context.Context, req *filestorepb.GetSnapshotRequest, opts ...gax.CallOption) (*filestorepb.Snapshot, error) {
1930 baseUrl, err := url.Parse(c.endpoint)
1931 if err != nil {
1932 return nil, err
1933 }
1934 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
1935
1936 params := url.Values{}
1937 params.Add("$alt", "json;enum-encoding=int")
1938
1939 baseUrl.RawQuery = params.Encode()
1940
1941 // Build HTTP headers from client and context metadata.
1942 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1943
1944 hds = append(c.xGoogHeaders, hds...)
1945 hds = append(hds, "Content-Type", "application/json")
1946 headers := gax.BuildHeaders(ctx, hds...)
1947 opts = append((*c.CallOptions).GetSnapshot[0:len((*c.CallOptions).GetSnapshot):len((*c.CallOptions).GetSnapshot)], opts...)
1948 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1949 resp := &filestorepb.Snapshot{}
1950 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1951 if settings.Path != "" {
1952 baseUrl.Path = settings.Path
1953 }
1954 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1955 if err != nil {
1956 return err
1957 }
1958 httpReq = httpReq.WithContext(ctx)
1959 httpReq.Header = headers
1960
1961 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetSnapshot")
1962 if err != nil {
1963 return err
1964 }
1965
1966 if err := unm.Unmarshal(buf, resp); err != nil {
1967 return err
1968 }
1969
1970 return nil
1971 }, opts...)
1972 if e != nil {
1973 return nil, e
1974 }
1975 return resp, nil
1976 }
1977
1978 // CreateSnapshot creates a snapshot.
1979 func (c *cloudFilestoreManagerRESTClient) CreateSnapshot(ctx context.Context, req *filestorepb.CreateSnapshotRequest, opts ...gax.CallOption) (*CreateSnapshotOperation, error) {
1980 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1981 body := req.GetSnapshot()
1982 jsonReq, err := m.Marshal(body)
1983 if err != nil {
1984 return nil, err
1985 }
1986
1987 baseUrl, err := url.Parse(c.endpoint)
1988 if err != nil {
1989 return nil, err
1990 }
1991 baseUrl.Path += fmt.Sprintf("/v1/%v/snapshots", req.GetParent())
1992
1993 params := url.Values{}
1994 params.Add("$alt", "json;enum-encoding=int")
1995 params.Add("snapshotId", fmt.Sprintf("%v", req.GetSnapshotId()))
1996
1997 baseUrl.RawQuery = params.Encode()
1998
1999 // Build HTTP headers from client and context metadata.
2000 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2001
2002 hds = append(c.xGoogHeaders, hds...)
2003 hds = append(hds, "Content-Type", "application/json")
2004 headers := gax.BuildHeaders(ctx, hds...)
2005 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2006 resp := &longrunningpb.Operation{}
2007 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2008 if settings.Path != "" {
2009 baseUrl.Path = settings.Path
2010 }
2011 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2012 if err != nil {
2013 return err
2014 }
2015 httpReq = httpReq.WithContext(ctx)
2016 httpReq.Header = headers
2017
2018 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateSnapshot")
2019 if err != nil {
2020 return err
2021 }
2022 if err := unm.Unmarshal(buf, resp); err != nil {
2023 return err
2024 }
2025
2026 return nil
2027 }, opts...)
2028 if e != nil {
2029 return nil, e
2030 }
2031
2032 override := fmt.Sprintf("/v1/%s", resp.GetName())
2033 return &CreateSnapshotOperation{
2034 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2035 pollPath: override,
2036 }, nil
2037 }
2038
2039 // DeleteSnapshot deletes a snapshot.
2040 func (c *cloudFilestoreManagerRESTClient) DeleteSnapshot(ctx context.Context, req *filestorepb.DeleteSnapshotRequest, opts ...gax.CallOption) (*DeleteSnapshotOperation, error) {
2041 baseUrl, err := url.Parse(c.endpoint)
2042 if err != nil {
2043 return nil, err
2044 }
2045 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2046
2047 params := url.Values{}
2048 params.Add("$alt", "json;enum-encoding=int")
2049
2050 baseUrl.RawQuery = params.Encode()
2051
2052 // Build HTTP headers from client and context metadata.
2053 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2054
2055 hds = append(c.xGoogHeaders, hds...)
2056 hds = append(hds, "Content-Type", "application/json")
2057 headers := gax.BuildHeaders(ctx, hds...)
2058 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2059 resp := &longrunningpb.Operation{}
2060 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2061 if settings.Path != "" {
2062 baseUrl.Path = settings.Path
2063 }
2064 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2065 if err != nil {
2066 return err
2067 }
2068 httpReq = httpReq.WithContext(ctx)
2069 httpReq.Header = headers
2070
2071 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteSnapshot")
2072 if err != nil {
2073 return err
2074 }
2075 if err := unm.Unmarshal(buf, resp); err != nil {
2076 return err
2077 }
2078
2079 return nil
2080 }, opts...)
2081 if e != nil {
2082 return nil, e
2083 }
2084
2085 override := fmt.Sprintf("/v1/%s", resp.GetName())
2086 return &DeleteSnapshotOperation{
2087 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2088 pollPath: override,
2089 }, nil
2090 }
2091
2092 // UpdateSnapshot updates the settings of a specific snapshot.
2093 func (c *cloudFilestoreManagerRESTClient) UpdateSnapshot(ctx context.Context, req *filestorepb.UpdateSnapshotRequest, opts ...gax.CallOption) (*UpdateSnapshotOperation, error) {
2094 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2095 body := req.GetSnapshot()
2096 jsonReq, err := m.Marshal(body)
2097 if err != nil {
2098 return nil, err
2099 }
2100
2101 baseUrl, err := url.Parse(c.endpoint)
2102 if err != nil {
2103 return nil, err
2104 }
2105 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetSnapshot().GetName())
2106
2107 params := url.Values{}
2108 params.Add("$alt", "json;enum-encoding=int")
2109 if req.GetUpdateMask() != nil {
2110 field, err := protojson.Marshal(req.GetUpdateMask())
2111 if err != nil {
2112 return nil, err
2113 }
2114 params.Add("updateMask", string(field[1:len(field)-1]))
2115 }
2116
2117 baseUrl.RawQuery = params.Encode()
2118
2119 // Build HTTP headers from client and context metadata.
2120 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "snapshot.name", url.QueryEscape(req.GetSnapshot().GetName()))}
2121
2122 hds = append(c.xGoogHeaders, hds...)
2123 hds = append(hds, "Content-Type", "application/json")
2124 headers := gax.BuildHeaders(ctx, hds...)
2125 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2126 resp := &longrunningpb.Operation{}
2127 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2128 if settings.Path != "" {
2129 baseUrl.Path = settings.Path
2130 }
2131 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
2132 if err != nil {
2133 return err
2134 }
2135 httpReq = httpReq.WithContext(ctx)
2136 httpReq.Header = headers
2137
2138 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateSnapshot")
2139 if err != nil {
2140 return err
2141 }
2142 if err := unm.Unmarshal(buf, resp); err != nil {
2143 return err
2144 }
2145
2146 return nil
2147 }, opts...)
2148 if e != nil {
2149 return nil, e
2150 }
2151
2152 override := fmt.Sprintf("/v1/%s", resp.GetName())
2153 return &UpdateSnapshotOperation{
2154 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2155 pollPath: override,
2156 }, nil
2157 }
2158
2159 // ListBackups lists all backups in a project for either a specified location or for all
2160 // locations.
2161 func (c *cloudFilestoreManagerRESTClient) ListBackups(ctx context.Context, req *filestorepb.ListBackupsRequest, opts ...gax.CallOption) *BackupIterator {
2162 it := &BackupIterator{}
2163 req = proto.Clone(req).(*filestorepb.ListBackupsRequest)
2164 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2165 it.InternalFetch = func(pageSize int, pageToken string) ([]*filestorepb.Backup, string, error) {
2166 resp := &filestorepb.ListBackupsResponse{}
2167 if pageToken != "" {
2168 req.PageToken = pageToken
2169 }
2170 if pageSize > math.MaxInt32 {
2171 req.PageSize = math.MaxInt32
2172 } else if pageSize != 0 {
2173 req.PageSize = int32(pageSize)
2174 }
2175 baseUrl, err := url.Parse(c.endpoint)
2176 if err != nil {
2177 return nil, "", err
2178 }
2179 baseUrl.Path += fmt.Sprintf("/v1/%v/backups", req.GetParent())
2180
2181 params := url.Values{}
2182 params.Add("$alt", "json;enum-encoding=int")
2183 if req.GetFilter() != "" {
2184 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2185 }
2186 if req.GetOrderBy() != "" {
2187 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
2188 }
2189 if req.GetPageSize() != 0 {
2190 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2191 }
2192 if req.GetPageToken() != "" {
2193 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2194 }
2195
2196 baseUrl.RawQuery = params.Encode()
2197
2198 // Build HTTP headers from client and context metadata.
2199 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2200 headers := gax.BuildHeaders(ctx, hds...)
2201 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2202 if settings.Path != "" {
2203 baseUrl.Path = settings.Path
2204 }
2205 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2206 if err != nil {
2207 return err
2208 }
2209 httpReq.Header = headers
2210
2211 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListBackups")
2212 if err != nil {
2213 return err
2214 }
2215 if err := unm.Unmarshal(buf, resp); err != nil {
2216 return err
2217 }
2218
2219 return nil
2220 }, opts...)
2221 if e != nil {
2222 return nil, "", e
2223 }
2224 it.Response = resp
2225 return resp.GetBackups(), resp.GetNextPageToken(), nil
2226 }
2227
2228 fetch := func(pageSize int, pageToken string) (string, error) {
2229 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2230 if err != nil {
2231 return "", err
2232 }
2233 it.items = append(it.items, items...)
2234 return nextPageToken, nil
2235 }
2236
2237 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2238 it.pageInfo.MaxSize = int(req.GetPageSize())
2239 it.pageInfo.Token = req.GetPageToken()
2240
2241 return it
2242 }
2243
2244 // GetBackup gets the details of a specific backup.
2245 func (c *cloudFilestoreManagerRESTClient) GetBackup(ctx context.Context, req *filestorepb.GetBackupRequest, opts ...gax.CallOption) (*filestorepb.Backup, error) {
2246 baseUrl, err := url.Parse(c.endpoint)
2247 if err != nil {
2248 return nil, err
2249 }
2250 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2251
2252 params := url.Values{}
2253 params.Add("$alt", "json;enum-encoding=int")
2254
2255 baseUrl.RawQuery = params.Encode()
2256
2257 // Build HTTP headers from client and context metadata.
2258 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2259
2260 hds = append(c.xGoogHeaders, hds...)
2261 hds = append(hds, "Content-Type", "application/json")
2262 headers := gax.BuildHeaders(ctx, hds...)
2263 opts = append((*c.CallOptions).GetBackup[0:len((*c.CallOptions).GetBackup):len((*c.CallOptions).GetBackup)], opts...)
2264 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2265 resp := &filestorepb.Backup{}
2266 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2267 if settings.Path != "" {
2268 baseUrl.Path = settings.Path
2269 }
2270 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2271 if err != nil {
2272 return err
2273 }
2274 httpReq = httpReq.WithContext(ctx)
2275 httpReq.Header = headers
2276
2277 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetBackup")
2278 if err != nil {
2279 return err
2280 }
2281
2282 if err := unm.Unmarshal(buf, resp); err != nil {
2283 return err
2284 }
2285
2286 return nil
2287 }, opts...)
2288 if e != nil {
2289 return nil, e
2290 }
2291 return resp, nil
2292 }
2293
2294 // CreateBackup creates a backup.
2295 func (c *cloudFilestoreManagerRESTClient) CreateBackup(ctx context.Context, req *filestorepb.CreateBackupRequest, opts ...gax.CallOption) (*CreateBackupOperation, error) {
2296 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2297 body := req.GetBackup()
2298 jsonReq, err := m.Marshal(body)
2299 if err != nil {
2300 return nil, err
2301 }
2302
2303 baseUrl, err := url.Parse(c.endpoint)
2304 if err != nil {
2305 return nil, err
2306 }
2307 baseUrl.Path += fmt.Sprintf("/v1/%v/backups", req.GetParent())
2308
2309 params := url.Values{}
2310 params.Add("$alt", "json;enum-encoding=int")
2311 params.Add("backupId", fmt.Sprintf("%v", req.GetBackupId()))
2312
2313 baseUrl.RawQuery = params.Encode()
2314
2315 // Build HTTP headers from client and context metadata.
2316 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2317
2318 hds = append(c.xGoogHeaders, hds...)
2319 hds = append(hds, "Content-Type", "application/json")
2320 headers := gax.BuildHeaders(ctx, hds...)
2321 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2322 resp := &longrunningpb.Operation{}
2323 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2324 if settings.Path != "" {
2325 baseUrl.Path = settings.Path
2326 }
2327 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2328 if err != nil {
2329 return err
2330 }
2331 httpReq = httpReq.WithContext(ctx)
2332 httpReq.Header = headers
2333
2334 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateBackup")
2335 if err != nil {
2336 return err
2337 }
2338 if err := unm.Unmarshal(buf, resp); err != nil {
2339 return err
2340 }
2341
2342 return nil
2343 }, opts...)
2344 if e != nil {
2345 return nil, e
2346 }
2347
2348 override := fmt.Sprintf("/v1/%s", resp.GetName())
2349 return &CreateBackupOperation{
2350 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2351 pollPath: override,
2352 }, nil
2353 }
2354
2355 // DeleteBackup deletes a backup.
2356 func (c *cloudFilestoreManagerRESTClient) DeleteBackup(ctx context.Context, req *filestorepb.DeleteBackupRequest, opts ...gax.CallOption) (*DeleteBackupOperation, error) {
2357 baseUrl, err := url.Parse(c.endpoint)
2358 if err != nil {
2359 return nil, err
2360 }
2361 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2362
2363 params := url.Values{}
2364 params.Add("$alt", "json;enum-encoding=int")
2365
2366 baseUrl.RawQuery = params.Encode()
2367
2368 // Build HTTP headers from client and context metadata.
2369 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2370
2371 hds = append(c.xGoogHeaders, hds...)
2372 hds = append(hds, "Content-Type", "application/json")
2373 headers := gax.BuildHeaders(ctx, hds...)
2374 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2375 resp := &longrunningpb.Operation{}
2376 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2377 if settings.Path != "" {
2378 baseUrl.Path = settings.Path
2379 }
2380 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2381 if err != nil {
2382 return err
2383 }
2384 httpReq = httpReq.WithContext(ctx)
2385 httpReq.Header = headers
2386
2387 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteBackup")
2388 if err != nil {
2389 return err
2390 }
2391 if err := unm.Unmarshal(buf, resp); err != nil {
2392 return err
2393 }
2394
2395 return nil
2396 }, opts...)
2397 if e != nil {
2398 return nil, e
2399 }
2400
2401 override := fmt.Sprintf("/v1/%s", resp.GetName())
2402 return &DeleteBackupOperation{
2403 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2404 pollPath: override,
2405 }, nil
2406 }
2407
2408 // UpdateBackup updates the settings of a specific backup.
2409 func (c *cloudFilestoreManagerRESTClient) UpdateBackup(ctx context.Context, req *filestorepb.UpdateBackupRequest, opts ...gax.CallOption) (*UpdateBackupOperation, error) {
2410 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2411 body := req.GetBackup()
2412 jsonReq, err := m.Marshal(body)
2413 if err != nil {
2414 return nil, err
2415 }
2416
2417 baseUrl, err := url.Parse(c.endpoint)
2418 if err != nil {
2419 return nil, err
2420 }
2421 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetBackup().GetName())
2422
2423 params := url.Values{}
2424 params.Add("$alt", "json;enum-encoding=int")
2425 if req.GetUpdateMask() != nil {
2426 field, err := protojson.Marshal(req.GetUpdateMask())
2427 if err != nil {
2428 return nil, err
2429 }
2430 params.Add("updateMask", string(field[1:len(field)-1]))
2431 }
2432
2433 baseUrl.RawQuery = params.Encode()
2434
2435 // Build HTTP headers from client and context metadata.
2436 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "backup.name", url.QueryEscape(req.GetBackup().GetName()))}
2437
2438 hds = append(c.xGoogHeaders, hds...)
2439 hds = append(hds, "Content-Type", "application/json")
2440 headers := gax.BuildHeaders(ctx, hds...)
2441 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2442 resp := &longrunningpb.Operation{}
2443 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2444 if settings.Path != "" {
2445 baseUrl.Path = settings.Path
2446 }
2447 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
2448 if err != nil {
2449 return err
2450 }
2451 httpReq = httpReq.WithContext(ctx)
2452 httpReq.Header = headers
2453
2454 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateBackup")
2455 if err != nil {
2456 return err
2457 }
2458 if err := unm.Unmarshal(buf, resp); err != nil {
2459 return err
2460 }
2461
2462 return nil
2463 }, opts...)
2464 if e != nil {
2465 return nil, e
2466 }
2467
2468 override := fmt.Sprintf("/v1/%s", resp.GetName())
2469 return &UpdateBackupOperation{
2470 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2471 pollPath: override,
2472 }, nil
2473 }
2474
2475 // PromoteReplica promote the standby instance (replica).
2476 func (c *cloudFilestoreManagerRESTClient) PromoteReplica(ctx context.Context, req *filestorepb.PromoteReplicaRequest, opts ...gax.CallOption) (*PromoteReplicaOperation, error) {
2477 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2478 jsonReq, err := m.Marshal(req)
2479 if err != nil {
2480 return nil, err
2481 }
2482
2483 baseUrl, err := url.Parse(c.endpoint)
2484 if err != nil {
2485 return nil, err
2486 }
2487 baseUrl.Path += fmt.Sprintf("/v1/%v:promoteReplica", req.GetName())
2488
2489 params := url.Values{}
2490 params.Add("$alt", "json;enum-encoding=int")
2491
2492 baseUrl.RawQuery = params.Encode()
2493
2494 // Build HTTP headers from client and context metadata.
2495 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2496
2497 hds = append(c.xGoogHeaders, hds...)
2498 hds = append(hds, "Content-Type", "application/json")
2499 headers := gax.BuildHeaders(ctx, hds...)
2500 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2501 resp := &longrunningpb.Operation{}
2502 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2503 if settings.Path != "" {
2504 baseUrl.Path = settings.Path
2505 }
2506 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2507 if err != nil {
2508 return err
2509 }
2510 httpReq = httpReq.WithContext(ctx)
2511 httpReq.Header = headers
2512
2513 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "PromoteReplica")
2514 if err != nil {
2515 return err
2516 }
2517 if err := unm.Unmarshal(buf, resp); err != nil {
2518 return err
2519 }
2520
2521 return nil
2522 }, opts...)
2523 if e != nil {
2524 return nil, e
2525 }
2526
2527 override := fmt.Sprintf("/v1/%s", resp.GetName())
2528 return &PromoteReplicaOperation{
2529 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2530 pollPath: override,
2531 }, nil
2532 }
2533
2534 // GetLocation gets information about a location.
2535 func (c *cloudFilestoreManagerRESTClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
2536 baseUrl, err := url.Parse(c.endpoint)
2537 if err != nil {
2538 return nil, err
2539 }
2540 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2541
2542 params := url.Values{}
2543 params.Add("$alt", "json;enum-encoding=int")
2544
2545 baseUrl.RawQuery = params.Encode()
2546
2547 // Build HTTP headers from client and context metadata.
2548 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2549
2550 hds = append(c.xGoogHeaders, hds...)
2551 hds = append(hds, "Content-Type", "application/json")
2552 headers := gax.BuildHeaders(ctx, hds...)
2553 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
2554 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2555 resp := &locationpb.Location{}
2556 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2557 if settings.Path != "" {
2558 baseUrl.Path = settings.Path
2559 }
2560 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2561 if err != nil {
2562 return err
2563 }
2564 httpReq = httpReq.WithContext(ctx)
2565 httpReq.Header = headers
2566
2567 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetLocation")
2568 if err != nil {
2569 return err
2570 }
2571
2572 if err := unm.Unmarshal(buf, resp); err != nil {
2573 return err
2574 }
2575
2576 return nil
2577 }, opts...)
2578 if e != nil {
2579 return nil, e
2580 }
2581 return resp, nil
2582 }
2583
2584 // ListLocations lists information about the supported locations for this service.
2585 func (c *cloudFilestoreManagerRESTClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
2586 it := &LocationIterator{}
2587 req = proto.Clone(req).(*locationpb.ListLocationsRequest)
2588 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2589 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
2590 resp := &locationpb.ListLocationsResponse{}
2591 if pageToken != "" {
2592 req.PageToken = pageToken
2593 }
2594 if pageSize > math.MaxInt32 {
2595 req.PageSize = math.MaxInt32
2596 } else if pageSize != 0 {
2597 req.PageSize = int32(pageSize)
2598 }
2599 baseUrl, err := url.Parse(c.endpoint)
2600 if err != nil {
2601 return nil, "", err
2602 }
2603 baseUrl.Path += fmt.Sprintf("/v1/%v/locations", req.GetName())
2604
2605 params := url.Values{}
2606 params.Add("$alt", "json;enum-encoding=int")
2607 if req.GetFilter() != "" {
2608 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2609 }
2610 if req.GetPageSize() != 0 {
2611 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2612 }
2613 if req.GetPageToken() != "" {
2614 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2615 }
2616
2617 baseUrl.RawQuery = params.Encode()
2618
2619 // Build HTTP headers from client and context metadata.
2620 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2621 headers := gax.BuildHeaders(ctx, hds...)
2622 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2623 if settings.Path != "" {
2624 baseUrl.Path = settings.Path
2625 }
2626 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2627 if err != nil {
2628 return err
2629 }
2630 httpReq.Header = headers
2631
2632 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListLocations")
2633 if err != nil {
2634 return err
2635 }
2636 if err := unm.Unmarshal(buf, resp); err != nil {
2637 return err
2638 }
2639
2640 return nil
2641 }, opts...)
2642 if e != nil {
2643 return nil, "", e
2644 }
2645 it.Response = resp
2646 return resp.GetLocations(), resp.GetNextPageToken(), nil
2647 }
2648
2649 fetch := func(pageSize int, pageToken string) (string, error) {
2650 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2651 if err != nil {
2652 return "", err
2653 }
2654 it.items = append(it.items, items...)
2655 return nextPageToken, nil
2656 }
2657
2658 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2659 it.pageInfo.MaxSize = int(req.GetPageSize())
2660 it.pageInfo.Token = req.GetPageToken()
2661
2662 return it
2663 }
2664
2665 // CancelOperation is a utility method from google.longrunning.Operations.
2666 func (c *cloudFilestoreManagerRESTClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
2667 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2668 jsonReq, err := m.Marshal(req)
2669 if err != nil {
2670 return err
2671 }
2672
2673 baseUrl, err := url.Parse(c.endpoint)
2674 if err != nil {
2675 return err
2676 }
2677 baseUrl.Path += fmt.Sprintf("/v1/%v:cancel", req.GetName())
2678
2679 params := url.Values{}
2680 params.Add("$alt", "json;enum-encoding=int")
2681
2682 baseUrl.RawQuery = params.Encode()
2683
2684 // Build HTTP headers from client and context metadata.
2685 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2686
2687 hds = append(c.xGoogHeaders, hds...)
2688 hds = append(hds, "Content-Type", "application/json")
2689 headers := gax.BuildHeaders(ctx, hds...)
2690 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2691 if settings.Path != "" {
2692 baseUrl.Path = settings.Path
2693 }
2694 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2695 if err != nil {
2696 return err
2697 }
2698 httpReq = httpReq.WithContext(ctx)
2699 httpReq.Header = headers
2700
2701 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CancelOperation")
2702 return err
2703 }, opts...)
2704 }
2705
2706 // DeleteOperation is a utility method from google.longrunning.Operations.
2707 func (c *cloudFilestoreManagerRESTClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
2708 baseUrl, err := url.Parse(c.endpoint)
2709 if err != nil {
2710 return err
2711 }
2712 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2713
2714 params := url.Values{}
2715 params.Add("$alt", "json;enum-encoding=int")
2716
2717 baseUrl.RawQuery = params.Encode()
2718
2719 // Build HTTP headers from client and context metadata.
2720 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2721
2722 hds = append(c.xGoogHeaders, hds...)
2723 hds = append(hds, "Content-Type", "application/json")
2724 headers := gax.BuildHeaders(ctx, hds...)
2725 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2726 if settings.Path != "" {
2727 baseUrl.Path = settings.Path
2728 }
2729 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2730 if err != nil {
2731 return err
2732 }
2733 httpReq = httpReq.WithContext(ctx)
2734 httpReq.Header = headers
2735
2736 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation")
2737 return err
2738 }, opts...)
2739 }
2740
2741 // GetOperation is a utility method from google.longrunning.Operations.
2742 func (c *cloudFilestoreManagerRESTClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
2743 baseUrl, err := url.Parse(c.endpoint)
2744 if err != nil {
2745 return nil, err
2746 }
2747 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
2748
2749 params := url.Values{}
2750 params.Add("$alt", "json;enum-encoding=int")
2751
2752 baseUrl.RawQuery = params.Encode()
2753
2754 // Build HTTP headers from client and context metadata.
2755 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2756
2757 hds = append(c.xGoogHeaders, hds...)
2758 hds = append(hds, "Content-Type", "application/json")
2759 headers := gax.BuildHeaders(ctx, hds...)
2760 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
2761 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2762 resp := &longrunningpb.Operation{}
2763 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2764 if settings.Path != "" {
2765 baseUrl.Path = settings.Path
2766 }
2767 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2768 if err != nil {
2769 return err
2770 }
2771 httpReq = httpReq.WithContext(ctx)
2772 httpReq.Header = headers
2773
2774 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOperation")
2775 if err != nil {
2776 return err
2777 }
2778
2779 if err := unm.Unmarshal(buf, resp); err != nil {
2780 return err
2781 }
2782
2783 return nil
2784 }, opts...)
2785 if e != nil {
2786 return nil, e
2787 }
2788 return resp, nil
2789 }
2790
2791 // ListOperations is a utility method from google.longrunning.Operations.
2792 func (c *cloudFilestoreManagerRESTClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
2793 it := &OperationIterator{}
2794 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
2795 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2796 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
2797 resp := &longrunningpb.ListOperationsResponse{}
2798 if pageToken != "" {
2799 req.PageToken = pageToken
2800 }
2801 if pageSize > math.MaxInt32 {
2802 req.PageSize = math.MaxInt32
2803 } else if pageSize != 0 {
2804 req.PageSize = int32(pageSize)
2805 }
2806 baseUrl, err := url.Parse(c.endpoint)
2807 if err != nil {
2808 return nil, "", err
2809 }
2810 baseUrl.Path += fmt.Sprintf("/v1/%v/operations", req.GetName())
2811
2812 params := url.Values{}
2813 params.Add("$alt", "json;enum-encoding=int")
2814 if req.GetFilter() != "" {
2815 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2816 }
2817 if req.GetPageSize() != 0 {
2818 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2819 }
2820 if req.GetPageToken() != "" {
2821 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2822 }
2823
2824 baseUrl.RawQuery = params.Encode()
2825
2826 // Build HTTP headers from client and context metadata.
2827 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2828 headers := gax.BuildHeaders(ctx, hds...)
2829 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2830 if settings.Path != "" {
2831 baseUrl.Path = settings.Path
2832 }
2833 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2834 if err != nil {
2835 return err
2836 }
2837 httpReq.Header = headers
2838
2839 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations")
2840 if err != nil {
2841 return err
2842 }
2843 if err := unm.Unmarshal(buf, resp); err != nil {
2844 return err
2845 }
2846
2847 return nil
2848 }, opts...)
2849 if e != nil {
2850 return nil, "", e
2851 }
2852 it.Response = resp
2853 return resp.GetOperations(), resp.GetNextPageToken(), nil
2854 }
2855
2856 fetch := func(pageSize int, pageToken string) (string, error) {
2857 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2858 if err != nil {
2859 return "", err
2860 }
2861 it.items = append(it.items, items...)
2862 return nextPageToken, nil
2863 }
2864
2865 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2866 it.pageInfo.MaxSize = int(req.GetPageSize())
2867 it.pageInfo.Token = req.GetPageToken()
2868
2869 return it
2870 }
2871
2872 // CreateBackupOperation returns a new CreateBackupOperation from a given name.
2873 // The name must be that of a previously created CreateBackupOperation, possibly from a different process.
2874 func (c *cloudFilestoreManagerGRPCClient) CreateBackupOperation(name string) *CreateBackupOperation {
2875 return &CreateBackupOperation{
2876 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2877 }
2878 }
2879
2880 // CreateBackupOperation returns a new CreateBackupOperation from a given name.
2881 // The name must be that of a previously created CreateBackupOperation, possibly from a different process.
2882 func (c *cloudFilestoreManagerRESTClient) CreateBackupOperation(name string) *CreateBackupOperation {
2883 override := fmt.Sprintf("/v1/%s", name)
2884 return &CreateBackupOperation{
2885 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2886 pollPath: override,
2887 }
2888 }
2889
2890 // CreateInstanceOperation returns a new CreateInstanceOperation from a given name.
2891 // The name must be that of a previously created CreateInstanceOperation, possibly from a different process.
2892 func (c *cloudFilestoreManagerGRPCClient) CreateInstanceOperation(name string) *CreateInstanceOperation {
2893 return &CreateInstanceOperation{
2894 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2895 }
2896 }
2897
2898 // CreateInstanceOperation returns a new CreateInstanceOperation from a given name.
2899 // The name must be that of a previously created CreateInstanceOperation, possibly from a different process.
2900 func (c *cloudFilestoreManagerRESTClient) CreateInstanceOperation(name string) *CreateInstanceOperation {
2901 override := fmt.Sprintf("/v1/%s", name)
2902 return &CreateInstanceOperation{
2903 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2904 pollPath: override,
2905 }
2906 }
2907
2908 // CreateSnapshotOperation returns a new CreateSnapshotOperation from a given name.
2909 // The name must be that of a previously created CreateSnapshotOperation, possibly from a different process.
2910 func (c *cloudFilestoreManagerGRPCClient) CreateSnapshotOperation(name string) *CreateSnapshotOperation {
2911 return &CreateSnapshotOperation{
2912 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2913 }
2914 }
2915
2916 // CreateSnapshotOperation returns a new CreateSnapshotOperation from a given name.
2917 // The name must be that of a previously created CreateSnapshotOperation, possibly from a different process.
2918 func (c *cloudFilestoreManagerRESTClient) CreateSnapshotOperation(name string) *CreateSnapshotOperation {
2919 override := fmt.Sprintf("/v1/%s", name)
2920 return &CreateSnapshotOperation{
2921 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2922 pollPath: override,
2923 }
2924 }
2925
2926 // DeleteBackupOperation returns a new DeleteBackupOperation from a given name.
2927 // The name must be that of a previously created DeleteBackupOperation, possibly from a different process.
2928 func (c *cloudFilestoreManagerGRPCClient) DeleteBackupOperation(name string) *DeleteBackupOperation {
2929 return &DeleteBackupOperation{
2930 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2931 }
2932 }
2933
2934 // DeleteBackupOperation returns a new DeleteBackupOperation from a given name.
2935 // The name must be that of a previously created DeleteBackupOperation, possibly from a different process.
2936 func (c *cloudFilestoreManagerRESTClient) DeleteBackupOperation(name string) *DeleteBackupOperation {
2937 override := fmt.Sprintf("/v1/%s", name)
2938 return &DeleteBackupOperation{
2939 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2940 pollPath: override,
2941 }
2942 }
2943
2944 // DeleteInstanceOperation returns a new DeleteInstanceOperation from a given name.
2945 // The name must be that of a previously created DeleteInstanceOperation, possibly from a different process.
2946 func (c *cloudFilestoreManagerGRPCClient) DeleteInstanceOperation(name string) *DeleteInstanceOperation {
2947 return &DeleteInstanceOperation{
2948 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2949 }
2950 }
2951
2952 // DeleteInstanceOperation returns a new DeleteInstanceOperation from a given name.
2953 // The name must be that of a previously created DeleteInstanceOperation, possibly from a different process.
2954 func (c *cloudFilestoreManagerRESTClient) DeleteInstanceOperation(name string) *DeleteInstanceOperation {
2955 override := fmt.Sprintf("/v1/%s", name)
2956 return &DeleteInstanceOperation{
2957 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2958 pollPath: override,
2959 }
2960 }
2961
2962 // DeleteSnapshotOperation returns a new DeleteSnapshotOperation from a given name.
2963 // The name must be that of a previously created DeleteSnapshotOperation, possibly from a different process.
2964 func (c *cloudFilestoreManagerGRPCClient) DeleteSnapshotOperation(name string) *DeleteSnapshotOperation {
2965 return &DeleteSnapshotOperation{
2966 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2967 }
2968 }
2969
2970 // DeleteSnapshotOperation returns a new DeleteSnapshotOperation from a given name.
2971 // The name must be that of a previously created DeleteSnapshotOperation, possibly from a different process.
2972 func (c *cloudFilestoreManagerRESTClient) DeleteSnapshotOperation(name string) *DeleteSnapshotOperation {
2973 override := fmt.Sprintf("/v1/%s", name)
2974 return &DeleteSnapshotOperation{
2975 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2976 pollPath: override,
2977 }
2978 }
2979
2980 // PromoteReplicaOperation returns a new PromoteReplicaOperation from a given name.
2981 // The name must be that of a previously created PromoteReplicaOperation, possibly from a different process.
2982 func (c *cloudFilestoreManagerGRPCClient) PromoteReplicaOperation(name string) *PromoteReplicaOperation {
2983 return &PromoteReplicaOperation{
2984 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2985 }
2986 }
2987
2988 // PromoteReplicaOperation returns a new PromoteReplicaOperation from a given name.
2989 // The name must be that of a previously created PromoteReplicaOperation, possibly from a different process.
2990 func (c *cloudFilestoreManagerRESTClient) PromoteReplicaOperation(name string) *PromoteReplicaOperation {
2991 override := fmt.Sprintf("/v1/%s", name)
2992 return &PromoteReplicaOperation{
2993 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
2994 pollPath: override,
2995 }
2996 }
2997
2998 // RestoreInstanceOperation returns a new RestoreInstanceOperation from a given name.
2999 // The name must be that of a previously created RestoreInstanceOperation, possibly from a different process.
3000 func (c *cloudFilestoreManagerGRPCClient) RestoreInstanceOperation(name string) *RestoreInstanceOperation {
3001 return &RestoreInstanceOperation{
3002 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3003 }
3004 }
3005
3006 // RestoreInstanceOperation returns a new RestoreInstanceOperation from a given name.
3007 // The name must be that of a previously created RestoreInstanceOperation, possibly from a different process.
3008 func (c *cloudFilestoreManagerRESTClient) RestoreInstanceOperation(name string) *RestoreInstanceOperation {
3009 override := fmt.Sprintf("/v1/%s", name)
3010 return &RestoreInstanceOperation{
3011 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3012 pollPath: override,
3013 }
3014 }
3015
3016 // RevertInstanceOperation returns a new RevertInstanceOperation from a given name.
3017 // The name must be that of a previously created RevertInstanceOperation, possibly from a different process.
3018 func (c *cloudFilestoreManagerGRPCClient) RevertInstanceOperation(name string) *RevertInstanceOperation {
3019 return &RevertInstanceOperation{
3020 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3021 }
3022 }
3023
3024 // RevertInstanceOperation returns a new RevertInstanceOperation from a given name.
3025 // The name must be that of a previously created RevertInstanceOperation, possibly from a different process.
3026 func (c *cloudFilestoreManagerRESTClient) RevertInstanceOperation(name string) *RevertInstanceOperation {
3027 override := fmt.Sprintf("/v1/%s", name)
3028 return &RevertInstanceOperation{
3029 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3030 pollPath: override,
3031 }
3032 }
3033
3034 // UpdateBackupOperation returns a new UpdateBackupOperation from a given name.
3035 // The name must be that of a previously created UpdateBackupOperation, possibly from a different process.
3036 func (c *cloudFilestoreManagerGRPCClient) UpdateBackupOperation(name string) *UpdateBackupOperation {
3037 return &UpdateBackupOperation{
3038 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3039 }
3040 }
3041
3042 // UpdateBackupOperation returns a new UpdateBackupOperation from a given name.
3043 // The name must be that of a previously created UpdateBackupOperation, possibly from a different process.
3044 func (c *cloudFilestoreManagerRESTClient) UpdateBackupOperation(name string) *UpdateBackupOperation {
3045 override := fmt.Sprintf("/v1/%s", name)
3046 return &UpdateBackupOperation{
3047 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3048 pollPath: override,
3049 }
3050 }
3051
3052 // UpdateInstanceOperation returns a new UpdateInstanceOperation from a given name.
3053 // The name must be that of a previously created UpdateInstanceOperation, possibly from a different process.
3054 func (c *cloudFilestoreManagerGRPCClient) UpdateInstanceOperation(name string) *UpdateInstanceOperation {
3055 return &UpdateInstanceOperation{
3056 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3057 }
3058 }
3059
3060 // UpdateInstanceOperation returns a new UpdateInstanceOperation from a given name.
3061 // The name must be that of a previously created UpdateInstanceOperation, possibly from a different process.
3062 func (c *cloudFilestoreManagerRESTClient) UpdateInstanceOperation(name string) *UpdateInstanceOperation {
3063 override := fmt.Sprintf("/v1/%s", name)
3064 return &UpdateInstanceOperation{
3065 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3066 pollPath: override,
3067 }
3068 }
3069
3070 // UpdateSnapshotOperation returns a new UpdateSnapshotOperation from a given name.
3071 // The name must be that of a previously created UpdateSnapshotOperation, possibly from a different process.
3072 func (c *cloudFilestoreManagerGRPCClient) UpdateSnapshotOperation(name string) *UpdateSnapshotOperation {
3073 return &UpdateSnapshotOperation{
3074 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3075 }
3076 }
3077
3078 // UpdateSnapshotOperation returns a new UpdateSnapshotOperation from a given name.
3079 // The name must be that of a previously created UpdateSnapshotOperation, possibly from a different process.
3080 func (c *cloudFilestoreManagerRESTClient) UpdateSnapshotOperation(name string) *UpdateSnapshotOperation {
3081 override := fmt.Sprintf("/v1/%s", name)
3082 return &UpdateSnapshotOperation{
3083 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3084 pollPath: override,
3085 }
3086 }