Debian Codegraph @

networkservices/apiv1/network_services_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 networkservices
18
19 import (
20 "bytes"
21 "context"
22 "fmt"
23 "log/slog"
24 "math"
25 "net/http"
26 "net/url"
27 "time"
28
29 iampb "cloud.google.com/go/iam/apiv1/iampb"
30 "cloud.google.com/go/longrunning"
31 lroauto "cloud.google.com/go/longrunning/autogen"
32 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
33 networkservicespb "cloud.google.com/go/networkservices/apiv1/networkservicespb"
34 gax "github.com/googleapis/gax-go/v2"
35 "google.golang.org/api/iterator"
36 "google.golang.org/api/option"
37 "google.golang.org/api/option/internaloption"
38 gtransport "google.golang.org/api/transport/grpc"
39 httptransport "google.golang.org/api/transport/http"
40 locationpb "google.golang.org/genproto/googleapis/cloud/location"
41 "google.golang.org/grpc"
42 "google.golang.org/protobuf/encoding/protojson"
43 "google.golang.org/protobuf/proto"
44 )
45
46 var newClientHook clientHook
47
48 // CallOptions contains the retry settings for each method of Client.
49 type CallOptions struct {
50 ListEndpointPolicies []gax.CallOption
51 GetEndpointPolicy []gax.CallOption
52 CreateEndpointPolicy []gax.CallOption
53 UpdateEndpointPolicy []gax.CallOption
54 DeleteEndpointPolicy []gax.CallOption
55 ListWasmPluginVersions []gax.CallOption
56 GetWasmPluginVersion []gax.CallOption
57 CreateWasmPluginVersion []gax.CallOption
58 DeleteWasmPluginVersion []gax.CallOption
59 ListWasmPlugins []gax.CallOption
60 GetWasmPlugin []gax.CallOption
61 CreateWasmPlugin []gax.CallOption
62 UpdateWasmPlugin []gax.CallOption
63 DeleteWasmPlugin []gax.CallOption
64 ListGateways []gax.CallOption
65 GetGateway []gax.CallOption
66 CreateGateway []gax.CallOption
67 UpdateGateway []gax.CallOption
68 DeleteGateway []gax.CallOption
69 ListGrpcRoutes []gax.CallOption
70 GetGrpcRoute []gax.CallOption
71 CreateGrpcRoute []gax.CallOption
72 UpdateGrpcRoute []gax.CallOption
73 DeleteGrpcRoute []gax.CallOption
74 ListHttpRoutes []gax.CallOption
75 GetHttpRoute []gax.CallOption
76 CreateHttpRoute []gax.CallOption
77 UpdateHttpRoute []gax.CallOption
78 DeleteHttpRoute []gax.CallOption
79 ListTcpRoutes []gax.CallOption
80 GetTcpRoute []gax.CallOption
81 CreateTcpRoute []gax.CallOption
82 UpdateTcpRoute []gax.CallOption
83 DeleteTcpRoute []gax.CallOption
84 ListTlsRoutes []gax.CallOption
85 GetTlsRoute []gax.CallOption
86 CreateTlsRoute []gax.CallOption
87 UpdateTlsRoute []gax.CallOption
88 DeleteTlsRoute []gax.CallOption
89 ListServiceBindings []gax.CallOption
90 GetServiceBinding []gax.CallOption
91 CreateServiceBinding []gax.CallOption
92 UpdateServiceBinding []gax.CallOption
93 DeleteServiceBinding []gax.CallOption
94 ListMeshes []gax.CallOption
95 GetMesh []gax.CallOption
96 CreateMesh []gax.CallOption
97 UpdateMesh []gax.CallOption
98 DeleteMesh []gax.CallOption
99 ListServiceLbPolicies []gax.CallOption
100 GetServiceLbPolicy []gax.CallOption
101 CreateServiceLbPolicy []gax.CallOption
102 UpdateServiceLbPolicy []gax.CallOption
103 DeleteServiceLbPolicy []gax.CallOption
104 GetGatewayRouteView []gax.CallOption
105 GetMeshRouteView []gax.CallOption
106 ListGatewayRouteViews []gax.CallOption
107 ListMeshRouteViews []gax.CallOption
108 GetLocation []gax.CallOption
109 ListLocations []gax.CallOption
110 GetIamPolicy []gax.CallOption
111 SetIamPolicy []gax.CallOption
112 TestIamPermissions []gax.CallOption
113 CancelOperation []gax.CallOption
114 DeleteOperation []gax.CallOption
115 GetOperation []gax.CallOption
116 ListOperations []gax.CallOption
117 }
118
119 func defaultGRPCClientOptions() []option.ClientOption {
120 return []option.ClientOption{
121 internaloption.WithDefaultEndpoint("networkservices.googleapis.com:443"),
122 internaloption.WithDefaultEndpointTemplate("networkservices.UNIVERSE_DOMAIN:443"),
123 internaloption.WithDefaultMTLSEndpoint("networkservices.mtls.googleapis.com:443"),
124 internaloption.WithDefaultUniverseDomain("googleapis.com"),
125 internaloption.WithDefaultAudience("https://networkservices.googleapis.com/"),
126 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
127 internaloption.EnableJwtWithScope(),
128 internaloption.EnableNewAuthLibrary(),
129 option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
130 grpc.MaxCallRecvMsgSize(math.MaxInt32))),
131 }
132 }
133
134 func defaultCallOptions() *CallOptions {
135 return &CallOptions{
136 ListEndpointPolicies: []gax.CallOption{
137 gax.WithTimeout(60000 * time.Millisecond),
138 },
139 GetEndpointPolicy: []gax.CallOption{
140 gax.WithTimeout(60000 * time.Millisecond),
141 },
142 CreateEndpointPolicy: []gax.CallOption{
143 gax.WithTimeout(60000 * time.Millisecond),
144 },
145 UpdateEndpointPolicy: []gax.CallOption{
146 gax.WithTimeout(60000 * time.Millisecond),
147 },
148 DeleteEndpointPolicy: []gax.CallOption{
149 gax.WithTimeout(60000 * time.Millisecond),
150 },
151 ListWasmPluginVersions: []gax.CallOption{
152 gax.WithTimeout(60000 * time.Millisecond),
153 },
154 GetWasmPluginVersion: []gax.CallOption{
155 gax.WithTimeout(60000 * time.Millisecond),
156 },
157 CreateWasmPluginVersion: []gax.CallOption{
158 gax.WithTimeout(60000 * time.Millisecond),
159 },
160 DeleteWasmPluginVersion: []gax.CallOption{
161 gax.WithTimeout(60000 * time.Millisecond),
162 },
163 ListWasmPlugins: []gax.CallOption{
164 gax.WithTimeout(60000 * time.Millisecond),
165 },
166 GetWasmPlugin: []gax.CallOption{
167 gax.WithTimeout(60000 * time.Millisecond),
168 },
169 CreateWasmPlugin: []gax.CallOption{
170 gax.WithTimeout(60000 * time.Millisecond),
171 },
172 UpdateWasmPlugin: []gax.CallOption{
173 gax.WithTimeout(60000 * time.Millisecond),
174 },
175 DeleteWasmPlugin: []gax.CallOption{
176 gax.WithTimeout(60000 * time.Millisecond),
177 },
178 ListGateways: []gax.CallOption{
179 gax.WithTimeout(60000 * time.Millisecond),
180 },
181 GetGateway: []gax.CallOption{
182 gax.WithTimeout(60000 * time.Millisecond),
183 },
184 CreateGateway: []gax.CallOption{
185 gax.WithTimeout(60000 * time.Millisecond),
186 },
187 UpdateGateway: []gax.CallOption{
188 gax.WithTimeout(60000 * time.Millisecond),
189 },
190 DeleteGateway: []gax.CallOption{
191 gax.WithTimeout(60000 * time.Millisecond),
192 },
193 ListGrpcRoutes: []gax.CallOption{
194 gax.WithTimeout(60000 * time.Millisecond),
195 },
196 GetGrpcRoute: []gax.CallOption{
197 gax.WithTimeout(60000 * time.Millisecond),
198 },
199 CreateGrpcRoute: []gax.CallOption{
200 gax.WithTimeout(60000 * time.Millisecond),
201 },
202 UpdateGrpcRoute: []gax.CallOption{
203 gax.WithTimeout(60000 * time.Millisecond),
204 },
205 DeleteGrpcRoute: []gax.CallOption{
206 gax.WithTimeout(60000 * time.Millisecond),
207 },
208 ListHttpRoutes: []gax.CallOption{
209 gax.WithTimeout(60000 * time.Millisecond),
210 },
211 GetHttpRoute: []gax.CallOption{
212 gax.WithTimeout(60000 * time.Millisecond),
213 },
214 CreateHttpRoute: []gax.CallOption{
215 gax.WithTimeout(60000 * time.Millisecond),
216 },
217 UpdateHttpRoute: []gax.CallOption{
218 gax.WithTimeout(60000 * time.Millisecond),
219 },
220 DeleteHttpRoute: []gax.CallOption{
221 gax.WithTimeout(60000 * time.Millisecond),
222 },
223 ListTcpRoutes: []gax.CallOption{
224 gax.WithTimeout(60000 * time.Millisecond),
225 },
226 GetTcpRoute: []gax.CallOption{
227 gax.WithTimeout(60000 * time.Millisecond),
228 },
229 CreateTcpRoute: []gax.CallOption{
230 gax.WithTimeout(60000 * time.Millisecond),
231 },
232 UpdateTcpRoute: []gax.CallOption{
233 gax.WithTimeout(60000 * time.Millisecond),
234 },
235 DeleteTcpRoute: []gax.CallOption{
236 gax.WithTimeout(60000 * time.Millisecond),
237 },
238 ListTlsRoutes: []gax.CallOption{
239 gax.WithTimeout(60000 * time.Millisecond),
240 },
241 GetTlsRoute: []gax.CallOption{
242 gax.WithTimeout(60000 * time.Millisecond),
243 },
244 CreateTlsRoute: []gax.CallOption{
245 gax.WithTimeout(60000 * time.Millisecond),
246 },
247 UpdateTlsRoute: []gax.CallOption{
248 gax.WithTimeout(60000 * time.Millisecond),
249 },
250 DeleteTlsRoute: []gax.CallOption{
251 gax.WithTimeout(60000 * time.Millisecond),
252 },
253 ListServiceBindings: []gax.CallOption{
254 gax.WithTimeout(60000 * time.Millisecond),
255 },
256 GetServiceBinding: []gax.CallOption{
257 gax.WithTimeout(60000 * time.Millisecond),
258 },
259 CreateServiceBinding: []gax.CallOption{
260 gax.WithTimeout(60000 * time.Millisecond),
261 },
262 UpdateServiceBinding: []gax.CallOption{
263 gax.WithTimeout(60000 * time.Millisecond),
264 },
265 DeleteServiceBinding: []gax.CallOption{
266 gax.WithTimeout(60000 * time.Millisecond),
267 },
268 ListMeshes: []gax.CallOption{
269 gax.WithTimeout(60000 * time.Millisecond),
270 },
271 GetMesh: []gax.CallOption{
272 gax.WithTimeout(60000 * time.Millisecond),
273 },
274 CreateMesh: []gax.CallOption{
275 gax.WithTimeout(60000 * time.Millisecond),
276 },
277 UpdateMesh: []gax.CallOption{
278 gax.WithTimeout(60000 * time.Millisecond),
279 },
280 DeleteMesh: []gax.CallOption{
281 gax.WithTimeout(60000 * time.Millisecond),
282 },
283 ListServiceLbPolicies: []gax.CallOption{
284 gax.WithTimeout(60000 * time.Millisecond),
285 },
286 GetServiceLbPolicy: []gax.CallOption{
287 gax.WithTimeout(60000 * time.Millisecond),
288 },
289 CreateServiceLbPolicy: []gax.CallOption{
290 gax.WithTimeout(60000 * time.Millisecond),
291 },
292 UpdateServiceLbPolicy: []gax.CallOption{
293 gax.WithTimeout(60000 * time.Millisecond),
294 },
295 DeleteServiceLbPolicy: []gax.CallOption{
296 gax.WithTimeout(60000 * time.Millisecond),
297 },
298 GetGatewayRouteView: []gax.CallOption{
299 gax.WithTimeout(60000 * time.Millisecond),
300 },
301 GetMeshRouteView: []gax.CallOption{
302 gax.WithTimeout(60000 * time.Millisecond),
303 },
304 ListGatewayRouteViews: []gax.CallOption{
305 gax.WithTimeout(60000 * time.Millisecond),
306 },
307 ListMeshRouteViews: []gax.CallOption{
308 gax.WithTimeout(60000 * time.Millisecond),
309 },
310 GetLocation: []gax.CallOption{},
311 ListLocations: []gax.CallOption{},
312 GetIamPolicy: []gax.CallOption{},
313 SetIamPolicy: []gax.CallOption{},
314 TestIamPermissions: []gax.CallOption{},
315 CancelOperation: []gax.CallOption{},
316 DeleteOperation: []gax.CallOption{},
317 GetOperation: []gax.CallOption{},
318 ListOperations: []gax.CallOption{},
319 }
320 }
321
322 func defaultRESTCallOptions() *CallOptions {
323 return &CallOptions{
324 ListEndpointPolicies: []gax.CallOption{
325 gax.WithTimeout(60000 * time.Millisecond),
326 },
327 GetEndpointPolicy: []gax.CallOption{
328 gax.WithTimeout(60000 * time.Millisecond),
329 },
330 CreateEndpointPolicy: []gax.CallOption{
331 gax.WithTimeout(60000 * time.Millisecond),
332 },
333 UpdateEndpointPolicy: []gax.CallOption{
334 gax.WithTimeout(60000 * time.Millisecond),
335 },
336 DeleteEndpointPolicy: []gax.CallOption{
337 gax.WithTimeout(60000 * time.Millisecond),
338 },
339 ListWasmPluginVersions: []gax.CallOption{
340 gax.WithTimeout(60000 * time.Millisecond),
341 },
342 GetWasmPluginVersion: []gax.CallOption{
343 gax.WithTimeout(60000 * time.Millisecond),
344 },
345 CreateWasmPluginVersion: []gax.CallOption{
346 gax.WithTimeout(60000 * time.Millisecond),
347 },
348 DeleteWasmPluginVersion: []gax.CallOption{
349 gax.WithTimeout(60000 * time.Millisecond),
350 },
351 ListWasmPlugins: []gax.CallOption{
352 gax.WithTimeout(60000 * time.Millisecond),
353 },
354 GetWasmPlugin: []gax.CallOption{
355 gax.WithTimeout(60000 * time.Millisecond),
356 },
357 CreateWasmPlugin: []gax.CallOption{
358 gax.WithTimeout(60000 * time.Millisecond),
359 },
360 UpdateWasmPlugin: []gax.CallOption{
361 gax.WithTimeout(60000 * time.Millisecond),
362 },
363 DeleteWasmPlugin: []gax.CallOption{
364 gax.WithTimeout(60000 * time.Millisecond),
365 },
366 ListGateways: []gax.CallOption{
367 gax.WithTimeout(60000 * time.Millisecond),
368 },
369 GetGateway: []gax.CallOption{
370 gax.WithTimeout(60000 * time.Millisecond),
371 },
372 CreateGateway: []gax.CallOption{
373 gax.WithTimeout(60000 * time.Millisecond),
374 },
375 UpdateGateway: []gax.CallOption{
376 gax.WithTimeout(60000 * time.Millisecond),
377 },
378 DeleteGateway: []gax.CallOption{
379 gax.WithTimeout(60000 * time.Millisecond),
380 },
381 ListGrpcRoutes: []gax.CallOption{
382 gax.WithTimeout(60000 * time.Millisecond),
383 },
384 GetGrpcRoute: []gax.CallOption{
385 gax.WithTimeout(60000 * time.Millisecond),
386 },
387 CreateGrpcRoute: []gax.CallOption{
388 gax.WithTimeout(60000 * time.Millisecond),
389 },
390 UpdateGrpcRoute: []gax.CallOption{
391 gax.WithTimeout(60000 * time.Millisecond),
392 },
393 DeleteGrpcRoute: []gax.CallOption{
394 gax.WithTimeout(60000 * time.Millisecond),
395 },
396 ListHttpRoutes: []gax.CallOption{
397 gax.WithTimeout(60000 * time.Millisecond),
398 },
399 GetHttpRoute: []gax.CallOption{
400 gax.WithTimeout(60000 * time.Millisecond),
401 },
402 CreateHttpRoute: []gax.CallOption{
403 gax.WithTimeout(60000 * time.Millisecond),
404 },
405 UpdateHttpRoute: []gax.CallOption{
406 gax.WithTimeout(60000 * time.Millisecond),
407 },
408 DeleteHttpRoute: []gax.CallOption{
409 gax.WithTimeout(60000 * time.Millisecond),
410 },
411 ListTcpRoutes: []gax.CallOption{
412 gax.WithTimeout(60000 * time.Millisecond),
413 },
414 GetTcpRoute: []gax.CallOption{
415 gax.WithTimeout(60000 * time.Millisecond),
416 },
417 CreateTcpRoute: []gax.CallOption{
418 gax.WithTimeout(60000 * time.Millisecond),
419 },
420 UpdateTcpRoute: []gax.CallOption{
421 gax.WithTimeout(60000 * time.Millisecond),
422 },
423 DeleteTcpRoute: []gax.CallOption{
424 gax.WithTimeout(60000 * time.Millisecond),
425 },
426 ListTlsRoutes: []gax.CallOption{
427 gax.WithTimeout(60000 * time.Millisecond),
428 },
429 GetTlsRoute: []gax.CallOption{
430 gax.WithTimeout(60000 * time.Millisecond),
431 },
432 CreateTlsRoute: []gax.CallOption{
433 gax.WithTimeout(60000 * time.Millisecond),
434 },
435 UpdateTlsRoute: []gax.CallOption{
436 gax.WithTimeout(60000 * time.Millisecond),
437 },
438 DeleteTlsRoute: []gax.CallOption{
439 gax.WithTimeout(60000 * time.Millisecond),
440 },
441 ListServiceBindings: []gax.CallOption{
442 gax.WithTimeout(60000 * time.Millisecond),
443 },
444 GetServiceBinding: []gax.CallOption{
445 gax.WithTimeout(60000 * time.Millisecond),
446 },
447 CreateServiceBinding: []gax.CallOption{
448 gax.WithTimeout(60000 * time.Millisecond),
449 },
450 UpdateServiceBinding: []gax.CallOption{
451 gax.WithTimeout(60000 * time.Millisecond),
452 },
453 DeleteServiceBinding: []gax.CallOption{
454 gax.WithTimeout(60000 * time.Millisecond),
455 },
456 ListMeshes: []gax.CallOption{
457 gax.WithTimeout(60000 * time.Millisecond),
458 },
459 GetMesh: []gax.CallOption{
460 gax.WithTimeout(60000 * time.Millisecond),
461 },
462 CreateMesh: []gax.CallOption{
463 gax.WithTimeout(60000 * time.Millisecond),
464 },
465 UpdateMesh: []gax.CallOption{
466 gax.WithTimeout(60000 * time.Millisecond),
467 },
468 DeleteMesh: []gax.CallOption{
469 gax.WithTimeout(60000 * time.Millisecond),
470 },
471 ListServiceLbPolicies: []gax.CallOption{
472 gax.WithTimeout(60000 * time.Millisecond),
473 },
474 GetServiceLbPolicy: []gax.CallOption{
475 gax.WithTimeout(60000 * time.Millisecond),
476 },
477 CreateServiceLbPolicy: []gax.CallOption{
478 gax.WithTimeout(60000 * time.Millisecond),
479 },
480 UpdateServiceLbPolicy: []gax.CallOption{
481 gax.WithTimeout(60000 * time.Millisecond),
482 },
483 DeleteServiceLbPolicy: []gax.CallOption{
484 gax.WithTimeout(60000 * time.Millisecond),
485 },
486 GetGatewayRouteView: []gax.CallOption{
487 gax.WithTimeout(60000 * time.Millisecond),
488 },
489 GetMeshRouteView: []gax.CallOption{
490 gax.WithTimeout(60000 * time.Millisecond),
491 },
492 ListGatewayRouteViews: []gax.CallOption{
493 gax.WithTimeout(60000 * time.Millisecond),
494 },
495 ListMeshRouteViews: []gax.CallOption{
496 gax.WithTimeout(60000 * time.Millisecond),
497 },
498 GetLocation: []gax.CallOption{},
499 ListLocations: []gax.CallOption{},
500 GetIamPolicy: []gax.CallOption{},
501 SetIamPolicy: []gax.CallOption{},
502 TestIamPermissions: []gax.CallOption{},
503 CancelOperation: []gax.CallOption{},
504 DeleteOperation: []gax.CallOption{},
505 GetOperation: []gax.CallOption{},
506 ListOperations: []gax.CallOption{},
507 }
508 }
509
510 // internalClient is an interface that defines the methods available from Network Services API.
511 type internalClient interface {
512 Close() error
513 setGoogleClientInfo(...string)
514 Connection() *grpc.ClientConn
515 ListEndpointPolicies(context.Context, *networkservicespb.ListEndpointPoliciesRequest, ...gax.CallOption) *EndpointPolicyIterator
516 GetEndpointPolicy(context.Context, *networkservicespb.GetEndpointPolicyRequest, ...gax.CallOption) (*networkservicespb.EndpointPolicy, error)
517 CreateEndpointPolicy(context.Context, *networkservicespb.CreateEndpointPolicyRequest, ...gax.CallOption) (*CreateEndpointPolicyOperation, error)
518 CreateEndpointPolicyOperation(name string) *CreateEndpointPolicyOperation
519 UpdateEndpointPolicy(context.Context, *networkservicespb.UpdateEndpointPolicyRequest, ...gax.CallOption) (*UpdateEndpointPolicyOperation, error)
520 UpdateEndpointPolicyOperation(name string) *UpdateEndpointPolicyOperation
521 DeleteEndpointPolicy(context.Context, *networkservicespb.DeleteEndpointPolicyRequest, ...gax.CallOption) (*DeleteEndpointPolicyOperation, error)
522 DeleteEndpointPolicyOperation(name string) *DeleteEndpointPolicyOperation
523 ListWasmPluginVersions(context.Context, *networkservicespb.ListWasmPluginVersionsRequest, ...gax.CallOption) *WasmPluginVersionIterator
524 GetWasmPluginVersion(context.Context, *networkservicespb.GetWasmPluginVersionRequest, ...gax.CallOption) (*networkservicespb.WasmPluginVersion, error)
525 CreateWasmPluginVersion(context.Context, *networkservicespb.CreateWasmPluginVersionRequest, ...gax.CallOption) (*CreateWasmPluginVersionOperation, error)
526 CreateWasmPluginVersionOperation(name string) *CreateWasmPluginVersionOperation
527 DeleteWasmPluginVersion(context.Context, *networkservicespb.DeleteWasmPluginVersionRequest, ...gax.CallOption) (*DeleteWasmPluginVersionOperation, error)
528 DeleteWasmPluginVersionOperation(name string) *DeleteWasmPluginVersionOperation
529 ListWasmPlugins(context.Context, *networkservicespb.ListWasmPluginsRequest, ...gax.CallOption) *WasmPluginIterator
530 GetWasmPlugin(context.Context, *networkservicespb.GetWasmPluginRequest, ...gax.CallOption) (*networkservicespb.WasmPlugin, error)
531 CreateWasmPlugin(context.Context, *networkservicespb.CreateWasmPluginRequest, ...gax.CallOption) (*CreateWasmPluginOperation, error)
532 CreateWasmPluginOperation(name string) *CreateWasmPluginOperation
533 UpdateWasmPlugin(context.Context, *networkservicespb.UpdateWasmPluginRequest, ...gax.CallOption) (*UpdateWasmPluginOperation, error)
534 UpdateWasmPluginOperation(name string) *UpdateWasmPluginOperation
535 DeleteWasmPlugin(context.Context, *networkservicespb.DeleteWasmPluginRequest, ...gax.CallOption) (*DeleteWasmPluginOperation, error)
536 DeleteWasmPluginOperation(name string) *DeleteWasmPluginOperation
537 ListGateways(context.Context, *networkservicespb.ListGatewaysRequest, ...gax.CallOption) *GatewayIterator
538 GetGateway(context.Context, *networkservicespb.GetGatewayRequest, ...gax.CallOption) (*networkservicespb.Gateway, error)
539 CreateGateway(context.Context, *networkservicespb.CreateGatewayRequest, ...gax.CallOption) (*CreateGatewayOperation, error)
540 CreateGatewayOperation(name string) *CreateGatewayOperation
541 UpdateGateway(context.Context, *networkservicespb.UpdateGatewayRequest, ...gax.CallOption) (*UpdateGatewayOperation, error)
542 UpdateGatewayOperation(name string) *UpdateGatewayOperation
543 DeleteGateway(context.Context, *networkservicespb.DeleteGatewayRequest, ...gax.CallOption) (*DeleteGatewayOperation, error)
544 DeleteGatewayOperation(name string) *DeleteGatewayOperation
545 ListGrpcRoutes(context.Context, *networkservicespb.ListGrpcRoutesRequest, ...gax.CallOption) *GrpcRouteIterator
546 GetGrpcRoute(context.Context, *networkservicespb.GetGrpcRouteRequest, ...gax.CallOption) (*networkservicespb.GrpcRoute, error)
547 CreateGrpcRoute(context.Context, *networkservicespb.CreateGrpcRouteRequest, ...gax.CallOption) (*CreateGrpcRouteOperation, error)
548 CreateGrpcRouteOperation(name string) *CreateGrpcRouteOperation
549 UpdateGrpcRoute(context.Context, *networkservicespb.UpdateGrpcRouteRequest, ...gax.CallOption) (*UpdateGrpcRouteOperation, error)
550 UpdateGrpcRouteOperation(name string) *UpdateGrpcRouteOperation
551 DeleteGrpcRoute(context.Context, *networkservicespb.DeleteGrpcRouteRequest, ...gax.CallOption) (*DeleteGrpcRouteOperation, error)
552 DeleteGrpcRouteOperation(name string) *DeleteGrpcRouteOperation
553 ListHttpRoutes(context.Context, *networkservicespb.ListHttpRoutesRequest, ...gax.CallOption) *HttpRouteIterator
554 GetHttpRoute(context.Context, *networkservicespb.GetHttpRouteRequest, ...gax.CallOption) (*networkservicespb.HttpRoute, error)
555 CreateHttpRoute(context.Context, *networkservicespb.CreateHttpRouteRequest, ...gax.CallOption) (*CreateHttpRouteOperation, error)
556 CreateHttpRouteOperation(name string) *CreateHttpRouteOperation
557 UpdateHttpRoute(context.Context, *networkservicespb.UpdateHttpRouteRequest, ...gax.CallOption) (*UpdateHttpRouteOperation, error)
558 UpdateHttpRouteOperation(name string) *UpdateHttpRouteOperation
559 DeleteHttpRoute(context.Context, *networkservicespb.DeleteHttpRouteRequest, ...gax.CallOption) (*DeleteHttpRouteOperation, error)
560 DeleteHttpRouteOperation(name string) *DeleteHttpRouteOperation
561 ListTcpRoutes(context.Context, *networkservicespb.ListTcpRoutesRequest, ...gax.CallOption) *TcpRouteIterator
562 GetTcpRoute(context.Context, *networkservicespb.GetTcpRouteRequest, ...gax.CallOption) (*networkservicespb.TcpRoute, error)
563 CreateTcpRoute(context.Context, *networkservicespb.CreateTcpRouteRequest, ...gax.CallOption) (*CreateTcpRouteOperation, error)
564 CreateTcpRouteOperation(name string) *CreateTcpRouteOperation
565 UpdateTcpRoute(context.Context, *networkservicespb.UpdateTcpRouteRequest, ...gax.CallOption) (*UpdateTcpRouteOperation, error)
566 UpdateTcpRouteOperation(name string) *UpdateTcpRouteOperation
567 DeleteTcpRoute(context.Context, *networkservicespb.DeleteTcpRouteRequest, ...gax.CallOption) (*DeleteTcpRouteOperation, error)
568 DeleteTcpRouteOperation(name string) *DeleteTcpRouteOperation
569 ListTlsRoutes(context.Context, *networkservicespb.ListTlsRoutesRequest, ...gax.CallOption) *TlsRouteIterator
570 GetTlsRoute(context.Context, *networkservicespb.GetTlsRouteRequest, ...gax.CallOption) (*networkservicespb.TlsRoute, error)
571 CreateTlsRoute(context.Context, *networkservicespb.CreateTlsRouteRequest, ...gax.CallOption) (*CreateTlsRouteOperation, error)
572 CreateTlsRouteOperation(name string) *CreateTlsRouteOperation
573 UpdateTlsRoute(context.Context, *networkservicespb.UpdateTlsRouteRequest, ...gax.CallOption) (*UpdateTlsRouteOperation, error)
574 UpdateTlsRouteOperation(name string) *UpdateTlsRouteOperation
575 DeleteTlsRoute(context.Context, *networkservicespb.DeleteTlsRouteRequest, ...gax.CallOption) (*DeleteTlsRouteOperation, error)
576 DeleteTlsRouteOperation(name string) *DeleteTlsRouteOperation
577 ListServiceBindings(context.Context, *networkservicespb.ListServiceBindingsRequest, ...gax.CallOption) *ServiceBindingIterator
578 GetServiceBinding(context.Context, *networkservicespb.GetServiceBindingRequest, ...gax.CallOption) (*networkservicespb.ServiceBinding, error)
579 CreateServiceBinding(context.Context, *networkservicespb.CreateServiceBindingRequest, ...gax.CallOption) (*CreateServiceBindingOperation, error)
580 CreateServiceBindingOperation(name string) *CreateServiceBindingOperation
581 UpdateServiceBinding(context.Context, *networkservicespb.UpdateServiceBindingRequest, ...gax.CallOption) (*UpdateServiceBindingOperation, error)
582 UpdateServiceBindingOperation(name string) *UpdateServiceBindingOperation
583 DeleteServiceBinding(context.Context, *networkservicespb.DeleteServiceBindingRequest, ...gax.CallOption) (*DeleteServiceBindingOperation, error)
584 DeleteServiceBindingOperation(name string) *DeleteServiceBindingOperation
585 ListMeshes(context.Context, *networkservicespb.ListMeshesRequest, ...gax.CallOption) *MeshIterator
586 GetMesh(context.Context, *networkservicespb.GetMeshRequest, ...gax.CallOption) (*networkservicespb.Mesh, error)
587 CreateMesh(context.Context, *networkservicespb.CreateMeshRequest, ...gax.CallOption) (*CreateMeshOperation, error)
588 CreateMeshOperation(name string) *CreateMeshOperation
589 UpdateMesh(context.Context, *networkservicespb.UpdateMeshRequest, ...gax.CallOption) (*UpdateMeshOperation, error)
590 UpdateMeshOperation(name string) *UpdateMeshOperation
591 DeleteMesh(context.Context, *networkservicespb.DeleteMeshRequest, ...gax.CallOption) (*DeleteMeshOperation, error)
592 DeleteMeshOperation(name string) *DeleteMeshOperation
593 ListServiceLbPolicies(context.Context, *networkservicespb.ListServiceLbPoliciesRequest, ...gax.CallOption) *ServiceLbPolicyIterator
594 GetServiceLbPolicy(context.Context, *networkservicespb.GetServiceLbPolicyRequest, ...gax.CallOption) (*networkservicespb.ServiceLbPolicy, error)
595 CreateServiceLbPolicy(context.Context, *networkservicespb.CreateServiceLbPolicyRequest, ...gax.CallOption) (*CreateServiceLbPolicyOperation, error)
596 CreateServiceLbPolicyOperation(name string) *CreateServiceLbPolicyOperation
597 UpdateServiceLbPolicy(context.Context, *networkservicespb.UpdateServiceLbPolicyRequest, ...gax.CallOption) (*UpdateServiceLbPolicyOperation, error)
598 UpdateServiceLbPolicyOperation(name string) *UpdateServiceLbPolicyOperation
599 DeleteServiceLbPolicy(context.Context, *networkservicespb.DeleteServiceLbPolicyRequest, ...gax.CallOption) (*DeleteServiceLbPolicyOperation, error)
600 DeleteServiceLbPolicyOperation(name string) *DeleteServiceLbPolicyOperation
601 GetGatewayRouteView(context.Context, *networkservicespb.GetGatewayRouteViewRequest, ...gax.CallOption) (*networkservicespb.GatewayRouteView, error)
602 GetMeshRouteView(context.Context, *networkservicespb.GetMeshRouteViewRequest, ...gax.CallOption) (*networkservicespb.MeshRouteView, error)
603 ListGatewayRouteViews(context.Context, *networkservicespb.ListGatewayRouteViewsRequest, ...gax.CallOption) *GatewayRouteViewIterator
604 ListMeshRouteViews(context.Context, *networkservicespb.ListMeshRouteViewsRequest, ...gax.CallOption) *MeshRouteViewIterator
605 GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error)
606 ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator
607 GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
608 SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
609 TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
610 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
611 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
612 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
613 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
614 }
615
616 // Client is a client for interacting with Network Services API.
617 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
618 //
619 // Service describing handlers for resources.
620 type Client struct {
621 // The internal transport-dependent client.
622 internalClient internalClient
623
624 // The call options for this service.
625 CallOptions *CallOptions
626
627 // LROClient is used internally to handle long-running operations.
628 // It is exposed so that its CallOptions can be modified if required.
629 // Users should not Close this client.
630 LROClient *lroauto.OperationsClient
631 }
632
633 // Wrapper methods routed to the internal client.
634
635 // Close closes the connection to the API service. The user should invoke this when
636 // the client is no longer required.
637 func (c *Client) Close() error {
638 return c.internalClient.Close()
639 }
640
641 // setGoogleClientInfo sets the name and version of the application in
642 // the `x-goog-api-client` header passed on each request. Intended for
643 // use by Google-written clients.
644 func (c *Client) setGoogleClientInfo(keyval ...string) {
645 c.internalClient.setGoogleClientInfo(keyval...)
646 }
647
648 // Connection returns a connection to the API service.
649 //
650 // Deprecated: Connections are now pooled so this method does not always
651 // return the same resource.
652 func (c *Client) Connection() *grpc.ClientConn {
653 return c.internalClient.Connection()
654 }
655
656 // ListEndpointPolicies lists EndpointPolicies in a given project and location.
657 func (c *Client) ListEndpointPolicies(ctx context.Context, req *networkservicespb.ListEndpointPoliciesRequest, opts ...gax.CallOption) *EndpointPolicyIterator {
658 return c.internalClient.ListEndpointPolicies(ctx, req, opts...)
659 }
660
661 // GetEndpointPolicy gets details of a single EndpointPolicy.
662 func (c *Client) GetEndpointPolicy(ctx context.Context, req *networkservicespb.GetEndpointPolicyRequest, opts ...gax.CallOption) (*networkservicespb.EndpointPolicy, error) {
663 return c.internalClient.GetEndpointPolicy(ctx, req, opts...)
664 }
665
666 // CreateEndpointPolicy creates a new EndpointPolicy in a given project and location.
667 func (c *Client) CreateEndpointPolicy(ctx context.Context, req *networkservicespb.CreateEndpointPolicyRequest, opts ...gax.CallOption) (*CreateEndpointPolicyOperation, error) {
668 return c.internalClient.CreateEndpointPolicy(ctx, req, opts...)
669 }
670
671 // CreateEndpointPolicyOperation returns a new CreateEndpointPolicyOperation from a given name.
672 // The name must be that of a previously created CreateEndpointPolicyOperation, possibly from a different process.
673 func (c *Client) CreateEndpointPolicyOperation(name string) *CreateEndpointPolicyOperation {
674 return c.internalClient.CreateEndpointPolicyOperation(name)
675 }
676
677 // UpdateEndpointPolicy updates the parameters of a single EndpointPolicy.
678 func (c *Client) UpdateEndpointPolicy(ctx context.Context, req *networkservicespb.UpdateEndpointPolicyRequest, opts ...gax.CallOption) (*UpdateEndpointPolicyOperation, error) {
679 return c.internalClient.UpdateEndpointPolicy(ctx, req, opts...)
680 }
681
682 // UpdateEndpointPolicyOperation returns a new UpdateEndpointPolicyOperation from a given name.
683 // The name must be that of a previously created UpdateEndpointPolicyOperation, possibly from a different process.
684 func (c *Client) UpdateEndpointPolicyOperation(name string) *UpdateEndpointPolicyOperation {
685 return c.internalClient.UpdateEndpointPolicyOperation(name)
686 }
687
688 // DeleteEndpointPolicy deletes a single EndpointPolicy.
689 func (c *Client) DeleteEndpointPolicy(ctx context.Context, req *networkservicespb.DeleteEndpointPolicyRequest, opts ...gax.CallOption) (*DeleteEndpointPolicyOperation, error) {
690 return c.internalClient.DeleteEndpointPolicy(ctx, req, opts...)
691 }
692
693 // DeleteEndpointPolicyOperation returns a new DeleteEndpointPolicyOperation from a given name.
694 // The name must be that of a previously created DeleteEndpointPolicyOperation, possibly from a different process.
695 func (c *Client) DeleteEndpointPolicyOperation(name string) *DeleteEndpointPolicyOperation {
696 return c.internalClient.DeleteEndpointPolicyOperation(name)
697 }
698
699 // ListWasmPluginVersions lists WasmPluginVersion resources in a given project and
700 // location.
701 func (c *Client) ListWasmPluginVersions(ctx context.Context, req *networkservicespb.ListWasmPluginVersionsRequest, opts ...gax.CallOption) *WasmPluginVersionIterator {
702 return c.internalClient.ListWasmPluginVersions(ctx, req, opts...)
703 }
704
705 // GetWasmPluginVersion gets details of the specified WasmPluginVersion resource.
706 func (c *Client) GetWasmPluginVersion(ctx context.Context, req *networkservicespb.GetWasmPluginVersionRequest, opts ...gax.CallOption) (*networkservicespb.WasmPluginVersion, error) {
707 return c.internalClient.GetWasmPluginVersion(ctx, req, opts...)
708 }
709
710 // CreateWasmPluginVersion creates a new WasmPluginVersion resource in a given project
711 // and location.
712 func (c *Client) CreateWasmPluginVersion(ctx context.Context, req *networkservicespb.CreateWasmPluginVersionRequest, opts ...gax.CallOption) (*CreateWasmPluginVersionOperation, error) {
713 return c.internalClient.CreateWasmPluginVersion(ctx, req, opts...)
714 }
715
716 // CreateWasmPluginVersionOperation returns a new CreateWasmPluginVersionOperation from a given name.
717 // The name must be that of a previously created CreateWasmPluginVersionOperation, possibly from a different process.
718 func (c *Client) CreateWasmPluginVersionOperation(name string) *CreateWasmPluginVersionOperation {
719 return c.internalClient.CreateWasmPluginVersionOperation(name)
720 }
721
722 // DeleteWasmPluginVersion deletes the specified WasmPluginVersion resource.
723 func (c *Client) DeleteWasmPluginVersion(ctx context.Context, req *networkservicespb.DeleteWasmPluginVersionRequest, opts ...gax.CallOption) (*DeleteWasmPluginVersionOperation, error) {
724 return c.internalClient.DeleteWasmPluginVersion(ctx, req, opts...)
725 }
726
727 // DeleteWasmPluginVersionOperation returns a new DeleteWasmPluginVersionOperation from a given name.
728 // The name must be that of a previously created DeleteWasmPluginVersionOperation, possibly from a different process.
729 func (c *Client) DeleteWasmPluginVersionOperation(name string) *DeleteWasmPluginVersionOperation {
730 return c.internalClient.DeleteWasmPluginVersionOperation(name)
731 }
732
733 // ListWasmPlugins lists WasmPlugin resources in a given project and
734 // location.
735 func (c *Client) ListWasmPlugins(ctx context.Context, req *networkservicespb.ListWasmPluginsRequest, opts ...gax.CallOption) *WasmPluginIterator {
736 return c.internalClient.ListWasmPlugins(ctx, req, opts...)
737 }
738
739 // GetWasmPlugin gets details of the specified WasmPlugin resource.
740 func (c *Client) GetWasmPlugin(ctx context.Context, req *networkservicespb.GetWasmPluginRequest, opts ...gax.CallOption) (*networkservicespb.WasmPlugin, error) {
741 return c.internalClient.GetWasmPlugin(ctx, req, opts...)
742 }
743
744 // CreateWasmPlugin creates a new WasmPlugin resource in a given project
745 // and location.
746 func (c *Client) CreateWasmPlugin(ctx context.Context, req *networkservicespb.CreateWasmPluginRequest, opts ...gax.CallOption) (*CreateWasmPluginOperation, error) {
747 return c.internalClient.CreateWasmPlugin(ctx, req, opts...)
748 }
749
750 // CreateWasmPluginOperation returns a new CreateWasmPluginOperation from a given name.
751 // The name must be that of a previously created CreateWasmPluginOperation, possibly from a different process.
752 func (c *Client) CreateWasmPluginOperation(name string) *CreateWasmPluginOperation {
753 return c.internalClient.CreateWasmPluginOperation(name)
754 }
755
756 // UpdateWasmPlugin updates the parameters of the specified WasmPlugin resource.
757 func (c *Client) UpdateWasmPlugin(ctx context.Context, req *networkservicespb.UpdateWasmPluginRequest, opts ...gax.CallOption) (*UpdateWasmPluginOperation, error) {
758 return c.internalClient.UpdateWasmPlugin(ctx, req, opts...)
759 }
760
761 // UpdateWasmPluginOperation returns a new UpdateWasmPluginOperation from a given name.
762 // The name must be that of a previously created UpdateWasmPluginOperation, possibly from a different process.
763 func (c *Client) UpdateWasmPluginOperation(name string) *UpdateWasmPluginOperation {
764 return c.internalClient.UpdateWasmPluginOperation(name)
765 }
766
767 // DeleteWasmPlugin deletes the specified WasmPlugin resource.
768 func (c *Client) DeleteWasmPlugin(ctx context.Context, req *networkservicespb.DeleteWasmPluginRequest, opts ...gax.CallOption) (*DeleteWasmPluginOperation, error) {
769 return c.internalClient.DeleteWasmPlugin(ctx, req, opts...)
770 }
771
772 // DeleteWasmPluginOperation returns a new DeleteWasmPluginOperation from a given name.
773 // The name must be that of a previously created DeleteWasmPluginOperation, possibly from a different process.
774 func (c *Client) DeleteWasmPluginOperation(name string) *DeleteWasmPluginOperation {
775 return c.internalClient.DeleteWasmPluginOperation(name)
776 }
777
778 // ListGateways lists Gateways in a given project and location.
779 func (c *Client) ListGateways(ctx context.Context, req *networkservicespb.ListGatewaysRequest, opts ...gax.CallOption) *GatewayIterator {
780 return c.internalClient.ListGateways(ctx, req, opts...)
781 }
782
783 // GetGateway gets details of a single Gateway.
784 func (c *Client) GetGateway(ctx context.Context, req *networkservicespb.GetGatewayRequest, opts ...gax.CallOption) (*networkservicespb.Gateway, error) {
785 return c.internalClient.GetGateway(ctx, req, opts...)
786 }
787
788 // CreateGateway creates a new Gateway in a given project and location.
789 func (c *Client) CreateGateway(ctx context.Context, req *networkservicespb.CreateGatewayRequest, opts ...gax.CallOption) (*CreateGatewayOperation, error) {
790 return c.internalClient.CreateGateway(ctx, req, opts...)
791 }
792
793 // CreateGatewayOperation returns a new CreateGatewayOperation from a given name.
794 // The name must be that of a previously created CreateGatewayOperation, possibly from a different process.
795 func (c *Client) CreateGatewayOperation(name string) *CreateGatewayOperation {
796 return c.internalClient.CreateGatewayOperation(name)
797 }
798
799 // UpdateGateway updates the parameters of a single Gateway.
800 func (c *Client) UpdateGateway(ctx context.Context, req *networkservicespb.UpdateGatewayRequest, opts ...gax.CallOption) (*UpdateGatewayOperation, error) {
801 return c.internalClient.UpdateGateway(ctx, req, opts...)
802 }
803
804 // UpdateGatewayOperation returns a new UpdateGatewayOperation from a given name.
805 // The name must be that of a previously created UpdateGatewayOperation, possibly from a different process.
806 func (c *Client) UpdateGatewayOperation(name string) *UpdateGatewayOperation {
807 return c.internalClient.UpdateGatewayOperation(name)
808 }
809
810 // DeleteGateway deletes a single Gateway.
811 func (c *Client) DeleteGateway(ctx context.Context, req *networkservicespb.DeleteGatewayRequest, opts ...gax.CallOption) (*DeleteGatewayOperation, error) {
812 return c.internalClient.DeleteGateway(ctx, req, opts...)
813 }
814
815 // DeleteGatewayOperation returns a new DeleteGatewayOperation from a given name.
816 // The name must be that of a previously created DeleteGatewayOperation, possibly from a different process.
817 func (c *Client) DeleteGatewayOperation(name string) *DeleteGatewayOperation {
818 return c.internalClient.DeleteGatewayOperation(name)
819 }
820
821 // ListGrpcRoutes lists GrpcRoutes in a given project and location.
822 func (c *Client) ListGrpcRoutes(ctx context.Context, req *networkservicespb.ListGrpcRoutesRequest, opts ...gax.CallOption) *GrpcRouteIterator {
823 return c.internalClient.ListGrpcRoutes(ctx, req, opts...)
824 }
825
826 // GetGrpcRoute gets details of a single GrpcRoute.
827 func (c *Client) GetGrpcRoute(ctx context.Context, req *networkservicespb.GetGrpcRouteRequest, opts ...gax.CallOption) (*networkservicespb.GrpcRoute, error) {
828 return c.internalClient.GetGrpcRoute(ctx, req, opts...)
829 }
830
831 // CreateGrpcRoute creates a new GrpcRoute in a given project and location.
832 func (c *Client) CreateGrpcRoute(ctx context.Context, req *networkservicespb.CreateGrpcRouteRequest, opts ...gax.CallOption) (*CreateGrpcRouteOperation, error) {
833 return c.internalClient.CreateGrpcRoute(ctx, req, opts...)
834 }
835
836 // CreateGrpcRouteOperation returns a new CreateGrpcRouteOperation from a given name.
837 // The name must be that of a previously created CreateGrpcRouteOperation, possibly from a different process.
838 func (c *Client) CreateGrpcRouteOperation(name string) *CreateGrpcRouteOperation {
839 return c.internalClient.CreateGrpcRouteOperation(name)
840 }
841
842 // UpdateGrpcRoute updates the parameters of a single GrpcRoute.
843 func (c *Client) UpdateGrpcRoute(ctx context.Context, req *networkservicespb.UpdateGrpcRouteRequest, opts ...gax.CallOption) (*UpdateGrpcRouteOperation, error) {
844 return c.internalClient.UpdateGrpcRoute(ctx, req, opts...)
845 }
846
847 // UpdateGrpcRouteOperation returns a new UpdateGrpcRouteOperation from a given name.
848 // The name must be that of a previously created UpdateGrpcRouteOperation, possibly from a different process.
849 func (c *Client) UpdateGrpcRouteOperation(name string) *UpdateGrpcRouteOperation {
850 return c.internalClient.UpdateGrpcRouteOperation(name)
851 }
852
853 // DeleteGrpcRoute deletes a single GrpcRoute.
854 func (c *Client) DeleteGrpcRoute(ctx context.Context, req *networkservicespb.DeleteGrpcRouteRequest, opts ...gax.CallOption) (*DeleteGrpcRouteOperation, error) {
855 return c.internalClient.DeleteGrpcRoute(ctx, req, opts...)
856 }
857
858 // DeleteGrpcRouteOperation returns a new DeleteGrpcRouteOperation from a given name.
859 // The name must be that of a previously created DeleteGrpcRouteOperation, possibly from a different process.
860 func (c *Client) DeleteGrpcRouteOperation(name string) *DeleteGrpcRouteOperation {
861 return c.internalClient.DeleteGrpcRouteOperation(name)
862 }
863
864 // ListHttpRoutes lists HttpRoute in a given project and location.
865 func (c *Client) ListHttpRoutes(ctx context.Context, req *networkservicespb.ListHttpRoutesRequest, opts ...gax.CallOption) *HttpRouteIterator {
866 return c.internalClient.ListHttpRoutes(ctx, req, opts...)
867 }
868
869 // GetHttpRoute gets details of a single HttpRoute.
870 func (c *Client) GetHttpRoute(ctx context.Context, req *networkservicespb.GetHttpRouteRequest, opts ...gax.CallOption) (*networkservicespb.HttpRoute, error) {
871 return c.internalClient.GetHttpRoute(ctx, req, opts...)
872 }
873
874 // CreateHttpRoute creates a new HttpRoute in a given project and location.
875 func (c *Client) CreateHttpRoute(ctx context.Context, req *networkservicespb.CreateHttpRouteRequest, opts ...gax.CallOption) (*CreateHttpRouteOperation, error) {
876 return c.internalClient.CreateHttpRoute(ctx, req, opts...)
877 }
878
879 // CreateHttpRouteOperation returns a new CreateHttpRouteOperation from a given name.
880 // The name must be that of a previously created CreateHttpRouteOperation, possibly from a different process.
881 func (c *Client) CreateHttpRouteOperation(name string) *CreateHttpRouteOperation {
882 return c.internalClient.CreateHttpRouteOperation(name)
883 }
884
885 // UpdateHttpRoute updates the parameters of a single HttpRoute.
886 func (c *Client) UpdateHttpRoute(ctx context.Context, req *networkservicespb.UpdateHttpRouteRequest, opts ...gax.CallOption) (*UpdateHttpRouteOperation, error) {
887 return c.internalClient.UpdateHttpRoute(ctx, req, opts...)
888 }
889
890 // UpdateHttpRouteOperation returns a new UpdateHttpRouteOperation from a given name.
891 // The name must be that of a previously created UpdateHttpRouteOperation, possibly from a different process.
892 func (c *Client) UpdateHttpRouteOperation(name string) *UpdateHttpRouteOperation {
893 return c.internalClient.UpdateHttpRouteOperation(name)
894 }
895
896 // DeleteHttpRoute deletes a single HttpRoute.
897 func (c *Client) DeleteHttpRoute(ctx context.Context, req *networkservicespb.DeleteHttpRouteRequest, opts ...gax.CallOption) (*DeleteHttpRouteOperation, error) {
898 return c.internalClient.DeleteHttpRoute(ctx, req, opts...)
899 }
900
901 // DeleteHttpRouteOperation returns a new DeleteHttpRouteOperation from a given name.
902 // The name must be that of a previously created DeleteHttpRouteOperation, possibly from a different process.
903 func (c *Client) DeleteHttpRouteOperation(name string) *DeleteHttpRouteOperation {
904 return c.internalClient.DeleteHttpRouteOperation(name)
905 }
906
907 // ListTcpRoutes lists TcpRoute in a given project and location.
908 func (c *Client) ListTcpRoutes(ctx context.Context, req *networkservicespb.ListTcpRoutesRequest, opts ...gax.CallOption) *TcpRouteIterator {
909 return c.internalClient.ListTcpRoutes(ctx, req, opts...)
910 }
911
912 // GetTcpRoute gets details of a single TcpRoute.
913 func (c *Client) GetTcpRoute(ctx context.Context, req *networkservicespb.GetTcpRouteRequest, opts ...gax.CallOption) (*networkservicespb.TcpRoute, error) {
914 return c.internalClient.GetTcpRoute(ctx, req, opts...)
915 }
916
917 // CreateTcpRoute creates a new TcpRoute in a given project and location.
918 func (c *Client) CreateTcpRoute(ctx context.Context, req *networkservicespb.CreateTcpRouteRequest, opts ...gax.CallOption) (*CreateTcpRouteOperation, error) {
919 return c.internalClient.CreateTcpRoute(ctx, req, opts...)
920 }
921
922 // CreateTcpRouteOperation returns a new CreateTcpRouteOperation from a given name.
923 // The name must be that of a previously created CreateTcpRouteOperation, possibly from a different process.
924 func (c *Client) CreateTcpRouteOperation(name string) *CreateTcpRouteOperation {
925 return c.internalClient.CreateTcpRouteOperation(name)
926 }
927
928 // UpdateTcpRoute updates the parameters of a single TcpRoute.
929 func (c *Client) UpdateTcpRoute(ctx context.Context, req *networkservicespb.UpdateTcpRouteRequest, opts ...gax.CallOption) (*UpdateTcpRouteOperation, error) {
930 return c.internalClient.UpdateTcpRoute(ctx, req, opts...)
931 }
932
933 // UpdateTcpRouteOperation returns a new UpdateTcpRouteOperation from a given name.
934 // The name must be that of a previously created UpdateTcpRouteOperation, possibly from a different process.
935 func (c *Client) UpdateTcpRouteOperation(name string) *UpdateTcpRouteOperation {
936 return c.internalClient.UpdateTcpRouteOperation(name)
937 }
938
939 // DeleteTcpRoute deletes a single TcpRoute.
940 func (c *Client) DeleteTcpRoute(ctx context.Context, req *networkservicespb.DeleteTcpRouteRequest, opts ...gax.CallOption) (*DeleteTcpRouteOperation, error) {
941 return c.internalClient.DeleteTcpRoute(ctx, req, opts...)
942 }
943
944 // DeleteTcpRouteOperation returns a new DeleteTcpRouteOperation from a given name.
945 // The name must be that of a previously created DeleteTcpRouteOperation, possibly from a different process.
946 func (c *Client) DeleteTcpRouteOperation(name string) *DeleteTcpRouteOperation {
947 return c.internalClient.DeleteTcpRouteOperation(name)
948 }
949
950 // ListTlsRoutes lists TlsRoute in a given project and location.
951 func (c *Client) ListTlsRoutes(ctx context.Context, req *networkservicespb.ListTlsRoutesRequest, opts ...gax.CallOption) *TlsRouteIterator {
952 return c.internalClient.ListTlsRoutes(ctx, req, opts...)
953 }
954
955 // GetTlsRoute gets details of a single TlsRoute.
956 func (c *Client) GetTlsRoute(ctx context.Context, req *networkservicespb.GetTlsRouteRequest, opts ...gax.CallOption) (*networkservicespb.TlsRoute, error) {
957 return c.internalClient.GetTlsRoute(ctx, req, opts...)
958 }
959
960 // CreateTlsRoute creates a new TlsRoute in a given project and location.
961 func (c *Client) CreateTlsRoute(ctx context.Context, req *networkservicespb.CreateTlsRouteRequest, opts ...gax.CallOption) (*CreateTlsRouteOperation, error) {
962 return c.internalClient.CreateTlsRoute(ctx, req, opts...)
963 }
964
965 // CreateTlsRouteOperation returns a new CreateTlsRouteOperation from a given name.
966 // The name must be that of a previously created CreateTlsRouteOperation, possibly from a different process.
967 func (c *Client) CreateTlsRouteOperation(name string) *CreateTlsRouteOperation {
968 return c.internalClient.CreateTlsRouteOperation(name)
969 }
970
971 // UpdateTlsRoute updates the parameters of a single TlsRoute.
972 func (c *Client) UpdateTlsRoute(ctx context.Context, req *networkservicespb.UpdateTlsRouteRequest, opts ...gax.CallOption) (*UpdateTlsRouteOperation, error) {
973 return c.internalClient.UpdateTlsRoute(ctx, req, opts...)
974 }
975
976 // UpdateTlsRouteOperation returns a new UpdateTlsRouteOperation from a given name.
977 // The name must be that of a previously created UpdateTlsRouteOperation, possibly from a different process.
978 func (c *Client) UpdateTlsRouteOperation(name string) *UpdateTlsRouteOperation {
979 return c.internalClient.UpdateTlsRouteOperation(name)
980 }
981
982 // DeleteTlsRoute deletes a single TlsRoute.
983 func (c *Client) DeleteTlsRoute(ctx context.Context, req *networkservicespb.DeleteTlsRouteRequest, opts ...gax.CallOption) (*DeleteTlsRouteOperation, error) {
984 return c.internalClient.DeleteTlsRoute(ctx, req, opts...)
985 }
986
987 // DeleteTlsRouteOperation returns a new DeleteTlsRouteOperation from a given name.
988 // The name must be that of a previously created DeleteTlsRouteOperation, possibly from a different process.
989 func (c *Client) DeleteTlsRouteOperation(name string) *DeleteTlsRouteOperation {
990 return c.internalClient.DeleteTlsRouteOperation(name)
991 }
992
993 // ListServiceBindings lists ServiceBinding in a given project and location.
994 func (c *Client) ListServiceBindings(ctx context.Context, req *networkservicespb.ListServiceBindingsRequest, opts ...gax.CallOption) *ServiceBindingIterator {
995 return c.internalClient.ListServiceBindings(ctx, req, opts...)
996 }
997
998 // GetServiceBinding gets details of a single ServiceBinding.
999 func (c *Client) GetServiceBinding(ctx context.Context, req *networkservicespb.GetServiceBindingRequest, opts ...gax.CallOption) (*networkservicespb.ServiceBinding, error) {
1000 return c.internalClient.GetServiceBinding(ctx, req, opts...)
1001 }
1002
1003 // CreateServiceBinding creates a new ServiceBinding in a given project and location.
1004 func (c *Client) CreateServiceBinding(ctx context.Context, req *networkservicespb.CreateServiceBindingRequest, opts ...gax.CallOption) (*CreateServiceBindingOperation, error) {
1005 return c.internalClient.CreateServiceBinding(ctx, req, opts...)
1006 }
1007
1008 // CreateServiceBindingOperation returns a new CreateServiceBindingOperation from a given name.
1009 // The name must be that of a previously created CreateServiceBindingOperation, possibly from a different process.
1010 func (c *Client) CreateServiceBindingOperation(name string) *CreateServiceBindingOperation {
1011 return c.internalClient.CreateServiceBindingOperation(name)
1012 }
1013
1014 // UpdateServiceBinding updates the parameters of a single ServiceBinding.
1015 func (c *Client) UpdateServiceBinding(ctx context.Context, req *networkservicespb.UpdateServiceBindingRequest, opts ...gax.CallOption) (*UpdateServiceBindingOperation, error) {
1016 return c.internalClient.UpdateServiceBinding(ctx, req, opts...)
1017 }
1018
1019 // UpdateServiceBindingOperation returns a new UpdateServiceBindingOperation from a given name.
1020 // The name must be that of a previously created UpdateServiceBindingOperation, possibly from a different process.
1021 func (c *Client) UpdateServiceBindingOperation(name string) *UpdateServiceBindingOperation {
1022 return c.internalClient.UpdateServiceBindingOperation(name)
1023 }
1024
1025 // DeleteServiceBinding deletes a single ServiceBinding.
1026 func (c *Client) DeleteServiceBinding(ctx context.Context, req *networkservicespb.DeleteServiceBindingRequest, opts ...gax.CallOption) (*DeleteServiceBindingOperation, error) {
1027 return c.internalClient.DeleteServiceBinding(ctx, req, opts...)
1028 }
1029
1030 // DeleteServiceBindingOperation returns a new DeleteServiceBindingOperation from a given name.
1031 // The name must be that of a previously created DeleteServiceBindingOperation, possibly from a different process.
1032 func (c *Client) DeleteServiceBindingOperation(name string) *DeleteServiceBindingOperation {
1033 return c.internalClient.DeleteServiceBindingOperation(name)
1034 }
1035
1036 // ListMeshes lists Meshes in a given project and location.
1037 func (c *Client) ListMeshes(ctx context.Context, req *networkservicespb.ListMeshesRequest, opts ...gax.CallOption) *MeshIterator {
1038 return c.internalClient.ListMeshes(ctx, req, opts...)
1039 }
1040
1041 // GetMesh gets details of a single Mesh.
1042 func (c *Client) GetMesh(ctx context.Context, req *networkservicespb.GetMeshRequest, opts ...gax.CallOption) (*networkservicespb.Mesh, error) {
1043 return c.internalClient.GetMesh(ctx, req, opts...)
1044 }
1045
1046 // CreateMesh creates a new Mesh in a given project and location.
1047 func (c *Client) CreateMesh(ctx context.Context, req *networkservicespb.CreateMeshRequest, opts ...gax.CallOption) (*CreateMeshOperation, error) {
1048 return c.internalClient.CreateMesh(ctx, req, opts...)
1049 }
1050
1051 // CreateMeshOperation returns a new CreateMeshOperation from a given name.
1052 // The name must be that of a previously created CreateMeshOperation, possibly from a different process.
1053 func (c *Client) CreateMeshOperation(name string) *CreateMeshOperation {
1054 return c.internalClient.CreateMeshOperation(name)
1055 }
1056
1057 // UpdateMesh updates the parameters of a single Mesh.
1058 func (c *Client) UpdateMesh(ctx context.Context, req *networkservicespb.UpdateMeshRequest, opts ...gax.CallOption) (*UpdateMeshOperation, error) {
1059 return c.internalClient.UpdateMesh(ctx, req, opts...)
1060 }
1061
1062 // UpdateMeshOperation returns a new UpdateMeshOperation from a given name.
1063 // The name must be that of a previously created UpdateMeshOperation, possibly from a different process.
1064 func (c *Client) UpdateMeshOperation(name string) *UpdateMeshOperation {
1065 return c.internalClient.UpdateMeshOperation(name)
1066 }
1067
1068 // DeleteMesh deletes a single Mesh.
1069 func (c *Client) DeleteMesh(ctx context.Context, req *networkservicespb.DeleteMeshRequest, opts ...gax.CallOption) (*DeleteMeshOperation, error) {
1070 return c.internalClient.DeleteMesh(ctx, req, opts...)
1071 }
1072
1073 // DeleteMeshOperation returns a new DeleteMeshOperation from a given name.
1074 // The name must be that of a previously created DeleteMeshOperation, possibly from a different process.
1075 func (c *Client) DeleteMeshOperation(name string) *DeleteMeshOperation {
1076 return c.internalClient.DeleteMeshOperation(name)
1077 }
1078
1079 // ListServiceLbPolicies lists ServiceLbPolicies in a given project and location.
1080 func (c *Client) ListServiceLbPolicies(ctx context.Context, req *networkservicespb.ListServiceLbPoliciesRequest, opts ...gax.CallOption) *ServiceLbPolicyIterator {
1081 return c.internalClient.ListServiceLbPolicies(ctx, req, opts...)
1082 }
1083
1084 // GetServiceLbPolicy gets details of a single ServiceLbPolicy.
1085 func (c *Client) GetServiceLbPolicy(ctx context.Context, req *networkservicespb.GetServiceLbPolicyRequest, opts ...gax.CallOption) (*networkservicespb.ServiceLbPolicy, error) {
1086 return c.internalClient.GetServiceLbPolicy(ctx, req, opts...)
1087 }
1088
1089 // CreateServiceLbPolicy creates a new ServiceLbPolicy in a given project and location.
1090 func (c *Client) CreateServiceLbPolicy(ctx context.Context, req *networkservicespb.CreateServiceLbPolicyRequest, opts ...gax.CallOption) (*CreateServiceLbPolicyOperation, error) {
1091 return c.internalClient.CreateServiceLbPolicy(ctx, req, opts...)
1092 }
1093
1094 // CreateServiceLbPolicyOperation returns a new CreateServiceLbPolicyOperation from a given name.
1095 // The name must be that of a previously created CreateServiceLbPolicyOperation, possibly from a different process.
1096 func (c *Client) CreateServiceLbPolicyOperation(name string) *CreateServiceLbPolicyOperation {
1097 return c.internalClient.CreateServiceLbPolicyOperation(name)
1098 }
1099
1100 // UpdateServiceLbPolicy updates the parameters of a single ServiceLbPolicy.
1101 func (c *Client) UpdateServiceLbPolicy(ctx context.Context, req *networkservicespb.UpdateServiceLbPolicyRequest, opts ...gax.CallOption) (*UpdateServiceLbPolicyOperation, error) {
1102 return c.internalClient.UpdateServiceLbPolicy(ctx, req, opts...)
1103 }
1104
1105 // UpdateServiceLbPolicyOperation returns a new UpdateServiceLbPolicyOperation from a given name.
1106 // The name must be that of a previously created UpdateServiceLbPolicyOperation, possibly from a different process.
1107 func (c *Client) UpdateServiceLbPolicyOperation(name string) *UpdateServiceLbPolicyOperation {
1108 return c.internalClient.UpdateServiceLbPolicyOperation(name)
1109 }
1110
1111 // DeleteServiceLbPolicy deletes a single ServiceLbPolicy.
1112 func (c *Client) DeleteServiceLbPolicy(ctx context.Context, req *networkservicespb.DeleteServiceLbPolicyRequest, opts ...gax.CallOption) (*DeleteServiceLbPolicyOperation, error) {
1113 return c.internalClient.DeleteServiceLbPolicy(ctx, req, opts...)
1114 }
1115
1116 // DeleteServiceLbPolicyOperation returns a new DeleteServiceLbPolicyOperation from a given name.
1117 // The name must be that of a previously created DeleteServiceLbPolicyOperation, possibly from a different process.
1118 func (c *Client) DeleteServiceLbPolicyOperation(name string) *DeleteServiceLbPolicyOperation {
1119 return c.internalClient.DeleteServiceLbPolicyOperation(name)
1120 }
1121
1122 // GetGatewayRouteView get a single RouteView of a Gateway.
1123 func (c *Client) GetGatewayRouteView(ctx context.Context, req *networkservicespb.GetGatewayRouteViewRequest, opts ...gax.CallOption) (*networkservicespb.GatewayRouteView, error) {
1124 return c.internalClient.GetGatewayRouteView(ctx, req, opts...)
1125 }
1126
1127 // GetMeshRouteView get a single RouteView of a Mesh.
1128 func (c *Client) GetMeshRouteView(ctx context.Context, req *networkservicespb.GetMeshRouteViewRequest, opts ...gax.CallOption) (*networkservicespb.MeshRouteView, error) {
1129 return c.internalClient.GetMeshRouteView(ctx, req, opts...)
1130 }
1131
1132 // ListGatewayRouteViews lists RouteViews
1133 func (c *Client) ListGatewayRouteViews(ctx context.Context, req *networkservicespb.ListGatewayRouteViewsRequest, opts ...gax.CallOption) *GatewayRouteViewIterator {
1134 return c.internalClient.ListGatewayRouteViews(ctx, req, opts...)
1135 }
1136
1137 // ListMeshRouteViews lists RouteViews
1138 func (c *Client) ListMeshRouteViews(ctx context.Context, req *networkservicespb.ListMeshRouteViewsRequest, opts ...gax.CallOption) *MeshRouteViewIterator {
1139 return c.internalClient.ListMeshRouteViews(ctx, req, opts...)
1140 }
1141
1142 // GetLocation gets information about a location.
1143 func (c *Client) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
1144 return c.internalClient.GetLocation(ctx, req, opts...)
1145 }
1146
1147 // ListLocations lists information about the supported locations for this service.
1148 func (c *Client) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
1149 return c.internalClient.ListLocations(ctx, req, opts...)
1150 }
1151
1152 // GetIamPolicy gets the access control policy for a resource. Returns an empty policy
1153 // if the resource exists and does not have a policy set.
1154 func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
1155 return c.internalClient.GetIamPolicy(ctx, req, opts...)
1156 }
1157
1158 // SetIamPolicy sets the access control policy on the specified resource. Replaces
1159 // any existing policy.
1160 //
1161 // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
1162 // errors.
1163 func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
1164 return c.internalClient.SetIamPolicy(ctx, req, opts...)
1165 }
1166
1167 // TestIamPermissions returns permissions that a caller has on the specified resource. If the
1168 // resource does not exist, this will return an empty set of
1169 // permissions, not a NOT_FOUND error.
1170 //
1171 // Note: This operation is designed to be used for building
1172 // permission-aware UIs and command-line tools, not for authorization
1173 // checking. This operation may “fail open” without warning.
1174 func (c *Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
1175 return c.internalClient.TestIamPermissions(ctx, req, opts...)
1176 }
1177
1178 // CancelOperation is a utility method from google.longrunning.Operations.
1179 func (c *Client) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
1180 return c.internalClient.CancelOperation(ctx, req, opts...)
1181 }
1182
1183 // DeleteOperation is a utility method from google.longrunning.Operations.
1184 func (c *Client) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
1185 return c.internalClient.DeleteOperation(ctx, req, opts...)
1186 }
1187
1188 // GetOperation is a utility method from google.longrunning.Operations.
1189 func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
1190 return c.internalClient.GetOperation(ctx, req, opts...)
1191 }
1192
1193 // ListOperations is a utility method from google.longrunning.Operations.
1194 func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
1195 return c.internalClient.ListOperations(ctx, req, opts...)
1196 }
1197
1198 // gRPCClient is a client for interacting with Network Services API over gRPC transport.
1199 //
1200 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
1201 type gRPCClient struct {
1202 // Connection pool of gRPC connections to the service.
1203 connPool gtransport.ConnPool
1204
1205 // Points back to the CallOptions field of the containing Client
1206 CallOptions **CallOptions
1207
1208 // The gRPC API client.
1209 client networkservicespb.NetworkServicesClient
1210
1211 // LROClient is used internally to handle long-running operations.
1212 // It is exposed so that its CallOptions can be modified if required.
1213 // Users should not Close this client.
1214 LROClient **lroauto.OperationsClient
1215
1216 operationsClient longrunningpb.OperationsClient
1217
1218 iamPolicyClient iampb.IAMPolicyClient
1219
1220 locationsClient locationpb.LocationsClient
1221
1222 // The x-goog-* metadata to be sent with each request.
1223 xGoogHeaders []string
1224
1225 logger *slog.Logger
1226 }
1227
1228 // NewClient creates a new network services client based on gRPC.
1229 // The returned client must be Closed when it is done being used to clean up its underlying connections.
1230 //
1231 // Service describing handlers for resources.
1232 func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
1233 clientOpts := defaultGRPCClientOptions()
1234 if newClientHook != nil {
1235 hookOpts, err := newClientHook(ctx, clientHookParams{})
1236 if err != nil {
1237 return nil, err
1238 }
1239 clientOpts = append(clientOpts, hookOpts...)
1240 }
1241
1242 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
1243 if err != nil {
1244 return nil, err
1245 }
1246 client := Client{CallOptions: defaultCallOptions()}
1247
1248 c := &gRPCClient{
1249 connPool: connPool,
1250 client: networkservicespb.NewNetworkServicesClient(connPool),
1251 CallOptions: &client.CallOptions,
1252 logger: internaloption.GetLogger(opts),
1253 operationsClient: longrunningpb.NewOperationsClient(connPool),
1254 iamPolicyClient: iampb.NewIAMPolicyClient(connPool),
1255 locationsClient: locationpb.NewLocationsClient(connPool),
1256 }
1257 c.setGoogleClientInfo()
1258
1259 client.internalClient = c
1260
1261 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
1262 if err != nil {
1263 // This error "should not happen", since we are just reusing old connection pool
1264 // and never actually need to dial.
1265 // If this does happen, we could leak connp. However, we cannot close conn:
1266 // If the user invoked the constructor with option.WithGRPCConn,
1267 // we would close a connection that's still in use.
1268 // TODO: investigate error conditions.
1269 return nil, err
1270 }
1271 c.LROClient = &client.LROClient
1272 return &client, nil
1273 }
1274
1275 // Connection returns a connection to the API service.
1276 //
1277 // Deprecated: Connections are now pooled so this method does not always
1278 // return the same resource.
1279 func (c *gRPCClient) Connection() *grpc.ClientConn {
1280 return c.connPool.Conn()
1281 }
1282
1283 // setGoogleClientInfo sets the name and version of the application in
1284 // the `x-goog-api-client` header passed on each request. Intended for
1285 // use by Google-written clients.
1286 func (c *gRPCClient) setGoogleClientInfo(keyval ...string) {
1287 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
1288 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
1289 c.xGoogHeaders = []string{
1290 "x-goog-api-client", gax.XGoogHeader(kv...),
1291 }
1292 }
1293
1294 // Close closes the connection to the API service. The user should invoke this when
1295 // the client is no longer required.
1296 func (c *gRPCClient) Close() error {
1297 return c.connPool.Close()
1298 }
1299
1300 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
1301 type restClient struct {
1302 // The http endpoint to connect to.
1303 endpoint string
1304
1305 // The http client.
1306 httpClient *http.Client
1307
1308 // LROClient is used internally to handle long-running operations.
1309 // It is exposed so that its CallOptions can be modified if required.
1310 // Users should not Close this client.
1311 LROClient **lroauto.OperationsClient
1312
1313 // The x-goog-* headers to be sent with each request.
1314 xGoogHeaders []string
1315
1316 // Points back to the CallOptions field of the containing Client
1317 CallOptions **CallOptions
1318
1319 logger *slog.Logger
1320 }
1321
1322 // NewRESTClient creates a new network services rest client.
1323 //
1324 // Service describing handlers for resources.
1325 func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
1326 clientOpts := append(defaultRESTClientOptions(), opts...)
1327 httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
1328 if err != nil {
1329 return nil, err
1330 }
1331
1332 callOpts := defaultRESTCallOptions()
1333 c := &restClient{
1334 endpoint: endpoint,
1335 httpClient: httpClient,
1336 CallOptions: &callOpts,
1337 logger: internaloption.GetLogger(opts),
1338 }
1339 c.setGoogleClientInfo()
1340
1341 lroOpts := []option.ClientOption{
1342 option.WithHTTPClient(httpClient),
1343 option.WithEndpoint(endpoint),
1344 }
1345 opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
1346 if err != nil {
1347 return nil, err
1348 }
1349 c.LROClient = &opClient
1350
1351 return &Client{internalClient: c, CallOptions: callOpts}, nil
1352 }
1353
1354 func defaultRESTClientOptions() []option.ClientOption {
1355 return []option.ClientOption{
1356 internaloption.WithDefaultEndpoint("https://networkservices.googleapis.com"),
1357 internaloption.WithDefaultEndpointTemplate("https://networkservices.UNIVERSE_DOMAIN"),
1358 internaloption.WithDefaultMTLSEndpoint("https://networkservices.mtls.googleapis.com"),
1359 internaloption.WithDefaultUniverseDomain("googleapis.com"),
1360 internaloption.WithDefaultAudience("https://networkservices.googleapis.com/"),
1361 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
1362 internaloption.EnableNewAuthLibrary(),
1363 }
1364 }
1365
1366 // setGoogleClientInfo sets the name and version of the application in
1367 // the `x-goog-api-client` header passed on each request. Intended for
1368 // use by Google-written clients.
1369 func (c *restClient) setGoogleClientInfo(keyval ...string) {
1370 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
1371 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion)
1372 c.xGoogHeaders = []string{
1373 "x-goog-api-client", gax.XGoogHeader(kv...),
1374 }
1375 }
1376
1377 // Close closes the connection to the API service. The user should invoke this when
1378 // the client is no longer required.
1379 func (c *restClient) Close() error {
1380 // Replace httpClient with nil to force cleanup.
1381 c.httpClient = nil
1382 return nil
1383 }
1384
1385 // Connection returns a connection to the API service.
1386 //
1387 // Deprecated: This method always returns nil.
1388 func (c *restClient) Connection() *grpc.ClientConn {
1389 return nil
1390 }
1391 func (c *gRPCClient) ListEndpointPolicies(ctx context.Context, req *networkservicespb.ListEndpointPoliciesRequest, opts ...gax.CallOption) *EndpointPolicyIterator {
1392 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1393
1394 hds = append(c.xGoogHeaders, hds...)
1395 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1396 opts = append((*c.CallOptions).ListEndpointPolicies[0:len((*c.CallOptions).ListEndpointPolicies):len((*c.CallOptions).ListEndpointPolicies)], opts...)
1397 it := &EndpointPolicyIterator{}
1398 req = proto.Clone(req).(*networkservicespb.ListEndpointPoliciesRequest)
1399 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.EndpointPolicy, string, error) {
1400 resp := &networkservicespb.ListEndpointPoliciesResponse{}
1401 if pageToken != "" {
1402 req.PageToken = pageToken
1403 }
1404 if pageSize > math.MaxInt32 {
1405 req.PageSize = math.MaxInt32
1406 } else if pageSize != 0 {
1407 req.PageSize = int32(pageSize)
1408 }
1409 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1410 var err error
1411 resp, err = executeRPC(ctx, c.client.ListEndpointPolicies, req, settings.GRPC, c.logger, "ListEndpointPolicies")
1412 return err
1413 }, opts...)
1414 if err != nil {
1415 return nil, "", err
1416 }
1417
1418 it.Response = resp
1419 return resp.GetEndpointPolicies(), resp.GetNextPageToken(), nil
1420 }
1421 fetch := func(pageSize int, pageToken string) (string, error) {
1422 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1423 if err != nil {
1424 return "", err
1425 }
1426 it.items = append(it.items, items...)
1427 return nextPageToken, nil
1428 }
1429
1430 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1431 it.pageInfo.MaxSize = int(req.GetPageSize())
1432 it.pageInfo.Token = req.GetPageToken()
1433
1434 return it
1435 }
1436
1437 func (c *gRPCClient) GetEndpointPolicy(ctx context.Context, req *networkservicespb.GetEndpointPolicyRequest, opts ...gax.CallOption) (*networkservicespb.EndpointPolicy, error) {
1438 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1439
1440 hds = append(c.xGoogHeaders, hds...)
1441 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1442 opts = append((*c.CallOptions).GetEndpointPolicy[0:len((*c.CallOptions).GetEndpointPolicy):len((*c.CallOptions).GetEndpointPolicy)], opts...)
1443 var resp *networkservicespb.EndpointPolicy
1444 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1445 var err error
1446 resp, err = executeRPC(ctx, c.client.GetEndpointPolicy, req, settings.GRPC, c.logger, "GetEndpointPolicy")
1447 return err
1448 }, opts...)
1449 if err != nil {
1450 return nil, err
1451 }
1452 return resp, nil
1453 }
1454
1455 func (c *gRPCClient) CreateEndpointPolicy(ctx context.Context, req *networkservicespb.CreateEndpointPolicyRequest, opts ...gax.CallOption) (*CreateEndpointPolicyOperation, error) {
1456 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1457
1458 hds = append(c.xGoogHeaders, hds...)
1459 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1460 opts = append((*c.CallOptions).CreateEndpointPolicy[0:len((*c.CallOptions).CreateEndpointPolicy):len((*c.CallOptions).CreateEndpointPolicy)], opts...)
1461 var resp *longrunningpb.Operation
1462 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1463 var err error
1464 resp, err = executeRPC(ctx, c.client.CreateEndpointPolicy, req, settings.GRPC, c.logger, "CreateEndpointPolicy")
1465 return err
1466 }, opts...)
1467 if err != nil {
1468 return nil, err
1469 }
1470 return &CreateEndpointPolicyOperation{
1471 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1472 }, nil
1473 }
1474
1475 func (c *gRPCClient) UpdateEndpointPolicy(ctx context.Context, req *networkservicespb.UpdateEndpointPolicyRequest, opts ...gax.CallOption) (*UpdateEndpointPolicyOperation, error) {
1476 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "endpoint_policy.name", url.QueryEscape(req.GetEndpointPolicy().GetName()))}
1477
1478 hds = append(c.xGoogHeaders, hds...)
1479 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1480 opts = append((*c.CallOptions).UpdateEndpointPolicy[0:len((*c.CallOptions).UpdateEndpointPolicy):len((*c.CallOptions).UpdateEndpointPolicy)], opts...)
1481 var resp *longrunningpb.Operation
1482 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1483 var err error
1484 resp, err = executeRPC(ctx, c.client.UpdateEndpointPolicy, req, settings.GRPC, c.logger, "UpdateEndpointPolicy")
1485 return err
1486 }, opts...)
1487 if err != nil {
1488 return nil, err
1489 }
1490 return &UpdateEndpointPolicyOperation{
1491 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1492 }, nil
1493 }
1494
1495 func (c *gRPCClient) DeleteEndpointPolicy(ctx context.Context, req *networkservicespb.DeleteEndpointPolicyRequest, opts ...gax.CallOption) (*DeleteEndpointPolicyOperation, error) {
1496 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1497
1498 hds = append(c.xGoogHeaders, hds...)
1499 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1500 opts = append((*c.CallOptions).DeleteEndpointPolicy[0:len((*c.CallOptions).DeleteEndpointPolicy):len((*c.CallOptions).DeleteEndpointPolicy)], opts...)
1501 var resp *longrunningpb.Operation
1502 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1503 var err error
1504 resp, err = executeRPC(ctx, c.client.DeleteEndpointPolicy, req, settings.GRPC, c.logger, "DeleteEndpointPolicy")
1505 return err
1506 }, opts...)
1507 if err != nil {
1508 return nil, err
1509 }
1510 return &DeleteEndpointPolicyOperation{
1511 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1512 }, nil
1513 }
1514
1515 func (c *gRPCClient) ListWasmPluginVersions(ctx context.Context, req *networkservicespb.ListWasmPluginVersionsRequest, opts ...gax.CallOption) *WasmPluginVersionIterator {
1516 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1517
1518 hds = append(c.xGoogHeaders, hds...)
1519 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1520 opts = append((*c.CallOptions).ListWasmPluginVersions[0:len((*c.CallOptions).ListWasmPluginVersions):len((*c.CallOptions).ListWasmPluginVersions)], opts...)
1521 it := &WasmPluginVersionIterator{}
1522 req = proto.Clone(req).(*networkservicespb.ListWasmPluginVersionsRequest)
1523 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.WasmPluginVersion, string, error) {
1524 resp := &networkservicespb.ListWasmPluginVersionsResponse{}
1525 if pageToken != "" {
1526 req.PageToken = pageToken
1527 }
1528 if pageSize > math.MaxInt32 {
1529 req.PageSize = math.MaxInt32
1530 } else if pageSize != 0 {
1531 req.PageSize = int32(pageSize)
1532 }
1533 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1534 var err error
1535 resp, err = executeRPC(ctx, c.client.ListWasmPluginVersions, req, settings.GRPC, c.logger, "ListWasmPluginVersions")
1536 return err
1537 }, opts...)
1538 if err != nil {
1539 return nil, "", err
1540 }
1541
1542 it.Response = resp
1543 return resp.GetWasmPluginVersions(), resp.GetNextPageToken(), nil
1544 }
1545 fetch := func(pageSize int, pageToken string) (string, error) {
1546 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1547 if err != nil {
1548 return "", err
1549 }
1550 it.items = append(it.items, items...)
1551 return nextPageToken, nil
1552 }
1553
1554 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1555 it.pageInfo.MaxSize = int(req.GetPageSize())
1556 it.pageInfo.Token = req.GetPageToken()
1557
1558 return it
1559 }
1560
1561 func (c *gRPCClient) GetWasmPluginVersion(ctx context.Context, req *networkservicespb.GetWasmPluginVersionRequest, opts ...gax.CallOption) (*networkservicespb.WasmPluginVersion, error) {
1562 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1563
1564 hds = append(c.xGoogHeaders, hds...)
1565 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1566 opts = append((*c.CallOptions).GetWasmPluginVersion[0:len((*c.CallOptions).GetWasmPluginVersion):len((*c.CallOptions).GetWasmPluginVersion)], opts...)
1567 var resp *networkservicespb.WasmPluginVersion
1568 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1569 var err error
1570 resp, err = executeRPC(ctx, c.client.GetWasmPluginVersion, req, settings.GRPC, c.logger, "GetWasmPluginVersion")
1571 return err
1572 }, opts...)
1573 if err != nil {
1574 return nil, err
1575 }
1576 return resp, nil
1577 }
1578
1579 func (c *gRPCClient) CreateWasmPluginVersion(ctx context.Context, req *networkservicespb.CreateWasmPluginVersionRequest, opts ...gax.CallOption) (*CreateWasmPluginVersionOperation, error) {
1580 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1581
1582 hds = append(c.xGoogHeaders, hds...)
1583 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1584 opts = append((*c.CallOptions).CreateWasmPluginVersion[0:len((*c.CallOptions).CreateWasmPluginVersion):len((*c.CallOptions).CreateWasmPluginVersion)], opts...)
1585 var resp *longrunningpb.Operation
1586 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1587 var err error
1588 resp, err = executeRPC(ctx, c.client.CreateWasmPluginVersion, req, settings.GRPC, c.logger, "CreateWasmPluginVersion")
1589 return err
1590 }, opts...)
1591 if err != nil {
1592 return nil, err
1593 }
1594 return &CreateWasmPluginVersionOperation{
1595 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1596 }, nil
1597 }
1598
1599 func (c *gRPCClient) DeleteWasmPluginVersion(ctx context.Context, req *networkservicespb.DeleteWasmPluginVersionRequest, opts ...gax.CallOption) (*DeleteWasmPluginVersionOperation, error) {
1600 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1601
1602 hds = append(c.xGoogHeaders, hds...)
1603 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1604 opts = append((*c.CallOptions).DeleteWasmPluginVersion[0:len((*c.CallOptions).DeleteWasmPluginVersion):len((*c.CallOptions).DeleteWasmPluginVersion)], opts...)
1605 var resp *longrunningpb.Operation
1606 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1607 var err error
1608 resp, err = executeRPC(ctx, c.client.DeleteWasmPluginVersion, req, settings.GRPC, c.logger, "DeleteWasmPluginVersion")
1609 return err
1610 }, opts...)
1611 if err != nil {
1612 return nil, err
1613 }
1614 return &DeleteWasmPluginVersionOperation{
1615 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1616 }, nil
1617 }
1618
1619 func (c *gRPCClient) ListWasmPlugins(ctx context.Context, req *networkservicespb.ListWasmPluginsRequest, opts ...gax.CallOption) *WasmPluginIterator {
1620 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1621
1622 hds = append(c.xGoogHeaders, hds...)
1623 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1624 opts = append((*c.CallOptions).ListWasmPlugins[0:len((*c.CallOptions).ListWasmPlugins):len((*c.CallOptions).ListWasmPlugins)], opts...)
1625 it := &WasmPluginIterator{}
1626 req = proto.Clone(req).(*networkservicespb.ListWasmPluginsRequest)
1627 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.WasmPlugin, string, error) {
1628 resp := &networkservicespb.ListWasmPluginsResponse{}
1629 if pageToken != "" {
1630 req.PageToken = pageToken
1631 }
1632 if pageSize > math.MaxInt32 {
1633 req.PageSize = math.MaxInt32
1634 } else if pageSize != 0 {
1635 req.PageSize = int32(pageSize)
1636 }
1637 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1638 var err error
1639 resp, err = executeRPC(ctx, c.client.ListWasmPlugins, req, settings.GRPC, c.logger, "ListWasmPlugins")
1640 return err
1641 }, opts...)
1642 if err != nil {
1643 return nil, "", err
1644 }
1645
1646 it.Response = resp
1647 return resp.GetWasmPlugins(), resp.GetNextPageToken(), nil
1648 }
1649 fetch := func(pageSize int, pageToken string) (string, error) {
1650 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1651 if err != nil {
1652 return "", err
1653 }
1654 it.items = append(it.items, items...)
1655 return nextPageToken, nil
1656 }
1657
1658 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1659 it.pageInfo.MaxSize = int(req.GetPageSize())
1660 it.pageInfo.Token = req.GetPageToken()
1661
1662 return it
1663 }
1664
1665 func (c *gRPCClient) GetWasmPlugin(ctx context.Context, req *networkservicespb.GetWasmPluginRequest, opts ...gax.CallOption) (*networkservicespb.WasmPlugin, error) {
1666 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1667
1668 hds = append(c.xGoogHeaders, hds...)
1669 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1670 opts = append((*c.CallOptions).GetWasmPlugin[0:len((*c.CallOptions).GetWasmPlugin):len((*c.CallOptions).GetWasmPlugin)], opts...)
1671 var resp *networkservicespb.WasmPlugin
1672 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1673 var err error
1674 resp, err = executeRPC(ctx, c.client.GetWasmPlugin, req, settings.GRPC, c.logger, "GetWasmPlugin")
1675 return err
1676 }, opts...)
1677 if err != nil {
1678 return nil, err
1679 }
1680 return resp, nil
1681 }
1682
1683 func (c *gRPCClient) CreateWasmPlugin(ctx context.Context, req *networkservicespb.CreateWasmPluginRequest, opts ...gax.CallOption) (*CreateWasmPluginOperation, error) {
1684 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1685
1686 hds = append(c.xGoogHeaders, hds...)
1687 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1688 opts = append((*c.CallOptions).CreateWasmPlugin[0:len((*c.CallOptions).CreateWasmPlugin):len((*c.CallOptions).CreateWasmPlugin)], opts...)
1689 var resp *longrunningpb.Operation
1690 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1691 var err error
1692 resp, err = executeRPC(ctx, c.client.CreateWasmPlugin, req, settings.GRPC, c.logger, "CreateWasmPlugin")
1693 return err
1694 }, opts...)
1695 if err != nil {
1696 return nil, err
1697 }
1698 return &CreateWasmPluginOperation{
1699 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1700 }, nil
1701 }
1702
1703 func (c *gRPCClient) UpdateWasmPlugin(ctx context.Context, req *networkservicespb.UpdateWasmPluginRequest, opts ...gax.CallOption) (*UpdateWasmPluginOperation, error) {
1704 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "wasm_plugin.name", url.QueryEscape(req.GetWasmPlugin().GetName()))}
1705
1706 hds = append(c.xGoogHeaders, hds...)
1707 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1708 opts = append((*c.CallOptions).UpdateWasmPlugin[0:len((*c.CallOptions).UpdateWasmPlugin):len((*c.CallOptions).UpdateWasmPlugin)], opts...)
1709 var resp *longrunningpb.Operation
1710 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1711 var err error
1712 resp, err = executeRPC(ctx, c.client.UpdateWasmPlugin, req, settings.GRPC, c.logger, "UpdateWasmPlugin")
1713 return err
1714 }, opts...)
1715 if err != nil {
1716 return nil, err
1717 }
1718 return &UpdateWasmPluginOperation{
1719 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1720 }, nil
1721 }
1722
1723 func (c *gRPCClient) DeleteWasmPlugin(ctx context.Context, req *networkservicespb.DeleteWasmPluginRequest, opts ...gax.CallOption) (*DeleteWasmPluginOperation, error) {
1724 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1725
1726 hds = append(c.xGoogHeaders, hds...)
1727 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1728 opts = append((*c.CallOptions).DeleteWasmPlugin[0:len((*c.CallOptions).DeleteWasmPlugin):len((*c.CallOptions).DeleteWasmPlugin)], opts...)
1729 var resp *longrunningpb.Operation
1730 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1731 var err error
1732 resp, err = executeRPC(ctx, c.client.DeleteWasmPlugin, req, settings.GRPC, c.logger, "DeleteWasmPlugin")
1733 return err
1734 }, opts...)
1735 if err != nil {
1736 return nil, err
1737 }
1738 return &DeleteWasmPluginOperation{
1739 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1740 }, nil
1741 }
1742
1743 func (c *gRPCClient) ListGateways(ctx context.Context, req *networkservicespb.ListGatewaysRequest, opts ...gax.CallOption) *GatewayIterator {
1744 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1745
1746 hds = append(c.xGoogHeaders, hds...)
1747 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1748 opts = append((*c.CallOptions).ListGateways[0:len((*c.CallOptions).ListGateways):len((*c.CallOptions).ListGateways)], opts...)
1749 it := &GatewayIterator{}
1750 req = proto.Clone(req).(*networkservicespb.ListGatewaysRequest)
1751 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.Gateway, string, error) {
1752 resp := &networkservicespb.ListGatewaysResponse{}
1753 if pageToken != "" {
1754 req.PageToken = pageToken
1755 }
1756 if pageSize > math.MaxInt32 {
1757 req.PageSize = math.MaxInt32
1758 } else if pageSize != 0 {
1759 req.PageSize = int32(pageSize)
1760 }
1761 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1762 var err error
1763 resp, err = executeRPC(ctx, c.client.ListGateways, req, settings.GRPC, c.logger, "ListGateways")
1764 return err
1765 }, opts...)
1766 if err != nil {
1767 return nil, "", err
1768 }
1769
1770 it.Response = resp
1771 return resp.GetGateways(), resp.GetNextPageToken(), nil
1772 }
1773 fetch := func(pageSize int, pageToken string) (string, error) {
1774 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1775 if err != nil {
1776 return "", err
1777 }
1778 it.items = append(it.items, items...)
1779 return nextPageToken, nil
1780 }
1781
1782 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1783 it.pageInfo.MaxSize = int(req.GetPageSize())
1784 it.pageInfo.Token = req.GetPageToken()
1785
1786 return it
1787 }
1788
1789 func (c *gRPCClient) GetGateway(ctx context.Context, req *networkservicespb.GetGatewayRequest, opts ...gax.CallOption) (*networkservicespb.Gateway, error) {
1790 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1791
1792 hds = append(c.xGoogHeaders, hds...)
1793 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1794 opts = append((*c.CallOptions).GetGateway[0:len((*c.CallOptions).GetGateway):len((*c.CallOptions).GetGateway)], opts...)
1795 var resp *networkservicespb.Gateway
1796 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1797 var err error
1798 resp, err = executeRPC(ctx, c.client.GetGateway, req, settings.GRPC, c.logger, "GetGateway")
1799 return err
1800 }, opts...)
1801 if err != nil {
1802 return nil, err
1803 }
1804 return resp, nil
1805 }
1806
1807 func (c *gRPCClient) CreateGateway(ctx context.Context, req *networkservicespb.CreateGatewayRequest, opts ...gax.CallOption) (*CreateGatewayOperation, error) {
1808 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1809
1810 hds = append(c.xGoogHeaders, hds...)
1811 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1812 opts = append((*c.CallOptions).CreateGateway[0:len((*c.CallOptions).CreateGateway):len((*c.CallOptions).CreateGateway)], opts...)
1813 var resp *longrunningpb.Operation
1814 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1815 var err error
1816 resp, err = executeRPC(ctx, c.client.CreateGateway, req, settings.GRPC, c.logger, "CreateGateway")
1817 return err
1818 }, opts...)
1819 if err != nil {
1820 return nil, err
1821 }
1822 return &CreateGatewayOperation{
1823 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1824 }, nil
1825 }
1826
1827 func (c *gRPCClient) UpdateGateway(ctx context.Context, req *networkservicespb.UpdateGatewayRequest, opts ...gax.CallOption) (*UpdateGatewayOperation, error) {
1828 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "gateway.name", url.QueryEscape(req.GetGateway().GetName()))}
1829
1830 hds = append(c.xGoogHeaders, hds...)
1831 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1832 opts = append((*c.CallOptions).UpdateGateway[0:len((*c.CallOptions).UpdateGateway):len((*c.CallOptions).UpdateGateway)], opts...)
1833 var resp *longrunningpb.Operation
1834 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1835 var err error
1836 resp, err = executeRPC(ctx, c.client.UpdateGateway, req, settings.GRPC, c.logger, "UpdateGateway")
1837 return err
1838 }, opts...)
1839 if err != nil {
1840 return nil, err
1841 }
1842 return &UpdateGatewayOperation{
1843 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1844 }, nil
1845 }
1846
1847 func (c *gRPCClient) DeleteGateway(ctx context.Context, req *networkservicespb.DeleteGatewayRequest, opts ...gax.CallOption) (*DeleteGatewayOperation, error) {
1848 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1849
1850 hds = append(c.xGoogHeaders, hds...)
1851 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1852 opts = append((*c.CallOptions).DeleteGateway[0:len((*c.CallOptions).DeleteGateway):len((*c.CallOptions).DeleteGateway)], opts...)
1853 var resp *longrunningpb.Operation
1854 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1855 var err error
1856 resp, err = executeRPC(ctx, c.client.DeleteGateway, req, settings.GRPC, c.logger, "DeleteGateway")
1857 return err
1858 }, opts...)
1859 if err != nil {
1860 return nil, err
1861 }
1862 return &DeleteGatewayOperation{
1863 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1864 }, nil
1865 }
1866
1867 func (c *gRPCClient) ListGrpcRoutes(ctx context.Context, req *networkservicespb.ListGrpcRoutesRequest, opts ...gax.CallOption) *GrpcRouteIterator {
1868 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1869
1870 hds = append(c.xGoogHeaders, hds...)
1871 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1872 opts = append((*c.CallOptions).ListGrpcRoutes[0:len((*c.CallOptions).ListGrpcRoutes):len((*c.CallOptions).ListGrpcRoutes)], opts...)
1873 it := &GrpcRouteIterator{}
1874 req = proto.Clone(req).(*networkservicespb.ListGrpcRoutesRequest)
1875 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.GrpcRoute, string, error) {
1876 resp := &networkservicespb.ListGrpcRoutesResponse{}
1877 if pageToken != "" {
1878 req.PageToken = pageToken
1879 }
1880 if pageSize > math.MaxInt32 {
1881 req.PageSize = math.MaxInt32
1882 } else if pageSize != 0 {
1883 req.PageSize = int32(pageSize)
1884 }
1885 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1886 var err error
1887 resp, err = executeRPC(ctx, c.client.ListGrpcRoutes, req, settings.GRPC, c.logger, "ListGrpcRoutes")
1888 return err
1889 }, opts...)
1890 if err != nil {
1891 return nil, "", err
1892 }
1893
1894 it.Response = resp
1895 return resp.GetGrpcRoutes(), resp.GetNextPageToken(), nil
1896 }
1897 fetch := func(pageSize int, pageToken string) (string, error) {
1898 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1899 if err != nil {
1900 return "", err
1901 }
1902 it.items = append(it.items, items...)
1903 return nextPageToken, nil
1904 }
1905
1906 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1907 it.pageInfo.MaxSize = int(req.GetPageSize())
1908 it.pageInfo.Token = req.GetPageToken()
1909
1910 return it
1911 }
1912
1913 func (c *gRPCClient) GetGrpcRoute(ctx context.Context, req *networkservicespb.GetGrpcRouteRequest, opts ...gax.CallOption) (*networkservicespb.GrpcRoute, error) {
1914 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1915
1916 hds = append(c.xGoogHeaders, hds...)
1917 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1918 opts = append((*c.CallOptions).GetGrpcRoute[0:len((*c.CallOptions).GetGrpcRoute):len((*c.CallOptions).GetGrpcRoute)], opts...)
1919 var resp *networkservicespb.GrpcRoute
1920 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1921 var err error
1922 resp, err = executeRPC(ctx, c.client.GetGrpcRoute, req, settings.GRPC, c.logger, "GetGrpcRoute")
1923 return err
1924 }, opts...)
1925 if err != nil {
1926 return nil, err
1927 }
1928 return resp, nil
1929 }
1930
1931 func (c *gRPCClient) CreateGrpcRoute(ctx context.Context, req *networkservicespb.CreateGrpcRouteRequest, opts ...gax.CallOption) (*CreateGrpcRouteOperation, error) {
1932 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1933
1934 hds = append(c.xGoogHeaders, hds...)
1935 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1936 opts = append((*c.CallOptions).CreateGrpcRoute[0:len((*c.CallOptions).CreateGrpcRoute):len((*c.CallOptions).CreateGrpcRoute)], opts...)
1937 var resp *longrunningpb.Operation
1938 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1939 var err error
1940 resp, err = executeRPC(ctx, c.client.CreateGrpcRoute, req, settings.GRPC, c.logger, "CreateGrpcRoute")
1941 return err
1942 }, opts...)
1943 if err != nil {
1944 return nil, err
1945 }
1946 return &CreateGrpcRouteOperation{
1947 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1948 }, nil
1949 }
1950
1951 func (c *gRPCClient) UpdateGrpcRoute(ctx context.Context, req *networkservicespb.UpdateGrpcRouteRequest, opts ...gax.CallOption) (*UpdateGrpcRouteOperation, error) {
1952 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "grpc_route.name", url.QueryEscape(req.GetGrpcRoute().GetName()))}
1953
1954 hds = append(c.xGoogHeaders, hds...)
1955 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1956 opts = append((*c.CallOptions).UpdateGrpcRoute[0:len((*c.CallOptions).UpdateGrpcRoute):len((*c.CallOptions).UpdateGrpcRoute)], opts...)
1957 var resp *longrunningpb.Operation
1958 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1959 var err error
1960 resp, err = executeRPC(ctx, c.client.UpdateGrpcRoute, req, settings.GRPC, c.logger, "UpdateGrpcRoute")
1961 return err
1962 }, opts...)
1963 if err != nil {
1964 return nil, err
1965 }
1966 return &UpdateGrpcRouteOperation{
1967 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1968 }, nil
1969 }
1970
1971 func (c *gRPCClient) DeleteGrpcRoute(ctx context.Context, req *networkservicespb.DeleteGrpcRouteRequest, opts ...gax.CallOption) (*DeleteGrpcRouteOperation, error) {
1972 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1973
1974 hds = append(c.xGoogHeaders, hds...)
1975 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1976 opts = append((*c.CallOptions).DeleteGrpcRoute[0:len((*c.CallOptions).DeleteGrpcRoute):len((*c.CallOptions).DeleteGrpcRoute)], opts...)
1977 var resp *longrunningpb.Operation
1978 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1979 var err error
1980 resp, err = executeRPC(ctx, c.client.DeleteGrpcRoute, req, settings.GRPC, c.logger, "DeleteGrpcRoute")
1981 return err
1982 }, opts...)
1983 if err != nil {
1984 return nil, err
1985 }
1986 return &DeleteGrpcRouteOperation{
1987 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1988 }, nil
1989 }
1990
1991 func (c *gRPCClient) ListHttpRoutes(ctx context.Context, req *networkservicespb.ListHttpRoutesRequest, opts ...gax.CallOption) *HttpRouteIterator {
1992 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1993
1994 hds = append(c.xGoogHeaders, hds...)
1995 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1996 opts = append((*c.CallOptions).ListHttpRoutes[0:len((*c.CallOptions).ListHttpRoutes):len((*c.CallOptions).ListHttpRoutes)], opts...)
1997 it := &HttpRouteIterator{}
1998 req = proto.Clone(req).(*networkservicespb.ListHttpRoutesRequest)
1999 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.HttpRoute, string, error) {
2000 resp := &networkservicespb.ListHttpRoutesResponse{}
2001 if pageToken != "" {
2002 req.PageToken = pageToken
2003 }
2004 if pageSize > math.MaxInt32 {
2005 req.PageSize = math.MaxInt32
2006 } else if pageSize != 0 {
2007 req.PageSize = int32(pageSize)
2008 }
2009 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2010 var err error
2011 resp, err = executeRPC(ctx, c.client.ListHttpRoutes, req, settings.GRPC, c.logger, "ListHttpRoutes")
2012 return err
2013 }, opts...)
2014 if err != nil {
2015 return nil, "", err
2016 }
2017
2018 it.Response = resp
2019 return resp.GetHttpRoutes(), resp.GetNextPageToken(), nil
2020 }
2021 fetch := func(pageSize int, pageToken string) (string, error) {
2022 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2023 if err != nil {
2024 return "", err
2025 }
2026 it.items = append(it.items, items...)
2027 return nextPageToken, nil
2028 }
2029
2030 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2031 it.pageInfo.MaxSize = int(req.GetPageSize())
2032 it.pageInfo.Token = req.GetPageToken()
2033
2034 return it
2035 }
2036
2037 func (c *gRPCClient) GetHttpRoute(ctx context.Context, req *networkservicespb.GetHttpRouteRequest, opts ...gax.CallOption) (*networkservicespb.HttpRoute, error) {
2038 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2039
2040 hds = append(c.xGoogHeaders, hds...)
2041 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2042 opts = append((*c.CallOptions).GetHttpRoute[0:len((*c.CallOptions).GetHttpRoute):len((*c.CallOptions).GetHttpRoute)], opts...)
2043 var resp *networkservicespb.HttpRoute
2044 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2045 var err error
2046 resp, err = executeRPC(ctx, c.client.GetHttpRoute, req, settings.GRPC, c.logger, "GetHttpRoute")
2047 return err
2048 }, opts...)
2049 if err != nil {
2050 return nil, err
2051 }
2052 return resp, nil
2053 }
2054
2055 func (c *gRPCClient) CreateHttpRoute(ctx context.Context, req *networkservicespb.CreateHttpRouteRequest, opts ...gax.CallOption) (*CreateHttpRouteOperation, error) {
2056 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2057
2058 hds = append(c.xGoogHeaders, hds...)
2059 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2060 opts = append((*c.CallOptions).CreateHttpRoute[0:len((*c.CallOptions).CreateHttpRoute):len((*c.CallOptions).CreateHttpRoute)], opts...)
2061 var resp *longrunningpb.Operation
2062 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2063 var err error
2064 resp, err = executeRPC(ctx, c.client.CreateHttpRoute, req, settings.GRPC, c.logger, "CreateHttpRoute")
2065 return err
2066 }, opts...)
2067 if err != nil {
2068 return nil, err
2069 }
2070 return &CreateHttpRouteOperation{
2071 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2072 }, nil
2073 }
2074
2075 func (c *gRPCClient) UpdateHttpRoute(ctx context.Context, req *networkservicespb.UpdateHttpRouteRequest, opts ...gax.CallOption) (*UpdateHttpRouteOperation, error) {
2076 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "http_route.name", url.QueryEscape(req.GetHttpRoute().GetName()))}
2077
2078 hds = append(c.xGoogHeaders, hds...)
2079 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2080 opts = append((*c.CallOptions).UpdateHttpRoute[0:len((*c.CallOptions).UpdateHttpRoute):len((*c.CallOptions).UpdateHttpRoute)], opts...)
2081 var resp *longrunningpb.Operation
2082 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2083 var err error
2084 resp, err = executeRPC(ctx, c.client.UpdateHttpRoute, req, settings.GRPC, c.logger, "UpdateHttpRoute")
2085 return err
2086 }, opts...)
2087 if err != nil {
2088 return nil, err
2089 }
2090 return &UpdateHttpRouteOperation{
2091 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2092 }, nil
2093 }
2094
2095 func (c *gRPCClient) DeleteHttpRoute(ctx context.Context, req *networkservicespb.DeleteHttpRouteRequest, opts ...gax.CallOption) (*DeleteHttpRouteOperation, error) {
2096 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2097
2098 hds = append(c.xGoogHeaders, hds...)
2099 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2100 opts = append((*c.CallOptions).DeleteHttpRoute[0:len((*c.CallOptions).DeleteHttpRoute):len((*c.CallOptions).DeleteHttpRoute)], opts...)
2101 var resp *longrunningpb.Operation
2102 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2103 var err error
2104 resp, err = executeRPC(ctx, c.client.DeleteHttpRoute, req, settings.GRPC, c.logger, "DeleteHttpRoute")
2105 return err
2106 }, opts...)
2107 if err != nil {
2108 return nil, err
2109 }
2110 return &DeleteHttpRouteOperation{
2111 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2112 }, nil
2113 }
2114
2115 func (c *gRPCClient) ListTcpRoutes(ctx context.Context, req *networkservicespb.ListTcpRoutesRequest, opts ...gax.CallOption) *TcpRouteIterator {
2116 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2117
2118 hds = append(c.xGoogHeaders, hds...)
2119 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2120 opts = append((*c.CallOptions).ListTcpRoutes[0:len((*c.CallOptions).ListTcpRoutes):len((*c.CallOptions).ListTcpRoutes)], opts...)
2121 it := &TcpRouteIterator{}
2122 req = proto.Clone(req).(*networkservicespb.ListTcpRoutesRequest)
2123 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.TcpRoute, string, error) {
2124 resp := &networkservicespb.ListTcpRoutesResponse{}
2125 if pageToken != "" {
2126 req.PageToken = pageToken
2127 }
2128 if pageSize > math.MaxInt32 {
2129 req.PageSize = math.MaxInt32
2130 } else if pageSize != 0 {
2131 req.PageSize = int32(pageSize)
2132 }
2133 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2134 var err error
2135 resp, err = executeRPC(ctx, c.client.ListTcpRoutes, req, settings.GRPC, c.logger, "ListTcpRoutes")
2136 return err
2137 }, opts...)
2138 if err != nil {
2139 return nil, "", err
2140 }
2141
2142 it.Response = resp
2143 return resp.GetTcpRoutes(), resp.GetNextPageToken(), nil
2144 }
2145 fetch := func(pageSize int, pageToken string) (string, error) {
2146 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2147 if err != nil {
2148 return "", err
2149 }
2150 it.items = append(it.items, items...)
2151 return nextPageToken, nil
2152 }
2153
2154 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2155 it.pageInfo.MaxSize = int(req.GetPageSize())
2156 it.pageInfo.Token = req.GetPageToken()
2157
2158 return it
2159 }
2160
2161 func (c *gRPCClient) GetTcpRoute(ctx context.Context, req *networkservicespb.GetTcpRouteRequest, opts ...gax.CallOption) (*networkservicespb.TcpRoute, error) {
2162 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2163
2164 hds = append(c.xGoogHeaders, hds...)
2165 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2166 opts = append((*c.CallOptions).GetTcpRoute[0:len((*c.CallOptions).GetTcpRoute):len((*c.CallOptions).GetTcpRoute)], opts...)
2167 var resp *networkservicespb.TcpRoute
2168 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2169 var err error
2170 resp, err = executeRPC(ctx, c.client.GetTcpRoute, req, settings.GRPC, c.logger, "GetTcpRoute")
2171 return err
2172 }, opts...)
2173 if err != nil {
2174 return nil, err
2175 }
2176 return resp, nil
2177 }
2178
2179 func (c *gRPCClient) CreateTcpRoute(ctx context.Context, req *networkservicespb.CreateTcpRouteRequest, opts ...gax.CallOption) (*CreateTcpRouteOperation, error) {
2180 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2181
2182 hds = append(c.xGoogHeaders, hds...)
2183 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2184 opts = append((*c.CallOptions).CreateTcpRoute[0:len((*c.CallOptions).CreateTcpRoute):len((*c.CallOptions).CreateTcpRoute)], opts...)
2185 var resp *longrunningpb.Operation
2186 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2187 var err error
2188 resp, err = executeRPC(ctx, c.client.CreateTcpRoute, req, settings.GRPC, c.logger, "CreateTcpRoute")
2189 return err
2190 }, opts...)
2191 if err != nil {
2192 return nil, err
2193 }
2194 return &CreateTcpRouteOperation{
2195 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2196 }, nil
2197 }
2198
2199 func (c *gRPCClient) UpdateTcpRoute(ctx context.Context, req *networkservicespb.UpdateTcpRouteRequest, opts ...gax.CallOption) (*UpdateTcpRouteOperation, error) {
2200 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "tcp_route.name", url.QueryEscape(req.GetTcpRoute().GetName()))}
2201
2202 hds = append(c.xGoogHeaders, hds...)
2203 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2204 opts = append((*c.CallOptions).UpdateTcpRoute[0:len((*c.CallOptions).UpdateTcpRoute):len((*c.CallOptions).UpdateTcpRoute)], opts...)
2205 var resp *longrunningpb.Operation
2206 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2207 var err error
2208 resp, err = executeRPC(ctx, c.client.UpdateTcpRoute, req, settings.GRPC, c.logger, "UpdateTcpRoute")
2209 return err
2210 }, opts...)
2211 if err != nil {
2212 return nil, err
2213 }
2214 return &UpdateTcpRouteOperation{
2215 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2216 }, nil
2217 }
2218
2219 func (c *gRPCClient) DeleteTcpRoute(ctx context.Context, req *networkservicespb.DeleteTcpRouteRequest, opts ...gax.CallOption) (*DeleteTcpRouteOperation, error) {
2220 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2221
2222 hds = append(c.xGoogHeaders, hds...)
2223 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2224 opts = append((*c.CallOptions).DeleteTcpRoute[0:len((*c.CallOptions).DeleteTcpRoute):len((*c.CallOptions).DeleteTcpRoute)], opts...)
2225 var resp *longrunningpb.Operation
2226 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2227 var err error
2228 resp, err = executeRPC(ctx, c.client.DeleteTcpRoute, req, settings.GRPC, c.logger, "DeleteTcpRoute")
2229 return err
2230 }, opts...)
2231 if err != nil {
2232 return nil, err
2233 }
2234 return &DeleteTcpRouteOperation{
2235 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2236 }, nil
2237 }
2238
2239 func (c *gRPCClient) ListTlsRoutes(ctx context.Context, req *networkservicespb.ListTlsRoutesRequest, opts ...gax.CallOption) *TlsRouteIterator {
2240 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2241
2242 hds = append(c.xGoogHeaders, hds...)
2243 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2244 opts = append((*c.CallOptions).ListTlsRoutes[0:len((*c.CallOptions).ListTlsRoutes):len((*c.CallOptions).ListTlsRoutes)], opts...)
2245 it := &TlsRouteIterator{}
2246 req = proto.Clone(req).(*networkservicespb.ListTlsRoutesRequest)
2247 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.TlsRoute, string, error) {
2248 resp := &networkservicespb.ListTlsRoutesResponse{}
2249 if pageToken != "" {
2250 req.PageToken = pageToken
2251 }
2252 if pageSize > math.MaxInt32 {
2253 req.PageSize = math.MaxInt32
2254 } else if pageSize != 0 {
2255 req.PageSize = int32(pageSize)
2256 }
2257 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2258 var err error
2259 resp, err = executeRPC(ctx, c.client.ListTlsRoutes, req, settings.GRPC, c.logger, "ListTlsRoutes")
2260 return err
2261 }, opts...)
2262 if err != nil {
2263 return nil, "", err
2264 }
2265
2266 it.Response = resp
2267 return resp.GetTlsRoutes(), resp.GetNextPageToken(), nil
2268 }
2269 fetch := func(pageSize int, pageToken string) (string, error) {
2270 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2271 if err != nil {
2272 return "", err
2273 }
2274 it.items = append(it.items, items...)
2275 return nextPageToken, nil
2276 }
2277
2278 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2279 it.pageInfo.MaxSize = int(req.GetPageSize())
2280 it.pageInfo.Token = req.GetPageToken()
2281
2282 return it
2283 }
2284
2285 func (c *gRPCClient) GetTlsRoute(ctx context.Context, req *networkservicespb.GetTlsRouteRequest, opts ...gax.CallOption) (*networkservicespb.TlsRoute, error) {
2286 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2287
2288 hds = append(c.xGoogHeaders, hds...)
2289 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2290 opts = append((*c.CallOptions).GetTlsRoute[0:len((*c.CallOptions).GetTlsRoute):len((*c.CallOptions).GetTlsRoute)], opts...)
2291 var resp *networkservicespb.TlsRoute
2292 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2293 var err error
2294 resp, err = executeRPC(ctx, c.client.GetTlsRoute, req, settings.GRPC, c.logger, "GetTlsRoute")
2295 return err
2296 }, opts...)
2297 if err != nil {
2298 return nil, err
2299 }
2300 return resp, nil
2301 }
2302
2303 func (c *gRPCClient) CreateTlsRoute(ctx context.Context, req *networkservicespb.CreateTlsRouteRequest, opts ...gax.CallOption) (*CreateTlsRouteOperation, error) {
2304 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2305
2306 hds = append(c.xGoogHeaders, hds...)
2307 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2308 opts = append((*c.CallOptions).CreateTlsRoute[0:len((*c.CallOptions).CreateTlsRoute):len((*c.CallOptions).CreateTlsRoute)], opts...)
2309 var resp *longrunningpb.Operation
2310 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2311 var err error
2312 resp, err = executeRPC(ctx, c.client.CreateTlsRoute, req, settings.GRPC, c.logger, "CreateTlsRoute")
2313 return err
2314 }, opts...)
2315 if err != nil {
2316 return nil, err
2317 }
2318 return &CreateTlsRouteOperation{
2319 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2320 }, nil
2321 }
2322
2323 func (c *gRPCClient) UpdateTlsRoute(ctx context.Context, req *networkservicespb.UpdateTlsRouteRequest, opts ...gax.CallOption) (*UpdateTlsRouteOperation, error) {
2324 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "tls_route.name", url.QueryEscape(req.GetTlsRoute().GetName()))}
2325
2326 hds = append(c.xGoogHeaders, hds...)
2327 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2328 opts = append((*c.CallOptions).UpdateTlsRoute[0:len((*c.CallOptions).UpdateTlsRoute):len((*c.CallOptions).UpdateTlsRoute)], opts...)
2329 var resp *longrunningpb.Operation
2330 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2331 var err error
2332 resp, err = executeRPC(ctx, c.client.UpdateTlsRoute, req, settings.GRPC, c.logger, "UpdateTlsRoute")
2333 return err
2334 }, opts...)
2335 if err != nil {
2336 return nil, err
2337 }
2338 return &UpdateTlsRouteOperation{
2339 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2340 }, nil
2341 }
2342
2343 func (c *gRPCClient) DeleteTlsRoute(ctx context.Context, req *networkservicespb.DeleteTlsRouteRequest, opts ...gax.CallOption) (*DeleteTlsRouteOperation, error) {
2344 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2345
2346 hds = append(c.xGoogHeaders, hds...)
2347 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2348 opts = append((*c.CallOptions).DeleteTlsRoute[0:len((*c.CallOptions).DeleteTlsRoute):len((*c.CallOptions).DeleteTlsRoute)], opts...)
2349 var resp *longrunningpb.Operation
2350 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2351 var err error
2352 resp, err = executeRPC(ctx, c.client.DeleteTlsRoute, req, settings.GRPC, c.logger, "DeleteTlsRoute")
2353 return err
2354 }, opts...)
2355 if err != nil {
2356 return nil, err
2357 }
2358 return &DeleteTlsRouteOperation{
2359 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2360 }, nil
2361 }
2362
2363 func (c *gRPCClient) ListServiceBindings(ctx context.Context, req *networkservicespb.ListServiceBindingsRequest, opts ...gax.CallOption) *ServiceBindingIterator {
2364 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2365
2366 hds = append(c.xGoogHeaders, hds...)
2367 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2368 opts = append((*c.CallOptions).ListServiceBindings[0:len((*c.CallOptions).ListServiceBindings):len((*c.CallOptions).ListServiceBindings)], opts...)
2369 it := &ServiceBindingIterator{}
2370 req = proto.Clone(req).(*networkservicespb.ListServiceBindingsRequest)
2371 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.ServiceBinding, string, error) {
2372 resp := &networkservicespb.ListServiceBindingsResponse{}
2373 if pageToken != "" {
2374 req.PageToken = pageToken
2375 }
2376 if pageSize > math.MaxInt32 {
2377 req.PageSize = math.MaxInt32
2378 } else if pageSize != 0 {
2379 req.PageSize = int32(pageSize)
2380 }
2381 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2382 var err error
2383 resp, err = executeRPC(ctx, c.client.ListServiceBindings, req, settings.GRPC, c.logger, "ListServiceBindings")
2384 return err
2385 }, opts...)
2386 if err != nil {
2387 return nil, "", err
2388 }
2389
2390 it.Response = resp
2391 return resp.GetServiceBindings(), resp.GetNextPageToken(), nil
2392 }
2393 fetch := func(pageSize int, pageToken string) (string, error) {
2394 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2395 if err != nil {
2396 return "", err
2397 }
2398 it.items = append(it.items, items...)
2399 return nextPageToken, nil
2400 }
2401
2402 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2403 it.pageInfo.MaxSize = int(req.GetPageSize())
2404 it.pageInfo.Token = req.GetPageToken()
2405
2406 return it
2407 }
2408
2409 func (c *gRPCClient) GetServiceBinding(ctx context.Context, req *networkservicespb.GetServiceBindingRequest, opts ...gax.CallOption) (*networkservicespb.ServiceBinding, error) {
2410 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2411
2412 hds = append(c.xGoogHeaders, hds...)
2413 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2414 opts = append((*c.CallOptions).GetServiceBinding[0:len((*c.CallOptions).GetServiceBinding):len((*c.CallOptions).GetServiceBinding)], opts...)
2415 var resp *networkservicespb.ServiceBinding
2416 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2417 var err error
2418 resp, err = executeRPC(ctx, c.client.GetServiceBinding, req, settings.GRPC, c.logger, "GetServiceBinding")
2419 return err
2420 }, opts...)
2421 if err != nil {
2422 return nil, err
2423 }
2424 return resp, nil
2425 }
2426
2427 func (c *gRPCClient) CreateServiceBinding(ctx context.Context, req *networkservicespb.CreateServiceBindingRequest, opts ...gax.CallOption) (*CreateServiceBindingOperation, error) {
2428 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2429
2430 hds = append(c.xGoogHeaders, hds...)
2431 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2432 opts = append((*c.CallOptions).CreateServiceBinding[0:len((*c.CallOptions).CreateServiceBinding):len((*c.CallOptions).CreateServiceBinding)], opts...)
2433 var resp *longrunningpb.Operation
2434 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2435 var err error
2436 resp, err = executeRPC(ctx, c.client.CreateServiceBinding, req, settings.GRPC, c.logger, "CreateServiceBinding")
2437 return err
2438 }, opts...)
2439 if err != nil {
2440 return nil, err
2441 }
2442 return &CreateServiceBindingOperation{
2443 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2444 }, nil
2445 }
2446
2447 func (c *gRPCClient) UpdateServiceBinding(ctx context.Context, req *networkservicespb.UpdateServiceBindingRequest, opts ...gax.CallOption) (*UpdateServiceBindingOperation, error) {
2448 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "service_binding.name", url.QueryEscape(req.GetServiceBinding().GetName()))}
2449
2450 hds = append(c.xGoogHeaders, hds...)
2451 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2452 opts = append((*c.CallOptions).UpdateServiceBinding[0:len((*c.CallOptions).UpdateServiceBinding):len((*c.CallOptions).UpdateServiceBinding)], opts...)
2453 var resp *longrunningpb.Operation
2454 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2455 var err error
2456 resp, err = executeRPC(ctx, c.client.UpdateServiceBinding, req, settings.GRPC, c.logger, "UpdateServiceBinding")
2457 return err
2458 }, opts...)
2459 if err != nil {
2460 return nil, err
2461 }
2462 return &UpdateServiceBindingOperation{
2463 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2464 }, nil
2465 }
2466
2467 func (c *gRPCClient) DeleteServiceBinding(ctx context.Context, req *networkservicespb.DeleteServiceBindingRequest, opts ...gax.CallOption) (*DeleteServiceBindingOperation, error) {
2468 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2469
2470 hds = append(c.xGoogHeaders, hds...)
2471 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2472 opts = append((*c.CallOptions).DeleteServiceBinding[0:len((*c.CallOptions).DeleteServiceBinding):len((*c.CallOptions).DeleteServiceBinding)], opts...)
2473 var resp *longrunningpb.Operation
2474 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2475 var err error
2476 resp, err = executeRPC(ctx, c.client.DeleteServiceBinding, req, settings.GRPC, c.logger, "DeleteServiceBinding")
2477 return err
2478 }, opts...)
2479 if err != nil {
2480 return nil, err
2481 }
2482 return &DeleteServiceBindingOperation{
2483 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2484 }, nil
2485 }
2486
2487 func (c *gRPCClient) ListMeshes(ctx context.Context, req *networkservicespb.ListMeshesRequest, opts ...gax.CallOption) *MeshIterator {
2488 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2489
2490 hds = append(c.xGoogHeaders, hds...)
2491 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2492 opts = append((*c.CallOptions).ListMeshes[0:len((*c.CallOptions).ListMeshes):len((*c.CallOptions).ListMeshes)], opts...)
2493 it := &MeshIterator{}
2494 req = proto.Clone(req).(*networkservicespb.ListMeshesRequest)
2495 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.Mesh, string, error) {
2496 resp := &networkservicespb.ListMeshesResponse{}
2497 if pageToken != "" {
2498 req.PageToken = pageToken
2499 }
2500 if pageSize > math.MaxInt32 {
2501 req.PageSize = math.MaxInt32
2502 } else if pageSize != 0 {
2503 req.PageSize = int32(pageSize)
2504 }
2505 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2506 var err error
2507 resp, err = executeRPC(ctx, c.client.ListMeshes, req, settings.GRPC, c.logger, "ListMeshes")
2508 return err
2509 }, opts...)
2510 if err != nil {
2511 return nil, "", err
2512 }
2513
2514 it.Response = resp
2515 return resp.GetMeshes(), resp.GetNextPageToken(), nil
2516 }
2517 fetch := func(pageSize int, pageToken string) (string, error) {
2518 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2519 if err != nil {
2520 return "", err
2521 }
2522 it.items = append(it.items, items...)
2523 return nextPageToken, nil
2524 }
2525
2526 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2527 it.pageInfo.MaxSize = int(req.GetPageSize())
2528 it.pageInfo.Token = req.GetPageToken()
2529
2530 return it
2531 }
2532
2533 func (c *gRPCClient) GetMesh(ctx context.Context, req *networkservicespb.GetMeshRequest, opts ...gax.CallOption) (*networkservicespb.Mesh, error) {
2534 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2535
2536 hds = append(c.xGoogHeaders, hds...)
2537 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2538 opts = append((*c.CallOptions).GetMesh[0:len((*c.CallOptions).GetMesh):len((*c.CallOptions).GetMesh)], opts...)
2539 var resp *networkservicespb.Mesh
2540 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2541 var err error
2542 resp, err = executeRPC(ctx, c.client.GetMesh, req, settings.GRPC, c.logger, "GetMesh")
2543 return err
2544 }, opts...)
2545 if err != nil {
2546 return nil, err
2547 }
2548 return resp, nil
2549 }
2550
2551 func (c *gRPCClient) CreateMesh(ctx context.Context, req *networkservicespb.CreateMeshRequest, opts ...gax.CallOption) (*CreateMeshOperation, error) {
2552 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2553
2554 hds = append(c.xGoogHeaders, hds...)
2555 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2556 opts = append((*c.CallOptions).CreateMesh[0:len((*c.CallOptions).CreateMesh):len((*c.CallOptions).CreateMesh)], opts...)
2557 var resp *longrunningpb.Operation
2558 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2559 var err error
2560 resp, err = executeRPC(ctx, c.client.CreateMesh, req, settings.GRPC, c.logger, "CreateMesh")
2561 return err
2562 }, opts...)
2563 if err != nil {
2564 return nil, err
2565 }
2566 return &CreateMeshOperation{
2567 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2568 }, nil
2569 }
2570
2571 func (c *gRPCClient) UpdateMesh(ctx context.Context, req *networkservicespb.UpdateMeshRequest, opts ...gax.CallOption) (*UpdateMeshOperation, error) {
2572 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "mesh.name", url.QueryEscape(req.GetMesh().GetName()))}
2573
2574 hds = append(c.xGoogHeaders, hds...)
2575 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2576 opts = append((*c.CallOptions).UpdateMesh[0:len((*c.CallOptions).UpdateMesh):len((*c.CallOptions).UpdateMesh)], opts...)
2577 var resp *longrunningpb.Operation
2578 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2579 var err error
2580 resp, err = executeRPC(ctx, c.client.UpdateMesh, req, settings.GRPC, c.logger, "UpdateMesh")
2581 return err
2582 }, opts...)
2583 if err != nil {
2584 return nil, err
2585 }
2586 return &UpdateMeshOperation{
2587 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2588 }, nil
2589 }
2590
2591 func (c *gRPCClient) DeleteMesh(ctx context.Context, req *networkservicespb.DeleteMeshRequest, opts ...gax.CallOption) (*DeleteMeshOperation, error) {
2592 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2593
2594 hds = append(c.xGoogHeaders, hds...)
2595 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2596 opts = append((*c.CallOptions).DeleteMesh[0:len((*c.CallOptions).DeleteMesh):len((*c.CallOptions).DeleteMesh)], opts...)
2597 var resp *longrunningpb.Operation
2598 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2599 var err error
2600 resp, err = executeRPC(ctx, c.client.DeleteMesh, req, settings.GRPC, c.logger, "DeleteMesh")
2601 return err
2602 }, opts...)
2603 if err != nil {
2604 return nil, err
2605 }
2606 return &DeleteMeshOperation{
2607 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2608 }, nil
2609 }
2610
2611 func (c *gRPCClient) ListServiceLbPolicies(ctx context.Context, req *networkservicespb.ListServiceLbPoliciesRequest, opts ...gax.CallOption) *ServiceLbPolicyIterator {
2612 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2613
2614 hds = append(c.xGoogHeaders, hds...)
2615 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2616 opts = append((*c.CallOptions).ListServiceLbPolicies[0:len((*c.CallOptions).ListServiceLbPolicies):len((*c.CallOptions).ListServiceLbPolicies)], opts...)
2617 it := &ServiceLbPolicyIterator{}
2618 req = proto.Clone(req).(*networkservicespb.ListServiceLbPoliciesRequest)
2619 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.ServiceLbPolicy, string, error) {
2620 resp := &networkservicespb.ListServiceLbPoliciesResponse{}
2621 if pageToken != "" {
2622 req.PageToken = pageToken
2623 }
2624 if pageSize > math.MaxInt32 {
2625 req.PageSize = math.MaxInt32
2626 } else if pageSize != 0 {
2627 req.PageSize = int32(pageSize)
2628 }
2629 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2630 var err error
2631 resp, err = executeRPC(ctx, c.client.ListServiceLbPolicies, req, settings.GRPC, c.logger, "ListServiceLbPolicies")
2632 return err
2633 }, opts...)
2634 if err != nil {
2635 return nil, "", err
2636 }
2637
2638 it.Response = resp
2639 return resp.GetServiceLbPolicies(), resp.GetNextPageToken(), nil
2640 }
2641 fetch := func(pageSize int, pageToken string) (string, error) {
2642 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2643 if err != nil {
2644 return "", err
2645 }
2646 it.items = append(it.items, items...)
2647 return nextPageToken, nil
2648 }
2649
2650 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2651 it.pageInfo.MaxSize = int(req.GetPageSize())
2652 it.pageInfo.Token = req.GetPageToken()
2653
2654 return it
2655 }
2656
2657 func (c *gRPCClient) GetServiceLbPolicy(ctx context.Context, req *networkservicespb.GetServiceLbPolicyRequest, opts ...gax.CallOption) (*networkservicespb.ServiceLbPolicy, error) {
2658 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2659
2660 hds = append(c.xGoogHeaders, hds...)
2661 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2662 opts = append((*c.CallOptions).GetServiceLbPolicy[0:len((*c.CallOptions).GetServiceLbPolicy):len((*c.CallOptions).GetServiceLbPolicy)], opts...)
2663 var resp *networkservicespb.ServiceLbPolicy
2664 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2665 var err error
2666 resp, err = executeRPC(ctx, c.client.GetServiceLbPolicy, req, settings.GRPC, c.logger, "GetServiceLbPolicy")
2667 return err
2668 }, opts...)
2669 if err != nil {
2670 return nil, err
2671 }
2672 return resp, nil
2673 }
2674
2675 func (c *gRPCClient) CreateServiceLbPolicy(ctx context.Context, req *networkservicespb.CreateServiceLbPolicyRequest, opts ...gax.CallOption) (*CreateServiceLbPolicyOperation, error) {
2676 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2677
2678 hds = append(c.xGoogHeaders, hds...)
2679 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2680 opts = append((*c.CallOptions).CreateServiceLbPolicy[0:len((*c.CallOptions).CreateServiceLbPolicy):len((*c.CallOptions).CreateServiceLbPolicy)], opts...)
2681 var resp *longrunningpb.Operation
2682 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2683 var err error
2684 resp, err = executeRPC(ctx, c.client.CreateServiceLbPolicy, req, settings.GRPC, c.logger, "CreateServiceLbPolicy")
2685 return err
2686 }, opts...)
2687 if err != nil {
2688 return nil, err
2689 }
2690 return &CreateServiceLbPolicyOperation{
2691 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2692 }, nil
2693 }
2694
2695 func (c *gRPCClient) UpdateServiceLbPolicy(ctx context.Context, req *networkservicespb.UpdateServiceLbPolicyRequest, opts ...gax.CallOption) (*UpdateServiceLbPolicyOperation, error) {
2696 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "service_lb_policy.name", url.QueryEscape(req.GetServiceLbPolicy().GetName()))}
2697
2698 hds = append(c.xGoogHeaders, hds...)
2699 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2700 opts = append((*c.CallOptions).UpdateServiceLbPolicy[0:len((*c.CallOptions).UpdateServiceLbPolicy):len((*c.CallOptions).UpdateServiceLbPolicy)], opts...)
2701 var resp *longrunningpb.Operation
2702 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2703 var err error
2704 resp, err = executeRPC(ctx, c.client.UpdateServiceLbPolicy, req, settings.GRPC, c.logger, "UpdateServiceLbPolicy")
2705 return err
2706 }, opts...)
2707 if err != nil {
2708 return nil, err
2709 }
2710 return &UpdateServiceLbPolicyOperation{
2711 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2712 }, nil
2713 }
2714
2715 func (c *gRPCClient) DeleteServiceLbPolicy(ctx context.Context, req *networkservicespb.DeleteServiceLbPolicyRequest, opts ...gax.CallOption) (*DeleteServiceLbPolicyOperation, error) {
2716 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2717
2718 hds = append(c.xGoogHeaders, hds...)
2719 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2720 opts = append((*c.CallOptions).DeleteServiceLbPolicy[0:len((*c.CallOptions).DeleteServiceLbPolicy):len((*c.CallOptions).DeleteServiceLbPolicy)], opts...)
2721 var resp *longrunningpb.Operation
2722 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2723 var err error
2724 resp, err = executeRPC(ctx, c.client.DeleteServiceLbPolicy, req, settings.GRPC, c.logger, "DeleteServiceLbPolicy")
2725 return err
2726 }, opts...)
2727 if err != nil {
2728 return nil, err
2729 }
2730 return &DeleteServiceLbPolicyOperation{
2731 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2732 }, nil
2733 }
2734
2735 func (c *gRPCClient) GetGatewayRouteView(ctx context.Context, req *networkservicespb.GetGatewayRouteViewRequest, opts ...gax.CallOption) (*networkservicespb.GatewayRouteView, error) {
2736 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2737
2738 hds = append(c.xGoogHeaders, hds...)
2739 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2740 opts = append((*c.CallOptions).GetGatewayRouteView[0:len((*c.CallOptions).GetGatewayRouteView):len((*c.CallOptions).GetGatewayRouteView)], opts...)
2741 var resp *networkservicespb.GatewayRouteView
2742 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2743 var err error
2744 resp, err = executeRPC(ctx, c.client.GetGatewayRouteView, req, settings.GRPC, c.logger, "GetGatewayRouteView")
2745 return err
2746 }, opts...)
2747 if err != nil {
2748 return nil, err
2749 }
2750 return resp, nil
2751 }
2752
2753 func (c *gRPCClient) GetMeshRouteView(ctx context.Context, req *networkservicespb.GetMeshRouteViewRequest, opts ...gax.CallOption) (*networkservicespb.MeshRouteView, error) {
2754 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2755
2756 hds = append(c.xGoogHeaders, hds...)
2757 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2758 opts = append((*c.CallOptions).GetMeshRouteView[0:len((*c.CallOptions).GetMeshRouteView):len((*c.CallOptions).GetMeshRouteView)], opts...)
2759 var resp *networkservicespb.MeshRouteView
2760 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2761 var err error
2762 resp, err = executeRPC(ctx, c.client.GetMeshRouteView, req, settings.GRPC, c.logger, "GetMeshRouteView")
2763 return err
2764 }, opts...)
2765 if err != nil {
2766 return nil, err
2767 }
2768 return resp, nil
2769 }
2770
2771 func (c *gRPCClient) ListGatewayRouteViews(ctx context.Context, req *networkservicespb.ListGatewayRouteViewsRequest, opts ...gax.CallOption) *GatewayRouteViewIterator {
2772 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2773
2774 hds = append(c.xGoogHeaders, hds...)
2775 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2776 opts = append((*c.CallOptions).ListGatewayRouteViews[0:len((*c.CallOptions).ListGatewayRouteViews):len((*c.CallOptions).ListGatewayRouteViews)], opts...)
2777 it := &GatewayRouteViewIterator{}
2778 req = proto.Clone(req).(*networkservicespb.ListGatewayRouteViewsRequest)
2779 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.GatewayRouteView, string, error) {
2780 resp := &networkservicespb.ListGatewayRouteViewsResponse{}
2781 if pageToken != "" {
2782 req.PageToken = pageToken
2783 }
2784 if pageSize > math.MaxInt32 {
2785 req.PageSize = math.MaxInt32
2786 } else if pageSize != 0 {
2787 req.PageSize = int32(pageSize)
2788 }
2789 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2790 var err error
2791 resp, err = executeRPC(ctx, c.client.ListGatewayRouteViews, req, settings.GRPC, c.logger, "ListGatewayRouteViews")
2792 return err
2793 }, opts...)
2794 if err != nil {
2795 return nil, "", err
2796 }
2797
2798 it.Response = resp
2799 return resp.GetGatewayRouteViews(), resp.GetNextPageToken(), nil
2800 }
2801 fetch := func(pageSize int, pageToken string) (string, error) {
2802 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2803 if err != nil {
2804 return "", err
2805 }
2806 it.items = append(it.items, items...)
2807 return nextPageToken, nil
2808 }
2809
2810 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2811 it.pageInfo.MaxSize = int(req.GetPageSize())
2812 it.pageInfo.Token = req.GetPageToken()
2813
2814 return it
2815 }
2816
2817 func (c *gRPCClient) ListMeshRouteViews(ctx context.Context, req *networkservicespb.ListMeshRouteViewsRequest, opts ...gax.CallOption) *MeshRouteViewIterator {
2818 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2819
2820 hds = append(c.xGoogHeaders, hds...)
2821 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2822 opts = append((*c.CallOptions).ListMeshRouteViews[0:len((*c.CallOptions).ListMeshRouteViews):len((*c.CallOptions).ListMeshRouteViews)], opts...)
2823 it := &MeshRouteViewIterator{}
2824 req = proto.Clone(req).(*networkservicespb.ListMeshRouteViewsRequest)
2825 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.MeshRouteView, string, error) {
2826 resp := &networkservicespb.ListMeshRouteViewsResponse{}
2827 if pageToken != "" {
2828 req.PageToken = pageToken
2829 }
2830 if pageSize > math.MaxInt32 {
2831 req.PageSize = math.MaxInt32
2832 } else if pageSize != 0 {
2833 req.PageSize = int32(pageSize)
2834 }
2835 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2836 var err error
2837 resp, err = executeRPC(ctx, c.client.ListMeshRouteViews, req, settings.GRPC, c.logger, "ListMeshRouteViews")
2838 return err
2839 }, opts...)
2840 if err != nil {
2841 return nil, "", err
2842 }
2843
2844 it.Response = resp
2845 return resp.GetMeshRouteViews(), resp.GetNextPageToken(), nil
2846 }
2847 fetch := func(pageSize int, pageToken string) (string, error) {
2848 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2849 if err != nil {
2850 return "", err
2851 }
2852 it.items = append(it.items, items...)
2853 return nextPageToken, nil
2854 }
2855
2856 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2857 it.pageInfo.MaxSize = int(req.GetPageSize())
2858 it.pageInfo.Token = req.GetPageToken()
2859
2860 return it
2861 }
2862
2863 func (c *gRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
2864 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2865
2866 hds = append(c.xGoogHeaders, hds...)
2867 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2868 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
2869 var resp *locationpb.Location
2870 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2871 var err error
2872 resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation")
2873 return err
2874 }, opts...)
2875 if err != nil {
2876 return nil, err
2877 }
2878 return resp, nil
2879 }
2880
2881 func (c *gRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
2882 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2883
2884 hds = append(c.xGoogHeaders, hds...)
2885 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2886 opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...)
2887 it := &LocationIterator{}
2888 req = proto.Clone(req).(*locationpb.ListLocationsRequest)
2889 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
2890 resp := &locationpb.ListLocationsResponse{}
2891 if pageToken != "" {
2892 req.PageToken = pageToken
2893 }
2894 if pageSize > math.MaxInt32 {
2895 req.PageSize = math.MaxInt32
2896 } else if pageSize != 0 {
2897 req.PageSize = int32(pageSize)
2898 }
2899 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2900 var err error
2901 resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations")
2902 return err
2903 }, opts...)
2904 if err != nil {
2905 return nil, "", err
2906 }
2907
2908 it.Response = resp
2909 return resp.GetLocations(), resp.GetNextPageToken(), nil
2910 }
2911 fetch := func(pageSize int, pageToken string) (string, error) {
2912 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2913 if err != nil {
2914 return "", err
2915 }
2916 it.items = append(it.items, items...)
2917 return nextPageToken, nil
2918 }
2919
2920 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2921 it.pageInfo.MaxSize = int(req.GetPageSize())
2922 it.pageInfo.Token = req.GetPageToken()
2923
2924 return it
2925 }
2926
2927 func (c *gRPCClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
2928 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
2929
2930 hds = append(c.xGoogHeaders, hds...)
2931 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2932 opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
2933 var resp *iampb.Policy
2934 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2935 var err error
2936 resp, err = executeRPC(ctx, c.iamPolicyClient.GetIamPolicy, req, settings.GRPC, c.logger, "GetIamPolicy")
2937 return err
2938 }, opts...)
2939 if err != nil {
2940 return nil, err
2941 }
2942 return resp, nil
2943 }
2944
2945 func (c *gRPCClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
2946 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
2947
2948 hds = append(c.xGoogHeaders, hds...)
2949 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2950 opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
2951 var resp *iampb.Policy
2952 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2953 var err error
2954 resp, err = executeRPC(ctx, c.iamPolicyClient.SetIamPolicy, req, settings.GRPC, c.logger, "SetIamPolicy")
2955 return err
2956 }, opts...)
2957 if err != nil {
2958 return nil, err
2959 }
2960 return resp, nil
2961 }
2962
2963 func (c *gRPCClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
2964 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
2965
2966 hds = append(c.xGoogHeaders, hds...)
2967 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2968 opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...)
2969 var resp *iampb.TestIamPermissionsResponse
2970 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2971 var err error
2972 resp, err = executeRPC(ctx, c.iamPolicyClient.TestIamPermissions, req, settings.GRPC, c.logger, "TestIamPermissions")
2973 return err
2974 }, opts...)
2975 if err != nil {
2976 return nil, err
2977 }
2978 return resp, nil
2979 }
2980
2981 func (c *gRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
2982 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2983
2984 hds = append(c.xGoogHeaders, hds...)
2985 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
2986 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
2987 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2988 var err error
2989 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
2990 return err
2991 }, opts...)
2992 return err
2993 }
2994
2995 func (c *gRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
2996 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2997
2998 hds = append(c.xGoogHeaders, hds...)
2999 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
3000 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
3001 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3002 var err error
3003 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
3004 return err
3005 }, opts...)
3006 return err
3007 }
3008
3009 func (c *gRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
3010 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3011
3012 hds = append(c.xGoogHeaders, hds...)
3013 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
3014 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
3015 var resp *longrunningpb.Operation
3016 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3017 var err error
3018 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
3019 return err
3020 }, opts...)
3021 if err != nil {
3022 return nil, err
3023 }
3024 return resp, nil
3025 }
3026
3027 func (c *gRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
3028 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3029
3030 hds = append(c.xGoogHeaders, hds...)
3031 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
3032 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
3033 it := &OperationIterator{}
3034 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
3035 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
3036 resp := &longrunningpb.ListOperationsResponse{}
3037 if pageToken != "" {
3038 req.PageToken = pageToken
3039 }
3040 if pageSize > math.MaxInt32 {
3041 req.PageSize = math.MaxInt32
3042 } else if pageSize != 0 {
3043 req.PageSize = int32(pageSize)
3044 }
3045 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3046 var err error
3047 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
3048 return err
3049 }, opts...)
3050 if err != nil {
3051 return nil, "", err
3052 }
3053
3054 it.Response = resp
3055 return resp.GetOperations(), resp.GetNextPageToken(), nil
3056 }
3057 fetch := func(pageSize int, pageToken string) (string, error) {
3058 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3059 if err != nil {
3060 return "", err
3061 }
3062 it.items = append(it.items, items...)
3063 return nextPageToken, nil
3064 }
3065
3066 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3067 it.pageInfo.MaxSize = int(req.GetPageSize())
3068 it.pageInfo.Token = req.GetPageToken()
3069
3070 return it
3071 }
3072
3073 // ListEndpointPolicies lists EndpointPolicies in a given project and location.
3074 func (c *restClient) ListEndpointPolicies(ctx context.Context, req *networkservicespb.ListEndpointPoliciesRequest, opts ...gax.CallOption) *EndpointPolicyIterator {
3075 it := &EndpointPolicyIterator{}
3076 req = proto.Clone(req).(*networkservicespb.ListEndpointPoliciesRequest)
3077 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3078 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.EndpointPolicy, string, error) {
3079 resp := &networkservicespb.ListEndpointPoliciesResponse{}
3080 if pageToken != "" {
3081 req.PageToken = pageToken
3082 }
3083 if pageSize > math.MaxInt32 {
3084 req.PageSize = math.MaxInt32
3085 } else if pageSize != 0 {
3086 req.PageSize = int32(pageSize)
3087 }
3088 baseUrl, err := url.Parse(c.endpoint)
3089 if err != nil {
3090 return nil, "", err
3091 }
3092 baseUrl.Path += fmt.Sprintf("/v1/%v/endpointPolicies", req.GetParent())
3093
3094 params := url.Values{}
3095 params.Add("$alt", "json;enum-encoding=int")
3096 if req.GetPageSize() != 0 {
3097 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3098 }
3099 if req.GetPageToken() != "" {
3100 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3101 }
3102 if req.GetReturnPartialSuccess() {
3103 params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
3104 }
3105
3106 baseUrl.RawQuery = params.Encode()
3107
3108 // Build HTTP headers from client and context metadata.
3109 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3110 headers := gax.BuildHeaders(ctx, hds...)
3111 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3112 if settings.Path != "" {
3113 baseUrl.Path = settings.Path
3114 }
3115 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3116 if err != nil {
3117 return err
3118 }
3119 httpReq.Header = headers
3120
3121 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListEndpointPolicies")
3122 if err != nil {
3123 return err
3124 }
3125 if err := unm.Unmarshal(buf, resp); err != nil {
3126 return err
3127 }
3128
3129 return nil
3130 }, opts...)
3131 if e != nil {
3132 return nil, "", e
3133 }
3134 it.Response = resp
3135 return resp.GetEndpointPolicies(), resp.GetNextPageToken(), nil
3136 }
3137
3138 fetch := func(pageSize int, pageToken string) (string, error) {
3139 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3140 if err != nil {
3141 return "", err
3142 }
3143 it.items = append(it.items, items...)
3144 return nextPageToken, nil
3145 }
3146
3147 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3148 it.pageInfo.MaxSize = int(req.GetPageSize())
3149 it.pageInfo.Token = req.GetPageToken()
3150
3151 return it
3152 }
3153
3154 // GetEndpointPolicy gets details of a single EndpointPolicy.
3155 func (c *restClient) GetEndpointPolicy(ctx context.Context, req *networkservicespb.GetEndpointPolicyRequest, opts ...gax.CallOption) (*networkservicespb.EndpointPolicy, error) {
3156 baseUrl, err := url.Parse(c.endpoint)
3157 if err != nil {
3158 return nil, err
3159 }
3160 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3161
3162 params := url.Values{}
3163 params.Add("$alt", "json;enum-encoding=int")
3164
3165 baseUrl.RawQuery = params.Encode()
3166
3167 // Build HTTP headers from client and context metadata.
3168 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3169
3170 hds = append(c.xGoogHeaders, hds...)
3171 hds = append(hds, "Content-Type", "application/json")
3172 headers := gax.BuildHeaders(ctx, hds...)
3173 opts = append((*c.CallOptions).GetEndpointPolicy[0:len((*c.CallOptions).GetEndpointPolicy):len((*c.CallOptions).GetEndpointPolicy)], opts...)
3174 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3175 resp := &networkservicespb.EndpointPolicy{}
3176 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3177 if settings.Path != "" {
3178 baseUrl.Path = settings.Path
3179 }
3180 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3181 if err != nil {
3182 return err
3183 }
3184 httpReq = httpReq.WithContext(ctx)
3185 httpReq.Header = headers
3186
3187 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetEndpointPolicy")
3188 if err != nil {
3189 return err
3190 }
3191
3192 if err := unm.Unmarshal(buf, resp); err != nil {
3193 return err
3194 }
3195
3196 return nil
3197 }, opts...)
3198 if e != nil {
3199 return nil, e
3200 }
3201 return resp, nil
3202 }
3203
3204 // CreateEndpointPolicy creates a new EndpointPolicy in a given project and location.
3205 func (c *restClient) CreateEndpointPolicy(ctx context.Context, req *networkservicespb.CreateEndpointPolicyRequest, opts ...gax.CallOption) (*CreateEndpointPolicyOperation, error) {
3206 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3207 body := req.GetEndpointPolicy()
3208 jsonReq, err := m.Marshal(body)
3209 if err != nil {
3210 return nil, err
3211 }
3212
3213 baseUrl, err := url.Parse(c.endpoint)
3214 if err != nil {
3215 return nil, err
3216 }
3217 baseUrl.Path += fmt.Sprintf("/v1/%v/endpointPolicies", req.GetParent())
3218
3219 params := url.Values{}
3220 params.Add("$alt", "json;enum-encoding=int")
3221 params.Add("endpointPolicyId", fmt.Sprintf("%v", req.GetEndpointPolicyId()))
3222
3223 baseUrl.RawQuery = params.Encode()
3224
3225 // Build HTTP headers from client and context metadata.
3226 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
3227
3228 hds = append(c.xGoogHeaders, hds...)
3229 hds = append(hds, "Content-Type", "application/json")
3230 headers := gax.BuildHeaders(ctx, hds...)
3231 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3232 resp := &longrunningpb.Operation{}
3233 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3234 if settings.Path != "" {
3235 baseUrl.Path = settings.Path
3236 }
3237 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3238 if err != nil {
3239 return err
3240 }
3241 httpReq = httpReq.WithContext(ctx)
3242 httpReq.Header = headers
3243
3244 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateEndpointPolicy")
3245 if err != nil {
3246 return err
3247 }
3248 if err := unm.Unmarshal(buf, resp); err != nil {
3249 return err
3250 }
3251
3252 return nil
3253 }, opts...)
3254 if e != nil {
3255 return nil, e
3256 }
3257
3258 override := fmt.Sprintf("/v1/%s", resp.GetName())
3259 return &CreateEndpointPolicyOperation{
3260 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3261 pollPath: override,
3262 }, nil
3263 }
3264
3265 // UpdateEndpointPolicy updates the parameters of a single EndpointPolicy.
3266 func (c *restClient) UpdateEndpointPolicy(ctx context.Context, req *networkservicespb.UpdateEndpointPolicyRequest, opts ...gax.CallOption) (*UpdateEndpointPolicyOperation, error) {
3267 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3268 body := req.GetEndpointPolicy()
3269 jsonReq, err := m.Marshal(body)
3270 if err != nil {
3271 return nil, err
3272 }
3273
3274 baseUrl, err := url.Parse(c.endpoint)
3275 if err != nil {
3276 return nil, err
3277 }
3278 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetEndpointPolicy().GetName())
3279
3280 params := url.Values{}
3281 params.Add("$alt", "json;enum-encoding=int")
3282 if req.GetUpdateMask() != nil {
3283 field, err := protojson.Marshal(req.GetUpdateMask())
3284 if err != nil {
3285 return nil, err
3286 }
3287 params.Add("updateMask", string(field[1:len(field)-1]))
3288 }
3289
3290 baseUrl.RawQuery = params.Encode()
3291
3292 // Build HTTP headers from client and context metadata.
3293 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "endpoint_policy.name", url.QueryEscape(req.GetEndpointPolicy().GetName()))}
3294
3295 hds = append(c.xGoogHeaders, hds...)
3296 hds = append(hds, "Content-Type", "application/json")
3297 headers := gax.BuildHeaders(ctx, hds...)
3298 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3299 resp := &longrunningpb.Operation{}
3300 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3301 if settings.Path != "" {
3302 baseUrl.Path = settings.Path
3303 }
3304 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
3305 if err != nil {
3306 return err
3307 }
3308 httpReq = httpReq.WithContext(ctx)
3309 httpReq.Header = headers
3310
3311 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateEndpointPolicy")
3312 if err != nil {
3313 return err
3314 }
3315 if err := unm.Unmarshal(buf, resp); err != nil {
3316 return err
3317 }
3318
3319 return nil
3320 }, opts...)
3321 if e != nil {
3322 return nil, e
3323 }
3324
3325 override := fmt.Sprintf("/v1/%s", resp.GetName())
3326 return &UpdateEndpointPolicyOperation{
3327 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3328 pollPath: override,
3329 }, nil
3330 }
3331
3332 // DeleteEndpointPolicy deletes a single EndpointPolicy.
3333 func (c *restClient) DeleteEndpointPolicy(ctx context.Context, req *networkservicespb.DeleteEndpointPolicyRequest, opts ...gax.CallOption) (*DeleteEndpointPolicyOperation, error) {
3334 baseUrl, err := url.Parse(c.endpoint)
3335 if err != nil {
3336 return nil, err
3337 }
3338 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3339
3340 params := url.Values{}
3341 params.Add("$alt", "json;enum-encoding=int")
3342
3343 baseUrl.RawQuery = params.Encode()
3344
3345 // Build HTTP headers from client and context metadata.
3346 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3347
3348 hds = append(c.xGoogHeaders, hds...)
3349 hds = append(hds, "Content-Type", "application/json")
3350 headers := gax.BuildHeaders(ctx, hds...)
3351 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3352 resp := &longrunningpb.Operation{}
3353 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3354 if settings.Path != "" {
3355 baseUrl.Path = settings.Path
3356 }
3357 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
3358 if err != nil {
3359 return err
3360 }
3361 httpReq = httpReq.WithContext(ctx)
3362 httpReq.Header = headers
3363
3364 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteEndpointPolicy")
3365 if err != nil {
3366 return err
3367 }
3368 if err := unm.Unmarshal(buf, resp); err != nil {
3369 return err
3370 }
3371
3372 return nil
3373 }, opts...)
3374 if e != nil {
3375 return nil, e
3376 }
3377
3378 override := fmt.Sprintf("/v1/%s", resp.GetName())
3379 return &DeleteEndpointPolicyOperation{
3380 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3381 pollPath: override,
3382 }, nil
3383 }
3384
3385 // ListWasmPluginVersions lists WasmPluginVersion resources in a given project and
3386 // location.
3387 func (c *restClient) ListWasmPluginVersions(ctx context.Context, req *networkservicespb.ListWasmPluginVersionsRequest, opts ...gax.CallOption) *WasmPluginVersionIterator {
3388 it := &WasmPluginVersionIterator{}
3389 req = proto.Clone(req).(*networkservicespb.ListWasmPluginVersionsRequest)
3390 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3391 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.WasmPluginVersion, string, error) {
3392 resp := &networkservicespb.ListWasmPluginVersionsResponse{}
3393 if pageToken != "" {
3394 req.PageToken = pageToken
3395 }
3396 if pageSize > math.MaxInt32 {
3397 req.PageSize = math.MaxInt32
3398 } else if pageSize != 0 {
3399 req.PageSize = int32(pageSize)
3400 }
3401 baseUrl, err := url.Parse(c.endpoint)
3402 if err != nil {
3403 return nil, "", err
3404 }
3405 baseUrl.Path += fmt.Sprintf("/v1/%v/versions", req.GetParent())
3406
3407 params := url.Values{}
3408 params.Add("$alt", "json;enum-encoding=int")
3409 if req.GetPageSize() != 0 {
3410 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3411 }
3412 if req.GetPageToken() != "" {
3413 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3414 }
3415
3416 baseUrl.RawQuery = params.Encode()
3417
3418 // Build HTTP headers from client and context metadata.
3419 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3420 headers := gax.BuildHeaders(ctx, hds...)
3421 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3422 if settings.Path != "" {
3423 baseUrl.Path = settings.Path
3424 }
3425 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3426 if err != nil {
3427 return err
3428 }
3429 httpReq.Header = headers
3430
3431 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListWasmPluginVersions")
3432 if err != nil {
3433 return err
3434 }
3435 if err := unm.Unmarshal(buf, resp); err != nil {
3436 return err
3437 }
3438
3439 return nil
3440 }, opts...)
3441 if e != nil {
3442 return nil, "", e
3443 }
3444 it.Response = resp
3445 return resp.GetWasmPluginVersions(), resp.GetNextPageToken(), nil
3446 }
3447
3448 fetch := func(pageSize int, pageToken string) (string, error) {
3449 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3450 if err != nil {
3451 return "", err
3452 }
3453 it.items = append(it.items, items...)
3454 return nextPageToken, nil
3455 }
3456
3457 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3458 it.pageInfo.MaxSize = int(req.GetPageSize())
3459 it.pageInfo.Token = req.GetPageToken()
3460
3461 return it
3462 }
3463
3464 // GetWasmPluginVersion gets details of the specified WasmPluginVersion resource.
3465 func (c *restClient) GetWasmPluginVersion(ctx context.Context, req *networkservicespb.GetWasmPluginVersionRequest, opts ...gax.CallOption) (*networkservicespb.WasmPluginVersion, error) {
3466 baseUrl, err := url.Parse(c.endpoint)
3467 if err != nil {
3468 return nil, err
3469 }
3470 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3471
3472 params := url.Values{}
3473 params.Add("$alt", "json;enum-encoding=int")
3474
3475 baseUrl.RawQuery = params.Encode()
3476
3477 // Build HTTP headers from client and context metadata.
3478 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3479
3480 hds = append(c.xGoogHeaders, hds...)
3481 hds = append(hds, "Content-Type", "application/json")
3482 headers := gax.BuildHeaders(ctx, hds...)
3483 opts = append((*c.CallOptions).GetWasmPluginVersion[0:len((*c.CallOptions).GetWasmPluginVersion):len((*c.CallOptions).GetWasmPluginVersion)], opts...)
3484 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3485 resp := &networkservicespb.WasmPluginVersion{}
3486 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3487 if settings.Path != "" {
3488 baseUrl.Path = settings.Path
3489 }
3490 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3491 if err != nil {
3492 return err
3493 }
3494 httpReq = httpReq.WithContext(ctx)
3495 httpReq.Header = headers
3496
3497 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetWasmPluginVersion")
3498 if err != nil {
3499 return err
3500 }
3501
3502 if err := unm.Unmarshal(buf, resp); err != nil {
3503 return err
3504 }
3505
3506 return nil
3507 }, opts...)
3508 if e != nil {
3509 return nil, e
3510 }
3511 return resp, nil
3512 }
3513
3514 // CreateWasmPluginVersion creates a new WasmPluginVersion resource in a given project
3515 // and location.
3516 func (c *restClient) CreateWasmPluginVersion(ctx context.Context, req *networkservicespb.CreateWasmPluginVersionRequest, opts ...gax.CallOption) (*CreateWasmPluginVersionOperation, error) {
3517 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3518 body := req.GetWasmPluginVersion()
3519 jsonReq, err := m.Marshal(body)
3520 if err != nil {
3521 return nil, err
3522 }
3523
3524 baseUrl, err := url.Parse(c.endpoint)
3525 if err != nil {
3526 return nil, err
3527 }
3528 baseUrl.Path += fmt.Sprintf("/v1/%v/versions", req.GetParent())
3529
3530 params := url.Values{}
3531 params.Add("$alt", "json;enum-encoding=int")
3532 params.Add("wasmPluginVersionId", fmt.Sprintf("%v", req.GetWasmPluginVersionId()))
3533
3534 baseUrl.RawQuery = params.Encode()
3535
3536 // Build HTTP headers from client and context metadata.
3537 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
3538
3539 hds = append(c.xGoogHeaders, hds...)
3540 hds = append(hds, "Content-Type", "application/json")
3541 headers := gax.BuildHeaders(ctx, hds...)
3542 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3543 resp := &longrunningpb.Operation{}
3544 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3545 if settings.Path != "" {
3546 baseUrl.Path = settings.Path
3547 }
3548 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3549 if err != nil {
3550 return err
3551 }
3552 httpReq = httpReq.WithContext(ctx)
3553 httpReq.Header = headers
3554
3555 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateWasmPluginVersion")
3556 if err != nil {
3557 return err
3558 }
3559 if err := unm.Unmarshal(buf, resp); err != nil {
3560 return err
3561 }
3562
3563 return nil
3564 }, opts...)
3565 if e != nil {
3566 return nil, e
3567 }
3568
3569 override := fmt.Sprintf("/v1/%s", resp.GetName())
3570 return &CreateWasmPluginVersionOperation{
3571 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3572 pollPath: override,
3573 }, nil
3574 }
3575
3576 // DeleteWasmPluginVersion deletes the specified WasmPluginVersion resource.
3577 func (c *restClient) DeleteWasmPluginVersion(ctx context.Context, req *networkservicespb.DeleteWasmPluginVersionRequest, opts ...gax.CallOption) (*DeleteWasmPluginVersionOperation, error) {
3578 baseUrl, err := url.Parse(c.endpoint)
3579 if err != nil {
3580 return nil, err
3581 }
3582 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3583
3584 params := url.Values{}
3585 params.Add("$alt", "json;enum-encoding=int")
3586
3587 baseUrl.RawQuery = params.Encode()
3588
3589 // Build HTTP headers from client and context metadata.
3590 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3591
3592 hds = append(c.xGoogHeaders, hds...)
3593 hds = append(hds, "Content-Type", "application/json")
3594 headers := gax.BuildHeaders(ctx, hds...)
3595 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3596 resp := &longrunningpb.Operation{}
3597 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3598 if settings.Path != "" {
3599 baseUrl.Path = settings.Path
3600 }
3601 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
3602 if err != nil {
3603 return err
3604 }
3605 httpReq = httpReq.WithContext(ctx)
3606 httpReq.Header = headers
3607
3608 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteWasmPluginVersion")
3609 if err != nil {
3610 return err
3611 }
3612 if err := unm.Unmarshal(buf, resp); err != nil {
3613 return err
3614 }
3615
3616 return nil
3617 }, opts...)
3618 if e != nil {
3619 return nil, e
3620 }
3621
3622 override := fmt.Sprintf("/v1/%s", resp.GetName())
3623 return &DeleteWasmPluginVersionOperation{
3624 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3625 pollPath: override,
3626 }, nil
3627 }
3628
3629 // ListWasmPlugins lists WasmPlugin resources in a given project and
3630 // location.
3631 func (c *restClient) ListWasmPlugins(ctx context.Context, req *networkservicespb.ListWasmPluginsRequest, opts ...gax.CallOption) *WasmPluginIterator {
3632 it := &WasmPluginIterator{}
3633 req = proto.Clone(req).(*networkservicespb.ListWasmPluginsRequest)
3634 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3635 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.WasmPlugin, string, error) {
3636 resp := &networkservicespb.ListWasmPluginsResponse{}
3637 if pageToken != "" {
3638 req.PageToken = pageToken
3639 }
3640 if pageSize > math.MaxInt32 {
3641 req.PageSize = math.MaxInt32
3642 } else if pageSize != 0 {
3643 req.PageSize = int32(pageSize)
3644 }
3645 baseUrl, err := url.Parse(c.endpoint)
3646 if err != nil {
3647 return nil, "", err
3648 }
3649 baseUrl.Path += fmt.Sprintf("/v1/%v/wasmPlugins", req.GetParent())
3650
3651 params := url.Values{}
3652 params.Add("$alt", "json;enum-encoding=int")
3653 if req.GetPageSize() != 0 {
3654 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3655 }
3656 if req.GetPageToken() != "" {
3657 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3658 }
3659
3660 baseUrl.RawQuery = params.Encode()
3661
3662 // Build HTTP headers from client and context metadata.
3663 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3664 headers := gax.BuildHeaders(ctx, hds...)
3665 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3666 if settings.Path != "" {
3667 baseUrl.Path = settings.Path
3668 }
3669 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3670 if err != nil {
3671 return err
3672 }
3673 httpReq.Header = headers
3674
3675 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListWasmPlugins")
3676 if err != nil {
3677 return err
3678 }
3679 if err := unm.Unmarshal(buf, resp); err != nil {
3680 return err
3681 }
3682
3683 return nil
3684 }, opts...)
3685 if e != nil {
3686 return nil, "", e
3687 }
3688 it.Response = resp
3689 return resp.GetWasmPlugins(), resp.GetNextPageToken(), nil
3690 }
3691
3692 fetch := func(pageSize int, pageToken string) (string, error) {
3693 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3694 if err != nil {
3695 return "", err
3696 }
3697 it.items = append(it.items, items...)
3698 return nextPageToken, nil
3699 }
3700
3701 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3702 it.pageInfo.MaxSize = int(req.GetPageSize())
3703 it.pageInfo.Token = req.GetPageToken()
3704
3705 return it
3706 }
3707
3708 // GetWasmPlugin gets details of the specified WasmPlugin resource.
3709 func (c *restClient) GetWasmPlugin(ctx context.Context, req *networkservicespb.GetWasmPluginRequest, opts ...gax.CallOption) (*networkservicespb.WasmPlugin, error) {
3710 baseUrl, err := url.Parse(c.endpoint)
3711 if err != nil {
3712 return nil, err
3713 }
3714 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3715
3716 params := url.Values{}
3717 params.Add("$alt", "json;enum-encoding=int")
3718 if req.GetView() != 0 {
3719 params.Add("view", fmt.Sprintf("%v", req.GetView()))
3720 }
3721
3722 baseUrl.RawQuery = params.Encode()
3723
3724 // Build HTTP headers from client and context metadata.
3725 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3726
3727 hds = append(c.xGoogHeaders, hds...)
3728 hds = append(hds, "Content-Type", "application/json")
3729 headers := gax.BuildHeaders(ctx, hds...)
3730 opts = append((*c.CallOptions).GetWasmPlugin[0:len((*c.CallOptions).GetWasmPlugin):len((*c.CallOptions).GetWasmPlugin)], opts...)
3731 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3732 resp := &networkservicespb.WasmPlugin{}
3733 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3734 if settings.Path != "" {
3735 baseUrl.Path = settings.Path
3736 }
3737 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3738 if err != nil {
3739 return err
3740 }
3741 httpReq = httpReq.WithContext(ctx)
3742 httpReq.Header = headers
3743
3744 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetWasmPlugin")
3745 if err != nil {
3746 return err
3747 }
3748
3749 if err := unm.Unmarshal(buf, resp); err != nil {
3750 return err
3751 }
3752
3753 return nil
3754 }, opts...)
3755 if e != nil {
3756 return nil, e
3757 }
3758 return resp, nil
3759 }
3760
3761 // CreateWasmPlugin creates a new WasmPlugin resource in a given project
3762 // and location.
3763 func (c *restClient) CreateWasmPlugin(ctx context.Context, req *networkservicespb.CreateWasmPluginRequest, opts ...gax.CallOption) (*CreateWasmPluginOperation, error) {
3764 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3765 body := req.GetWasmPlugin()
3766 jsonReq, err := m.Marshal(body)
3767 if err != nil {
3768 return nil, err
3769 }
3770
3771 baseUrl, err := url.Parse(c.endpoint)
3772 if err != nil {
3773 return nil, err
3774 }
3775 baseUrl.Path += fmt.Sprintf("/v1/%v/wasmPlugins", req.GetParent())
3776
3777 params := url.Values{}
3778 params.Add("$alt", "json;enum-encoding=int")
3779 params.Add("wasmPluginId", fmt.Sprintf("%v", req.GetWasmPluginId()))
3780
3781 baseUrl.RawQuery = params.Encode()
3782
3783 // Build HTTP headers from client and context metadata.
3784 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
3785
3786 hds = append(c.xGoogHeaders, hds...)
3787 hds = append(hds, "Content-Type", "application/json")
3788 headers := gax.BuildHeaders(ctx, hds...)
3789 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3790 resp := &longrunningpb.Operation{}
3791 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3792 if settings.Path != "" {
3793 baseUrl.Path = settings.Path
3794 }
3795 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3796 if err != nil {
3797 return err
3798 }
3799 httpReq = httpReq.WithContext(ctx)
3800 httpReq.Header = headers
3801
3802 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateWasmPlugin")
3803 if err != nil {
3804 return err
3805 }
3806 if err := unm.Unmarshal(buf, resp); err != nil {
3807 return err
3808 }
3809
3810 return nil
3811 }, opts...)
3812 if e != nil {
3813 return nil, e
3814 }
3815
3816 override := fmt.Sprintf("/v1/%s", resp.GetName())
3817 return &CreateWasmPluginOperation{
3818 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3819 pollPath: override,
3820 }, nil
3821 }
3822
3823 // UpdateWasmPlugin updates the parameters of the specified WasmPlugin resource.
3824 func (c *restClient) UpdateWasmPlugin(ctx context.Context, req *networkservicespb.UpdateWasmPluginRequest, opts ...gax.CallOption) (*UpdateWasmPluginOperation, error) {
3825 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3826 body := req.GetWasmPlugin()
3827 jsonReq, err := m.Marshal(body)
3828 if err != nil {
3829 return nil, err
3830 }
3831
3832 baseUrl, err := url.Parse(c.endpoint)
3833 if err != nil {
3834 return nil, err
3835 }
3836 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetWasmPlugin().GetName())
3837
3838 params := url.Values{}
3839 params.Add("$alt", "json;enum-encoding=int")
3840 if req.GetUpdateMask() != nil {
3841 field, err := protojson.Marshal(req.GetUpdateMask())
3842 if err != nil {
3843 return nil, err
3844 }
3845 params.Add("updateMask", string(field[1:len(field)-1]))
3846 }
3847
3848 baseUrl.RawQuery = params.Encode()
3849
3850 // Build HTTP headers from client and context metadata.
3851 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "wasm_plugin.name", url.QueryEscape(req.GetWasmPlugin().GetName()))}
3852
3853 hds = append(c.xGoogHeaders, hds...)
3854 hds = append(hds, "Content-Type", "application/json")
3855 headers := gax.BuildHeaders(ctx, hds...)
3856 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3857 resp := &longrunningpb.Operation{}
3858 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3859 if settings.Path != "" {
3860 baseUrl.Path = settings.Path
3861 }
3862 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
3863 if err != nil {
3864 return err
3865 }
3866 httpReq = httpReq.WithContext(ctx)
3867 httpReq.Header = headers
3868
3869 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateWasmPlugin")
3870 if err != nil {
3871 return err
3872 }
3873 if err := unm.Unmarshal(buf, resp); err != nil {
3874 return err
3875 }
3876
3877 return nil
3878 }, opts...)
3879 if e != nil {
3880 return nil, e
3881 }
3882
3883 override := fmt.Sprintf("/v1/%s", resp.GetName())
3884 return &UpdateWasmPluginOperation{
3885 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3886 pollPath: override,
3887 }, nil
3888 }
3889
3890 // DeleteWasmPlugin deletes the specified WasmPlugin resource.
3891 func (c *restClient) DeleteWasmPlugin(ctx context.Context, req *networkservicespb.DeleteWasmPluginRequest, opts ...gax.CallOption) (*DeleteWasmPluginOperation, error) {
3892 baseUrl, err := url.Parse(c.endpoint)
3893 if err != nil {
3894 return nil, err
3895 }
3896 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
3897
3898 params := url.Values{}
3899 params.Add("$alt", "json;enum-encoding=int")
3900
3901 baseUrl.RawQuery = params.Encode()
3902
3903 // Build HTTP headers from client and context metadata.
3904 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3905
3906 hds = append(c.xGoogHeaders, hds...)
3907 hds = append(hds, "Content-Type", "application/json")
3908 headers := gax.BuildHeaders(ctx, hds...)
3909 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3910 resp := &longrunningpb.Operation{}
3911 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3912 if settings.Path != "" {
3913 baseUrl.Path = settings.Path
3914 }
3915 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
3916 if err != nil {
3917 return err
3918 }
3919 httpReq = httpReq.WithContext(ctx)
3920 httpReq.Header = headers
3921
3922 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteWasmPlugin")
3923 if err != nil {
3924 return err
3925 }
3926 if err := unm.Unmarshal(buf, resp); err != nil {
3927 return err
3928 }
3929
3930 return nil
3931 }, opts...)
3932 if e != nil {
3933 return nil, e
3934 }
3935
3936 override := fmt.Sprintf("/v1/%s", resp.GetName())
3937 return &DeleteWasmPluginOperation{
3938 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3939 pollPath: override,
3940 }, nil
3941 }
3942
3943 // ListGateways lists Gateways in a given project and location.
3944 func (c *restClient) ListGateways(ctx context.Context, req *networkservicespb.ListGatewaysRequest, opts ...gax.CallOption) *GatewayIterator {
3945 it := &GatewayIterator{}
3946 req = proto.Clone(req).(*networkservicespb.ListGatewaysRequest)
3947 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3948 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.Gateway, string, error) {
3949 resp := &networkservicespb.ListGatewaysResponse{}
3950 if pageToken != "" {
3951 req.PageToken = pageToken
3952 }
3953 if pageSize > math.MaxInt32 {
3954 req.PageSize = math.MaxInt32
3955 } else if pageSize != 0 {
3956 req.PageSize = int32(pageSize)
3957 }
3958 baseUrl, err := url.Parse(c.endpoint)
3959 if err != nil {
3960 return nil, "", err
3961 }
3962 baseUrl.Path += fmt.Sprintf("/v1/%v/gateways", req.GetParent())
3963
3964 params := url.Values{}
3965 params.Add("$alt", "json;enum-encoding=int")
3966 if req.GetPageSize() != 0 {
3967 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3968 }
3969 if req.GetPageToken() != "" {
3970 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3971 }
3972
3973 baseUrl.RawQuery = params.Encode()
3974
3975 // Build HTTP headers from client and context metadata.
3976 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3977 headers := gax.BuildHeaders(ctx, hds...)
3978 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3979 if settings.Path != "" {
3980 baseUrl.Path = settings.Path
3981 }
3982 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3983 if err != nil {
3984 return err
3985 }
3986 httpReq.Header = headers
3987
3988 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListGateways")
3989 if err != nil {
3990 return err
3991 }
3992 if err := unm.Unmarshal(buf, resp); err != nil {
3993 return err
3994 }
3995
3996 return nil
3997 }, opts...)
3998 if e != nil {
3999 return nil, "", e
4000 }
4001 it.Response = resp
4002 return resp.GetGateways(), resp.GetNextPageToken(), nil
4003 }
4004
4005 fetch := func(pageSize int, pageToken string) (string, error) {
4006 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
4007 if err != nil {
4008 return "", err
4009 }
4010 it.items = append(it.items, items...)
4011 return nextPageToken, nil
4012 }
4013
4014 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
4015 it.pageInfo.MaxSize = int(req.GetPageSize())
4016 it.pageInfo.Token = req.GetPageToken()
4017
4018 return it
4019 }
4020
4021 // GetGateway gets details of a single Gateway.
4022 func (c *restClient) GetGateway(ctx context.Context, req *networkservicespb.GetGatewayRequest, opts ...gax.CallOption) (*networkservicespb.Gateway, error) {
4023 baseUrl, err := url.Parse(c.endpoint)
4024 if err != nil {
4025 return nil, err
4026 }
4027 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4028
4029 params := url.Values{}
4030 params.Add("$alt", "json;enum-encoding=int")
4031
4032 baseUrl.RawQuery = params.Encode()
4033
4034 // Build HTTP headers from client and context metadata.
4035 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4036
4037 hds = append(c.xGoogHeaders, hds...)
4038 hds = append(hds, "Content-Type", "application/json")
4039 headers := gax.BuildHeaders(ctx, hds...)
4040 opts = append((*c.CallOptions).GetGateway[0:len((*c.CallOptions).GetGateway):len((*c.CallOptions).GetGateway)], opts...)
4041 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4042 resp := &networkservicespb.Gateway{}
4043 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4044 if settings.Path != "" {
4045 baseUrl.Path = settings.Path
4046 }
4047 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4048 if err != nil {
4049 return err
4050 }
4051 httpReq = httpReq.WithContext(ctx)
4052 httpReq.Header = headers
4053
4054 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetGateway")
4055 if err != nil {
4056 return err
4057 }
4058
4059 if err := unm.Unmarshal(buf, resp); err != nil {
4060 return err
4061 }
4062
4063 return nil
4064 }, opts...)
4065 if e != nil {
4066 return nil, e
4067 }
4068 return resp, nil
4069 }
4070
4071 // CreateGateway creates a new Gateway in a given project and location.
4072 func (c *restClient) CreateGateway(ctx context.Context, req *networkservicespb.CreateGatewayRequest, opts ...gax.CallOption) (*CreateGatewayOperation, error) {
4073 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4074 body := req.GetGateway()
4075 jsonReq, err := m.Marshal(body)
4076 if err != nil {
4077 return nil, err
4078 }
4079
4080 baseUrl, err := url.Parse(c.endpoint)
4081 if err != nil {
4082 return nil, err
4083 }
4084 baseUrl.Path += fmt.Sprintf("/v1/%v/gateways", req.GetParent())
4085
4086 params := url.Values{}
4087 params.Add("$alt", "json;enum-encoding=int")
4088 params.Add("gatewayId", fmt.Sprintf("%v", req.GetGatewayId()))
4089
4090 baseUrl.RawQuery = params.Encode()
4091
4092 // Build HTTP headers from client and context metadata.
4093 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
4094
4095 hds = append(c.xGoogHeaders, hds...)
4096 hds = append(hds, "Content-Type", "application/json")
4097 headers := gax.BuildHeaders(ctx, hds...)
4098 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4099 resp := &longrunningpb.Operation{}
4100 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4101 if settings.Path != "" {
4102 baseUrl.Path = settings.Path
4103 }
4104 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
4105 if err != nil {
4106 return err
4107 }
4108 httpReq = httpReq.WithContext(ctx)
4109 httpReq.Header = headers
4110
4111 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateGateway")
4112 if err != nil {
4113 return err
4114 }
4115 if err := unm.Unmarshal(buf, resp); err != nil {
4116 return err
4117 }
4118
4119 return nil
4120 }, opts...)
4121 if e != nil {
4122 return nil, e
4123 }
4124
4125 override := fmt.Sprintf("/v1/%s", resp.GetName())
4126 return &CreateGatewayOperation{
4127 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4128 pollPath: override,
4129 }, nil
4130 }
4131
4132 // UpdateGateway updates the parameters of a single Gateway.
4133 func (c *restClient) UpdateGateway(ctx context.Context, req *networkservicespb.UpdateGatewayRequest, opts ...gax.CallOption) (*UpdateGatewayOperation, error) {
4134 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4135 body := req.GetGateway()
4136 jsonReq, err := m.Marshal(body)
4137 if err != nil {
4138 return nil, err
4139 }
4140
4141 baseUrl, err := url.Parse(c.endpoint)
4142 if err != nil {
4143 return nil, err
4144 }
4145 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetGateway().GetName())
4146
4147 params := url.Values{}
4148 params.Add("$alt", "json;enum-encoding=int")
4149 if req.GetUpdateMask() != nil {
4150 field, err := protojson.Marshal(req.GetUpdateMask())
4151 if err != nil {
4152 return nil, err
4153 }
4154 params.Add("updateMask", string(field[1:len(field)-1]))
4155 }
4156
4157 baseUrl.RawQuery = params.Encode()
4158
4159 // Build HTTP headers from client and context metadata.
4160 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "gateway.name", url.QueryEscape(req.GetGateway().GetName()))}
4161
4162 hds = append(c.xGoogHeaders, hds...)
4163 hds = append(hds, "Content-Type", "application/json")
4164 headers := gax.BuildHeaders(ctx, hds...)
4165 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4166 resp := &longrunningpb.Operation{}
4167 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4168 if settings.Path != "" {
4169 baseUrl.Path = settings.Path
4170 }
4171 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
4172 if err != nil {
4173 return err
4174 }
4175 httpReq = httpReq.WithContext(ctx)
4176 httpReq.Header = headers
4177
4178 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateGateway")
4179 if err != nil {
4180 return err
4181 }
4182 if err := unm.Unmarshal(buf, resp); err != nil {
4183 return err
4184 }
4185
4186 return nil
4187 }, opts...)
4188 if e != nil {
4189 return nil, e
4190 }
4191
4192 override := fmt.Sprintf("/v1/%s", resp.GetName())
4193 return &UpdateGatewayOperation{
4194 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4195 pollPath: override,
4196 }, nil
4197 }
4198
4199 // DeleteGateway deletes a single Gateway.
4200 func (c *restClient) DeleteGateway(ctx context.Context, req *networkservicespb.DeleteGatewayRequest, opts ...gax.CallOption) (*DeleteGatewayOperation, error) {
4201 baseUrl, err := url.Parse(c.endpoint)
4202 if err != nil {
4203 return nil, err
4204 }
4205 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4206
4207 params := url.Values{}
4208 params.Add("$alt", "json;enum-encoding=int")
4209
4210 baseUrl.RawQuery = params.Encode()
4211
4212 // Build HTTP headers from client and context metadata.
4213 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4214
4215 hds = append(c.xGoogHeaders, hds...)
4216 hds = append(hds, "Content-Type", "application/json")
4217 headers := gax.BuildHeaders(ctx, hds...)
4218 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4219 resp := &longrunningpb.Operation{}
4220 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4221 if settings.Path != "" {
4222 baseUrl.Path = settings.Path
4223 }
4224 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
4225 if err != nil {
4226 return err
4227 }
4228 httpReq = httpReq.WithContext(ctx)
4229 httpReq.Header = headers
4230
4231 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteGateway")
4232 if err != nil {
4233 return err
4234 }
4235 if err := unm.Unmarshal(buf, resp); err != nil {
4236 return err
4237 }
4238
4239 return nil
4240 }, opts...)
4241 if e != nil {
4242 return nil, e
4243 }
4244
4245 override := fmt.Sprintf("/v1/%s", resp.GetName())
4246 return &DeleteGatewayOperation{
4247 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4248 pollPath: override,
4249 }, nil
4250 }
4251
4252 // ListGrpcRoutes lists GrpcRoutes in a given project and location.
4253 func (c *restClient) ListGrpcRoutes(ctx context.Context, req *networkservicespb.ListGrpcRoutesRequest, opts ...gax.CallOption) *GrpcRouteIterator {
4254 it := &GrpcRouteIterator{}
4255 req = proto.Clone(req).(*networkservicespb.ListGrpcRoutesRequest)
4256 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4257 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.GrpcRoute, string, error) {
4258 resp := &networkservicespb.ListGrpcRoutesResponse{}
4259 if pageToken != "" {
4260 req.PageToken = pageToken
4261 }
4262 if pageSize > math.MaxInt32 {
4263 req.PageSize = math.MaxInt32
4264 } else if pageSize != 0 {
4265 req.PageSize = int32(pageSize)
4266 }
4267 baseUrl, err := url.Parse(c.endpoint)
4268 if err != nil {
4269 return nil, "", err
4270 }
4271 baseUrl.Path += fmt.Sprintf("/v1/%v/grpcRoutes", req.GetParent())
4272
4273 params := url.Values{}
4274 params.Add("$alt", "json;enum-encoding=int")
4275 if req.GetPageSize() != 0 {
4276 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
4277 }
4278 if req.GetPageToken() != "" {
4279 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
4280 }
4281 if req.GetReturnPartialSuccess() {
4282 params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
4283 }
4284
4285 baseUrl.RawQuery = params.Encode()
4286
4287 // Build HTTP headers from client and context metadata.
4288 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
4289 headers := gax.BuildHeaders(ctx, hds...)
4290 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4291 if settings.Path != "" {
4292 baseUrl.Path = settings.Path
4293 }
4294 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4295 if err != nil {
4296 return err
4297 }
4298 httpReq.Header = headers
4299
4300 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListGrpcRoutes")
4301 if err != nil {
4302 return err
4303 }
4304 if err := unm.Unmarshal(buf, resp); err != nil {
4305 return err
4306 }
4307
4308 return nil
4309 }, opts...)
4310 if e != nil {
4311 return nil, "", e
4312 }
4313 it.Response = resp
4314 return resp.GetGrpcRoutes(), resp.GetNextPageToken(), nil
4315 }
4316
4317 fetch := func(pageSize int, pageToken string) (string, error) {
4318 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
4319 if err != nil {
4320 return "", err
4321 }
4322 it.items = append(it.items, items...)
4323 return nextPageToken, nil
4324 }
4325
4326 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
4327 it.pageInfo.MaxSize = int(req.GetPageSize())
4328 it.pageInfo.Token = req.GetPageToken()
4329
4330 return it
4331 }
4332
4333 // GetGrpcRoute gets details of a single GrpcRoute.
4334 func (c *restClient) GetGrpcRoute(ctx context.Context, req *networkservicespb.GetGrpcRouteRequest, opts ...gax.CallOption) (*networkservicespb.GrpcRoute, error) {
4335 baseUrl, err := url.Parse(c.endpoint)
4336 if err != nil {
4337 return nil, err
4338 }
4339 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4340
4341 params := url.Values{}
4342 params.Add("$alt", "json;enum-encoding=int")
4343
4344 baseUrl.RawQuery = params.Encode()
4345
4346 // Build HTTP headers from client and context metadata.
4347 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4348
4349 hds = append(c.xGoogHeaders, hds...)
4350 hds = append(hds, "Content-Type", "application/json")
4351 headers := gax.BuildHeaders(ctx, hds...)
4352 opts = append((*c.CallOptions).GetGrpcRoute[0:len((*c.CallOptions).GetGrpcRoute):len((*c.CallOptions).GetGrpcRoute)], opts...)
4353 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4354 resp := &networkservicespb.GrpcRoute{}
4355 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4356 if settings.Path != "" {
4357 baseUrl.Path = settings.Path
4358 }
4359 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4360 if err != nil {
4361 return err
4362 }
4363 httpReq = httpReq.WithContext(ctx)
4364 httpReq.Header = headers
4365
4366 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetGrpcRoute")
4367 if err != nil {
4368 return err
4369 }
4370
4371 if err := unm.Unmarshal(buf, resp); err != nil {
4372 return err
4373 }
4374
4375 return nil
4376 }, opts...)
4377 if e != nil {
4378 return nil, e
4379 }
4380 return resp, nil
4381 }
4382
4383 // CreateGrpcRoute creates a new GrpcRoute in a given project and location.
4384 func (c *restClient) CreateGrpcRoute(ctx context.Context, req *networkservicespb.CreateGrpcRouteRequest, opts ...gax.CallOption) (*CreateGrpcRouteOperation, error) {
4385 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4386 body := req.GetGrpcRoute()
4387 jsonReq, err := m.Marshal(body)
4388 if err != nil {
4389 return nil, err
4390 }
4391
4392 baseUrl, err := url.Parse(c.endpoint)
4393 if err != nil {
4394 return nil, err
4395 }
4396 baseUrl.Path += fmt.Sprintf("/v1/%v/grpcRoutes", req.GetParent())
4397
4398 params := url.Values{}
4399 params.Add("$alt", "json;enum-encoding=int")
4400 params.Add("grpcRouteId", fmt.Sprintf("%v", req.GetGrpcRouteId()))
4401
4402 baseUrl.RawQuery = params.Encode()
4403
4404 // Build HTTP headers from client and context metadata.
4405 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
4406
4407 hds = append(c.xGoogHeaders, hds...)
4408 hds = append(hds, "Content-Type", "application/json")
4409 headers := gax.BuildHeaders(ctx, hds...)
4410 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4411 resp := &longrunningpb.Operation{}
4412 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4413 if settings.Path != "" {
4414 baseUrl.Path = settings.Path
4415 }
4416 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
4417 if err != nil {
4418 return err
4419 }
4420 httpReq = httpReq.WithContext(ctx)
4421 httpReq.Header = headers
4422
4423 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateGrpcRoute")
4424 if err != nil {
4425 return err
4426 }
4427 if err := unm.Unmarshal(buf, resp); err != nil {
4428 return err
4429 }
4430
4431 return nil
4432 }, opts...)
4433 if e != nil {
4434 return nil, e
4435 }
4436
4437 override := fmt.Sprintf("/v1/%s", resp.GetName())
4438 return &CreateGrpcRouteOperation{
4439 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4440 pollPath: override,
4441 }, nil
4442 }
4443
4444 // UpdateGrpcRoute updates the parameters of a single GrpcRoute.
4445 func (c *restClient) UpdateGrpcRoute(ctx context.Context, req *networkservicespb.UpdateGrpcRouteRequest, opts ...gax.CallOption) (*UpdateGrpcRouteOperation, error) {
4446 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4447 body := req.GetGrpcRoute()
4448 jsonReq, err := m.Marshal(body)
4449 if err != nil {
4450 return nil, err
4451 }
4452
4453 baseUrl, err := url.Parse(c.endpoint)
4454 if err != nil {
4455 return nil, err
4456 }
4457 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetGrpcRoute().GetName())
4458
4459 params := url.Values{}
4460 params.Add("$alt", "json;enum-encoding=int")
4461 if req.GetUpdateMask() != nil {
4462 field, err := protojson.Marshal(req.GetUpdateMask())
4463 if err != nil {
4464 return nil, err
4465 }
4466 params.Add("updateMask", string(field[1:len(field)-1]))
4467 }
4468
4469 baseUrl.RawQuery = params.Encode()
4470
4471 // Build HTTP headers from client and context metadata.
4472 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "grpc_route.name", url.QueryEscape(req.GetGrpcRoute().GetName()))}
4473
4474 hds = append(c.xGoogHeaders, hds...)
4475 hds = append(hds, "Content-Type", "application/json")
4476 headers := gax.BuildHeaders(ctx, hds...)
4477 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4478 resp := &longrunningpb.Operation{}
4479 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4480 if settings.Path != "" {
4481 baseUrl.Path = settings.Path
4482 }
4483 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
4484 if err != nil {
4485 return err
4486 }
4487 httpReq = httpReq.WithContext(ctx)
4488 httpReq.Header = headers
4489
4490 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateGrpcRoute")
4491 if err != nil {
4492 return err
4493 }
4494 if err := unm.Unmarshal(buf, resp); err != nil {
4495 return err
4496 }
4497
4498 return nil
4499 }, opts...)
4500 if e != nil {
4501 return nil, e
4502 }
4503
4504 override := fmt.Sprintf("/v1/%s", resp.GetName())
4505 return &UpdateGrpcRouteOperation{
4506 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4507 pollPath: override,
4508 }, nil
4509 }
4510
4511 // DeleteGrpcRoute deletes a single GrpcRoute.
4512 func (c *restClient) DeleteGrpcRoute(ctx context.Context, req *networkservicespb.DeleteGrpcRouteRequest, opts ...gax.CallOption) (*DeleteGrpcRouteOperation, error) {
4513 baseUrl, err := url.Parse(c.endpoint)
4514 if err != nil {
4515 return nil, err
4516 }
4517 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4518
4519 params := url.Values{}
4520 params.Add("$alt", "json;enum-encoding=int")
4521
4522 baseUrl.RawQuery = params.Encode()
4523
4524 // Build HTTP headers from client and context metadata.
4525 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4526
4527 hds = append(c.xGoogHeaders, hds...)
4528 hds = append(hds, "Content-Type", "application/json")
4529 headers := gax.BuildHeaders(ctx, hds...)
4530 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4531 resp := &longrunningpb.Operation{}
4532 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4533 if settings.Path != "" {
4534 baseUrl.Path = settings.Path
4535 }
4536 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
4537 if err != nil {
4538 return err
4539 }
4540 httpReq = httpReq.WithContext(ctx)
4541 httpReq.Header = headers
4542
4543 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteGrpcRoute")
4544 if err != nil {
4545 return err
4546 }
4547 if err := unm.Unmarshal(buf, resp); err != nil {
4548 return err
4549 }
4550
4551 return nil
4552 }, opts...)
4553 if e != nil {
4554 return nil, e
4555 }
4556
4557 override := fmt.Sprintf("/v1/%s", resp.GetName())
4558 return &DeleteGrpcRouteOperation{
4559 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4560 pollPath: override,
4561 }, nil
4562 }
4563
4564 // ListHttpRoutes lists HttpRoute in a given project and location.
4565 func (c *restClient) ListHttpRoutes(ctx context.Context, req *networkservicespb.ListHttpRoutesRequest, opts ...gax.CallOption) *HttpRouteIterator {
4566 it := &HttpRouteIterator{}
4567 req = proto.Clone(req).(*networkservicespb.ListHttpRoutesRequest)
4568 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4569 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.HttpRoute, string, error) {
4570 resp := &networkservicespb.ListHttpRoutesResponse{}
4571 if pageToken != "" {
4572 req.PageToken = pageToken
4573 }
4574 if pageSize > math.MaxInt32 {
4575 req.PageSize = math.MaxInt32
4576 } else if pageSize != 0 {
4577 req.PageSize = int32(pageSize)
4578 }
4579 baseUrl, err := url.Parse(c.endpoint)
4580 if err != nil {
4581 return nil, "", err
4582 }
4583 baseUrl.Path += fmt.Sprintf("/v1/%v/httpRoutes", req.GetParent())
4584
4585 params := url.Values{}
4586 params.Add("$alt", "json;enum-encoding=int")
4587 if req.GetPageSize() != 0 {
4588 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
4589 }
4590 if req.GetPageToken() != "" {
4591 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
4592 }
4593 if req.GetReturnPartialSuccess() {
4594 params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
4595 }
4596
4597 baseUrl.RawQuery = params.Encode()
4598
4599 // Build HTTP headers from client and context metadata.
4600 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
4601 headers := gax.BuildHeaders(ctx, hds...)
4602 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4603 if settings.Path != "" {
4604 baseUrl.Path = settings.Path
4605 }
4606 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4607 if err != nil {
4608 return err
4609 }
4610 httpReq.Header = headers
4611
4612 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListHttpRoutes")
4613 if err != nil {
4614 return err
4615 }
4616 if err := unm.Unmarshal(buf, resp); err != nil {
4617 return err
4618 }
4619
4620 return nil
4621 }, opts...)
4622 if e != nil {
4623 return nil, "", e
4624 }
4625 it.Response = resp
4626 return resp.GetHttpRoutes(), resp.GetNextPageToken(), nil
4627 }
4628
4629 fetch := func(pageSize int, pageToken string) (string, error) {
4630 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
4631 if err != nil {
4632 return "", err
4633 }
4634 it.items = append(it.items, items...)
4635 return nextPageToken, nil
4636 }
4637
4638 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
4639 it.pageInfo.MaxSize = int(req.GetPageSize())
4640 it.pageInfo.Token = req.GetPageToken()
4641
4642 return it
4643 }
4644
4645 // GetHttpRoute gets details of a single HttpRoute.
4646 func (c *restClient) GetHttpRoute(ctx context.Context, req *networkservicespb.GetHttpRouteRequest, opts ...gax.CallOption) (*networkservicespb.HttpRoute, error) {
4647 baseUrl, err := url.Parse(c.endpoint)
4648 if err != nil {
4649 return nil, err
4650 }
4651 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4652
4653 params := url.Values{}
4654 params.Add("$alt", "json;enum-encoding=int")
4655
4656 baseUrl.RawQuery = params.Encode()
4657
4658 // Build HTTP headers from client and context metadata.
4659 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4660
4661 hds = append(c.xGoogHeaders, hds...)
4662 hds = append(hds, "Content-Type", "application/json")
4663 headers := gax.BuildHeaders(ctx, hds...)
4664 opts = append((*c.CallOptions).GetHttpRoute[0:len((*c.CallOptions).GetHttpRoute):len((*c.CallOptions).GetHttpRoute)], opts...)
4665 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4666 resp := &networkservicespb.HttpRoute{}
4667 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4668 if settings.Path != "" {
4669 baseUrl.Path = settings.Path
4670 }
4671 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4672 if err != nil {
4673 return err
4674 }
4675 httpReq = httpReq.WithContext(ctx)
4676 httpReq.Header = headers
4677
4678 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetHttpRoute")
4679 if err != nil {
4680 return err
4681 }
4682
4683 if err := unm.Unmarshal(buf, resp); err != nil {
4684 return err
4685 }
4686
4687 return nil
4688 }, opts...)
4689 if e != nil {
4690 return nil, e
4691 }
4692 return resp, nil
4693 }
4694
4695 // CreateHttpRoute creates a new HttpRoute in a given project and location.
4696 func (c *restClient) CreateHttpRoute(ctx context.Context, req *networkservicespb.CreateHttpRouteRequest, opts ...gax.CallOption) (*CreateHttpRouteOperation, error) {
4697 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4698 body := req.GetHttpRoute()
4699 jsonReq, err := m.Marshal(body)
4700 if err != nil {
4701 return nil, err
4702 }
4703
4704 baseUrl, err := url.Parse(c.endpoint)
4705 if err != nil {
4706 return nil, err
4707 }
4708 baseUrl.Path += fmt.Sprintf("/v1/%v/httpRoutes", req.GetParent())
4709
4710 params := url.Values{}
4711 params.Add("$alt", "json;enum-encoding=int")
4712 params.Add("httpRouteId", fmt.Sprintf("%v", req.GetHttpRouteId()))
4713
4714 baseUrl.RawQuery = params.Encode()
4715
4716 // Build HTTP headers from client and context metadata.
4717 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
4718
4719 hds = append(c.xGoogHeaders, hds...)
4720 hds = append(hds, "Content-Type", "application/json")
4721 headers := gax.BuildHeaders(ctx, hds...)
4722 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4723 resp := &longrunningpb.Operation{}
4724 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4725 if settings.Path != "" {
4726 baseUrl.Path = settings.Path
4727 }
4728 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
4729 if err != nil {
4730 return err
4731 }
4732 httpReq = httpReq.WithContext(ctx)
4733 httpReq.Header = headers
4734
4735 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateHttpRoute")
4736 if err != nil {
4737 return err
4738 }
4739 if err := unm.Unmarshal(buf, resp); err != nil {
4740 return err
4741 }
4742
4743 return nil
4744 }, opts...)
4745 if e != nil {
4746 return nil, e
4747 }
4748
4749 override := fmt.Sprintf("/v1/%s", resp.GetName())
4750 return &CreateHttpRouteOperation{
4751 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4752 pollPath: override,
4753 }, nil
4754 }
4755
4756 // UpdateHttpRoute updates the parameters of a single HttpRoute.
4757 func (c *restClient) UpdateHttpRoute(ctx context.Context, req *networkservicespb.UpdateHttpRouteRequest, opts ...gax.CallOption) (*UpdateHttpRouteOperation, error) {
4758 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
4759 body := req.GetHttpRoute()
4760 jsonReq, err := m.Marshal(body)
4761 if err != nil {
4762 return nil, err
4763 }
4764
4765 baseUrl, err := url.Parse(c.endpoint)
4766 if err != nil {
4767 return nil, err
4768 }
4769 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetHttpRoute().GetName())
4770
4771 params := url.Values{}
4772 params.Add("$alt", "json;enum-encoding=int")
4773 if req.GetUpdateMask() != nil {
4774 field, err := protojson.Marshal(req.GetUpdateMask())
4775 if err != nil {
4776 return nil, err
4777 }
4778 params.Add("updateMask", string(field[1:len(field)-1]))
4779 }
4780
4781 baseUrl.RawQuery = params.Encode()
4782
4783 // Build HTTP headers from client and context metadata.
4784 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "http_route.name", url.QueryEscape(req.GetHttpRoute().GetName()))}
4785
4786 hds = append(c.xGoogHeaders, hds...)
4787 hds = append(hds, "Content-Type", "application/json")
4788 headers := gax.BuildHeaders(ctx, hds...)
4789 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4790 resp := &longrunningpb.Operation{}
4791 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4792 if settings.Path != "" {
4793 baseUrl.Path = settings.Path
4794 }
4795 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
4796 if err != nil {
4797 return err
4798 }
4799 httpReq = httpReq.WithContext(ctx)
4800 httpReq.Header = headers
4801
4802 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateHttpRoute")
4803 if err != nil {
4804 return err
4805 }
4806 if err := unm.Unmarshal(buf, resp); err != nil {
4807 return err
4808 }
4809
4810 return nil
4811 }, opts...)
4812 if e != nil {
4813 return nil, e
4814 }
4815
4816 override := fmt.Sprintf("/v1/%s", resp.GetName())
4817 return &UpdateHttpRouteOperation{
4818 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4819 pollPath: override,
4820 }, nil
4821 }
4822
4823 // DeleteHttpRoute deletes a single HttpRoute.
4824 func (c *restClient) DeleteHttpRoute(ctx context.Context, req *networkservicespb.DeleteHttpRouteRequest, opts ...gax.CallOption) (*DeleteHttpRouteOperation, error) {
4825 baseUrl, err := url.Parse(c.endpoint)
4826 if err != nil {
4827 return nil, err
4828 }
4829 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4830
4831 params := url.Values{}
4832 params.Add("$alt", "json;enum-encoding=int")
4833
4834 baseUrl.RawQuery = params.Encode()
4835
4836 // Build HTTP headers from client and context metadata.
4837 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4838
4839 hds = append(c.xGoogHeaders, hds...)
4840 hds = append(hds, "Content-Type", "application/json")
4841 headers := gax.BuildHeaders(ctx, hds...)
4842 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4843 resp := &longrunningpb.Operation{}
4844 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4845 if settings.Path != "" {
4846 baseUrl.Path = settings.Path
4847 }
4848 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
4849 if err != nil {
4850 return err
4851 }
4852 httpReq = httpReq.WithContext(ctx)
4853 httpReq.Header = headers
4854
4855 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteHttpRoute")
4856 if err != nil {
4857 return err
4858 }
4859 if err := unm.Unmarshal(buf, resp); err != nil {
4860 return err
4861 }
4862
4863 return nil
4864 }, opts...)
4865 if e != nil {
4866 return nil, e
4867 }
4868
4869 override := fmt.Sprintf("/v1/%s", resp.GetName())
4870 return &DeleteHttpRouteOperation{
4871 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
4872 pollPath: override,
4873 }, nil
4874 }
4875
4876 // ListTcpRoutes lists TcpRoute in a given project and location.
4877 func (c *restClient) ListTcpRoutes(ctx context.Context, req *networkservicespb.ListTcpRoutesRequest, opts ...gax.CallOption) *TcpRouteIterator {
4878 it := &TcpRouteIterator{}
4879 req = proto.Clone(req).(*networkservicespb.ListTcpRoutesRequest)
4880 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4881 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.TcpRoute, string, error) {
4882 resp := &networkservicespb.ListTcpRoutesResponse{}
4883 if pageToken != "" {
4884 req.PageToken = pageToken
4885 }
4886 if pageSize > math.MaxInt32 {
4887 req.PageSize = math.MaxInt32
4888 } else if pageSize != 0 {
4889 req.PageSize = int32(pageSize)
4890 }
4891 baseUrl, err := url.Parse(c.endpoint)
4892 if err != nil {
4893 return nil, "", err
4894 }
4895 baseUrl.Path += fmt.Sprintf("/v1/%v/tcpRoutes", req.GetParent())
4896
4897 params := url.Values{}
4898 params.Add("$alt", "json;enum-encoding=int")
4899 if req.GetPageSize() != 0 {
4900 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
4901 }
4902 if req.GetPageToken() != "" {
4903 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
4904 }
4905 if req.GetReturnPartialSuccess() {
4906 params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
4907 }
4908
4909 baseUrl.RawQuery = params.Encode()
4910
4911 // Build HTTP headers from client and context metadata.
4912 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
4913 headers := gax.BuildHeaders(ctx, hds...)
4914 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4915 if settings.Path != "" {
4916 baseUrl.Path = settings.Path
4917 }
4918 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4919 if err != nil {
4920 return err
4921 }
4922 httpReq.Header = headers
4923
4924 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListTcpRoutes")
4925 if err != nil {
4926 return err
4927 }
4928 if err := unm.Unmarshal(buf, resp); err != nil {
4929 return err
4930 }
4931
4932 return nil
4933 }, opts...)
4934 if e != nil {
4935 return nil, "", e
4936 }
4937 it.Response = resp
4938 return resp.GetTcpRoutes(), resp.GetNextPageToken(), nil
4939 }
4940
4941 fetch := func(pageSize int, pageToken string) (string, error) {
4942 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
4943 if err != nil {
4944 return "", err
4945 }
4946 it.items = append(it.items, items...)
4947 return nextPageToken, nil
4948 }
4949
4950 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
4951 it.pageInfo.MaxSize = int(req.GetPageSize())
4952 it.pageInfo.Token = req.GetPageToken()
4953
4954 return it
4955 }
4956
4957 // GetTcpRoute gets details of a single TcpRoute.
4958 func (c *restClient) GetTcpRoute(ctx context.Context, req *networkservicespb.GetTcpRouteRequest, opts ...gax.CallOption) (*networkservicespb.TcpRoute, error) {
4959 baseUrl, err := url.Parse(c.endpoint)
4960 if err != nil {
4961 return nil, err
4962 }
4963 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
4964
4965 params := url.Values{}
4966 params.Add("$alt", "json;enum-encoding=int")
4967
4968 baseUrl.RawQuery = params.Encode()
4969
4970 // Build HTTP headers from client and context metadata.
4971 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
4972
4973 hds = append(c.xGoogHeaders, hds...)
4974 hds = append(hds, "Content-Type", "application/json")
4975 headers := gax.BuildHeaders(ctx, hds...)
4976 opts = append((*c.CallOptions).GetTcpRoute[0:len((*c.CallOptions).GetTcpRoute):len((*c.CallOptions).GetTcpRoute)], opts...)
4977 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
4978 resp := &networkservicespb.TcpRoute{}
4979 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
4980 if settings.Path != "" {
4981 baseUrl.Path = settings.Path
4982 }
4983 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
4984 if err != nil {
4985 return err
4986 }
4987 httpReq = httpReq.WithContext(ctx)
4988 httpReq.Header = headers
4989
4990 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetTcpRoute")
4991 if err != nil {
4992 return err
4993 }
4994
4995 if err := unm.Unmarshal(buf, resp); err != nil {
4996 return err
4997 }
4998
4999 return nil
5000 }, opts...)
5001 if e != nil {
5002 return nil, e
5003 }
5004 return resp, nil
5005 }
5006
5007 // CreateTcpRoute creates a new TcpRoute in a given project and location.
5008 func (c *restClient) CreateTcpRoute(ctx context.Context, req *networkservicespb.CreateTcpRouteRequest, opts ...gax.CallOption) (*CreateTcpRouteOperation, error) {
5009 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
5010 body := req.GetTcpRoute()
5011 jsonReq, err := m.Marshal(body)
5012 if err != nil {
5013 return nil, err
5014 }
5015
5016 baseUrl, err := url.Parse(c.endpoint)
5017 if err != nil {
5018 return nil, err
5019 }
5020 baseUrl.Path += fmt.Sprintf("/v1/%v/tcpRoutes", req.GetParent())
5021
5022 params := url.Values{}
5023 params.Add("$alt", "json;enum-encoding=int")
5024 params.Add("tcpRouteId", fmt.Sprintf("%v", req.GetTcpRouteId()))
5025
5026 baseUrl.RawQuery = params.Encode()
5027
5028 // Build HTTP headers from client and context metadata.
5029 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
5030
5031 hds = append(c.xGoogHeaders, hds...)
5032 hds = append(hds, "Content-Type", "application/json")
5033 headers := gax.BuildHeaders(ctx, hds...)
5034 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5035 resp := &longrunningpb.Operation{}
5036 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5037 if settings.Path != "" {
5038 baseUrl.Path = settings.Path
5039 }
5040 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
5041 if err != nil {
5042 return err
5043 }
5044 httpReq = httpReq.WithContext(ctx)
5045 httpReq.Header = headers
5046
5047 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateTcpRoute")
5048 if err != nil {
5049 return err
5050 }
5051 if err := unm.Unmarshal(buf, resp); err != nil {
5052 return err
5053 }
5054
5055 return nil
5056 }, opts...)
5057 if e != nil {
5058 return nil, e
5059 }
5060
5061 override := fmt.Sprintf("/v1/%s", resp.GetName())
5062 return &CreateTcpRouteOperation{
5063 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
5064 pollPath: override,
5065 }, nil
5066 }
5067
5068 // UpdateTcpRoute updates the parameters of a single TcpRoute.
5069 func (c *restClient) UpdateTcpRoute(ctx context.Context, req *networkservicespb.UpdateTcpRouteRequest, opts ...gax.CallOption) (*UpdateTcpRouteOperation, error) {
5070 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
5071 body := req.GetTcpRoute()
5072 jsonReq, err := m.Marshal(body)
5073 if err != nil {
5074 return nil, err
5075 }
5076
5077 baseUrl, err := url.Parse(c.endpoint)
5078 if err != nil {
5079 return nil, err
5080 }
5081 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetTcpRoute().GetName())
5082
5083 params := url.Values{}
5084 params.Add("$alt", "json;enum-encoding=int")
5085 if req.GetUpdateMask() != nil {
5086 field, err := protojson.Marshal(req.GetUpdateMask())
5087 if err != nil {
5088 return nil, err
5089 }
5090 params.Add("updateMask", string(field[1:len(field)-1]))
5091 }
5092
5093 baseUrl.RawQuery = params.Encode()
5094
5095 // Build HTTP headers from client and context metadata.
5096 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "tcp_route.name", url.QueryEscape(req.GetTcpRoute().GetName()))}
5097
5098 hds = append(c.xGoogHeaders, hds...)
5099 hds = append(hds, "Content-Type", "application/json")
5100 headers := gax.BuildHeaders(ctx, hds...)
5101 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5102 resp := &longrunningpb.Operation{}
5103 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5104 if settings.Path != "" {
5105 baseUrl.Path = settings.Path
5106 }
5107 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
5108 if err != nil {
5109 return err
5110 }
5111 httpReq = httpReq.WithContext(ctx)
5112 httpReq.Header = headers
5113
5114 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateTcpRoute")
5115 if err != nil {
5116 return err
5117 }
5118 if err := unm.Unmarshal(buf, resp); err != nil {
5119 return err
5120 }
5121
5122 return nil
5123 }, opts...)
5124 if e != nil {
5125 return nil, e
5126 }
5127
5128 override := fmt.Sprintf("/v1/%s", resp.GetName())
5129 return &UpdateTcpRouteOperation{
5130 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
5131 pollPath: override,
5132 }, nil
5133 }
5134
5135 // DeleteTcpRoute deletes a single TcpRoute.
5136 func (c *restClient) DeleteTcpRoute(ctx context.Context, req *networkservicespb.DeleteTcpRouteRequest, opts ...gax.CallOption) (*DeleteTcpRouteOperation, error) {
5137 baseUrl, err := url.Parse(c.endpoint)
5138 if err != nil {
5139 return nil, err
5140 }
5141 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
5142
5143 params := url.Values{}
5144 params.Add("$alt", "json;enum-encoding=int")
5145
5146 baseUrl.RawQuery = params.Encode()
5147
5148 // Build HTTP headers from client and context metadata.
5149 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
5150
5151 hds = append(c.xGoogHeaders, hds...)
5152 hds = append(hds, "Content-Type", "application/json")
5153 headers := gax.BuildHeaders(ctx, hds...)
5154 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5155 resp := &longrunningpb.Operation{}
5156 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5157 if settings.Path != "" {
5158 baseUrl.Path = settings.Path
5159 }
5160 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
5161 if err != nil {
5162 return err
5163 }
5164 httpReq = httpReq.WithContext(ctx)
5165 httpReq.Header = headers
5166
5167 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteTcpRoute")
5168 if err != nil {
5169 return err
5170 }
5171 if err := unm.Unmarshal(buf, resp); err != nil {
5172 return err
5173 }
5174
5175 return nil
5176 }, opts...)
5177 if e != nil {
5178 return nil, e
5179 }
5180
5181 override := fmt.Sprintf("/v1/%s", resp.GetName())
5182 return &DeleteTcpRouteOperation{
5183 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
5184 pollPath: override,
5185 }, nil
5186 }
5187
5188 // ListTlsRoutes lists TlsRoute in a given project and location.
5189 func (c *restClient) ListTlsRoutes(ctx context.Context, req *networkservicespb.ListTlsRoutesRequest, opts ...gax.CallOption) *TlsRouteIterator {
5190 it := &TlsRouteIterator{}
5191 req = proto.Clone(req).(*networkservicespb.ListTlsRoutesRequest)
5192 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5193 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.TlsRoute, string, error) {
5194 resp := &networkservicespb.ListTlsRoutesResponse{}
5195 if pageToken != "" {
5196 req.PageToken = pageToken
5197 }
5198 if pageSize > math.MaxInt32 {
5199 req.PageSize = math.MaxInt32
5200 } else if pageSize != 0 {
5201 req.PageSize = int32(pageSize)
5202 }
5203 baseUrl, err := url.Parse(c.endpoint)
5204 if err != nil {
5205 return nil, "", err
5206 }
5207 baseUrl.Path += fmt.Sprintf("/v1/%v/tlsRoutes", req.GetParent())
5208
5209 params := url.Values{}
5210 params.Add("$alt", "json;enum-encoding=int")
5211 if req.GetPageSize() != 0 {
5212 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
5213 }
5214 if req.GetPageToken() != "" {
5215 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
5216 }
5217 if req.GetReturnPartialSuccess() {
5218 params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
5219 }
5220
5221 baseUrl.RawQuery = params.Encode()
5222
5223 // Build HTTP headers from client and context metadata.
5224 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
5225 headers := gax.BuildHeaders(ctx, hds...)
5226 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5227 if settings.Path != "" {
5228 baseUrl.Path = settings.Path
5229 }
5230 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
5231 if err != nil {
5232 return err
5233 }
5234 httpReq.Header = headers
5235
5236 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListTlsRoutes")
5237 if err != nil {
5238 return err
5239 }
5240 if err := unm.Unmarshal(buf, resp); err != nil {
5241 return err
5242 }
5243
5244 return nil
5245 }, opts...)
5246 if e != nil {
5247 return nil, "", e
5248 }
5249 it.Response = resp
5250 return resp.GetTlsRoutes(), resp.GetNextPageToken(), nil
5251 }
5252
5253 fetch := func(pageSize int, pageToken string) (string, error) {
5254 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
5255 if err != nil {
5256 return "", err
5257 }
5258 it.items = append(it.items, items...)
5259 return nextPageToken, nil
5260 }
5261
5262 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
5263 it.pageInfo.MaxSize = int(req.GetPageSize())
5264 it.pageInfo.Token = req.GetPageToken()
5265
5266 return it
5267 }
5268
5269 // GetTlsRoute gets details of a single TlsRoute.
5270 func (c *restClient) GetTlsRoute(ctx context.Context, req *networkservicespb.GetTlsRouteRequest, opts ...gax.CallOption) (*networkservicespb.TlsRoute, error) {
5271 baseUrl, err := url.Parse(c.endpoint)
5272 if err != nil {
5273 return nil, err
5274 }
5275 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
5276
5277 params := url.Values{}
5278 params.Add("$alt", "json;enum-encoding=int")
5279
5280 baseUrl.RawQuery = params.Encode()
5281
5282 // Build HTTP headers from client and context metadata.
5283 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
5284
5285 hds = append(c.xGoogHeaders, hds...)
5286 hds = append(hds, "Content-Type", "application/json")
5287 headers := gax.BuildHeaders(ctx, hds...)
5288 opts = append((*c.CallOptions).GetTlsRoute[0:len((*c.CallOptions).GetTlsRoute):len((*c.CallOptions).GetTlsRoute)], opts...)
5289 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5290 resp := &networkservicespb.TlsRoute{}
5291 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5292 if settings.Path != "" {
5293 baseUrl.Path = settings.Path
5294 }
5295 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
5296 if err != nil {
5297 return err
5298 }
5299 httpReq = httpReq.WithContext(ctx)
5300 httpReq.Header = headers
5301
5302 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetTlsRoute")
5303 if err != nil {
5304 return err
5305 }
5306
5307 if err := unm.Unmarshal(buf, resp); err != nil {
5308 return err
5309 }
5310
5311 return nil
5312 }, opts...)
5313 if e != nil {
5314 return nil, e
5315 }
5316 return resp, nil
5317 }
5318
5319 // CreateTlsRoute creates a new TlsRoute in a given project and location.
5320 func (c *restClient) CreateTlsRoute(ctx context.Context, req *networkservicespb.CreateTlsRouteRequest, opts ...gax.CallOption) (*CreateTlsRouteOperation, error) {
5321 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
5322 body := req.GetTlsRoute()
5323 jsonReq, err := m.Marshal(body)
5324 if err != nil {
5325 return nil, err
5326 }
5327
5328 baseUrl, err := url.Parse(c.endpoint)
5329 if err != nil {
5330 return nil, err
5331 }
5332 baseUrl.Path += fmt.Sprintf("/v1/%v/tlsRoutes", req.GetParent())
5333
5334 params := url.Values{}
5335 params.Add("$alt", "json;enum-encoding=int")
5336 params.Add("tlsRouteId", fmt.Sprintf("%v", req.GetTlsRouteId()))
5337
5338 baseUrl.RawQuery = params.Encode()
5339
5340 // Build HTTP headers from client and context metadata.
5341 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
5342
5343 hds = append(c.xGoogHeaders, hds...)
5344 hds = append(hds, "Content-Type", "application/json")
5345 headers := gax.BuildHeaders(ctx, hds...)
5346 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5347 resp := &longrunningpb.Operation{}
5348 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5349 if settings.Path != "" {
5350 baseUrl.Path = settings.Path
5351 }
5352 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
5353 if err != nil {
5354 return err
5355 }
5356 httpReq = httpReq.WithContext(ctx)
5357 httpReq.Header = headers
5358
5359 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateTlsRoute")
5360 if err != nil {
5361 return err
5362 }
5363 if err := unm.Unmarshal(buf, resp); err != nil {
5364 return err
5365 }
5366
5367 return nil
5368 }, opts...)
5369 if e != nil {
5370 return nil, e
5371 }
5372
5373 override := fmt.Sprintf("/v1/%s", resp.GetName())
5374 return &CreateTlsRouteOperation{
5375 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
5376 pollPath: override,
5377 }, nil
5378 }
5379
5380 // UpdateTlsRoute updates the parameters of a single TlsRoute.
5381 func (c *restClient) UpdateTlsRoute(ctx context.Context, req *networkservicespb.UpdateTlsRouteRequest, opts ...gax.CallOption) (*UpdateTlsRouteOperation, error) {
5382 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
5383 body := req.GetTlsRoute()
5384 jsonReq, err := m.Marshal(body)
5385 if err != nil {
5386 return nil, err
5387 }
5388
5389 baseUrl, err := url.Parse(c.endpoint)
5390 if err != nil {
5391 return nil, err
5392 }
5393 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetTlsRoute().GetName())
5394
5395 params := url.Values{}
5396 params.Add("$alt", "json;enum-encoding=int")
5397 if req.GetUpdateMask() != nil {
5398 field, err := protojson.Marshal(req.GetUpdateMask())
5399 if err != nil {
5400 return nil, err
5401 }
5402 params.Add("updateMask", string(field[1:len(field)-1]))
5403 }
5404
5405 baseUrl.RawQuery = params.Encode()
5406
5407 // Build HTTP headers from client and context metadata.
5408 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "tls_route.name", url.QueryEscape(req.GetTlsRoute().GetName()))}
5409
5410 hds = append(c.xGoogHeaders, hds...)
5411 hds = append(hds, "Content-Type", "application/json")
5412 headers := gax.BuildHeaders(ctx, hds...)
5413 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5414 resp := &longrunningpb.Operation{}
5415 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5416 if settings.Path != "" {
5417 baseUrl.Path = settings.Path
5418 }
5419 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
5420 if err != nil {
5421 return err
5422 }
5423 httpReq = httpReq.WithContext(ctx)
5424 httpReq.Header = headers
5425
5426 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateTlsRoute")
5427 if err != nil {
5428 return err
5429 }
5430 if err := unm.Unmarshal(buf, resp); err != nil {
5431 return err
5432 }
5433
5434 return nil
5435 }, opts...)
5436 if e != nil {
5437 return nil, e
5438 }
5439
5440 override := fmt.Sprintf("/v1/%s", resp.GetName())
5441 return &UpdateTlsRouteOperation{
5442 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
5443 pollPath: override,
5444 }, nil
5445 }
5446
5447 // DeleteTlsRoute deletes a single TlsRoute.
5448 func (c *restClient) DeleteTlsRoute(ctx context.Context, req *networkservicespb.DeleteTlsRouteRequest, opts ...gax.CallOption) (*DeleteTlsRouteOperation, error) {
5449 baseUrl, err := url.Parse(c.endpoint)
5450 if err != nil {
5451 return nil, err
5452 }
5453 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
5454
5455 params := url.Values{}
5456 params.Add("$alt", "json;enum-encoding=int")
5457
5458 baseUrl.RawQuery = params.Encode()
5459
5460 // Build HTTP headers from client and context metadata.
5461 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
5462
5463 hds = append(c.xGoogHeaders, hds...)
5464 hds = append(hds, "Content-Type", "application/json")
5465 headers := gax.BuildHeaders(ctx, hds...)
5466 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5467 resp := &longrunningpb.Operation{}
5468 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5469 if settings.Path != "" {
5470 baseUrl.Path = settings.Path
5471 }
5472 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
5473 if err != nil {
5474 return err
5475 }
5476 httpReq = httpReq.WithContext(ctx)
5477 httpReq.Header = headers
5478
5479 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteTlsRoute")
5480 if err != nil {
5481 return err
5482 }
5483 if err := unm.Unmarshal(buf, resp); err != nil {
5484 return err
5485 }
5486
5487 return nil
5488 }, opts...)
5489 if e != nil {
5490 return nil, e
5491 }
5492
5493 override := fmt.Sprintf("/v1/%s", resp.GetName())
5494 return &DeleteTlsRouteOperation{
5495 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
5496 pollPath: override,
5497 }, nil
5498 }
5499
5500 // ListServiceBindings lists ServiceBinding in a given project and location.
5501 func (c *restClient) ListServiceBindings(ctx context.Context, req *networkservicespb.ListServiceBindingsRequest, opts ...gax.CallOption) *ServiceBindingIterator {
5502 it := &ServiceBindingIterator{}
5503 req = proto.Clone(req).(*networkservicespb.ListServiceBindingsRequest)
5504 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5505 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.ServiceBinding, string, error) {
5506 resp := &networkservicespb.ListServiceBindingsResponse{}
5507 if pageToken != "" {
5508 req.PageToken = pageToken
5509 }
5510 if pageSize > math.MaxInt32 {
5511 req.PageSize = math.MaxInt32
5512 } else if pageSize != 0 {
5513 req.PageSize = int32(pageSize)
5514 }
5515 baseUrl, err := url.Parse(c.endpoint)
5516 if err != nil {
5517 return nil, "", err
5518 }
5519 baseUrl.Path += fmt.Sprintf("/v1/%v/serviceBindings", req.GetParent())
5520
5521 params := url.Values{}
5522 params.Add("$alt", "json;enum-encoding=int")
5523 if req.GetPageSize() != 0 {
5524 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
5525 }
5526 if req.GetPageToken() != "" {
5527 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
5528 }
5529
5530 baseUrl.RawQuery = params.Encode()
5531
5532 // Build HTTP headers from client and context metadata.
5533 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
5534 headers := gax.BuildHeaders(ctx, hds...)
5535 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5536 if settings.Path != "" {
5537 baseUrl.Path = settings.Path
5538 }
5539 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
5540 if err != nil {
5541 return err
5542 }
5543 httpReq.Header = headers
5544
5545 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListServiceBindings")
5546 if err != nil {
5547 return err
5548 }
5549 if err := unm.Unmarshal(buf, resp); err != nil {
5550 return err
5551 }
5552
5553 return nil
5554 }, opts...)
5555 if e != nil {
5556 return nil, "", e
5557 }
5558 it.Response = resp
5559 return resp.GetServiceBindings(), resp.GetNextPageToken(), nil
5560 }
5561
5562 fetch := func(pageSize int, pageToken string) (string, error) {
5563 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
5564 if err != nil {
5565 return "", err
5566 }
5567 it.items = append(it.items, items...)
5568 return nextPageToken, nil
5569 }
5570
5571 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
5572 it.pageInfo.MaxSize = int(req.GetPageSize())
5573 it.pageInfo.Token = req.GetPageToken()
5574
5575 return it
5576 }
5577
5578 // GetServiceBinding gets details of a single ServiceBinding.
5579 func (c *restClient) GetServiceBinding(ctx context.Context, req *networkservicespb.GetServiceBindingRequest, opts ...gax.CallOption) (*networkservicespb.ServiceBinding, error) {
5580 baseUrl, err := url.Parse(c.endpoint)
5581 if err != nil {
5582 return nil, err
5583 }
5584 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
5585
5586 params := url.Values{}
5587 params.Add("$alt", "json;enum-encoding=int")
5588
5589 baseUrl.RawQuery = params.Encode()
5590
5591 // Build HTTP headers from client and context metadata.
5592 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
5593
5594 hds = append(c.xGoogHeaders, hds...)
5595 hds = append(hds, "Content-Type", "application/json")
5596 headers := gax.BuildHeaders(ctx, hds...)
5597 opts = append((*c.CallOptions).GetServiceBinding[0:len((*c.CallOptions).GetServiceBinding):len((*c.CallOptions).GetServiceBinding)], opts...)
5598 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5599 resp := &networkservicespb.ServiceBinding{}
5600 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5601 if settings.Path != "" {
5602 baseUrl.Path = settings.Path
5603 }
5604 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
5605 if err != nil {
5606 return err
5607 }
5608 httpReq = httpReq.WithContext(ctx)
5609 httpReq.Header = headers
5610
5611 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetServiceBinding")
5612 if err != nil {
5613 return err
5614 }
5615
5616 if err := unm.Unmarshal(buf, resp); err != nil {
5617 return err
5618 }
5619
5620 return nil
5621 }, opts...)
5622 if e != nil {
5623 return nil, e
5624 }
5625 return resp, nil
5626 }
5627
5628 // CreateServiceBinding creates a new ServiceBinding in a given project and location.
5629 func (c *restClient) CreateServiceBinding(ctx context.Context, req *networkservicespb.CreateServiceBindingRequest, opts ...gax.CallOption) (*CreateServiceBindingOperation, error) {
5630 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
5631 body := req.GetServiceBinding()
5632 jsonReq, err := m.Marshal(body)
5633 if err != nil {
5634 return nil, err
5635 }
5636
5637 baseUrl, err := url.Parse(c.endpoint)
5638 if err != nil {
5639 return nil, err
5640 }
5641 baseUrl.Path += fmt.Sprintf("/v1/%v/serviceBindings", req.GetParent())
5642
5643 params := url.Values{}
5644 params.Add("$alt", "json;enum-encoding=int")
5645 params.Add("serviceBindingId", fmt.Sprintf("%v", req.GetServiceBindingId()))
5646
5647 baseUrl.RawQuery = params.Encode()
5648
5649 // Build HTTP headers from client and context metadata.
5650 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
5651
5652 hds = append(c.xGoogHeaders, hds...)
5653 hds = append(hds, "Content-Type", "application/json")
5654 headers := gax.BuildHeaders(ctx, hds...)
5655 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5656 resp := &longrunningpb.Operation{}
5657 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5658 if settings.Path != "" {
5659 baseUrl.Path = settings.Path
5660 }
5661 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
5662 if err != nil {
5663 return err
5664 }
5665 httpReq = httpReq.WithContext(ctx)
5666 httpReq.Header = headers
5667
5668 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateServiceBinding")
5669 if err != nil {
5670 return err
5671 }
5672 if err := unm.Unmarshal(buf, resp); err != nil {
5673 return err
5674 }
5675
5676 return nil
5677 }, opts...)
5678 if e != nil {
5679 return nil, e
5680 }
5681
5682 override := fmt.Sprintf("/v1/%s", resp.GetName())
5683 return &CreateServiceBindingOperation{
5684 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
5685 pollPath: override,
5686 }, nil
5687 }
5688
5689 // UpdateServiceBinding updates the parameters of a single ServiceBinding.
5690 func (c *restClient) UpdateServiceBinding(ctx context.Context, req *networkservicespb.UpdateServiceBindingRequest, opts ...gax.CallOption) (*UpdateServiceBindingOperation, error) {
5691 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
5692 body := req.GetServiceBinding()
5693 jsonReq, err := m.Marshal(body)
5694 if err != nil {
5695 return nil, err
5696 }
5697
5698 baseUrl, err := url.Parse(c.endpoint)
5699 if err != nil {
5700 return nil, err
5701 }
5702 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetServiceBinding().GetName())
5703
5704 params := url.Values{}
5705 params.Add("$alt", "json;enum-encoding=int")
5706 if req.GetUpdateMask() != nil {
5707 field, err := protojson.Marshal(req.GetUpdateMask())
5708 if err != nil {
5709 return nil, err
5710 }
5711 params.Add("updateMask", string(field[1:len(field)-1]))
5712 }
5713
5714 baseUrl.RawQuery = params.Encode()
5715
5716 // Build HTTP headers from client and context metadata.
5717 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "service_binding.name", url.QueryEscape(req.GetServiceBinding().GetName()))}
5718
5719 hds = append(c.xGoogHeaders, hds...)
5720 hds = append(hds, "Content-Type", "application/json")
5721 headers := gax.BuildHeaders(ctx, hds...)
5722 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5723 resp := &longrunningpb.Operation{}
5724 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5725 if settings.Path != "" {
5726 baseUrl.Path = settings.Path
5727 }
5728 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
5729 if err != nil {
5730 return err
5731 }
5732 httpReq = httpReq.WithContext(ctx)
5733 httpReq.Header = headers
5734
5735 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateServiceBinding")
5736 if err != nil {
5737 return err
5738 }
5739 if err := unm.Unmarshal(buf, resp); err != nil {
5740 return err
5741 }
5742
5743 return nil
5744 }, opts...)
5745 if e != nil {
5746 return nil, e
5747 }
5748
5749 override := fmt.Sprintf("/v1/%s", resp.GetName())
5750 return &UpdateServiceBindingOperation{
5751 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
5752 pollPath: override,
5753 }, nil
5754 }
5755
5756 // DeleteServiceBinding deletes a single ServiceBinding.
5757 func (c *restClient) DeleteServiceBinding(ctx context.Context, req *networkservicespb.DeleteServiceBindingRequest, opts ...gax.CallOption) (*DeleteServiceBindingOperation, error) {
5758 baseUrl, err := url.Parse(c.endpoint)
5759 if err != nil {
5760 return nil, err
5761 }
5762 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
5763
5764 params := url.Values{}
5765 params.Add("$alt", "json;enum-encoding=int")
5766
5767 baseUrl.RawQuery = params.Encode()
5768
5769 // Build HTTP headers from client and context metadata.
5770 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
5771
5772 hds = append(c.xGoogHeaders, hds...)
5773 hds = append(hds, "Content-Type", "application/json")
5774 headers := gax.BuildHeaders(ctx, hds...)
5775 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5776 resp := &longrunningpb.Operation{}
5777 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5778 if settings.Path != "" {
5779 baseUrl.Path = settings.Path
5780 }
5781 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
5782 if err != nil {
5783 return err
5784 }
5785 httpReq = httpReq.WithContext(ctx)
5786 httpReq.Header = headers
5787
5788 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteServiceBinding")
5789 if err != nil {
5790 return err
5791 }
5792 if err := unm.Unmarshal(buf, resp); err != nil {
5793 return err
5794 }
5795
5796 return nil
5797 }, opts...)
5798 if e != nil {
5799 return nil, e
5800 }
5801
5802 override := fmt.Sprintf("/v1/%s", resp.GetName())
5803 return &DeleteServiceBindingOperation{
5804 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
5805 pollPath: override,
5806 }, nil
5807 }
5808
5809 // ListMeshes lists Meshes in a given project and location.
5810 func (c *restClient) ListMeshes(ctx context.Context, req *networkservicespb.ListMeshesRequest, opts ...gax.CallOption) *MeshIterator {
5811 it := &MeshIterator{}
5812 req = proto.Clone(req).(*networkservicespb.ListMeshesRequest)
5813 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5814 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.Mesh, string, error) {
5815 resp := &networkservicespb.ListMeshesResponse{}
5816 if pageToken != "" {
5817 req.PageToken = pageToken
5818 }
5819 if pageSize > math.MaxInt32 {
5820 req.PageSize = math.MaxInt32
5821 } else if pageSize != 0 {
5822 req.PageSize = int32(pageSize)
5823 }
5824 baseUrl, err := url.Parse(c.endpoint)
5825 if err != nil {
5826 return nil, "", err
5827 }
5828 baseUrl.Path += fmt.Sprintf("/v1/%v/meshes", req.GetParent())
5829
5830 params := url.Values{}
5831 params.Add("$alt", "json;enum-encoding=int")
5832 if req.GetPageSize() != 0 {
5833 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
5834 }
5835 if req.GetPageToken() != "" {
5836 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
5837 }
5838 if req.GetReturnPartialSuccess() {
5839 params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
5840 }
5841
5842 baseUrl.RawQuery = params.Encode()
5843
5844 // Build HTTP headers from client and context metadata.
5845 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
5846 headers := gax.BuildHeaders(ctx, hds...)
5847 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5848 if settings.Path != "" {
5849 baseUrl.Path = settings.Path
5850 }
5851 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
5852 if err != nil {
5853 return err
5854 }
5855 httpReq.Header = headers
5856
5857 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListMeshes")
5858 if err != nil {
5859 return err
5860 }
5861 if err := unm.Unmarshal(buf, resp); err != nil {
5862 return err
5863 }
5864
5865 return nil
5866 }, opts...)
5867 if e != nil {
5868 return nil, "", e
5869 }
5870 it.Response = resp
5871 return resp.GetMeshes(), resp.GetNextPageToken(), nil
5872 }
5873
5874 fetch := func(pageSize int, pageToken string) (string, error) {
5875 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
5876 if err != nil {
5877 return "", err
5878 }
5879 it.items = append(it.items, items...)
5880 return nextPageToken, nil
5881 }
5882
5883 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
5884 it.pageInfo.MaxSize = int(req.GetPageSize())
5885 it.pageInfo.Token = req.GetPageToken()
5886
5887 return it
5888 }
5889
5890 // GetMesh gets details of a single Mesh.
5891 func (c *restClient) GetMesh(ctx context.Context, req *networkservicespb.GetMeshRequest, opts ...gax.CallOption) (*networkservicespb.Mesh, error) {
5892 baseUrl, err := url.Parse(c.endpoint)
5893 if err != nil {
5894 return nil, err
5895 }
5896 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
5897
5898 params := url.Values{}
5899 params.Add("$alt", "json;enum-encoding=int")
5900
5901 baseUrl.RawQuery = params.Encode()
5902
5903 // Build HTTP headers from client and context metadata.
5904 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
5905
5906 hds = append(c.xGoogHeaders, hds...)
5907 hds = append(hds, "Content-Type", "application/json")
5908 headers := gax.BuildHeaders(ctx, hds...)
5909 opts = append((*c.CallOptions).GetMesh[0:len((*c.CallOptions).GetMesh):len((*c.CallOptions).GetMesh)], opts...)
5910 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5911 resp := &networkservicespb.Mesh{}
5912 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5913 if settings.Path != "" {
5914 baseUrl.Path = settings.Path
5915 }
5916 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
5917 if err != nil {
5918 return err
5919 }
5920 httpReq = httpReq.WithContext(ctx)
5921 httpReq.Header = headers
5922
5923 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetMesh")
5924 if err != nil {
5925 return err
5926 }
5927
5928 if err := unm.Unmarshal(buf, resp); err != nil {
5929 return err
5930 }
5931
5932 return nil
5933 }, opts...)
5934 if e != nil {
5935 return nil, e
5936 }
5937 return resp, nil
5938 }
5939
5940 // CreateMesh creates a new Mesh in a given project and location.
5941 func (c *restClient) CreateMesh(ctx context.Context, req *networkservicespb.CreateMeshRequest, opts ...gax.CallOption) (*CreateMeshOperation, error) {
5942 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
5943 body := req.GetMesh()
5944 jsonReq, err := m.Marshal(body)
5945 if err != nil {
5946 return nil, err
5947 }
5948
5949 baseUrl, err := url.Parse(c.endpoint)
5950 if err != nil {
5951 return nil, err
5952 }
5953 baseUrl.Path += fmt.Sprintf("/v1/%v/meshes", req.GetParent())
5954
5955 params := url.Values{}
5956 params.Add("$alt", "json;enum-encoding=int")
5957 params.Add("meshId", fmt.Sprintf("%v", req.GetMeshId()))
5958
5959 baseUrl.RawQuery = params.Encode()
5960
5961 // Build HTTP headers from client and context metadata.
5962 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
5963
5964 hds = append(c.xGoogHeaders, hds...)
5965 hds = append(hds, "Content-Type", "application/json")
5966 headers := gax.BuildHeaders(ctx, hds...)
5967 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
5968 resp := &longrunningpb.Operation{}
5969 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
5970 if settings.Path != "" {
5971 baseUrl.Path = settings.Path
5972 }
5973 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
5974 if err != nil {
5975 return err
5976 }
5977 httpReq = httpReq.WithContext(ctx)
5978 httpReq.Header = headers
5979
5980 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateMesh")
5981 if err != nil {
5982 return err
5983 }
5984 if err := unm.Unmarshal(buf, resp); err != nil {
5985 return err
5986 }
5987
5988 return nil
5989 }, opts...)
5990 if e != nil {
5991 return nil, e
5992 }
5993
5994 override := fmt.Sprintf("/v1/%s", resp.GetName())
5995 return &CreateMeshOperation{
5996 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
5997 pollPath: override,
5998 }, nil
5999 }
6000
6001 // UpdateMesh updates the parameters of a single Mesh.
6002 func (c *restClient) UpdateMesh(ctx context.Context, req *networkservicespb.UpdateMeshRequest, opts ...gax.CallOption) (*UpdateMeshOperation, error) {
6003 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
6004 body := req.GetMesh()
6005 jsonReq, err := m.Marshal(body)
6006 if err != nil {
6007 return nil, err
6008 }
6009
6010 baseUrl, err := url.Parse(c.endpoint)
6011 if err != nil {
6012 return nil, err
6013 }
6014 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetMesh().GetName())
6015
6016 params := url.Values{}
6017 params.Add("$alt", "json;enum-encoding=int")
6018 if req.GetUpdateMask() != nil {
6019 field, err := protojson.Marshal(req.GetUpdateMask())
6020 if err != nil {
6021 return nil, err
6022 }
6023 params.Add("updateMask", string(field[1:len(field)-1]))
6024 }
6025
6026 baseUrl.RawQuery = params.Encode()
6027
6028 // Build HTTP headers from client and context metadata.
6029 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "mesh.name", url.QueryEscape(req.GetMesh().GetName()))}
6030
6031 hds = append(c.xGoogHeaders, hds...)
6032 hds = append(hds, "Content-Type", "application/json")
6033 headers := gax.BuildHeaders(ctx, hds...)
6034 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6035 resp := &longrunningpb.Operation{}
6036 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6037 if settings.Path != "" {
6038 baseUrl.Path = settings.Path
6039 }
6040 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
6041 if err != nil {
6042 return err
6043 }
6044 httpReq = httpReq.WithContext(ctx)
6045 httpReq.Header = headers
6046
6047 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateMesh")
6048 if err != nil {
6049 return err
6050 }
6051 if err := unm.Unmarshal(buf, resp); err != nil {
6052 return err
6053 }
6054
6055 return nil
6056 }, opts...)
6057 if e != nil {
6058 return nil, e
6059 }
6060
6061 override := fmt.Sprintf("/v1/%s", resp.GetName())
6062 return &UpdateMeshOperation{
6063 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
6064 pollPath: override,
6065 }, nil
6066 }
6067
6068 // DeleteMesh deletes a single Mesh.
6069 func (c *restClient) DeleteMesh(ctx context.Context, req *networkservicespb.DeleteMeshRequest, opts ...gax.CallOption) (*DeleteMeshOperation, error) {
6070 baseUrl, err := url.Parse(c.endpoint)
6071 if err != nil {
6072 return nil, err
6073 }
6074 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
6075
6076 params := url.Values{}
6077 params.Add("$alt", "json;enum-encoding=int")
6078
6079 baseUrl.RawQuery = params.Encode()
6080
6081 // Build HTTP headers from client and context metadata.
6082 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
6083
6084 hds = append(c.xGoogHeaders, hds...)
6085 hds = append(hds, "Content-Type", "application/json")
6086 headers := gax.BuildHeaders(ctx, hds...)
6087 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6088 resp := &longrunningpb.Operation{}
6089 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6090 if settings.Path != "" {
6091 baseUrl.Path = settings.Path
6092 }
6093 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
6094 if err != nil {
6095 return err
6096 }
6097 httpReq = httpReq.WithContext(ctx)
6098 httpReq.Header = headers
6099
6100 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteMesh")
6101 if err != nil {
6102 return err
6103 }
6104 if err := unm.Unmarshal(buf, resp); err != nil {
6105 return err
6106 }
6107
6108 return nil
6109 }, opts...)
6110 if e != nil {
6111 return nil, e
6112 }
6113
6114 override := fmt.Sprintf("/v1/%s", resp.GetName())
6115 return &DeleteMeshOperation{
6116 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
6117 pollPath: override,
6118 }, nil
6119 }
6120
6121 // ListServiceLbPolicies lists ServiceLbPolicies in a given project and location.
6122 func (c *restClient) ListServiceLbPolicies(ctx context.Context, req *networkservicespb.ListServiceLbPoliciesRequest, opts ...gax.CallOption) *ServiceLbPolicyIterator {
6123 it := &ServiceLbPolicyIterator{}
6124 req = proto.Clone(req).(*networkservicespb.ListServiceLbPoliciesRequest)
6125 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6126 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.ServiceLbPolicy, string, error) {
6127 resp := &networkservicespb.ListServiceLbPoliciesResponse{}
6128 if pageToken != "" {
6129 req.PageToken = pageToken
6130 }
6131 if pageSize > math.MaxInt32 {
6132 req.PageSize = math.MaxInt32
6133 } else if pageSize != 0 {
6134 req.PageSize = int32(pageSize)
6135 }
6136 baseUrl, err := url.Parse(c.endpoint)
6137 if err != nil {
6138 return nil, "", err
6139 }
6140 baseUrl.Path += fmt.Sprintf("/v1/%v/serviceLbPolicies", req.GetParent())
6141
6142 params := url.Values{}
6143 params.Add("$alt", "json;enum-encoding=int")
6144 if req.GetPageSize() != 0 {
6145 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
6146 }
6147 if req.GetPageToken() != "" {
6148 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
6149 }
6150
6151 baseUrl.RawQuery = params.Encode()
6152
6153 // Build HTTP headers from client and context metadata.
6154 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
6155 headers := gax.BuildHeaders(ctx, hds...)
6156 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6157 if settings.Path != "" {
6158 baseUrl.Path = settings.Path
6159 }
6160 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
6161 if err != nil {
6162 return err
6163 }
6164 httpReq.Header = headers
6165
6166 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListServiceLbPolicies")
6167 if err != nil {
6168 return err
6169 }
6170 if err := unm.Unmarshal(buf, resp); err != nil {
6171 return err
6172 }
6173
6174 return nil
6175 }, opts...)
6176 if e != nil {
6177 return nil, "", e
6178 }
6179 it.Response = resp
6180 return resp.GetServiceLbPolicies(), resp.GetNextPageToken(), nil
6181 }
6182
6183 fetch := func(pageSize int, pageToken string) (string, error) {
6184 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
6185 if err != nil {
6186 return "", err
6187 }
6188 it.items = append(it.items, items...)
6189 return nextPageToken, nil
6190 }
6191
6192 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
6193 it.pageInfo.MaxSize = int(req.GetPageSize())
6194 it.pageInfo.Token = req.GetPageToken()
6195
6196 return it
6197 }
6198
6199 // GetServiceLbPolicy gets details of a single ServiceLbPolicy.
6200 func (c *restClient) GetServiceLbPolicy(ctx context.Context, req *networkservicespb.GetServiceLbPolicyRequest, opts ...gax.CallOption) (*networkservicespb.ServiceLbPolicy, error) {
6201 baseUrl, err := url.Parse(c.endpoint)
6202 if err != nil {
6203 return nil, err
6204 }
6205 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
6206
6207 params := url.Values{}
6208 params.Add("$alt", "json;enum-encoding=int")
6209
6210 baseUrl.RawQuery = params.Encode()
6211
6212 // Build HTTP headers from client and context metadata.
6213 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
6214
6215 hds = append(c.xGoogHeaders, hds...)
6216 hds = append(hds, "Content-Type", "application/json")
6217 headers := gax.BuildHeaders(ctx, hds...)
6218 opts = append((*c.CallOptions).GetServiceLbPolicy[0:len((*c.CallOptions).GetServiceLbPolicy):len((*c.CallOptions).GetServiceLbPolicy)], opts...)
6219 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6220 resp := &networkservicespb.ServiceLbPolicy{}
6221 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6222 if settings.Path != "" {
6223 baseUrl.Path = settings.Path
6224 }
6225 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
6226 if err != nil {
6227 return err
6228 }
6229 httpReq = httpReq.WithContext(ctx)
6230 httpReq.Header = headers
6231
6232 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetServiceLbPolicy")
6233 if err != nil {
6234 return err
6235 }
6236
6237 if err := unm.Unmarshal(buf, resp); err != nil {
6238 return err
6239 }
6240
6241 return nil
6242 }, opts...)
6243 if e != nil {
6244 return nil, e
6245 }
6246 return resp, nil
6247 }
6248
6249 // CreateServiceLbPolicy creates a new ServiceLbPolicy in a given project and location.
6250 func (c *restClient) CreateServiceLbPolicy(ctx context.Context, req *networkservicespb.CreateServiceLbPolicyRequest, opts ...gax.CallOption) (*CreateServiceLbPolicyOperation, error) {
6251 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
6252 body := req.GetServiceLbPolicy()
6253 jsonReq, err := m.Marshal(body)
6254 if err != nil {
6255 return nil, err
6256 }
6257
6258 baseUrl, err := url.Parse(c.endpoint)
6259 if err != nil {
6260 return nil, err
6261 }
6262 baseUrl.Path += fmt.Sprintf("/v1/%v/serviceLbPolicies", req.GetParent())
6263
6264 params := url.Values{}
6265 params.Add("$alt", "json;enum-encoding=int")
6266 params.Add("serviceLbPolicyId", fmt.Sprintf("%v", req.GetServiceLbPolicyId()))
6267
6268 baseUrl.RawQuery = params.Encode()
6269
6270 // Build HTTP headers from client and context metadata.
6271 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
6272
6273 hds = append(c.xGoogHeaders, hds...)
6274 hds = append(hds, "Content-Type", "application/json")
6275 headers := gax.BuildHeaders(ctx, hds...)
6276 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6277 resp := &longrunningpb.Operation{}
6278 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6279 if settings.Path != "" {
6280 baseUrl.Path = settings.Path
6281 }
6282 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
6283 if err != nil {
6284 return err
6285 }
6286 httpReq = httpReq.WithContext(ctx)
6287 httpReq.Header = headers
6288
6289 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateServiceLbPolicy")
6290 if err != nil {
6291 return err
6292 }
6293 if err := unm.Unmarshal(buf, resp); err != nil {
6294 return err
6295 }
6296
6297 return nil
6298 }, opts...)
6299 if e != nil {
6300 return nil, e
6301 }
6302
6303 override := fmt.Sprintf("/v1/%s", resp.GetName())
6304 return &CreateServiceLbPolicyOperation{
6305 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
6306 pollPath: override,
6307 }, nil
6308 }
6309
6310 // UpdateServiceLbPolicy updates the parameters of a single ServiceLbPolicy.
6311 func (c *restClient) UpdateServiceLbPolicy(ctx context.Context, req *networkservicespb.UpdateServiceLbPolicyRequest, opts ...gax.CallOption) (*UpdateServiceLbPolicyOperation, error) {
6312 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
6313 body := req.GetServiceLbPolicy()
6314 jsonReq, err := m.Marshal(body)
6315 if err != nil {
6316 return nil, err
6317 }
6318
6319 baseUrl, err := url.Parse(c.endpoint)
6320 if err != nil {
6321 return nil, err
6322 }
6323 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetServiceLbPolicy().GetName())
6324
6325 params := url.Values{}
6326 params.Add("$alt", "json;enum-encoding=int")
6327 if req.GetUpdateMask() != nil {
6328 field, err := protojson.Marshal(req.GetUpdateMask())
6329 if err != nil {
6330 return nil, err
6331 }
6332 params.Add("updateMask", string(field[1:len(field)-1]))
6333 }
6334
6335 baseUrl.RawQuery = params.Encode()
6336
6337 // Build HTTP headers from client and context metadata.
6338 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "service_lb_policy.name", url.QueryEscape(req.GetServiceLbPolicy().GetName()))}
6339
6340 hds = append(c.xGoogHeaders, hds...)
6341 hds = append(hds, "Content-Type", "application/json")
6342 headers := gax.BuildHeaders(ctx, hds...)
6343 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6344 resp := &longrunningpb.Operation{}
6345 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6346 if settings.Path != "" {
6347 baseUrl.Path = settings.Path
6348 }
6349 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
6350 if err != nil {
6351 return err
6352 }
6353 httpReq = httpReq.WithContext(ctx)
6354 httpReq.Header = headers
6355
6356 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateServiceLbPolicy")
6357 if err != nil {
6358 return err
6359 }
6360 if err := unm.Unmarshal(buf, resp); err != nil {
6361 return err
6362 }
6363
6364 return nil
6365 }, opts...)
6366 if e != nil {
6367 return nil, e
6368 }
6369
6370 override := fmt.Sprintf("/v1/%s", resp.GetName())
6371 return &UpdateServiceLbPolicyOperation{
6372 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
6373 pollPath: override,
6374 }, nil
6375 }
6376
6377 // DeleteServiceLbPolicy deletes a single ServiceLbPolicy.
6378 func (c *restClient) DeleteServiceLbPolicy(ctx context.Context, req *networkservicespb.DeleteServiceLbPolicyRequest, opts ...gax.CallOption) (*DeleteServiceLbPolicyOperation, error) {
6379 baseUrl, err := url.Parse(c.endpoint)
6380 if err != nil {
6381 return nil, err
6382 }
6383 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
6384
6385 params := url.Values{}
6386 params.Add("$alt", "json;enum-encoding=int")
6387
6388 baseUrl.RawQuery = params.Encode()
6389
6390 // Build HTTP headers from client and context metadata.
6391 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
6392
6393 hds = append(c.xGoogHeaders, hds...)
6394 hds = append(hds, "Content-Type", "application/json")
6395 headers := gax.BuildHeaders(ctx, hds...)
6396 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6397 resp := &longrunningpb.Operation{}
6398 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6399 if settings.Path != "" {
6400 baseUrl.Path = settings.Path
6401 }
6402 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
6403 if err != nil {
6404 return err
6405 }
6406 httpReq = httpReq.WithContext(ctx)
6407 httpReq.Header = headers
6408
6409 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteServiceLbPolicy")
6410 if err != nil {
6411 return err
6412 }
6413 if err := unm.Unmarshal(buf, resp); err != nil {
6414 return err
6415 }
6416
6417 return nil
6418 }, opts...)
6419 if e != nil {
6420 return nil, e
6421 }
6422
6423 override := fmt.Sprintf("/v1/%s", resp.GetName())
6424 return &DeleteServiceLbPolicyOperation{
6425 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
6426 pollPath: override,
6427 }, nil
6428 }
6429
6430 // GetGatewayRouteView get a single RouteView of a Gateway.
6431 func (c *restClient) GetGatewayRouteView(ctx context.Context, req *networkservicespb.GetGatewayRouteViewRequest, opts ...gax.CallOption) (*networkservicespb.GatewayRouteView, error) {
6432 baseUrl, err := url.Parse(c.endpoint)
6433 if err != nil {
6434 return nil, err
6435 }
6436 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
6437
6438 params := url.Values{}
6439 params.Add("$alt", "json;enum-encoding=int")
6440
6441 baseUrl.RawQuery = params.Encode()
6442
6443 // Build HTTP headers from client and context metadata.
6444 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
6445
6446 hds = append(c.xGoogHeaders, hds...)
6447 hds = append(hds, "Content-Type", "application/json")
6448 headers := gax.BuildHeaders(ctx, hds...)
6449 opts = append((*c.CallOptions).GetGatewayRouteView[0:len((*c.CallOptions).GetGatewayRouteView):len((*c.CallOptions).GetGatewayRouteView)], opts...)
6450 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6451 resp := &networkservicespb.GatewayRouteView{}
6452 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6453 if settings.Path != "" {
6454 baseUrl.Path = settings.Path
6455 }
6456 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
6457 if err != nil {
6458 return err
6459 }
6460 httpReq = httpReq.WithContext(ctx)
6461 httpReq.Header = headers
6462
6463 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetGatewayRouteView")
6464 if err != nil {
6465 return err
6466 }
6467
6468 if err := unm.Unmarshal(buf, resp); err != nil {
6469 return err
6470 }
6471
6472 return nil
6473 }, opts...)
6474 if e != nil {
6475 return nil, e
6476 }
6477 return resp, nil
6478 }
6479
6480 // GetMeshRouteView get a single RouteView of a Mesh.
6481 func (c *restClient) GetMeshRouteView(ctx context.Context, req *networkservicespb.GetMeshRouteViewRequest, opts ...gax.CallOption) (*networkservicespb.MeshRouteView, error) {
6482 baseUrl, err := url.Parse(c.endpoint)
6483 if err != nil {
6484 return nil, err
6485 }
6486 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
6487
6488 params := url.Values{}
6489 params.Add("$alt", "json;enum-encoding=int")
6490
6491 baseUrl.RawQuery = params.Encode()
6492
6493 // Build HTTP headers from client and context metadata.
6494 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
6495
6496 hds = append(c.xGoogHeaders, hds...)
6497 hds = append(hds, "Content-Type", "application/json")
6498 headers := gax.BuildHeaders(ctx, hds...)
6499 opts = append((*c.CallOptions).GetMeshRouteView[0:len((*c.CallOptions).GetMeshRouteView):len((*c.CallOptions).GetMeshRouteView)], opts...)
6500 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6501 resp := &networkservicespb.MeshRouteView{}
6502 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6503 if settings.Path != "" {
6504 baseUrl.Path = settings.Path
6505 }
6506 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
6507 if err != nil {
6508 return err
6509 }
6510 httpReq = httpReq.WithContext(ctx)
6511 httpReq.Header = headers
6512
6513 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetMeshRouteView")
6514 if err != nil {
6515 return err
6516 }
6517
6518 if err := unm.Unmarshal(buf, resp); err != nil {
6519 return err
6520 }
6521
6522 return nil
6523 }, opts...)
6524 if e != nil {
6525 return nil, e
6526 }
6527 return resp, nil
6528 }
6529
6530 // ListGatewayRouteViews lists RouteViews
6531 func (c *restClient) ListGatewayRouteViews(ctx context.Context, req *networkservicespb.ListGatewayRouteViewsRequest, opts ...gax.CallOption) *GatewayRouteViewIterator {
6532 it := &GatewayRouteViewIterator{}
6533 req = proto.Clone(req).(*networkservicespb.ListGatewayRouteViewsRequest)
6534 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6535 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.GatewayRouteView, string, error) {
6536 resp := &networkservicespb.ListGatewayRouteViewsResponse{}
6537 if pageToken != "" {
6538 req.PageToken = pageToken
6539 }
6540 if pageSize > math.MaxInt32 {
6541 req.PageSize = math.MaxInt32
6542 } else if pageSize != 0 {
6543 req.PageSize = int32(pageSize)
6544 }
6545 baseUrl, err := url.Parse(c.endpoint)
6546 if err != nil {
6547 return nil, "", err
6548 }
6549 baseUrl.Path += fmt.Sprintf("/v1/%v/routeViews", req.GetParent())
6550
6551 params := url.Values{}
6552 params.Add("$alt", "json;enum-encoding=int")
6553 if req.GetPageSize() != 0 {
6554 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
6555 }
6556 if req.GetPageToken() != "" {
6557 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
6558 }
6559
6560 baseUrl.RawQuery = params.Encode()
6561
6562 // Build HTTP headers from client and context metadata.
6563 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
6564 headers := gax.BuildHeaders(ctx, hds...)
6565 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6566 if settings.Path != "" {
6567 baseUrl.Path = settings.Path
6568 }
6569 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
6570 if err != nil {
6571 return err
6572 }
6573 httpReq.Header = headers
6574
6575 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListGatewayRouteViews")
6576 if err != nil {
6577 return err
6578 }
6579 if err := unm.Unmarshal(buf, resp); err != nil {
6580 return err
6581 }
6582
6583 return nil
6584 }, opts...)
6585 if e != nil {
6586 return nil, "", e
6587 }
6588 it.Response = resp
6589 return resp.GetGatewayRouteViews(), resp.GetNextPageToken(), nil
6590 }
6591
6592 fetch := func(pageSize int, pageToken string) (string, error) {
6593 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
6594 if err != nil {
6595 return "", err
6596 }
6597 it.items = append(it.items, items...)
6598 return nextPageToken, nil
6599 }
6600
6601 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
6602 it.pageInfo.MaxSize = int(req.GetPageSize())
6603 it.pageInfo.Token = req.GetPageToken()
6604
6605 return it
6606 }
6607
6608 // ListMeshRouteViews lists RouteViews
6609 func (c *restClient) ListMeshRouteViews(ctx context.Context, req *networkservicespb.ListMeshRouteViewsRequest, opts ...gax.CallOption) *MeshRouteViewIterator {
6610 it := &MeshRouteViewIterator{}
6611 req = proto.Clone(req).(*networkservicespb.ListMeshRouteViewsRequest)
6612 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6613 it.InternalFetch = func(pageSize int, pageToken string) ([]*networkservicespb.MeshRouteView, string, error) {
6614 resp := &networkservicespb.ListMeshRouteViewsResponse{}
6615 if pageToken != "" {
6616 req.PageToken = pageToken
6617 }
6618 if pageSize > math.MaxInt32 {
6619 req.PageSize = math.MaxInt32
6620 } else if pageSize != 0 {
6621 req.PageSize = int32(pageSize)
6622 }
6623 baseUrl, err := url.Parse(c.endpoint)
6624 if err != nil {
6625 return nil, "", err
6626 }
6627 baseUrl.Path += fmt.Sprintf("/v1/%v/routeViews", req.GetParent())
6628
6629 params := url.Values{}
6630 params.Add("$alt", "json;enum-encoding=int")
6631 if req.GetPageSize() != 0 {
6632 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
6633 }
6634 if req.GetPageToken() != "" {
6635 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
6636 }
6637
6638 baseUrl.RawQuery = params.Encode()
6639
6640 // Build HTTP headers from client and context metadata.
6641 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
6642 headers := gax.BuildHeaders(ctx, hds...)
6643 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6644 if settings.Path != "" {
6645 baseUrl.Path = settings.Path
6646 }
6647 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
6648 if err != nil {
6649 return err
6650 }
6651 httpReq.Header = headers
6652
6653 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListMeshRouteViews")
6654 if err != nil {
6655 return err
6656 }
6657 if err := unm.Unmarshal(buf, resp); err != nil {
6658 return err
6659 }
6660
6661 return nil
6662 }, opts...)
6663 if e != nil {
6664 return nil, "", e
6665 }
6666 it.Response = resp
6667 return resp.GetMeshRouteViews(), resp.GetNextPageToken(), nil
6668 }
6669
6670 fetch := func(pageSize int, pageToken string) (string, error) {
6671 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
6672 if err != nil {
6673 return "", err
6674 }
6675 it.items = append(it.items, items...)
6676 return nextPageToken, nil
6677 }
6678
6679 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
6680 it.pageInfo.MaxSize = int(req.GetPageSize())
6681 it.pageInfo.Token = req.GetPageToken()
6682
6683 return it
6684 }
6685
6686 // GetLocation gets information about a location.
6687 func (c *restClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
6688 baseUrl, err := url.Parse(c.endpoint)
6689 if err != nil {
6690 return nil, err
6691 }
6692 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
6693
6694 params := url.Values{}
6695 params.Add("$alt", "json;enum-encoding=int")
6696
6697 baseUrl.RawQuery = params.Encode()
6698
6699 // Build HTTP headers from client and context metadata.
6700 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
6701
6702 hds = append(c.xGoogHeaders, hds...)
6703 hds = append(hds, "Content-Type", "application/json")
6704 headers := gax.BuildHeaders(ctx, hds...)
6705 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
6706 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6707 resp := &locationpb.Location{}
6708 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6709 if settings.Path != "" {
6710 baseUrl.Path = settings.Path
6711 }
6712 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
6713 if err != nil {
6714 return err
6715 }
6716 httpReq = httpReq.WithContext(ctx)
6717 httpReq.Header = headers
6718
6719 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetLocation")
6720 if err != nil {
6721 return err
6722 }
6723
6724 if err := unm.Unmarshal(buf, resp); err != nil {
6725 return err
6726 }
6727
6728 return nil
6729 }, opts...)
6730 if e != nil {
6731 return nil, e
6732 }
6733 return resp, nil
6734 }
6735
6736 // ListLocations lists information about the supported locations for this service.
6737 func (c *restClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
6738 it := &LocationIterator{}
6739 req = proto.Clone(req).(*locationpb.ListLocationsRequest)
6740 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6741 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
6742 resp := &locationpb.ListLocationsResponse{}
6743 if pageToken != "" {
6744 req.PageToken = pageToken
6745 }
6746 if pageSize > math.MaxInt32 {
6747 req.PageSize = math.MaxInt32
6748 } else if pageSize != 0 {
6749 req.PageSize = int32(pageSize)
6750 }
6751 baseUrl, err := url.Parse(c.endpoint)
6752 if err != nil {
6753 return nil, "", err
6754 }
6755 baseUrl.Path += fmt.Sprintf("/v1/%v/locations", req.GetName())
6756
6757 params := url.Values{}
6758 params.Add("$alt", "json;enum-encoding=int")
6759 if req.GetFilter() != "" {
6760 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
6761 }
6762 if req.GetPageSize() != 0 {
6763 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
6764 }
6765 if req.GetPageToken() != "" {
6766 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
6767 }
6768
6769 baseUrl.RawQuery = params.Encode()
6770
6771 // Build HTTP headers from client and context metadata.
6772 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
6773 headers := gax.BuildHeaders(ctx, hds...)
6774 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6775 if settings.Path != "" {
6776 baseUrl.Path = settings.Path
6777 }
6778 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
6779 if err != nil {
6780 return err
6781 }
6782 httpReq.Header = headers
6783
6784 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListLocations")
6785 if err != nil {
6786 return err
6787 }
6788 if err := unm.Unmarshal(buf, resp); err != nil {
6789 return err
6790 }
6791
6792 return nil
6793 }, opts...)
6794 if e != nil {
6795 return nil, "", e
6796 }
6797 it.Response = resp
6798 return resp.GetLocations(), resp.GetNextPageToken(), nil
6799 }
6800
6801 fetch := func(pageSize int, pageToken string) (string, error) {
6802 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
6803 if err != nil {
6804 return "", err
6805 }
6806 it.items = append(it.items, items...)
6807 return nextPageToken, nil
6808 }
6809
6810 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
6811 it.pageInfo.MaxSize = int(req.GetPageSize())
6812 it.pageInfo.Token = req.GetPageToken()
6813
6814 return it
6815 }
6816
6817 // GetIamPolicy gets the access control policy for a resource. Returns an empty policy
6818 // if the resource exists and does not have a policy set.
6819 func (c *restClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
6820 baseUrl, err := url.Parse(c.endpoint)
6821 if err != nil {
6822 return nil, err
6823 }
6824 baseUrl.Path += fmt.Sprintf("/v1/%v:getIamPolicy", req.GetResource())
6825
6826 params := url.Values{}
6827 params.Add("$alt", "json;enum-encoding=int")
6828 if req.GetOptions().GetRequestedPolicyVersion() != 0 {
6829 params.Add("options.requestedPolicyVersion", fmt.Sprintf("%v", req.GetOptions().GetRequestedPolicyVersion()))
6830 }
6831
6832 baseUrl.RawQuery = params.Encode()
6833
6834 // Build HTTP headers from client and context metadata.
6835 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
6836
6837 hds = append(c.xGoogHeaders, hds...)
6838 hds = append(hds, "Content-Type", "application/json")
6839 headers := gax.BuildHeaders(ctx, hds...)
6840 opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
6841 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6842 resp := &iampb.Policy{}
6843 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6844 if settings.Path != "" {
6845 baseUrl.Path = settings.Path
6846 }
6847 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
6848 if err != nil {
6849 return err
6850 }
6851 httpReq = httpReq.WithContext(ctx)
6852 httpReq.Header = headers
6853
6854 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetIamPolicy")
6855 if err != nil {
6856 return err
6857 }
6858
6859 if err := unm.Unmarshal(buf, resp); err != nil {
6860 return err
6861 }
6862
6863 return nil
6864 }, opts...)
6865 if e != nil {
6866 return nil, e
6867 }
6868 return resp, nil
6869 }
6870
6871 // SetIamPolicy sets the access control policy on the specified resource. Replaces
6872 // any existing policy.
6873 //
6874 // Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
6875 // errors.
6876 func (c *restClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
6877 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
6878 jsonReq, err := m.Marshal(req)
6879 if err != nil {
6880 return nil, err
6881 }
6882
6883 baseUrl, err := url.Parse(c.endpoint)
6884 if err != nil {
6885 return nil, err
6886 }
6887 baseUrl.Path += fmt.Sprintf("/v1/%v:setIamPolicy", req.GetResource())
6888
6889 params := url.Values{}
6890 params.Add("$alt", "json;enum-encoding=int")
6891
6892 baseUrl.RawQuery = params.Encode()
6893
6894 // Build HTTP headers from client and context metadata.
6895 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
6896
6897 hds = append(c.xGoogHeaders, hds...)
6898 hds = append(hds, "Content-Type", "application/json")
6899 headers := gax.BuildHeaders(ctx, hds...)
6900 opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
6901 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6902 resp := &iampb.Policy{}
6903 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6904 if settings.Path != "" {
6905 baseUrl.Path = settings.Path
6906 }
6907 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
6908 if err != nil {
6909 return err
6910 }
6911 httpReq = httpReq.WithContext(ctx)
6912 httpReq.Header = headers
6913
6914 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "SetIamPolicy")
6915 if err != nil {
6916 return err
6917 }
6918
6919 if err := unm.Unmarshal(buf, resp); err != nil {
6920 return err
6921 }
6922
6923 return nil
6924 }, opts...)
6925 if e != nil {
6926 return nil, e
6927 }
6928 return resp, nil
6929 }
6930
6931 // TestIamPermissions returns permissions that a caller has on the specified resource. If the
6932 // resource does not exist, this will return an empty set of
6933 // permissions, not a NOT_FOUND error.
6934 //
6935 // Note: This operation is designed to be used for building
6936 // permission-aware UIs and command-line tools, not for authorization
6937 // checking. This operation may “fail open” without warning.
6938 func (c *restClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
6939 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
6940 jsonReq, err := m.Marshal(req)
6941 if err != nil {
6942 return nil, err
6943 }
6944
6945 baseUrl, err := url.Parse(c.endpoint)
6946 if err != nil {
6947 return nil, err
6948 }
6949 baseUrl.Path += fmt.Sprintf("/v1/%v:testIamPermissions", req.GetResource())
6950
6951 params := url.Values{}
6952 params.Add("$alt", "json;enum-encoding=int")
6953
6954 baseUrl.RawQuery = params.Encode()
6955
6956 // Build HTTP headers from client and context metadata.
6957 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource()))}
6958
6959 hds = append(c.xGoogHeaders, hds...)
6960 hds = append(hds, "Content-Type", "application/json")
6961 headers := gax.BuildHeaders(ctx, hds...)
6962 opts = append((*c.CallOptions).TestIamPermissions[0:len((*c.CallOptions).TestIamPermissions):len((*c.CallOptions).TestIamPermissions)], opts...)
6963 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
6964 resp := &iampb.TestIamPermissionsResponse{}
6965 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
6966 if settings.Path != "" {
6967 baseUrl.Path = settings.Path
6968 }
6969 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
6970 if err != nil {
6971 return err
6972 }
6973 httpReq = httpReq.WithContext(ctx)
6974 httpReq.Header = headers
6975
6976 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "TestIamPermissions")
6977 if err != nil {
6978 return err
6979 }
6980
6981 if err := unm.Unmarshal(buf, resp); err != nil {
6982 return err
6983 }
6984
6985 return nil
6986 }, opts...)
6987 if e != nil {
6988 return nil, e
6989 }
6990 return resp, nil
6991 }
6992
6993 // CancelOperation is a utility method from google.longrunning.Operations.
6994 func (c *restClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
6995 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
6996 jsonReq, err := m.Marshal(req)
6997 if err != nil {
6998 return err
6999 }
7000
7001 baseUrl, err := url.Parse(c.endpoint)
7002 if err != nil {
7003 return err
7004 }
7005 baseUrl.Path += fmt.Sprintf("/v1/%v:cancel", req.GetName())
7006
7007 params := url.Values{}
7008 params.Add("$alt", "json;enum-encoding=int")
7009
7010 baseUrl.RawQuery = params.Encode()
7011
7012 // Build HTTP headers from client and context metadata.
7013 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
7014
7015 hds = append(c.xGoogHeaders, hds...)
7016 hds = append(hds, "Content-Type", "application/json")
7017 headers := gax.BuildHeaders(ctx, hds...)
7018 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
7019 if settings.Path != "" {
7020 baseUrl.Path = settings.Path
7021 }
7022 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
7023 if err != nil {
7024 return err
7025 }
7026 httpReq = httpReq.WithContext(ctx)
7027 httpReq.Header = headers
7028
7029 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CancelOperation")
7030 return err
7031 }, opts...)
7032 }
7033
7034 // DeleteOperation is a utility method from google.longrunning.Operations.
7035 func (c *restClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
7036 baseUrl, err := url.Parse(c.endpoint)
7037 if err != nil {
7038 return err
7039 }
7040 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
7041
7042 params := url.Values{}
7043 params.Add("$alt", "json;enum-encoding=int")
7044
7045 baseUrl.RawQuery = params.Encode()
7046
7047 // Build HTTP headers from client and context metadata.
7048 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
7049
7050 hds = append(c.xGoogHeaders, hds...)
7051 hds = append(hds, "Content-Type", "application/json")
7052 headers := gax.BuildHeaders(ctx, hds...)
7053 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
7054 if settings.Path != "" {
7055 baseUrl.Path = settings.Path
7056 }
7057 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
7058 if err != nil {
7059 return err
7060 }
7061 httpReq = httpReq.WithContext(ctx)
7062 httpReq.Header = headers
7063
7064 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation")
7065 return err
7066 }, opts...)
7067 }
7068
7069 // GetOperation is a utility method from google.longrunning.Operations.
7070 func (c *restClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
7071 baseUrl, err := url.Parse(c.endpoint)
7072 if err != nil {
7073 return nil, err
7074 }
7075 baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName())
7076
7077 params := url.Values{}
7078 params.Add("$alt", "json;enum-encoding=int")
7079
7080 baseUrl.RawQuery = params.Encode()
7081
7082 // Build HTTP headers from client and context metadata.
7083 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
7084
7085 hds = append(c.xGoogHeaders, hds...)
7086 hds = append(hds, "Content-Type", "application/json")
7087 headers := gax.BuildHeaders(ctx, hds...)
7088 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
7089 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
7090 resp := &longrunningpb.Operation{}
7091 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
7092 if settings.Path != "" {
7093 baseUrl.Path = settings.Path
7094 }
7095 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
7096 if err != nil {
7097 return err
7098 }
7099 httpReq = httpReq.WithContext(ctx)
7100 httpReq.Header = headers
7101
7102 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOperation")
7103 if err != nil {
7104 return err
7105 }
7106
7107 if err := unm.Unmarshal(buf, resp); err != nil {
7108 return err
7109 }
7110
7111 return nil
7112 }, opts...)
7113 if e != nil {
7114 return nil, e
7115 }
7116 return resp, nil
7117 }
7118
7119 // ListOperations is a utility method from google.longrunning.Operations.
7120 func (c *restClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
7121 it := &OperationIterator{}
7122 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
7123 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
7124 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
7125 resp := &longrunningpb.ListOperationsResponse{}
7126 if pageToken != "" {
7127 req.PageToken = pageToken
7128 }
7129 if pageSize > math.MaxInt32 {
7130 req.PageSize = math.MaxInt32
7131 } else if pageSize != 0 {
7132 req.PageSize = int32(pageSize)
7133 }
7134 baseUrl, err := url.Parse(c.endpoint)
7135 if err != nil {
7136 return nil, "", err
7137 }
7138 baseUrl.Path += fmt.Sprintf("/v1/%v/operations", req.GetName())
7139
7140 params := url.Values{}
7141 params.Add("$alt", "json;enum-encoding=int")
7142 if req.GetFilter() != "" {
7143 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
7144 }
7145 if req.GetPageSize() != 0 {
7146 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
7147 }
7148 if req.GetPageToken() != "" {
7149 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
7150 }
7151
7152 baseUrl.RawQuery = params.Encode()
7153
7154 // Build HTTP headers from client and context metadata.
7155 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
7156 headers := gax.BuildHeaders(ctx, hds...)
7157 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
7158 if settings.Path != "" {
7159 baseUrl.Path = settings.Path
7160 }
7161 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
7162 if err != nil {
7163 return err
7164 }
7165 httpReq.Header = headers
7166
7167 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations")
7168 if err != nil {
7169 return err
7170 }
7171 if err := unm.Unmarshal(buf, resp); err != nil {
7172 return err
7173 }
7174
7175 return nil
7176 }, opts...)
7177 if e != nil {
7178 return nil, "", e
7179 }
7180 it.Response = resp
7181 return resp.GetOperations(), resp.GetNextPageToken(), nil
7182 }
7183
7184 fetch := func(pageSize int, pageToken string) (string, error) {
7185 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
7186 if err != nil {
7187 return "", err
7188 }
7189 it.items = append(it.items, items...)
7190 return nextPageToken, nil
7191 }
7192
7193 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
7194 it.pageInfo.MaxSize = int(req.GetPageSize())
7195 it.pageInfo.Token = req.GetPageToken()
7196
7197 return it
7198 }
7199
7200 // CreateEndpointPolicyOperation returns a new CreateEndpointPolicyOperation from a given name.
7201 // The name must be that of a previously created CreateEndpointPolicyOperation, possibly from a different process.
7202 func (c *gRPCClient) CreateEndpointPolicyOperation(name string) *CreateEndpointPolicyOperation {
7203 return &CreateEndpointPolicyOperation{
7204 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7205 }
7206 }
7207
7208 // CreateEndpointPolicyOperation returns a new CreateEndpointPolicyOperation from a given name.
7209 // The name must be that of a previously created CreateEndpointPolicyOperation, possibly from a different process.
7210 func (c *restClient) CreateEndpointPolicyOperation(name string) *CreateEndpointPolicyOperation {
7211 override := fmt.Sprintf("/v1/%s", name)
7212 return &CreateEndpointPolicyOperation{
7213 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7214 pollPath: override,
7215 }
7216 }
7217
7218 // CreateGatewayOperation returns a new CreateGatewayOperation from a given name.
7219 // The name must be that of a previously created CreateGatewayOperation, possibly from a different process.
7220 func (c *gRPCClient) CreateGatewayOperation(name string) *CreateGatewayOperation {
7221 return &CreateGatewayOperation{
7222 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7223 }
7224 }
7225
7226 // CreateGatewayOperation returns a new CreateGatewayOperation from a given name.
7227 // The name must be that of a previously created CreateGatewayOperation, possibly from a different process.
7228 func (c *restClient) CreateGatewayOperation(name string) *CreateGatewayOperation {
7229 override := fmt.Sprintf("/v1/%s", name)
7230 return &CreateGatewayOperation{
7231 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7232 pollPath: override,
7233 }
7234 }
7235
7236 // CreateGrpcRouteOperation returns a new CreateGrpcRouteOperation from a given name.
7237 // The name must be that of a previously created CreateGrpcRouteOperation, possibly from a different process.
7238 func (c *gRPCClient) CreateGrpcRouteOperation(name string) *CreateGrpcRouteOperation {
7239 return &CreateGrpcRouteOperation{
7240 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7241 }
7242 }
7243
7244 // CreateGrpcRouteOperation returns a new CreateGrpcRouteOperation from a given name.
7245 // The name must be that of a previously created CreateGrpcRouteOperation, possibly from a different process.
7246 func (c *restClient) CreateGrpcRouteOperation(name string) *CreateGrpcRouteOperation {
7247 override := fmt.Sprintf("/v1/%s", name)
7248 return &CreateGrpcRouteOperation{
7249 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7250 pollPath: override,
7251 }
7252 }
7253
7254 // CreateHttpRouteOperation returns a new CreateHttpRouteOperation from a given name.
7255 // The name must be that of a previously created CreateHttpRouteOperation, possibly from a different process.
7256 func (c *gRPCClient) CreateHttpRouteOperation(name string) *CreateHttpRouteOperation {
7257 return &CreateHttpRouteOperation{
7258 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7259 }
7260 }
7261
7262 // CreateHttpRouteOperation returns a new CreateHttpRouteOperation from a given name.
7263 // The name must be that of a previously created CreateHttpRouteOperation, possibly from a different process.
7264 func (c *restClient) CreateHttpRouteOperation(name string) *CreateHttpRouteOperation {
7265 override := fmt.Sprintf("/v1/%s", name)
7266 return &CreateHttpRouteOperation{
7267 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7268 pollPath: override,
7269 }
7270 }
7271
7272 // CreateMeshOperation returns a new CreateMeshOperation from a given name.
7273 // The name must be that of a previously created CreateMeshOperation, possibly from a different process.
7274 func (c *gRPCClient) CreateMeshOperation(name string) *CreateMeshOperation {
7275 return &CreateMeshOperation{
7276 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7277 }
7278 }
7279
7280 // CreateMeshOperation returns a new CreateMeshOperation from a given name.
7281 // The name must be that of a previously created CreateMeshOperation, possibly from a different process.
7282 func (c *restClient) CreateMeshOperation(name string) *CreateMeshOperation {
7283 override := fmt.Sprintf("/v1/%s", name)
7284 return &CreateMeshOperation{
7285 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7286 pollPath: override,
7287 }
7288 }
7289
7290 // CreateServiceBindingOperation returns a new CreateServiceBindingOperation from a given name.
7291 // The name must be that of a previously created CreateServiceBindingOperation, possibly from a different process.
7292 func (c *gRPCClient) CreateServiceBindingOperation(name string) *CreateServiceBindingOperation {
7293 return &CreateServiceBindingOperation{
7294 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7295 }
7296 }
7297
7298 // CreateServiceBindingOperation returns a new CreateServiceBindingOperation from a given name.
7299 // The name must be that of a previously created CreateServiceBindingOperation, possibly from a different process.
7300 func (c *restClient) CreateServiceBindingOperation(name string) *CreateServiceBindingOperation {
7301 override := fmt.Sprintf("/v1/%s", name)
7302 return &CreateServiceBindingOperation{
7303 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7304 pollPath: override,
7305 }
7306 }
7307
7308 // CreateServiceLbPolicyOperation returns a new CreateServiceLbPolicyOperation from a given name.
7309 // The name must be that of a previously created CreateServiceLbPolicyOperation, possibly from a different process.
7310 func (c *gRPCClient) CreateServiceLbPolicyOperation(name string) *CreateServiceLbPolicyOperation {
7311 return &CreateServiceLbPolicyOperation{
7312 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7313 }
7314 }
7315
7316 // CreateServiceLbPolicyOperation returns a new CreateServiceLbPolicyOperation from a given name.
7317 // The name must be that of a previously created CreateServiceLbPolicyOperation, possibly from a different process.
7318 func (c *restClient) CreateServiceLbPolicyOperation(name string) *CreateServiceLbPolicyOperation {
7319 override := fmt.Sprintf("/v1/%s", name)
7320 return &CreateServiceLbPolicyOperation{
7321 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7322 pollPath: override,
7323 }
7324 }
7325
7326 // CreateTcpRouteOperation returns a new CreateTcpRouteOperation from a given name.
7327 // The name must be that of a previously created CreateTcpRouteOperation, possibly from a different process.
7328 func (c *gRPCClient) CreateTcpRouteOperation(name string) *CreateTcpRouteOperation {
7329 return &CreateTcpRouteOperation{
7330 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7331 }
7332 }
7333
7334 // CreateTcpRouteOperation returns a new CreateTcpRouteOperation from a given name.
7335 // The name must be that of a previously created CreateTcpRouteOperation, possibly from a different process.
7336 func (c *restClient) CreateTcpRouteOperation(name string) *CreateTcpRouteOperation {
7337 override := fmt.Sprintf("/v1/%s", name)
7338 return &CreateTcpRouteOperation{
7339 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7340 pollPath: override,
7341 }
7342 }
7343
7344 // CreateTlsRouteOperation returns a new CreateTlsRouteOperation from a given name.
7345 // The name must be that of a previously created CreateTlsRouteOperation, possibly from a different process.
7346 func (c *gRPCClient) CreateTlsRouteOperation(name string) *CreateTlsRouteOperation {
7347 return &CreateTlsRouteOperation{
7348 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7349 }
7350 }
7351
7352 // CreateTlsRouteOperation returns a new CreateTlsRouteOperation from a given name.
7353 // The name must be that of a previously created CreateTlsRouteOperation, possibly from a different process.
7354 func (c *restClient) CreateTlsRouteOperation(name string) *CreateTlsRouteOperation {
7355 override := fmt.Sprintf("/v1/%s", name)
7356 return &CreateTlsRouteOperation{
7357 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7358 pollPath: override,
7359 }
7360 }
7361
7362 // CreateWasmPluginOperation returns a new CreateWasmPluginOperation from a given name.
7363 // The name must be that of a previously created CreateWasmPluginOperation, possibly from a different process.
7364 func (c *gRPCClient) CreateWasmPluginOperation(name string) *CreateWasmPluginOperation {
7365 return &CreateWasmPluginOperation{
7366 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7367 }
7368 }
7369
7370 // CreateWasmPluginOperation returns a new CreateWasmPluginOperation from a given name.
7371 // The name must be that of a previously created CreateWasmPluginOperation, possibly from a different process.
7372 func (c *restClient) CreateWasmPluginOperation(name string) *CreateWasmPluginOperation {
7373 override := fmt.Sprintf("/v1/%s", name)
7374 return &CreateWasmPluginOperation{
7375 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7376 pollPath: override,
7377 }
7378 }
7379
7380 // CreateWasmPluginVersionOperation returns a new CreateWasmPluginVersionOperation from a given name.
7381 // The name must be that of a previously created CreateWasmPluginVersionOperation, possibly from a different process.
7382 func (c *gRPCClient) CreateWasmPluginVersionOperation(name string) *CreateWasmPluginVersionOperation {
7383 return &CreateWasmPluginVersionOperation{
7384 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7385 }
7386 }
7387
7388 // CreateWasmPluginVersionOperation returns a new CreateWasmPluginVersionOperation from a given name.
7389 // The name must be that of a previously created CreateWasmPluginVersionOperation, possibly from a different process.
7390 func (c *restClient) CreateWasmPluginVersionOperation(name string) *CreateWasmPluginVersionOperation {
7391 override := fmt.Sprintf("/v1/%s", name)
7392 return &CreateWasmPluginVersionOperation{
7393 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7394 pollPath: override,
7395 }
7396 }
7397
7398 // DeleteEndpointPolicyOperation returns a new DeleteEndpointPolicyOperation from a given name.
7399 // The name must be that of a previously created DeleteEndpointPolicyOperation, possibly from a different process.
7400 func (c *gRPCClient) DeleteEndpointPolicyOperation(name string) *DeleteEndpointPolicyOperation {
7401 return &DeleteEndpointPolicyOperation{
7402 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7403 }
7404 }
7405
7406 // DeleteEndpointPolicyOperation returns a new DeleteEndpointPolicyOperation from a given name.
7407 // The name must be that of a previously created DeleteEndpointPolicyOperation, possibly from a different process.
7408 func (c *restClient) DeleteEndpointPolicyOperation(name string) *DeleteEndpointPolicyOperation {
7409 override := fmt.Sprintf("/v1/%s", name)
7410 return &DeleteEndpointPolicyOperation{
7411 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7412 pollPath: override,
7413 }
7414 }
7415
7416 // DeleteGatewayOperation returns a new DeleteGatewayOperation from a given name.
7417 // The name must be that of a previously created DeleteGatewayOperation, possibly from a different process.
7418 func (c *gRPCClient) DeleteGatewayOperation(name string) *DeleteGatewayOperation {
7419 return &DeleteGatewayOperation{
7420 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7421 }
7422 }
7423
7424 // DeleteGatewayOperation returns a new DeleteGatewayOperation from a given name.
7425 // The name must be that of a previously created DeleteGatewayOperation, possibly from a different process.
7426 func (c *restClient) DeleteGatewayOperation(name string) *DeleteGatewayOperation {
7427 override := fmt.Sprintf("/v1/%s", name)
7428 return &DeleteGatewayOperation{
7429 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7430 pollPath: override,
7431 }
7432 }
7433
7434 // DeleteGrpcRouteOperation returns a new DeleteGrpcRouteOperation from a given name.
7435 // The name must be that of a previously created DeleteGrpcRouteOperation, possibly from a different process.
7436 func (c *gRPCClient) DeleteGrpcRouteOperation(name string) *DeleteGrpcRouteOperation {
7437 return &DeleteGrpcRouteOperation{
7438 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7439 }
7440 }
7441
7442 // DeleteGrpcRouteOperation returns a new DeleteGrpcRouteOperation from a given name.
7443 // The name must be that of a previously created DeleteGrpcRouteOperation, possibly from a different process.
7444 func (c *restClient) DeleteGrpcRouteOperation(name string) *DeleteGrpcRouteOperation {
7445 override := fmt.Sprintf("/v1/%s", name)
7446 return &DeleteGrpcRouteOperation{
7447 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7448 pollPath: override,
7449 }
7450 }
7451
7452 // DeleteHttpRouteOperation returns a new DeleteHttpRouteOperation from a given name.
7453 // The name must be that of a previously created DeleteHttpRouteOperation, possibly from a different process.
7454 func (c *gRPCClient) DeleteHttpRouteOperation(name string) *DeleteHttpRouteOperation {
7455 return &DeleteHttpRouteOperation{
7456 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7457 }
7458 }
7459
7460 // DeleteHttpRouteOperation returns a new DeleteHttpRouteOperation from a given name.
7461 // The name must be that of a previously created DeleteHttpRouteOperation, possibly from a different process.
7462 func (c *restClient) DeleteHttpRouteOperation(name string) *DeleteHttpRouteOperation {
7463 override := fmt.Sprintf("/v1/%s", name)
7464 return &DeleteHttpRouteOperation{
7465 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7466 pollPath: override,
7467 }
7468 }
7469
7470 // DeleteMeshOperation returns a new DeleteMeshOperation from a given name.
7471 // The name must be that of a previously created DeleteMeshOperation, possibly from a different process.
7472 func (c *gRPCClient) DeleteMeshOperation(name string) *DeleteMeshOperation {
7473 return &DeleteMeshOperation{
7474 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7475 }
7476 }
7477
7478 // DeleteMeshOperation returns a new DeleteMeshOperation from a given name.
7479 // The name must be that of a previously created DeleteMeshOperation, possibly from a different process.
7480 func (c *restClient) DeleteMeshOperation(name string) *DeleteMeshOperation {
7481 override := fmt.Sprintf("/v1/%s", name)
7482 return &DeleteMeshOperation{
7483 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7484 pollPath: override,
7485 }
7486 }
7487
7488 // DeleteServiceBindingOperation returns a new DeleteServiceBindingOperation from a given name.
7489 // The name must be that of a previously created DeleteServiceBindingOperation, possibly from a different process.
7490 func (c *gRPCClient) DeleteServiceBindingOperation(name string) *DeleteServiceBindingOperation {
7491 return &DeleteServiceBindingOperation{
7492 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7493 }
7494 }
7495
7496 // DeleteServiceBindingOperation returns a new DeleteServiceBindingOperation from a given name.
7497 // The name must be that of a previously created DeleteServiceBindingOperation, possibly from a different process.
7498 func (c *restClient) DeleteServiceBindingOperation(name string) *DeleteServiceBindingOperation {
7499 override := fmt.Sprintf("/v1/%s", name)
7500 return &DeleteServiceBindingOperation{
7501 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7502 pollPath: override,
7503 }
7504 }
7505
7506 // DeleteServiceLbPolicyOperation returns a new DeleteServiceLbPolicyOperation from a given name.
7507 // The name must be that of a previously created DeleteServiceLbPolicyOperation, possibly from a different process.
7508 func (c *gRPCClient) DeleteServiceLbPolicyOperation(name string) *DeleteServiceLbPolicyOperation {
7509 return &DeleteServiceLbPolicyOperation{
7510 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7511 }
7512 }
7513
7514 // DeleteServiceLbPolicyOperation returns a new DeleteServiceLbPolicyOperation from a given name.
7515 // The name must be that of a previously created DeleteServiceLbPolicyOperation, possibly from a different process.
7516 func (c *restClient) DeleteServiceLbPolicyOperation(name string) *DeleteServiceLbPolicyOperation {
7517 override := fmt.Sprintf("/v1/%s", name)
7518 return &DeleteServiceLbPolicyOperation{
7519 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7520 pollPath: override,
7521 }
7522 }
7523
7524 // DeleteTcpRouteOperation returns a new DeleteTcpRouteOperation from a given name.
7525 // The name must be that of a previously created DeleteTcpRouteOperation, possibly from a different process.
7526 func (c *gRPCClient) DeleteTcpRouteOperation(name string) *DeleteTcpRouteOperation {
7527 return &DeleteTcpRouteOperation{
7528 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7529 }
7530 }
7531
7532 // DeleteTcpRouteOperation returns a new DeleteTcpRouteOperation from a given name.
7533 // The name must be that of a previously created DeleteTcpRouteOperation, possibly from a different process.
7534 func (c *restClient) DeleteTcpRouteOperation(name string) *DeleteTcpRouteOperation {
7535 override := fmt.Sprintf("/v1/%s", name)
7536 return &DeleteTcpRouteOperation{
7537 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7538 pollPath: override,
7539 }
7540 }
7541
7542 // DeleteTlsRouteOperation returns a new DeleteTlsRouteOperation from a given name.
7543 // The name must be that of a previously created DeleteTlsRouteOperation, possibly from a different process.
7544 func (c *gRPCClient) DeleteTlsRouteOperation(name string) *DeleteTlsRouteOperation {
7545 return &DeleteTlsRouteOperation{
7546 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7547 }
7548 }
7549
7550 // DeleteTlsRouteOperation returns a new DeleteTlsRouteOperation from a given name.
7551 // The name must be that of a previously created DeleteTlsRouteOperation, possibly from a different process.
7552 func (c *restClient) DeleteTlsRouteOperation(name string) *DeleteTlsRouteOperation {
7553 override := fmt.Sprintf("/v1/%s", name)
7554 return &DeleteTlsRouteOperation{
7555 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7556 pollPath: override,
7557 }
7558 }
7559
7560 // DeleteWasmPluginOperation returns a new DeleteWasmPluginOperation from a given name.
7561 // The name must be that of a previously created DeleteWasmPluginOperation, possibly from a different process.
7562 func (c *gRPCClient) DeleteWasmPluginOperation(name string) *DeleteWasmPluginOperation {
7563 return &DeleteWasmPluginOperation{
7564 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7565 }
7566 }
7567
7568 // DeleteWasmPluginOperation returns a new DeleteWasmPluginOperation from a given name.
7569 // The name must be that of a previously created DeleteWasmPluginOperation, possibly from a different process.
7570 func (c *restClient) DeleteWasmPluginOperation(name string) *DeleteWasmPluginOperation {
7571 override := fmt.Sprintf("/v1/%s", name)
7572 return &DeleteWasmPluginOperation{
7573 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7574 pollPath: override,
7575 }
7576 }
7577
7578 // DeleteWasmPluginVersionOperation returns a new DeleteWasmPluginVersionOperation from a given name.
7579 // The name must be that of a previously created DeleteWasmPluginVersionOperation, possibly from a different process.
7580 func (c *gRPCClient) DeleteWasmPluginVersionOperation(name string) *DeleteWasmPluginVersionOperation {
7581 return &DeleteWasmPluginVersionOperation{
7582 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7583 }
7584 }
7585
7586 // DeleteWasmPluginVersionOperation returns a new DeleteWasmPluginVersionOperation from a given name.
7587 // The name must be that of a previously created DeleteWasmPluginVersionOperation, possibly from a different process.
7588 func (c *restClient) DeleteWasmPluginVersionOperation(name string) *DeleteWasmPluginVersionOperation {
7589 override := fmt.Sprintf("/v1/%s", name)
7590 return &DeleteWasmPluginVersionOperation{
7591 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7592 pollPath: override,
7593 }
7594 }
7595
7596 // UpdateEndpointPolicyOperation returns a new UpdateEndpointPolicyOperation from a given name.
7597 // The name must be that of a previously created UpdateEndpointPolicyOperation, possibly from a different process.
7598 func (c *gRPCClient) UpdateEndpointPolicyOperation(name string) *UpdateEndpointPolicyOperation {
7599 return &UpdateEndpointPolicyOperation{
7600 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7601 }
7602 }
7603
7604 // UpdateEndpointPolicyOperation returns a new UpdateEndpointPolicyOperation from a given name.
7605 // The name must be that of a previously created UpdateEndpointPolicyOperation, possibly from a different process.
7606 func (c *restClient) UpdateEndpointPolicyOperation(name string) *UpdateEndpointPolicyOperation {
7607 override := fmt.Sprintf("/v1/%s", name)
7608 return &UpdateEndpointPolicyOperation{
7609 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7610 pollPath: override,
7611 }
7612 }
7613
7614 // UpdateGatewayOperation returns a new UpdateGatewayOperation from a given name.
7615 // The name must be that of a previously created UpdateGatewayOperation, possibly from a different process.
7616 func (c *gRPCClient) UpdateGatewayOperation(name string) *UpdateGatewayOperation {
7617 return &UpdateGatewayOperation{
7618 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7619 }
7620 }
7621
7622 // UpdateGatewayOperation returns a new UpdateGatewayOperation from a given name.
7623 // The name must be that of a previously created UpdateGatewayOperation, possibly from a different process.
7624 func (c *restClient) UpdateGatewayOperation(name string) *UpdateGatewayOperation {
7625 override := fmt.Sprintf("/v1/%s", name)
7626 return &UpdateGatewayOperation{
7627 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7628 pollPath: override,
7629 }
7630 }
7631
7632 // UpdateGrpcRouteOperation returns a new UpdateGrpcRouteOperation from a given name.
7633 // The name must be that of a previously created UpdateGrpcRouteOperation, possibly from a different process.
7634 func (c *gRPCClient) UpdateGrpcRouteOperation(name string) *UpdateGrpcRouteOperation {
7635 return &UpdateGrpcRouteOperation{
7636 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7637 }
7638 }
7639
7640 // UpdateGrpcRouteOperation returns a new UpdateGrpcRouteOperation from a given name.
7641 // The name must be that of a previously created UpdateGrpcRouteOperation, possibly from a different process.
7642 func (c *restClient) UpdateGrpcRouteOperation(name string) *UpdateGrpcRouteOperation {
7643 override := fmt.Sprintf("/v1/%s", name)
7644 return &UpdateGrpcRouteOperation{
7645 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7646 pollPath: override,
7647 }
7648 }
7649
7650 // UpdateHttpRouteOperation returns a new UpdateHttpRouteOperation from a given name.
7651 // The name must be that of a previously created UpdateHttpRouteOperation, possibly from a different process.
7652 func (c *gRPCClient) UpdateHttpRouteOperation(name string) *UpdateHttpRouteOperation {
7653 return &UpdateHttpRouteOperation{
7654 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7655 }
7656 }
7657
7658 // UpdateHttpRouteOperation returns a new UpdateHttpRouteOperation from a given name.
7659 // The name must be that of a previously created UpdateHttpRouteOperation, possibly from a different process.
7660 func (c *restClient) UpdateHttpRouteOperation(name string) *UpdateHttpRouteOperation {
7661 override := fmt.Sprintf("/v1/%s", name)
7662 return &UpdateHttpRouteOperation{
7663 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7664 pollPath: override,
7665 }
7666 }
7667
7668 // UpdateMeshOperation returns a new UpdateMeshOperation from a given name.
7669 // The name must be that of a previously created UpdateMeshOperation, possibly from a different process.
7670 func (c *gRPCClient) UpdateMeshOperation(name string) *UpdateMeshOperation {
7671 return &UpdateMeshOperation{
7672 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7673 }
7674 }
7675
7676 // UpdateMeshOperation returns a new UpdateMeshOperation from a given name.
7677 // The name must be that of a previously created UpdateMeshOperation, possibly from a different process.
7678 func (c *restClient) UpdateMeshOperation(name string) *UpdateMeshOperation {
7679 override := fmt.Sprintf("/v1/%s", name)
7680 return &UpdateMeshOperation{
7681 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7682 pollPath: override,
7683 }
7684 }
7685
7686 // UpdateServiceBindingOperation returns a new UpdateServiceBindingOperation from a given name.
7687 // The name must be that of a previously created UpdateServiceBindingOperation, possibly from a different process.
7688 func (c *gRPCClient) UpdateServiceBindingOperation(name string) *UpdateServiceBindingOperation {
7689 return &UpdateServiceBindingOperation{
7690 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7691 }
7692 }
7693
7694 // UpdateServiceBindingOperation returns a new UpdateServiceBindingOperation from a given name.
7695 // The name must be that of a previously created UpdateServiceBindingOperation, possibly from a different process.
7696 func (c *restClient) UpdateServiceBindingOperation(name string) *UpdateServiceBindingOperation {
7697 override := fmt.Sprintf("/v1/%s", name)
7698 return &UpdateServiceBindingOperation{
7699 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7700 pollPath: override,
7701 }
7702 }
7703
7704 // UpdateServiceLbPolicyOperation returns a new UpdateServiceLbPolicyOperation from a given name.
7705 // The name must be that of a previously created UpdateServiceLbPolicyOperation, possibly from a different process.
7706 func (c *gRPCClient) UpdateServiceLbPolicyOperation(name string) *UpdateServiceLbPolicyOperation {
7707 return &UpdateServiceLbPolicyOperation{
7708 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7709 }
7710 }
7711
7712 // UpdateServiceLbPolicyOperation returns a new UpdateServiceLbPolicyOperation from a given name.
7713 // The name must be that of a previously created UpdateServiceLbPolicyOperation, possibly from a different process.
7714 func (c *restClient) UpdateServiceLbPolicyOperation(name string) *UpdateServiceLbPolicyOperation {
7715 override := fmt.Sprintf("/v1/%s", name)
7716 return &UpdateServiceLbPolicyOperation{
7717 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7718 pollPath: override,
7719 }
7720 }
7721
7722 // UpdateTcpRouteOperation returns a new UpdateTcpRouteOperation from a given name.
7723 // The name must be that of a previously created UpdateTcpRouteOperation, possibly from a different process.
7724 func (c *gRPCClient) UpdateTcpRouteOperation(name string) *UpdateTcpRouteOperation {
7725 return &UpdateTcpRouteOperation{
7726 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7727 }
7728 }
7729
7730 // UpdateTcpRouteOperation returns a new UpdateTcpRouteOperation from a given name.
7731 // The name must be that of a previously created UpdateTcpRouteOperation, possibly from a different process.
7732 func (c *restClient) UpdateTcpRouteOperation(name string) *UpdateTcpRouteOperation {
7733 override := fmt.Sprintf("/v1/%s", name)
7734 return &UpdateTcpRouteOperation{
7735 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7736 pollPath: override,
7737 }
7738 }
7739
7740 // UpdateTlsRouteOperation returns a new UpdateTlsRouteOperation from a given name.
7741 // The name must be that of a previously created UpdateTlsRouteOperation, possibly from a different process.
7742 func (c *gRPCClient) UpdateTlsRouteOperation(name string) *UpdateTlsRouteOperation {
7743 return &UpdateTlsRouteOperation{
7744 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7745 }
7746 }
7747
7748 // UpdateTlsRouteOperation returns a new UpdateTlsRouteOperation from a given name.
7749 // The name must be that of a previously created UpdateTlsRouteOperation, possibly from a different process.
7750 func (c *restClient) UpdateTlsRouteOperation(name string) *UpdateTlsRouteOperation {
7751 override := fmt.Sprintf("/v1/%s", name)
7752 return &UpdateTlsRouteOperation{
7753 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7754 pollPath: override,
7755 }
7756 }
7757
7758 // UpdateWasmPluginOperation returns a new UpdateWasmPluginOperation from a given name.
7759 // The name must be that of a previously created UpdateWasmPluginOperation, possibly from a different process.
7760 func (c *gRPCClient) UpdateWasmPluginOperation(name string) *UpdateWasmPluginOperation {
7761 return &UpdateWasmPluginOperation{
7762 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7763 }
7764 }
7765
7766 // UpdateWasmPluginOperation returns a new UpdateWasmPluginOperation from a given name.
7767 // The name must be that of a previously created UpdateWasmPluginOperation, possibly from a different process.
7768 func (c *restClient) UpdateWasmPluginOperation(name string) *UpdateWasmPluginOperation {
7769 override := fmt.Sprintf("/v1/%s", name)
7770 return &UpdateWasmPluginOperation{
7771 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
7772 pollPath: override,
7773 }
7774 }