Debian Codegraph @

configdelivery/apiv1beta/config_delivery_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 configdelivery
18
19 import (
20 "bytes"
21 "context"
22 "fmt"
23 "log/slog"
24 "math"
25 "net/http"
26 "net/url"
27 "time"
28
29 configdeliverypb "cloud.google.com/go/configdelivery/apiv1beta/configdeliverypb"
30 "cloud.google.com/go/longrunning"
31 lroauto "cloud.google.com/go/longrunning/autogen"
32 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
33 gax "github.com/googleapis/gax-go/v2"
34 "google.golang.org/api/iterator"
35 "google.golang.org/api/option"
36 "google.golang.org/api/option/internaloption"
37 gtransport "google.golang.org/api/transport/grpc"
38 httptransport "google.golang.org/api/transport/http"
39 locationpb "google.golang.org/genproto/googleapis/cloud/location"
40 "google.golang.org/grpc"
41 "google.golang.org/grpc/codes"
42 "google.golang.org/protobuf/encoding/protojson"
43 "google.golang.org/protobuf/proto"
44 )
45
46 var newClientHook clientHook
47
48 // CallOptions contains the retry settings for each method of Client.
49 type CallOptions struct {
50 ListResourceBundles []gax.CallOption
51 GetResourceBundle []gax.CallOption
52 CreateResourceBundle []gax.CallOption
53 UpdateResourceBundle []gax.CallOption
54 DeleteResourceBundle []gax.CallOption
55 ListFleetPackages []gax.CallOption
56 GetFleetPackage []gax.CallOption
57 CreateFleetPackage []gax.CallOption
58 UpdateFleetPackage []gax.CallOption
59 DeleteFleetPackage []gax.CallOption
60 ListReleases []gax.CallOption
61 GetRelease []gax.CallOption
62 CreateRelease []gax.CallOption
63 UpdateRelease []gax.CallOption
64 DeleteRelease []gax.CallOption
65 ListVariants []gax.CallOption
66 GetVariant []gax.CallOption
67 CreateVariant []gax.CallOption
68 UpdateVariant []gax.CallOption
69 DeleteVariant []gax.CallOption
70 ListRollouts []gax.CallOption
71 GetRollout []gax.CallOption
72 SuspendRollout []gax.CallOption
73 ResumeRollout []gax.CallOption
74 AbortRollout []gax.CallOption
75 GetLocation []gax.CallOption
76 ListLocations []gax.CallOption
77 CancelOperation []gax.CallOption
78 DeleteOperation []gax.CallOption
79 GetOperation []gax.CallOption
80 ListOperations []gax.CallOption
81 }
82
83 func defaultGRPCClientOptions() []option.ClientOption {
84 return []option.ClientOption{
85 internaloption.WithDefaultEndpoint("configdelivery.googleapis.com:443"),
86 internaloption.WithDefaultEndpointTemplate("configdelivery.UNIVERSE_DOMAIN:443"),
87 internaloption.WithDefaultMTLSEndpoint("configdelivery.mtls.googleapis.com:443"),
88 internaloption.WithDefaultUniverseDomain("googleapis.com"),
89 internaloption.WithDefaultAudience("https://configdelivery.googleapis.com/"),
90 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
91 internaloption.EnableJwtWithScope(),
92 internaloption.EnableNewAuthLibrary(),
93 option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
94 grpc.MaxCallRecvMsgSize(math.MaxInt32))),
95 }
96 }
97
98 func defaultCallOptions() *CallOptions {
99 return &CallOptions{
100 ListResourceBundles: []gax.CallOption{
101 gax.WithTimeout(60000 * time.Millisecond),
102 gax.WithRetry(func() gax.Retryer {
103 return gax.OnCodes([]codes.Code{
104 codes.Unavailable,
105 }, gax.Backoff{
106 Initial: 1000 * time.Millisecond,
107 Max: 10000 * time.Millisecond,
108 Multiplier: 1.30,
109 })
110 }),
111 },
112 GetResourceBundle: []gax.CallOption{
113 gax.WithTimeout(60000 * time.Millisecond),
114 gax.WithRetry(func() gax.Retryer {
115 return gax.OnCodes([]codes.Code{
116 codes.Unavailable,
117 }, gax.Backoff{
118 Initial: 1000 * time.Millisecond,
119 Max: 10000 * time.Millisecond,
120 Multiplier: 1.30,
121 })
122 }),
123 },
124 CreateResourceBundle: []gax.CallOption{
125 gax.WithTimeout(60000 * time.Millisecond),
126 },
127 UpdateResourceBundle: []gax.CallOption{
128 gax.WithTimeout(60000 * time.Millisecond),
129 },
130 DeleteResourceBundle: []gax.CallOption{
131 gax.WithTimeout(60000 * time.Millisecond),
132 },
133 ListFleetPackages: []gax.CallOption{
134 gax.WithTimeout(60000 * time.Millisecond),
135 gax.WithRetry(func() gax.Retryer {
136 return gax.OnCodes([]codes.Code{
137 codes.Unavailable,
138 }, gax.Backoff{
139 Initial: 1000 * time.Millisecond,
140 Max: 10000 * time.Millisecond,
141 Multiplier: 1.30,
142 })
143 }),
144 },
145 GetFleetPackage: []gax.CallOption{
146 gax.WithTimeout(60000 * time.Millisecond),
147 gax.WithRetry(func() gax.Retryer {
148 return gax.OnCodes([]codes.Code{
149 codes.Unavailable,
150 }, gax.Backoff{
151 Initial: 1000 * time.Millisecond,
152 Max: 10000 * time.Millisecond,
153 Multiplier: 1.30,
154 })
155 }),
156 },
157 CreateFleetPackage: []gax.CallOption{
158 gax.WithTimeout(60000 * time.Millisecond),
159 },
160 UpdateFleetPackage: []gax.CallOption{
161 gax.WithTimeout(60000 * time.Millisecond),
162 },
163 DeleteFleetPackage: []gax.CallOption{
164 gax.WithTimeout(60000 * time.Millisecond),
165 },
166 ListReleases: []gax.CallOption{
167 gax.WithTimeout(60000 * time.Millisecond),
168 gax.WithRetry(func() gax.Retryer {
169 return gax.OnCodes([]codes.Code{
170 codes.Unavailable,
171 }, gax.Backoff{
172 Initial: 1000 * time.Millisecond,
173 Max: 10000 * time.Millisecond,
174 Multiplier: 1.30,
175 })
176 }),
177 },
178 GetRelease: []gax.CallOption{
179 gax.WithTimeout(60000 * time.Millisecond),
180 gax.WithRetry(func() gax.Retryer {
181 return gax.OnCodes([]codes.Code{
182 codes.Unavailable,
183 }, gax.Backoff{
184 Initial: 1000 * time.Millisecond,
185 Max: 10000 * time.Millisecond,
186 Multiplier: 1.30,
187 })
188 }),
189 },
190 CreateRelease: []gax.CallOption{
191 gax.WithTimeout(60000 * time.Millisecond),
192 },
193 UpdateRelease: []gax.CallOption{
194 gax.WithTimeout(60000 * time.Millisecond),
195 },
196 DeleteRelease: []gax.CallOption{
197 gax.WithTimeout(60000 * time.Millisecond),
198 },
199 ListVariants: []gax.CallOption{
200 gax.WithTimeout(60000 * time.Millisecond),
201 gax.WithRetry(func() gax.Retryer {
202 return gax.OnCodes([]codes.Code{
203 codes.Unavailable,
204 }, gax.Backoff{
205 Initial: 1000 * time.Millisecond,
206 Max: 10000 * time.Millisecond,
207 Multiplier: 1.30,
208 })
209 }),
210 },
211 GetVariant: []gax.CallOption{
212 gax.WithTimeout(60000 * time.Millisecond),
213 gax.WithRetry(func() gax.Retryer {
214 return gax.OnCodes([]codes.Code{
215 codes.Unavailable,
216 }, gax.Backoff{
217 Initial: 1000 * time.Millisecond,
218 Max: 10000 * time.Millisecond,
219 Multiplier: 1.30,
220 })
221 }),
222 },
223 CreateVariant: []gax.CallOption{
224 gax.WithTimeout(60000 * time.Millisecond),
225 },
226 UpdateVariant: []gax.CallOption{
227 gax.WithTimeout(60000 * time.Millisecond),
228 },
229 DeleteVariant: []gax.CallOption{
230 gax.WithTimeout(60000 * time.Millisecond),
231 },
232 ListRollouts: []gax.CallOption{
233 gax.WithTimeout(60000 * time.Millisecond),
234 gax.WithRetry(func() gax.Retryer {
235 return gax.OnCodes([]codes.Code{
236 codes.Unavailable,
237 }, gax.Backoff{
238 Initial: 1000 * time.Millisecond,
239 Max: 10000 * time.Millisecond,
240 Multiplier: 1.30,
241 })
242 }),
243 },
244 GetRollout: []gax.CallOption{
245 gax.WithTimeout(60000 * time.Millisecond),
246 gax.WithRetry(func() gax.Retryer {
247 return gax.OnCodes([]codes.Code{
248 codes.Unavailable,
249 }, gax.Backoff{
250 Initial: 1000 * time.Millisecond,
251 Max: 10000 * time.Millisecond,
252 Multiplier: 1.30,
253 })
254 }),
255 },
256 SuspendRollout: []gax.CallOption{
257 gax.WithTimeout(60000 * time.Millisecond),
258 },
259 ResumeRollout: []gax.CallOption{
260 gax.WithTimeout(60000 * time.Millisecond),
261 },
262 AbortRollout: []gax.CallOption{
263 gax.WithTimeout(60000 * time.Millisecond),
264 },
265 GetLocation: []gax.CallOption{},
266 ListLocations: []gax.CallOption{},
267 CancelOperation: []gax.CallOption{},
268 DeleteOperation: []gax.CallOption{},
269 GetOperation: []gax.CallOption{},
270 ListOperations: []gax.CallOption{},
271 }
272 }
273
274 func defaultRESTCallOptions() *CallOptions {
275 return &CallOptions{
276 ListResourceBundles: []gax.CallOption{
277 gax.WithTimeout(60000 * time.Millisecond),
278 gax.WithRetry(func() gax.Retryer {
279 return gax.OnHTTPCodes(gax.Backoff{
280 Initial: 1000 * time.Millisecond,
281 Max: 10000 * time.Millisecond,
282 Multiplier: 1.30,
283 },
284 http.StatusServiceUnavailable)
285 }),
286 },
287 GetResourceBundle: []gax.CallOption{
288 gax.WithTimeout(60000 * time.Millisecond),
289 gax.WithRetry(func() gax.Retryer {
290 return gax.OnHTTPCodes(gax.Backoff{
291 Initial: 1000 * time.Millisecond,
292 Max: 10000 * time.Millisecond,
293 Multiplier: 1.30,
294 },
295 http.StatusServiceUnavailable)
296 }),
297 },
298 CreateResourceBundle: []gax.CallOption{
299 gax.WithTimeout(60000 * time.Millisecond),
300 },
301 UpdateResourceBundle: []gax.CallOption{
302 gax.WithTimeout(60000 * time.Millisecond),
303 },
304 DeleteResourceBundle: []gax.CallOption{
305 gax.WithTimeout(60000 * time.Millisecond),
306 },
307 ListFleetPackages: []gax.CallOption{
308 gax.WithTimeout(60000 * time.Millisecond),
309 gax.WithRetry(func() gax.Retryer {
310 return gax.OnHTTPCodes(gax.Backoff{
311 Initial: 1000 * time.Millisecond,
312 Max: 10000 * time.Millisecond,
313 Multiplier: 1.30,
314 },
315 http.StatusServiceUnavailable)
316 }),
317 },
318 GetFleetPackage: []gax.CallOption{
319 gax.WithTimeout(60000 * time.Millisecond),
320 gax.WithRetry(func() gax.Retryer {
321 return gax.OnHTTPCodes(gax.Backoff{
322 Initial: 1000 * time.Millisecond,
323 Max: 10000 * time.Millisecond,
324 Multiplier: 1.30,
325 },
326 http.StatusServiceUnavailable)
327 }),
328 },
329 CreateFleetPackage: []gax.CallOption{
330 gax.WithTimeout(60000 * time.Millisecond),
331 },
332 UpdateFleetPackage: []gax.CallOption{
333 gax.WithTimeout(60000 * time.Millisecond),
334 },
335 DeleteFleetPackage: []gax.CallOption{
336 gax.WithTimeout(60000 * time.Millisecond),
337 },
338 ListReleases: []gax.CallOption{
339 gax.WithTimeout(60000 * time.Millisecond),
340 gax.WithRetry(func() gax.Retryer {
341 return gax.OnHTTPCodes(gax.Backoff{
342 Initial: 1000 * time.Millisecond,
343 Max: 10000 * time.Millisecond,
344 Multiplier: 1.30,
345 },
346 http.StatusServiceUnavailable)
347 }),
348 },
349 GetRelease: []gax.CallOption{
350 gax.WithTimeout(60000 * time.Millisecond),
351 gax.WithRetry(func() gax.Retryer {
352 return gax.OnHTTPCodes(gax.Backoff{
353 Initial: 1000 * time.Millisecond,
354 Max: 10000 * time.Millisecond,
355 Multiplier: 1.30,
356 },
357 http.StatusServiceUnavailable)
358 }),
359 },
360 CreateRelease: []gax.CallOption{
361 gax.WithTimeout(60000 * time.Millisecond),
362 },
363 UpdateRelease: []gax.CallOption{
364 gax.WithTimeout(60000 * time.Millisecond),
365 },
366 DeleteRelease: []gax.CallOption{
367 gax.WithTimeout(60000 * time.Millisecond),
368 },
369 ListVariants: []gax.CallOption{
370 gax.WithTimeout(60000 * time.Millisecond),
371 gax.WithRetry(func() gax.Retryer {
372 return gax.OnHTTPCodes(gax.Backoff{
373 Initial: 1000 * time.Millisecond,
374 Max: 10000 * time.Millisecond,
375 Multiplier: 1.30,
376 },
377 http.StatusServiceUnavailable)
378 }),
379 },
380 GetVariant: []gax.CallOption{
381 gax.WithTimeout(60000 * time.Millisecond),
382 gax.WithRetry(func() gax.Retryer {
383 return gax.OnHTTPCodes(gax.Backoff{
384 Initial: 1000 * time.Millisecond,
385 Max: 10000 * time.Millisecond,
386 Multiplier: 1.30,
387 },
388 http.StatusServiceUnavailable)
389 }),
390 },
391 CreateVariant: []gax.CallOption{
392 gax.WithTimeout(60000 * time.Millisecond),
393 },
394 UpdateVariant: []gax.CallOption{
395 gax.WithTimeout(60000 * time.Millisecond),
396 },
397 DeleteVariant: []gax.CallOption{
398 gax.WithTimeout(60000 * time.Millisecond),
399 },
400 ListRollouts: []gax.CallOption{
401 gax.WithTimeout(60000 * time.Millisecond),
402 gax.WithRetry(func() gax.Retryer {
403 return gax.OnHTTPCodes(gax.Backoff{
404 Initial: 1000 * time.Millisecond,
405 Max: 10000 * time.Millisecond,
406 Multiplier: 1.30,
407 },
408 http.StatusServiceUnavailable)
409 }),
410 },
411 GetRollout: []gax.CallOption{
412 gax.WithTimeout(60000 * time.Millisecond),
413 gax.WithRetry(func() gax.Retryer {
414 return gax.OnHTTPCodes(gax.Backoff{
415 Initial: 1000 * time.Millisecond,
416 Max: 10000 * time.Millisecond,
417 Multiplier: 1.30,
418 },
419 http.StatusServiceUnavailable)
420 }),
421 },
422 SuspendRollout: []gax.CallOption{
423 gax.WithTimeout(60000 * time.Millisecond),
424 },
425 ResumeRollout: []gax.CallOption{
426 gax.WithTimeout(60000 * time.Millisecond),
427 },
428 AbortRollout: []gax.CallOption{
429 gax.WithTimeout(60000 * time.Millisecond),
430 },
431 GetLocation: []gax.CallOption{},
432 ListLocations: []gax.CallOption{},
433 CancelOperation: []gax.CallOption{},
434 DeleteOperation: []gax.CallOption{},
435 GetOperation: []gax.CallOption{},
436 ListOperations: []gax.CallOption{},
437 }
438 }
439
440 // internalClient is an interface that defines the methods available from Config Delivery API.
441 type internalClient interface {
442 Close() error
443 setGoogleClientInfo(...string)
444 Connection() *grpc.ClientConn
445 ListResourceBundles(context.Context, *configdeliverypb.ListResourceBundlesRequest, ...gax.CallOption) *ResourceBundleIterator
446 GetResourceBundle(context.Context, *configdeliverypb.GetResourceBundleRequest, ...gax.CallOption) (*configdeliverypb.ResourceBundle, error)
447 CreateResourceBundle(context.Context, *configdeliverypb.CreateResourceBundleRequest, ...gax.CallOption) (*CreateResourceBundleOperation, error)
448 CreateResourceBundleOperation(name string) *CreateResourceBundleOperation
449 UpdateResourceBundle(context.Context, *configdeliverypb.UpdateResourceBundleRequest, ...gax.CallOption) (*UpdateResourceBundleOperation, error)
450 UpdateResourceBundleOperation(name string) *UpdateResourceBundleOperation
451 DeleteResourceBundle(context.Context, *configdeliverypb.DeleteResourceBundleRequest, ...gax.CallOption) (*DeleteResourceBundleOperation, error)
452 DeleteResourceBundleOperation(name string) *DeleteResourceBundleOperation
453 ListFleetPackages(context.Context, *configdeliverypb.ListFleetPackagesRequest, ...gax.CallOption) *FleetPackageIterator
454 GetFleetPackage(context.Context, *configdeliverypb.GetFleetPackageRequest, ...gax.CallOption) (*configdeliverypb.FleetPackage, error)
455 CreateFleetPackage(context.Context, *configdeliverypb.CreateFleetPackageRequest, ...gax.CallOption) (*CreateFleetPackageOperation, error)
456 CreateFleetPackageOperation(name string) *CreateFleetPackageOperation
457 UpdateFleetPackage(context.Context, *configdeliverypb.UpdateFleetPackageRequest, ...gax.CallOption) (*UpdateFleetPackageOperation, error)
458 UpdateFleetPackageOperation(name string) *UpdateFleetPackageOperation
459 DeleteFleetPackage(context.Context, *configdeliverypb.DeleteFleetPackageRequest, ...gax.CallOption) (*DeleteFleetPackageOperation, error)
460 DeleteFleetPackageOperation(name string) *DeleteFleetPackageOperation
461 ListReleases(context.Context, *configdeliverypb.ListReleasesRequest, ...gax.CallOption) *ReleaseIterator
462 GetRelease(context.Context, *configdeliverypb.GetReleaseRequest, ...gax.CallOption) (*configdeliverypb.Release, error)
463 CreateRelease(context.Context, *configdeliverypb.CreateReleaseRequest, ...gax.CallOption) (*CreateReleaseOperation, error)
464 CreateReleaseOperation(name string) *CreateReleaseOperation
465 UpdateRelease(context.Context, *configdeliverypb.UpdateReleaseRequest, ...gax.CallOption) (*UpdateReleaseOperation, error)
466 UpdateReleaseOperation(name string) *UpdateReleaseOperation
467 DeleteRelease(context.Context, *configdeliverypb.DeleteReleaseRequest, ...gax.CallOption) (*DeleteReleaseOperation, error)
468 DeleteReleaseOperation(name string) *DeleteReleaseOperation
469 ListVariants(context.Context, *configdeliverypb.ListVariantsRequest, ...gax.CallOption) *VariantIterator
470 GetVariant(context.Context, *configdeliverypb.GetVariantRequest, ...gax.CallOption) (*configdeliverypb.Variant, error)
471 CreateVariant(context.Context, *configdeliverypb.CreateVariantRequest, ...gax.CallOption) (*CreateVariantOperation, error)
472 CreateVariantOperation(name string) *CreateVariantOperation
473 UpdateVariant(context.Context, *configdeliverypb.UpdateVariantRequest, ...gax.CallOption) (*UpdateVariantOperation, error)
474 UpdateVariantOperation(name string) *UpdateVariantOperation
475 DeleteVariant(context.Context, *configdeliverypb.DeleteVariantRequest, ...gax.CallOption) (*DeleteVariantOperation, error)
476 DeleteVariantOperation(name string) *DeleteVariantOperation
477 ListRollouts(context.Context, *configdeliverypb.ListRolloutsRequest, ...gax.CallOption) *RolloutIterator
478 GetRollout(context.Context, *configdeliverypb.GetRolloutRequest, ...gax.CallOption) (*configdeliverypb.Rollout, error)
479 SuspendRollout(context.Context, *configdeliverypb.SuspendRolloutRequest, ...gax.CallOption) (*SuspendRolloutOperation, error)
480 SuspendRolloutOperation(name string) *SuspendRolloutOperation
481 ResumeRollout(context.Context, *configdeliverypb.ResumeRolloutRequest, ...gax.CallOption) (*ResumeRolloutOperation, error)
482 ResumeRolloutOperation(name string) *ResumeRolloutOperation
483 AbortRollout(context.Context, *configdeliverypb.AbortRolloutRequest, ...gax.CallOption) (*AbortRolloutOperation, error)
484 AbortRolloutOperation(name string) *AbortRolloutOperation
485 GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error)
486 ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator
487 CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error
488 DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error
489 GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error)
490 ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator
491 }
492
493 // Client is a client for interacting with Config Delivery API.
494 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
495 //
496 // ConfigDelivery service manages the deployment of kubernetes configuration to
497 // a fleet of kubernetes clusters.
498 type Client struct {
499 // The internal transport-dependent client.
500 internalClient internalClient
501
502 // The call options for this service.
503 CallOptions *CallOptions
504
505 // LROClient is used internally to handle long-running operations.
506 // It is exposed so that its CallOptions can be modified if required.
507 // Users should not Close this client.
508 LROClient *lroauto.OperationsClient
509 }
510
511 // Wrapper methods routed to the internal client.
512
513 // Close closes the connection to the API service. The user should invoke this when
514 // the client is no longer required.
515 func (c *Client) Close() error {
516 return c.internalClient.Close()
517 }
518
519 // setGoogleClientInfo sets the name and version of the application in
520 // the `x-goog-api-client` header passed on each request. Intended for
521 // use by Google-written clients.
522 func (c *Client) setGoogleClientInfo(keyval ...string) {
523 c.internalClient.setGoogleClientInfo(keyval...)
524 }
525
526 // Connection returns a connection to the API service.
527 //
528 // Deprecated: Connections are now pooled so this method does not always
529 // return the same resource.
530 func (c *Client) Connection() *grpc.ClientConn {
531 return c.internalClient.Connection()
532 }
533
534 // ListResourceBundles lists ResourceBundles in a given project and location.
535 func (c *Client) ListResourceBundles(ctx context.Context, req *configdeliverypb.ListResourceBundlesRequest, opts ...gax.CallOption) *ResourceBundleIterator {
536 return c.internalClient.ListResourceBundles(ctx, req, opts...)
537 }
538
539 // GetResourceBundle gets details of a single ResourceBundle.
540 func (c *Client) GetResourceBundle(ctx context.Context, req *configdeliverypb.GetResourceBundleRequest, opts ...gax.CallOption) (*configdeliverypb.ResourceBundle, error) {
541 return c.internalClient.GetResourceBundle(ctx, req, opts...)
542 }
543
544 // CreateResourceBundle creates a new ResourceBundle in a given project and location.
545 func (c *Client) CreateResourceBundle(ctx context.Context, req *configdeliverypb.CreateResourceBundleRequest, opts ...gax.CallOption) (*CreateResourceBundleOperation, error) {
546 return c.internalClient.CreateResourceBundle(ctx, req, opts...)
547 }
548
549 // CreateResourceBundleOperation returns a new CreateResourceBundleOperation from a given name.
550 // The name must be that of a previously created CreateResourceBundleOperation, possibly from a different process.
551 func (c *Client) CreateResourceBundleOperation(name string) *CreateResourceBundleOperation {
552 return c.internalClient.CreateResourceBundleOperation(name)
553 }
554
555 // UpdateResourceBundle updates the parameters of a single ResourceBundle.
556 func (c *Client) UpdateResourceBundle(ctx context.Context, req *configdeliverypb.UpdateResourceBundleRequest, opts ...gax.CallOption) (*UpdateResourceBundleOperation, error) {
557 return c.internalClient.UpdateResourceBundle(ctx, req, opts...)
558 }
559
560 // UpdateResourceBundleOperation returns a new UpdateResourceBundleOperation from a given name.
561 // The name must be that of a previously created UpdateResourceBundleOperation, possibly from a different process.
562 func (c *Client) UpdateResourceBundleOperation(name string) *UpdateResourceBundleOperation {
563 return c.internalClient.UpdateResourceBundleOperation(name)
564 }
565
566 // DeleteResourceBundle deletes a single ResourceBundle.
567 func (c *Client) DeleteResourceBundle(ctx context.Context, req *configdeliverypb.DeleteResourceBundleRequest, opts ...gax.CallOption) (*DeleteResourceBundleOperation, error) {
568 return c.internalClient.DeleteResourceBundle(ctx, req, opts...)
569 }
570
571 // DeleteResourceBundleOperation returns a new DeleteResourceBundleOperation from a given name.
572 // The name must be that of a previously created DeleteResourceBundleOperation, possibly from a different process.
573 func (c *Client) DeleteResourceBundleOperation(name string) *DeleteResourceBundleOperation {
574 return c.internalClient.DeleteResourceBundleOperation(name)
575 }
576
577 // ListFleetPackages lists FleetPackages in a given project and location.
578 func (c *Client) ListFleetPackages(ctx context.Context, req *configdeliverypb.ListFleetPackagesRequest, opts ...gax.CallOption) *FleetPackageIterator {
579 return c.internalClient.ListFleetPackages(ctx, req, opts...)
580 }
581
582 // GetFleetPackage gets details of a single FleetPackage.
583 func (c *Client) GetFleetPackage(ctx context.Context, req *configdeliverypb.GetFleetPackageRequest, opts ...gax.CallOption) (*configdeliverypb.FleetPackage, error) {
584 return c.internalClient.GetFleetPackage(ctx, req, opts...)
585 }
586
587 // CreateFleetPackage creates a new FleetPackage in a given project and location.
588 func (c *Client) CreateFleetPackage(ctx context.Context, req *configdeliverypb.CreateFleetPackageRequest, opts ...gax.CallOption) (*CreateFleetPackageOperation, error) {
589 return c.internalClient.CreateFleetPackage(ctx, req, opts...)
590 }
591
592 // CreateFleetPackageOperation returns a new CreateFleetPackageOperation from a given name.
593 // The name must be that of a previously created CreateFleetPackageOperation, possibly from a different process.
594 func (c *Client) CreateFleetPackageOperation(name string) *CreateFleetPackageOperation {
595 return c.internalClient.CreateFleetPackageOperation(name)
596 }
597
598 // UpdateFleetPackage updates the parameters of a single FleetPackage.
599 func (c *Client) UpdateFleetPackage(ctx context.Context, req *configdeliverypb.UpdateFleetPackageRequest, opts ...gax.CallOption) (*UpdateFleetPackageOperation, error) {
600 return c.internalClient.UpdateFleetPackage(ctx, req, opts...)
601 }
602
603 // UpdateFleetPackageOperation returns a new UpdateFleetPackageOperation from a given name.
604 // The name must be that of a previously created UpdateFleetPackageOperation, possibly from a different process.
605 func (c *Client) UpdateFleetPackageOperation(name string) *UpdateFleetPackageOperation {
606 return c.internalClient.UpdateFleetPackageOperation(name)
607 }
608
609 // DeleteFleetPackage deletes a single FleetPackage.
610 func (c *Client) DeleteFleetPackage(ctx context.Context, req *configdeliverypb.DeleteFleetPackageRequest, opts ...gax.CallOption) (*DeleteFleetPackageOperation, error) {
611 return c.internalClient.DeleteFleetPackage(ctx, req, opts...)
612 }
613
614 // DeleteFleetPackageOperation returns a new DeleteFleetPackageOperation from a given name.
615 // The name must be that of a previously created DeleteFleetPackageOperation, possibly from a different process.
616 func (c *Client) DeleteFleetPackageOperation(name string) *DeleteFleetPackageOperation {
617 return c.internalClient.DeleteFleetPackageOperation(name)
618 }
619
620 // ListReleases lists Releases in a given project and location.
621 func (c *Client) ListReleases(ctx context.Context, req *configdeliverypb.ListReleasesRequest, opts ...gax.CallOption) *ReleaseIterator {
622 return c.internalClient.ListReleases(ctx, req, opts...)
623 }
624
625 // GetRelease gets details of a single Release.
626 func (c *Client) GetRelease(ctx context.Context, req *configdeliverypb.GetReleaseRequest, opts ...gax.CallOption) (*configdeliverypb.Release, error) {
627 return c.internalClient.GetRelease(ctx, req, opts...)
628 }
629
630 // CreateRelease creates a new Release in a given project, location and resource bundle.
631 func (c *Client) CreateRelease(ctx context.Context, req *configdeliverypb.CreateReleaseRequest, opts ...gax.CallOption) (*CreateReleaseOperation, error) {
632 return c.internalClient.CreateRelease(ctx, req, opts...)
633 }
634
635 // CreateReleaseOperation returns a new CreateReleaseOperation from a given name.
636 // The name must be that of a previously created CreateReleaseOperation, possibly from a different process.
637 func (c *Client) CreateReleaseOperation(name string) *CreateReleaseOperation {
638 return c.internalClient.CreateReleaseOperation(name)
639 }
640
641 // UpdateRelease updates the parameters of a single Release.
642 func (c *Client) UpdateRelease(ctx context.Context, req *configdeliverypb.UpdateReleaseRequest, opts ...gax.CallOption) (*UpdateReleaseOperation, error) {
643 return c.internalClient.UpdateRelease(ctx, req, opts...)
644 }
645
646 // UpdateReleaseOperation returns a new UpdateReleaseOperation from a given name.
647 // The name must be that of a previously created UpdateReleaseOperation, possibly from a different process.
648 func (c *Client) UpdateReleaseOperation(name string) *UpdateReleaseOperation {
649 return c.internalClient.UpdateReleaseOperation(name)
650 }
651
652 // DeleteRelease deletes a single Release.
653 func (c *Client) DeleteRelease(ctx context.Context, req *configdeliverypb.DeleteReleaseRequest, opts ...gax.CallOption) (*DeleteReleaseOperation, error) {
654 return c.internalClient.DeleteRelease(ctx, req, opts...)
655 }
656
657 // DeleteReleaseOperation returns a new DeleteReleaseOperation from a given name.
658 // The name must be that of a previously created DeleteReleaseOperation, possibly from a different process.
659 func (c *Client) DeleteReleaseOperation(name string) *DeleteReleaseOperation {
660 return c.internalClient.DeleteReleaseOperation(name)
661 }
662
663 // ListVariants lists Variants in a given project and location.
664 func (c *Client) ListVariants(ctx context.Context, req *configdeliverypb.ListVariantsRequest, opts ...gax.CallOption) *VariantIterator {
665 return c.internalClient.ListVariants(ctx, req, opts...)
666 }
667
668 // GetVariant gets details of a single Variant.
669 func (c *Client) GetVariant(ctx context.Context, req *configdeliverypb.GetVariantRequest, opts ...gax.CallOption) (*configdeliverypb.Variant, error) {
670 return c.internalClient.GetVariant(ctx, req, opts...)
671 }
672
673 // CreateVariant creates a new Variant in a given project, location, resource bundle, and
674 // release.
675 func (c *Client) CreateVariant(ctx context.Context, req *configdeliverypb.CreateVariantRequest, opts ...gax.CallOption) (*CreateVariantOperation, error) {
676 return c.internalClient.CreateVariant(ctx, req, opts...)
677 }
678
679 // CreateVariantOperation returns a new CreateVariantOperation from a given name.
680 // The name must be that of a previously created CreateVariantOperation, possibly from a different process.
681 func (c *Client) CreateVariantOperation(name string) *CreateVariantOperation {
682 return c.internalClient.CreateVariantOperation(name)
683 }
684
685 // UpdateVariant updates the parameters of a single Variant.
686 func (c *Client) UpdateVariant(ctx context.Context, req *configdeliverypb.UpdateVariantRequest, opts ...gax.CallOption) (*UpdateVariantOperation, error) {
687 return c.internalClient.UpdateVariant(ctx, req, opts...)
688 }
689
690 // UpdateVariantOperation returns a new UpdateVariantOperation from a given name.
691 // The name must be that of a previously created UpdateVariantOperation, possibly from a different process.
692 func (c *Client) UpdateVariantOperation(name string) *UpdateVariantOperation {
693 return c.internalClient.UpdateVariantOperation(name)
694 }
695
696 // DeleteVariant deletes a single Variant.
697 func (c *Client) DeleteVariant(ctx context.Context, req *configdeliverypb.DeleteVariantRequest, opts ...gax.CallOption) (*DeleteVariantOperation, error) {
698 return c.internalClient.DeleteVariant(ctx, req, opts...)
699 }
700
701 // DeleteVariantOperation returns a new DeleteVariantOperation from a given name.
702 // The name must be that of a previously created DeleteVariantOperation, possibly from a different process.
703 func (c *Client) DeleteVariantOperation(name string) *DeleteVariantOperation {
704 return c.internalClient.DeleteVariantOperation(name)
705 }
706
707 // ListRollouts lists Rollouts in a given project, location, and Fleet Package.
708 func (c *Client) ListRollouts(ctx context.Context, req *configdeliverypb.ListRolloutsRequest, opts ...gax.CallOption) *RolloutIterator {
709 return c.internalClient.ListRollouts(ctx, req, opts...)
710 }
711
712 // GetRollout gets details of a single Rollout.
713 func (c *Client) GetRollout(ctx context.Context, req *configdeliverypb.GetRolloutRequest, opts ...gax.CallOption) (*configdeliverypb.Rollout, error) {
714 return c.internalClient.GetRollout(ctx, req, opts...)
715 }
716
717 // SuspendRollout suspend a Rollout.
718 func (c *Client) SuspendRollout(ctx context.Context, req *configdeliverypb.SuspendRolloutRequest, opts ...gax.CallOption) (*SuspendRolloutOperation, error) {
719 return c.internalClient.SuspendRollout(ctx, req, opts...)
720 }
721
722 // SuspendRolloutOperation returns a new SuspendRolloutOperation from a given name.
723 // The name must be that of a previously created SuspendRolloutOperation, possibly from a different process.
724 func (c *Client) SuspendRolloutOperation(name string) *SuspendRolloutOperation {
725 return c.internalClient.SuspendRolloutOperation(name)
726 }
727
728 // ResumeRollout resume a Rollout.
729 func (c *Client) ResumeRollout(ctx context.Context, req *configdeliverypb.ResumeRolloutRequest, opts ...gax.CallOption) (*ResumeRolloutOperation, error) {
730 return c.internalClient.ResumeRollout(ctx, req, opts...)
731 }
732
733 // ResumeRolloutOperation returns a new ResumeRolloutOperation from a given name.
734 // The name must be that of a previously created ResumeRolloutOperation, possibly from a different process.
735 func (c *Client) ResumeRolloutOperation(name string) *ResumeRolloutOperation {
736 return c.internalClient.ResumeRolloutOperation(name)
737 }
738
739 // AbortRollout abort a Rollout.
740 func (c *Client) AbortRollout(ctx context.Context, req *configdeliverypb.AbortRolloutRequest, opts ...gax.CallOption) (*AbortRolloutOperation, error) {
741 return c.internalClient.AbortRollout(ctx, req, opts...)
742 }
743
744 // AbortRolloutOperation returns a new AbortRolloutOperation from a given name.
745 // The name must be that of a previously created AbortRolloutOperation, possibly from a different process.
746 func (c *Client) AbortRolloutOperation(name string) *AbortRolloutOperation {
747 return c.internalClient.AbortRolloutOperation(name)
748 }
749
750 // GetLocation gets information about a location.
751 func (c *Client) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
752 return c.internalClient.GetLocation(ctx, req, opts...)
753 }
754
755 // ListLocations lists information about the supported locations for this service.
756 func (c *Client) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
757 return c.internalClient.ListLocations(ctx, req, opts...)
758 }
759
760 // CancelOperation is a utility method from google.longrunning.Operations.
761 func (c *Client) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
762 return c.internalClient.CancelOperation(ctx, req, opts...)
763 }
764
765 // DeleteOperation is a utility method from google.longrunning.Operations.
766 func (c *Client) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
767 return c.internalClient.DeleteOperation(ctx, req, opts...)
768 }
769
770 // GetOperation is a utility method from google.longrunning.Operations.
771 func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
772 return c.internalClient.GetOperation(ctx, req, opts...)
773 }
774
775 // ListOperations is a utility method from google.longrunning.Operations.
776 func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
777 return c.internalClient.ListOperations(ctx, req, opts...)
778 }
779
780 // gRPCClient is a client for interacting with Config Delivery API over gRPC transport.
781 //
782 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
783 type gRPCClient struct {
784 // Connection pool of gRPC connections to the service.
785 connPool gtransport.ConnPool
786
787 // Points back to the CallOptions field of the containing Client
788 CallOptions **CallOptions
789
790 // The gRPC API client.
791 client configdeliverypb.ConfigDeliveryClient
792
793 // LROClient is used internally to handle long-running operations.
794 // It is exposed so that its CallOptions can be modified if required.
795 // Users should not Close this client.
796 LROClient **lroauto.OperationsClient
797
798 operationsClient longrunningpb.OperationsClient
799
800 locationsClient locationpb.LocationsClient
801
802 // The x-goog-* metadata to be sent with each request.
803 xGoogHeaders []string
804
805 logger *slog.Logger
806 }
807
808 // NewClient creates a new config delivery client based on gRPC.
809 // The returned client must be Closed when it is done being used to clean up its underlying connections.
810 //
811 // ConfigDelivery service manages the deployment of kubernetes configuration to
812 // a fleet of kubernetes clusters.
813 func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
814 clientOpts := defaultGRPCClientOptions()
815 if newClientHook != nil {
816 hookOpts, err := newClientHook(ctx, clientHookParams{})
817 if err != nil {
818 return nil, err
819 }
820 clientOpts = append(clientOpts, hookOpts...)
821 }
822
823 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
824 if err != nil {
825 return nil, err
826 }
827 client := Client{CallOptions: defaultCallOptions()}
828
829 c := &gRPCClient{
830 connPool: connPool,
831 client: configdeliverypb.NewConfigDeliveryClient(connPool),
832 CallOptions: &client.CallOptions,
833 logger: internaloption.GetLogger(opts),
834 operationsClient: longrunningpb.NewOperationsClient(connPool),
835 locationsClient: locationpb.NewLocationsClient(connPool),
836 }
837 c.setGoogleClientInfo()
838
839 client.internalClient = c
840
841 client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
842 if err != nil {
843 // This error "should not happen", since we are just reusing old connection pool
844 // and never actually need to dial.
845 // If this does happen, we could leak connp. However, we cannot close conn:
846 // If the user invoked the constructor with option.WithGRPCConn,
847 // we would close a connection that's still in use.
848 // TODO: investigate error conditions.
849 return nil, err
850 }
851 c.LROClient = &client.LROClient
852 return &client, nil
853 }
854
855 // Connection returns a connection to the API service.
856 //
857 // Deprecated: Connections are now pooled so this method does not always
858 // return the same resource.
859 func (c *gRPCClient) Connection() *grpc.ClientConn {
860 return c.connPool.Conn()
861 }
862
863 // setGoogleClientInfo sets the name and version of the application in
864 // the `x-goog-api-client` header passed on each request. Intended for
865 // use by Google-written clients.
866 func (c *gRPCClient) setGoogleClientInfo(keyval ...string) {
867 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
868 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion)
869 c.xGoogHeaders = []string{
870 "x-goog-api-client", gax.XGoogHeader(kv...),
871 }
872 }
873
874 // Close closes the connection to the API service. The user should invoke this when
875 // the client is no longer required.
876 func (c *gRPCClient) Close() error {
877 return c.connPool.Close()
878 }
879
880 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
881 type restClient struct {
882 // The http endpoint to connect to.
883 endpoint string
884
885 // The http client.
886 httpClient *http.Client
887
888 // LROClient is used internally to handle long-running operations.
889 // It is exposed so that its CallOptions can be modified if required.
890 // Users should not Close this client.
891 LROClient **lroauto.OperationsClient
892
893 // The x-goog-* headers to be sent with each request.
894 xGoogHeaders []string
895
896 // Points back to the CallOptions field of the containing Client
897 CallOptions **CallOptions
898
899 logger *slog.Logger
900 }
901
902 // NewRESTClient creates a new config delivery rest client.
903 //
904 // ConfigDelivery service manages the deployment of kubernetes configuration to
905 // a fleet of kubernetes clusters.
906 func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
907 clientOpts := append(defaultRESTClientOptions(), opts...)
908 httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
909 if err != nil {
910 return nil, err
911 }
912
913 callOpts := defaultRESTCallOptions()
914 c := &restClient{
915 endpoint: endpoint,
916 httpClient: httpClient,
917 CallOptions: &callOpts,
918 logger: internaloption.GetLogger(opts),
919 }
920 c.setGoogleClientInfo()
921
922 lroOpts := []option.ClientOption{
923 option.WithHTTPClient(httpClient),
924 option.WithEndpoint(endpoint),
925 }
926 opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
927 if err != nil {
928 return nil, err
929 }
930 c.LROClient = &opClient
931
932 return &Client{internalClient: c, CallOptions: callOpts}, nil
933 }
934
935 func defaultRESTClientOptions() []option.ClientOption {
936 return []option.ClientOption{
937 internaloption.WithDefaultEndpoint("https://configdelivery.googleapis.com"),
938 internaloption.WithDefaultEndpointTemplate("https://configdelivery.UNIVERSE_DOMAIN"),
939 internaloption.WithDefaultMTLSEndpoint("https://configdelivery.mtls.googleapis.com"),
940 internaloption.WithDefaultUniverseDomain("googleapis.com"),
941 internaloption.WithDefaultAudience("https://configdelivery.googleapis.com/"),
942 internaloption.WithDefaultScopes(DefaultAuthScopes()...),
943 internaloption.EnableNewAuthLibrary(),
944 }
945 }
946
947 // setGoogleClientInfo sets the name and version of the application in
948 // the `x-goog-api-client` header passed on each request. Intended for
949 // use by Google-written clients.
950 func (c *restClient) setGoogleClientInfo(keyval ...string) {
951 kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
952 kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion)
953 c.xGoogHeaders = []string{
954 "x-goog-api-client", gax.XGoogHeader(kv...),
955 }
956 }
957
958 // Close closes the connection to the API service. The user should invoke this when
959 // the client is no longer required.
960 func (c *restClient) Close() error {
961 // Replace httpClient with nil to force cleanup.
962 c.httpClient = nil
963 return nil
964 }
965
966 // Connection returns a connection to the API service.
967 //
968 // Deprecated: This method always returns nil.
969 func (c *restClient) Connection() *grpc.ClientConn {
970 return nil
971 }
972 func (c *gRPCClient) ListResourceBundles(ctx context.Context, req *configdeliverypb.ListResourceBundlesRequest, opts ...gax.CallOption) *ResourceBundleIterator {
973 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
974
975 hds = append(c.xGoogHeaders, hds...)
976 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
977 opts = append((*c.CallOptions).ListResourceBundles[0:len((*c.CallOptions).ListResourceBundles):len((*c.CallOptions).ListResourceBundles)], opts...)
978 it := &ResourceBundleIterator{}
979 req = proto.Clone(req).(*configdeliverypb.ListResourceBundlesRequest)
980 it.InternalFetch = func(pageSize int, pageToken string) ([]*configdeliverypb.ResourceBundle, string, error) {
981 resp := &configdeliverypb.ListResourceBundlesResponse{}
982 if pageToken != "" {
983 req.PageToken = pageToken
984 }
985 if pageSize > math.MaxInt32 {
986 req.PageSize = math.MaxInt32
987 } else if pageSize != 0 {
988 req.PageSize = int32(pageSize)
989 }
990 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
991 var err error
992 resp, err = executeRPC(ctx, c.client.ListResourceBundles, req, settings.GRPC, c.logger, "ListResourceBundles")
993 return err
994 }, opts...)
995 if err != nil {
996 return nil, "", err
997 }
998
999 it.Response = resp
1000 return resp.GetResourceBundles(), resp.GetNextPageToken(), nil
1001 }
1002 fetch := func(pageSize int, pageToken string) (string, error) {
1003 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1004 if err != nil {
1005 return "", err
1006 }
1007 it.items = append(it.items, items...)
1008 return nextPageToken, nil
1009 }
1010
1011 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1012 it.pageInfo.MaxSize = int(req.GetPageSize())
1013 it.pageInfo.Token = req.GetPageToken()
1014
1015 return it
1016 }
1017
1018 func (c *gRPCClient) GetResourceBundle(ctx context.Context, req *configdeliverypb.GetResourceBundleRequest, opts ...gax.CallOption) (*configdeliverypb.ResourceBundle, error) {
1019 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1020
1021 hds = append(c.xGoogHeaders, hds...)
1022 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1023 opts = append((*c.CallOptions).GetResourceBundle[0:len((*c.CallOptions).GetResourceBundle):len((*c.CallOptions).GetResourceBundle)], opts...)
1024 var resp *configdeliverypb.ResourceBundle
1025 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1026 var err error
1027 resp, err = executeRPC(ctx, c.client.GetResourceBundle, req, settings.GRPC, c.logger, "GetResourceBundle")
1028 return err
1029 }, opts...)
1030 if err != nil {
1031 return nil, err
1032 }
1033 return resp, nil
1034 }
1035
1036 func (c *gRPCClient) CreateResourceBundle(ctx context.Context, req *configdeliverypb.CreateResourceBundleRequest, opts ...gax.CallOption) (*CreateResourceBundleOperation, error) {
1037 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1038
1039 hds = append(c.xGoogHeaders, hds...)
1040 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1041 opts = append((*c.CallOptions).CreateResourceBundle[0:len((*c.CallOptions).CreateResourceBundle):len((*c.CallOptions).CreateResourceBundle)], opts...)
1042 var resp *longrunningpb.Operation
1043 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1044 var err error
1045 resp, err = executeRPC(ctx, c.client.CreateResourceBundle, req, settings.GRPC, c.logger, "CreateResourceBundle")
1046 return err
1047 }, opts...)
1048 if err != nil {
1049 return nil, err
1050 }
1051 return &CreateResourceBundleOperation{
1052 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1053 }, nil
1054 }
1055
1056 func (c *gRPCClient) UpdateResourceBundle(ctx context.Context, req *configdeliverypb.UpdateResourceBundleRequest, opts ...gax.CallOption) (*UpdateResourceBundleOperation, error) {
1057 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource_bundle.name", url.QueryEscape(req.GetResourceBundle().GetName()))}
1058
1059 hds = append(c.xGoogHeaders, hds...)
1060 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1061 opts = append((*c.CallOptions).UpdateResourceBundle[0:len((*c.CallOptions).UpdateResourceBundle):len((*c.CallOptions).UpdateResourceBundle)], opts...)
1062 var resp *longrunningpb.Operation
1063 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1064 var err error
1065 resp, err = executeRPC(ctx, c.client.UpdateResourceBundle, req, settings.GRPC, c.logger, "UpdateResourceBundle")
1066 return err
1067 }, opts...)
1068 if err != nil {
1069 return nil, err
1070 }
1071 return &UpdateResourceBundleOperation{
1072 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1073 }, nil
1074 }
1075
1076 func (c *gRPCClient) DeleteResourceBundle(ctx context.Context, req *configdeliverypb.DeleteResourceBundleRequest, opts ...gax.CallOption) (*DeleteResourceBundleOperation, error) {
1077 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1078
1079 hds = append(c.xGoogHeaders, hds...)
1080 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1081 opts = append((*c.CallOptions).DeleteResourceBundle[0:len((*c.CallOptions).DeleteResourceBundle):len((*c.CallOptions).DeleteResourceBundle)], opts...)
1082 var resp *longrunningpb.Operation
1083 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1084 var err error
1085 resp, err = executeRPC(ctx, c.client.DeleteResourceBundle, req, settings.GRPC, c.logger, "DeleteResourceBundle")
1086 return err
1087 }, opts...)
1088 if err != nil {
1089 return nil, err
1090 }
1091 return &DeleteResourceBundleOperation{
1092 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1093 }, nil
1094 }
1095
1096 func (c *gRPCClient) ListFleetPackages(ctx context.Context, req *configdeliverypb.ListFleetPackagesRequest, opts ...gax.CallOption) *FleetPackageIterator {
1097 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1098
1099 hds = append(c.xGoogHeaders, hds...)
1100 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1101 opts = append((*c.CallOptions).ListFleetPackages[0:len((*c.CallOptions).ListFleetPackages):len((*c.CallOptions).ListFleetPackages)], opts...)
1102 it := &FleetPackageIterator{}
1103 req = proto.Clone(req).(*configdeliverypb.ListFleetPackagesRequest)
1104 it.InternalFetch = func(pageSize int, pageToken string) ([]*configdeliverypb.FleetPackage, string, error) {
1105 resp := &configdeliverypb.ListFleetPackagesResponse{}
1106 if pageToken != "" {
1107 req.PageToken = pageToken
1108 }
1109 if pageSize > math.MaxInt32 {
1110 req.PageSize = math.MaxInt32
1111 } else if pageSize != 0 {
1112 req.PageSize = int32(pageSize)
1113 }
1114 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1115 var err error
1116 resp, err = executeRPC(ctx, c.client.ListFleetPackages, req, settings.GRPC, c.logger, "ListFleetPackages")
1117 return err
1118 }, opts...)
1119 if err != nil {
1120 return nil, "", err
1121 }
1122
1123 it.Response = resp
1124 return resp.GetFleetPackages(), resp.GetNextPageToken(), nil
1125 }
1126 fetch := func(pageSize int, pageToken string) (string, error) {
1127 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1128 if err != nil {
1129 return "", err
1130 }
1131 it.items = append(it.items, items...)
1132 return nextPageToken, nil
1133 }
1134
1135 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1136 it.pageInfo.MaxSize = int(req.GetPageSize())
1137 it.pageInfo.Token = req.GetPageToken()
1138
1139 return it
1140 }
1141
1142 func (c *gRPCClient) GetFleetPackage(ctx context.Context, req *configdeliverypb.GetFleetPackageRequest, opts ...gax.CallOption) (*configdeliverypb.FleetPackage, error) {
1143 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1144
1145 hds = append(c.xGoogHeaders, hds...)
1146 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1147 opts = append((*c.CallOptions).GetFleetPackage[0:len((*c.CallOptions).GetFleetPackage):len((*c.CallOptions).GetFleetPackage)], opts...)
1148 var resp *configdeliverypb.FleetPackage
1149 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1150 var err error
1151 resp, err = executeRPC(ctx, c.client.GetFleetPackage, req, settings.GRPC, c.logger, "GetFleetPackage")
1152 return err
1153 }, opts...)
1154 if err != nil {
1155 return nil, err
1156 }
1157 return resp, nil
1158 }
1159
1160 func (c *gRPCClient) CreateFleetPackage(ctx context.Context, req *configdeliverypb.CreateFleetPackageRequest, opts ...gax.CallOption) (*CreateFleetPackageOperation, error) {
1161 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1162
1163 hds = append(c.xGoogHeaders, hds...)
1164 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1165 opts = append((*c.CallOptions).CreateFleetPackage[0:len((*c.CallOptions).CreateFleetPackage):len((*c.CallOptions).CreateFleetPackage)], opts...)
1166 var resp *longrunningpb.Operation
1167 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1168 var err error
1169 resp, err = executeRPC(ctx, c.client.CreateFleetPackage, req, settings.GRPC, c.logger, "CreateFleetPackage")
1170 return err
1171 }, opts...)
1172 if err != nil {
1173 return nil, err
1174 }
1175 return &CreateFleetPackageOperation{
1176 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1177 }, nil
1178 }
1179
1180 func (c *gRPCClient) UpdateFleetPackage(ctx context.Context, req *configdeliverypb.UpdateFleetPackageRequest, opts ...gax.CallOption) (*UpdateFleetPackageOperation, error) {
1181 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "fleet_package.name", url.QueryEscape(req.GetFleetPackage().GetName()))}
1182
1183 hds = append(c.xGoogHeaders, hds...)
1184 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1185 opts = append((*c.CallOptions).UpdateFleetPackage[0:len((*c.CallOptions).UpdateFleetPackage):len((*c.CallOptions).UpdateFleetPackage)], opts...)
1186 var resp *longrunningpb.Operation
1187 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1188 var err error
1189 resp, err = executeRPC(ctx, c.client.UpdateFleetPackage, req, settings.GRPC, c.logger, "UpdateFleetPackage")
1190 return err
1191 }, opts...)
1192 if err != nil {
1193 return nil, err
1194 }
1195 return &UpdateFleetPackageOperation{
1196 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1197 }, nil
1198 }
1199
1200 func (c *gRPCClient) DeleteFleetPackage(ctx context.Context, req *configdeliverypb.DeleteFleetPackageRequest, opts ...gax.CallOption) (*DeleteFleetPackageOperation, error) {
1201 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1202
1203 hds = append(c.xGoogHeaders, hds...)
1204 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1205 opts = append((*c.CallOptions).DeleteFleetPackage[0:len((*c.CallOptions).DeleteFleetPackage):len((*c.CallOptions).DeleteFleetPackage)], opts...)
1206 var resp *longrunningpb.Operation
1207 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1208 var err error
1209 resp, err = executeRPC(ctx, c.client.DeleteFleetPackage, req, settings.GRPC, c.logger, "DeleteFleetPackage")
1210 return err
1211 }, opts...)
1212 if err != nil {
1213 return nil, err
1214 }
1215 return &DeleteFleetPackageOperation{
1216 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1217 }, nil
1218 }
1219
1220 func (c *gRPCClient) ListReleases(ctx context.Context, req *configdeliverypb.ListReleasesRequest, opts ...gax.CallOption) *ReleaseIterator {
1221 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1222
1223 hds = append(c.xGoogHeaders, hds...)
1224 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1225 opts = append((*c.CallOptions).ListReleases[0:len((*c.CallOptions).ListReleases):len((*c.CallOptions).ListReleases)], opts...)
1226 it := &ReleaseIterator{}
1227 req = proto.Clone(req).(*configdeliverypb.ListReleasesRequest)
1228 it.InternalFetch = func(pageSize int, pageToken string) ([]*configdeliverypb.Release, string, error) {
1229 resp := &configdeliverypb.ListReleasesResponse{}
1230 if pageToken != "" {
1231 req.PageToken = pageToken
1232 }
1233 if pageSize > math.MaxInt32 {
1234 req.PageSize = math.MaxInt32
1235 } else if pageSize != 0 {
1236 req.PageSize = int32(pageSize)
1237 }
1238 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1239 var err error
1240 resp, err = executeRPC(ctx, c.client.ListReleases, req, settings.GRPC, c.logger, "ListReleases")
1241 return err
1242 }, opts...)
1243 if err != nil {
1244 return nil, "", err
1245 }
1246
1247 it.Response = resp
1248 return resp.GetReleases(), resp.GetNextPageToken(), nil
1249 }
1250 fetch := func(pageSize int, pageToken string) (string, error) {
1251 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1252 if err != nil {
1253 return "", err
1254 }
1255 it.items = append(it.items, items...)
1256 return nextPageToken, nil
1257 }
1258
1259 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1260 it.pageInfo.MaxSize = int(req.GetPageSize())
1261 it.pageInfo.Token = req.GetPageToken()
1262
1263 return it
1264 }
1265
1266 func (c *gRPCClient) GetRelease(ctx context.Context, req *configdeliverypb.GetReleaseRequest, opts ...gax.CallOption) (*configdeliverypb.Release, error) {
1267 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1268
1269 hds = append(c.xGoogHeaders, hds...)
1270 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1271 opts = append((*c.CallOptions).GetRelease[0:len((*c.CallOptions).GetRelease):len((*c.CallOptions).GetRelease)], opts...)
1272 var resp *configdeliverypb.Release
1273 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1274 var err error
1275 resp, err = executeRPC(ctx, c.client.GetRelease, req, settings.GRPC, c.logger, "GetRelease")
1276 return err
1277 }, opts...)
1278 if err != nil {
1279 return nil, err
1280 }
1281 return resp, nil
1282 }
1283
1284 func (c *gRPCClient) CreateRelease(ctx context.Context, req *configdeliverypb.CreateReleaseRequest, opts ...gax.CallOption) (*CreateReleaseOperation, error) {
1285 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1286
1287 hds = append(c.xGoogHeaders, hds...)
1288 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1289 opts = append((*c.CallOptions).CreateRelease[0:len((*c.CallOptions).CreateRelease):len((*c.CallOptions).CreateRelease)], opts...)
1290 var resp *longrunningpb.Operation
1291 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1292 var err error
1293 resp, err = executeRPC(ctx, c.client.CreateRelease, req, settings.GRPC, c.logger, "CreateRelease")
1294 return err
1295 }, opts...)
1296 if err != nil {
1297 return nil, err
1298 }
1299 return &CreateReleaseOperation{
1300 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1301 }, nil
1302 }
1303
1304 func (c *gRPCClient) UpdateRelease(ctx context.Context, req *configdeliverypb.UpdateReleaseRequest, opts ...gax.CallOption) (*UpdateReleaseOperation, error) {
1305 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "release.name", url.QueryEscape(req.GetRelease().GetName()))}
1306
1307 hds = append(c.xGoogHeaders, hds...)
1308 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1309 opts = append((*c.CallOptions).UpdateRelease[0:len((*c.CallOptions).UpdateRelease):len((*c.CallOptions).UpdateRelease)], opts...)
1310 var resp *longrunningpb.Operation
1311 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1312 var err error
1313 resp, err = executeRPC(ctx, c.client.UpdateRelease, req, settings.GRPC, c.logger, "UpdateRelease")
1314 return err
1315 }, opts...)
1316 if err != nil {
1317 return nil, err
1318 }
1319 return &UpdateReleaseOperation{
1320 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1321 }, nil
1322 }
1323
1324 func (c *gRPCClient) DeleteRelease(ctx context.Context, req *configdeliverypb.DeleteReleaseRequest, opts ...gax.CallOption) (*DeleteReleaseOperation, error) {
1325 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1326
1327 hds = append(c.xGoogHeaders, hds...)
1328 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1329 opts = append((*c.CallOptions).DeleteRelease[0:len((*c.CallOptions).DeleteRelease):len((*c.CallOptions).DeleteRelease)], opts...)
1330 var resp *longrunningpb.Operation
1331 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1332 var err error
1333 resp, err = executeRPC(ctx, c.client.DeleteRelease, req, settings.GRPC, c.logger, "DeleteRelease")
1334 return err
1335 }, opts...)
1336 if err != nil {
1337 return nil, err
1338 }
1339 return &DeleteReleaseOperation{
1340 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1341 }, nil
1342 }
1343
1344 func (c *gRPCClient) ListVariants(ctx context.Context, req *configdeliverypb.ListVariantsRequest, opts ...gax.CallOption) *VariantIterator {
1345 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1346
1347 hds = append(c.xGoogHeaders, hds...)
1348 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1349 opts = append((*c.CallOptions).ListVariants[0:len((*c.CallOptions).ListVariants):len((*c.CallOptions).ListVariants)], opts...)
1350 it := &VariantIterator{}
1351 req = proto.Clone(req).(*configdeliverypb.ListVariantsRequest)
1352 it.InternalFetch = func(pageSize int, pageToken string) ([]*configdeliverypb.Variant, string, error) {
1353 resp := &configdeliverypb.ListVariantsResponse{}
1354 if pageToken != "" {
1355 req.PageToken = pageToken
1356 }
1357 if pageSize > math.MaxInt32 {
1358 req.PageSize = math.MaxInt32
1359 } else if pageSize != 0 {
1360 req.PageSize = int32(pageSize)
1361 }
1362 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1363 var err error
1364 resp, err = executeRPC(ctx, c.client.ListVariants, req, settings.GRPC, c.logger, "ListVariants")
1365 return err
1366 }, opts...)
1367 if err != nil {
1368 return nil, "", err
1369 }
1370
1371 it.Response = resp
1372 return resp.GetVariants(), resp.GetNextPageToken(), nil
1373 }
1374 fetch := func(pageSize int, pageToken string) (string, error) {
1375 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1376 if err != nil {
1377 return "", err
1378 }
1379 it.items = append(it.items, items...)
1380 return nextPageToken, nil
1381 }
1382
1383 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1384 it.pageInfo.MaxSize = int(req.GetPageSize())
1385 it.pageInfo.Token = req.GetPageToken()
1386
1387 return it
1388 }
1389
1390 func (c *gRPCClient) GetVariant(ctx context.Context, req *configdeliverypb.GetVariantRequest, opts ...gax.CallOption) (*configdeliverypb.Variant, error) {
1391 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1392
1393 hds = append(c.xGoogHeaders, hds...)
1394 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1395 opts = append((*c.CallOptions).GetVariant[0:len((*c.CallOptions).GetVariant):len((*c.CallOptions).GetVariant)], opts...)
1396 var resp *configdeliverypb.Variant
1397 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1398 var err error
1399 resp, err = executeRPC(ctx, c.client.GetVariant, req, settings.GRPC, c.logger, "GetVariant")
1400 return err
1401 }, opts...)
1402 if err != nil {
1403 return nil, err
1404 }
1405 return resp, nil
1406 }
1407
1408 func (c *gRPCClient) CreateVariant(ctx context.Context, req *configdeliverypb.CreateVariantRequest, opts ...gax.CallOption) (*CreateVariantOperation, error) {
1409 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1410
1411 hds = append(c.xGoogHeaders, hds...)
1412 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1413 opts = append((*c.CallOptions).CreateVariant[0:len((*c.CallOptions).CreateVariant):len((*c.CallOptions).CreateVariant)], opts...)
1414 var resp *longrunningpb.Operation
1415 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1416 var err error
1417 resp, err = executeRPC(ctx, c.client.CreateVariant, req, settings.GRPC, c.logger, "CreateVariant")
1418 return err
1419 }, opts...)
1420 if err != nil {
1421 return nil, err
1422 }
1423 return &CreateVariantOperation{
1424 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1425 }, nil
1426 }
1427
1428 func (c *gRPCClient) UpdateVariant(ctx context.Context, req *configdeliverypb.UpdateVariantRequest, opts ...gax.CallOption) (*UpdateVariantOperation, error) {
1429 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "variant.name", url.QueryEscape(req.GetVariant().GetName()))}
1430
1431 hds = append(c.xGoogHeaders, hds...)
1432 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1433 opts = append((*c.CallOptions).UpdateVariant[0:len((*c.CallOptions).UpdateVariant):len((*c.CallOptions).UpdateVariant)], opts...)
1434 var resp *longrunningpb.Operation
1435 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1436 var err error
1437 resp, err = executeRPC(ctx, c.client.UpdateVariant, req, settings.GRPC, c.logger, "UpdateVariant")
1438 return err
1439 }, opts...)
1440 if err != nil {
1441 return nil, err
1442 }
1443 return &UpdateVariantOperation{
1444 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1445 }, nil
1446 }
1447
1448 func (c *gRPCClient) DeleteVariant(ctx context.Context, req *configdeliverypb.DeleteVariantRequest, opts ...gax.CallOption) (*DeleteVariantOperation, error) {
1449 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1450
1451 hds = append(c.xGoogHeaders, hds...)
1452 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1453 opts = append((*c.CallOptions).DeleteVariant[0:len((*c.CallOptions).DeleteVariant):len((*c.CallOptions).DeleteVariant)], opts...)
1454 var resp *longrunningpb.Operation
1455 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1456 var err error
1457 resp, err = executeRPC(ctx, c.client.DeleteVariant, req, settings.GRPC, c.logger, "DeleteVariant")
1458 return err
1459 }, opts...)
1460 if err != nil {
1461 return nil, err
1462 }
1463 return &DeleteVariantOperation{
1464 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1465 }, nil
1466 }
1467
1468 func (c *gRPCClient) ListRollouts(ctx context.Context, req *configdeliverypb.ListRolloutsRequest, opts ...gax.CallOption) *RolloutIterator {
1469 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1470
1471 hds = append(c.xGoogHeaders, hds...)
1472 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1473 opts = append((*c.CallOptions).ListRollouts[0:len((*c.CallOptions).ListRollouts):len((*c.CallOptions).ListRollouts)], opts...)
1474 it := &RolloutIterator{}
1475 req = proto.Clone(req).(*configdeliverypb.ListRolloutsRequest)
1476 it.InternalFetch = func(pageSize int, pageToken string) ([]*configdeliverypb.Rollout, string, error) {
1477 resp := &configdeliverypb.ListRolloutsResponse{}
1478 if pageToken != "" {
1479 req.PageToken = pageToken
1480 }
1481 if pageSize > math.MaxInt32 {
1482 req.PageSize = math.MaxInt32
1483 } else if pageSize != 0 {
1484 req.PageSize = int32(pageSize)
1485 }
1486 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1487 var err error
1488 resp, err = executeRPC(ctx, c.client.ListRollouts, req, settings.GRPC, c.logger, "ListRollouts")
1489 return err
1490 }, opts...)
1491 if err != nil {
1492 return nil, "", err
1493 }
1494
1495 it.Response = resp
1496 return resp.GetRollouts(), resp.GetNextPageToken(), nil
1497 }
1498 fetch := func(pageSize int, pageToken string) (string, error) {
1499 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1500 if err != nil {
1501 return "", err
1502 }
1503 it.items = append(it.items, items...)
1504 return nextPageToken, nil
1505 }
1506
1507 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1508 it.pageInfo.MaxSize = int(req.GetPageSize())
1509 it.pageInfo.Token = req.GetPageToken()
1510
1511 return it
1512 }
1513
1514 func (c *gRPCClient) GetRollout(ctx context.Context, req *configdeliverypb.GetRolloutRequest, opts ...gax.CallOption) (*configdeliverypb.Rollout, error) {
1515 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1516
1517 hds = append(c.xGoogHeaders, hds...)
1518 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1519 opts = append((*c.CallOptions).GetRollout[0:len((*c.CallOptions).GetRollout):len((*c.CallOptions).GetRollout)], opts...)
1520 var resp *configdeliverypb.Rollout
1521 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1522 var err error
1523 resp, err = executeRPC(ctx, c.client.GetRollout, req, settings.GRPC, c.logger, "GetRollout")
1524 return err
1525 }, opts...)
1526 if err != nil {
1527 return nil, err
1528 }
1529 return resp, nil
1530 }
1531
1532 func (c *gRPCClient) SuspendRollout(ctx context.Context, req *configdeliverypb.SuspendRolloutRequest, opts ...gax.CallOption) (*SuspendRolloutOperation, error) {
1533 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1534
1535 hds = append(c.xGoogHeaders, hds...)
1536 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1537 opts = append((*c.CallOptions).SuspendRollout[0:len((*c.CallOptions).SuspendRollout):len((*c.CallOptions).SuspendRollout)], opts...)
1538 var resp *longrunningpb.Operation
1539 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1540 var err error
1541 resp, err = executeRPC(ctx, c.client.SuspendRollout, req, settings.GRPC, c.logger, "SuspendRollout")
1542 return err
1543 }, opts...)
1544 if err != nil {
1545 return nil, err
1546 }
1547 return &SuspendRolloutOperation{
1548 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1549 }, nil
1550 }
1551
1552 func (c *gRPCClient) ResumeRollout(ctx context.Context, req *configdeliverypb.ResumeRolloutRequest, opts ...gax.CallOption) (*ResumeRolloutOperation, error) {
1553 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1554
1555 hds = append(c.xGoogHeaders, hds...)
1556 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1557 opts = append((*c.CallOptions).ResumeRollout[0:len((*c.CallOptions).ResumeRollout):len((*c.CallOptions).ResumeRollout)], opts...)
1558 var resp *longrunningpb.Operation
1559 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1560 var err error
1561 resp, err = executeRPC(ctx, c.client.ResumeRollout, req, settings.GRPC, c.logger, "ResumeRollout")
1562 return err
1563 }, opts...)
1564 if err != nil {
1565 return nil, err
1566 }
1567 return &ResumeRolloutOperation{
1568 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1569 }, nil
1570 }
1571
1572 func (c *gRPCClient) AbortRollout(ctx context.Context, req *configdeliverypb.AbortRolloutRequest, opts ...gax.CallOption) (*AbortRolloutOperation, error) {
1573 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1574
1575 hds = append(c.xGoogHeaders, hds...)
1576 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1577 opts = append((*c.CallOptions).AbortRollout[0:len((*c.CallOptions).AbortRollout):len((*c.CallOptions).AbortRollout)], opts...)
1578 var resp *longrunningpb.Operation
1579 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1580 var err error
1581 resp, err = executeRPC(ctx, c.client.AbortRollout, req, settings.GRPC, c.logger, "AbortRollout")
1582 return err
1583 }, opts...)
1584 if err != nil {
1585 return nil, err
1586 }
1587 return &AbortRolloutOperation{
1588 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1589 }, nil
1590 }
1591
1592 func (c *gRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
1593 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1594
1595 hds = append(c.xGoogHeaders, hds...)
1596 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1597 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
1598 var resp *locationpb.Location
1599 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1600 var err error
1601 resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation")
1602 return err
1603 }, opts...)
1604 if err != nil {
1605 return nil, err
1606 }
1607 return resp, nil
1608 }
1609
1610 func (c *gRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
1611 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1612
1613 hds = append(c.xGoogHeaders, hds...)
1614 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1615 opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...)
1616 it := &LocationIterator{}
1617 req = proto.Clone(req).(*locationpb.ListLocationsRequest)
1618 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
1619 resp := &locationpb.ListLocationsResponse{}
1620 if pageToken != "" {
1621 req.PageToken = pageToken
1622 }
1623 if pageSize > math.MaxInt32 {
1624 req.PageSize = math.MaxInt32
1625 } else if pageSize != 0 {
1626 req.PageSize = int32(pageSize)
1627 }
1628 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1629 var err error
1630 resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations")
1631 return err
1632 }, opts...)
1633 if err != nil {
1634 return nil, "", err
1635 }
1636
1637 it.Response = resp
1638 return resp.GetLocations(), resp.GetNextPageToken(), nil
1639 }
1640 fetch := func(pageSize int, pageToken string) (string, error) {
1641 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1642 if err != nil {
1643 return "", err
1644 }
1645 it.items = append(it.items, items...)
1646 return nextPageToken, nil
1647 }
1648
1649 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1650 it.pageInfo.MaxSize = int(req.GetPageSize())
1651 it.pageInfo.Token = req.GetPageToken()
1652
1653 return it
1654 }
1655
1656 func (c *gRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
1657 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1658
1659 hds = append(c.xGoogHeaders, hds...)
1660 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1661 opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...)
1662 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1663 var err error
1664 _, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation")
1665 return err
1666 }, opts...)
1667 return err
1668 }
1669
1670 func (c *gRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
1671 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1672
1673 hds = append(c.xGoogHeaders, hds...)
1674 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1675 opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...)
1676 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1677 var err error
1678 _, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation")
1679 return err
1680 }, opts...)
1681 return err
1682 }
1683
1684 func (c *gRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
1685 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1686
1687 hds = append(c.xGoogHeaders, hds...)
1688 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1689 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
1690 var resp *longrunningpb.Operation
1691 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1692 var err error
1693 resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation")
1694 return err
1695 }, opts...)
1696 if err != nil {
1697 return nil, err
1698 }
1699 return resp, nil
1700 }
1701
1702 func (c *gRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
1703 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1704
1705 hds = append(c.xGoogHeaders, hds...)
1706 ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...)
1707 opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...)
1708 it := &OperationIterator{}
1709 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
1710 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
1711 resp := &longrunningpb.ListOperationsResponse{}
1712 if pageToken != "" {
1713 req.PageToken = pageToken
1714 }
1715 if pageSize > math.MaxInt32 {
1716 req.PageSize = math.MaxInt32
1717 } else if pageSize != 0 {
1718 req.PageSize = int32(pageSize)
1719 }
1720 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1721 var err error
1722 resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations")
1723 return err
1724 }, opts...)
1725 if err != nil {
1726 return nil, "", err
1727 }
1728
1729 it.Response = resp
1730 return resp.GetOperations(), resp.GetNextPageToken(), nil
1731 }
1732 fetch := func(pageSize int, pageToken string) (string, error) {
1733 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1734 if err != nil {
1735 return "", err
1736 }
1737 it.items = append(it.items, items...)
1738 return nextPageToken, nil
1739 }
1740
1741 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1742 it.pageInfo.MaxSize = int(req.GetPageSize())
1743 it.pageInfo.Token = req.GetPageToken()
1744
1745 return it
1746 }
1747
1748 // ListResourceBundles lists ResourceBundles in a given project and location.
1749 func (c *restClient) ListResourceBundles(ctx context.Context, req *configdeliverypb.ListResourceBundlesRequest, opts ...gax.CallOption) *ResourceBundleIterator {
1750 it := &ResourceBundleIterator{}
1751 req = proto.Clone(req).(*configdeliverypb.ListResourceBundlesRequest)
1752 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1753 it.InternalFetch = func(pageSize int, pageToken string) ([]*configdeliverypb.ResourceBundle, string, error) {
1754 resp := &configdeliverypb.ListResourceBundlesResponse{}
1755 if pageToken != "" {
1756 req.PageToken = pageToken
1757 }
1758 if pageSize > math.MaxInt32 {
1759 req.PageSize = math.MaxInt32
1760 } else if pageSize != 0 {
1761 req.PageSize = int32(pageSize)
1762 }
1763 baseUrl, err := url.Parse(c.endpoint)
1764 if err != nil {
1765 return nil, "", err
1766 }
1767 baseUrl.Path += fmt.Sprintf("/v1beta/%v/resourceBundles", req.GetParent())
1768
1769 params := url.Values{}
1770 params.Add("$alt", "json;enum-encoding=int")
1771 if req.GetFilter() != "" {
1772 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
1773 }
1774 if req.GetOrderBy() != "" {
1775 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
1776 }
1777 if req.GetPageSize() != 0 {
1778 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
1779 }
1780 if req.GetPageToken() != "" {
1781 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
1782 }
1783
1784 baseUrl.RawQuery = params.Encode()
1785
1786 // Build HTTP headers from client and context metadata.
1787 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
1788 headers := gax.BuildHeaders(ctx, hds...)
1789 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1790 if settings.Path != "" {
1791 baseUrl.Path = settings.Path
1792 }
1793 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1794 if err != nil {
1795 return err
1796 }
1797 httpReq.Header = headers
1798
1799 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListResourceBundles")
1800 if err != nil {
1801 return err
1802 }
1803 if err := unm.Unmarshal(buf, resp); err != nil {
1804 return err
1805 }
1806
1807 return nil
1808 }, opts...)
1809 if e != nil {
1810 return nil, "", e
1811 }
1812 it.Response = resp
1813 return resp.GetResourceBundles(), resp.GetNextPageToken(), nil
1814 }
1815
1816 fetch := func(pageSize int, pageToken string) (string, error) {
1817 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
1818 if err != nil {
1819 return "", err
1820 }
1821 it.items = append(it.items, items...)
1822 return nextPageToken, nil
1823 }
1824
1825 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
1826 it.pageInfo.MaxSize = int(req.GetPageSize())
1827 it.pageInfo.Token = req.GetPageToken()
1828
1829 return it
1830 }
1831
1832 // GetResourceBundle gets details of a single ResourceBundle.
1833 func (c *restClient) GetResourceBundle(ctx context.Context, req *configdeliverypb.GetResourceBundleRequest, opts ...gax.CallOption) (*configdeliverypb.ResourceBundle, error) {
1834 baseUrl, err := url.Parse(c.endpoint)
1835 if err != nil {
1836 return nil, err
1837 }
1838 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
1839
1840 params := url.Values{}
1841 params.Add("$alt", "json;enum-encoding=int")
1842
1843 baseUrl.RawQuery = params.Encode()
1844
1845 // Build HTTP headers from client and context metadata.
1846 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
1847
1848 hds = append(c.xGoogHeaders, hds...)
1849 hds = append(hds, "Content-Type", "application/json")
1850 headers := gax.BuildHeaders(ctx, hds...)
1851 opts = append((*c.CallOptions).GetResourceBundle[0:len((*c.CallOptions).GetResourceBundle):len((*c.CallOptions).GetResourceBundle)], opts...)
1852 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1853 resp := &configdeliverypb.ResourceBundle{}
1854 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1855 if settings.Path != "" {
1856 baseUrl.Path = settings.Path
1857 }
1858 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
1859 if err != nil {
1860 return err
1861 }
1862 httpReq = httpReq.WithContext(ctx)
1863 httpReq.Header = headers
1864
1865 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetResourceBundle")
1866 if err != nil {
1867 return err
1868 }
1869
1870 if err := unm.Unmarshal(buf, resp); err != nil {
1871 return err
1872 }
1873
1874 return nil
1875 }, opts...)
1876 if e != nil {
1877 return nil, e
1878 }
1879 return resp, nil
1880 }
1881
1882 // CreateResourceBundle creates a new ResourceBundle in a given project and location.
1883 func (c *restClient) CreateResourceBundle(ctx context.Context, req *configdeliverypb.CreateResourceBundleRequest, opts ...gax.CallOption) (*CreateResourceBundleOperation, error) {
1884 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1885 body := req.GetResourceBundle()
1886 jsonReq, err := m.Marshal(body)
1887 if err != nil {
1888 return nil, err
1889 }
1890
1891 baseUrl, err := url.Parse(c.endpoint)
1892 if err != nil {
1893 return nil, err
1894 }
1895 baseUrl.Path += fmt.Sprintf("/v1beta/%v/resourceBundles", req.GetParent())
1896
1897 params := url.Values{}
1898 params.Add("$alt", "json;enum-encoding=int")
1899 if req.GetRequestId() != "" {
1900 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
1901 }
1902 params.Add("resourceBundleId", fmt.Sprintf("%v", req.GetResourceBundleId()))
1903
1904 baseUrl.RawQuery = params.Encode()
1905
1906 // Build HTTP headers from client and context metadata.
1907 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
1908
1909 hds = append(c.xGoogHeaders, hds...)
1910 hds = append(hds, "Content-Type", "application/json")
1911 headers := gax.BuildHeaders(ctx, hds...)
1912 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1913 resp := &longrunningpb.Operation{}
1914 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1915 if settings.Path != "" {
1916 baseUrl.Path = settings.Path
1917 }
1918 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
1919 if err != nil {
1920 return err
1921 }
1922 httpReq = httpReq.WithContext(ctx)
1923 httpReq.Header = headers
1924
1925 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateResourceBundle")
1926 if err != nil {
1927 return err
1928 }
1929 if err := unm.Unmarshal(buf, resp); err != nil {
1930 return err
1931 }
1932
1933 return nil
1934 }, opts...)
1935 if e != nil {
1936 return nil, e
1937 }
1938
1939 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
1940 return &CreateResourceBundleOperation{
1941 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
1942 pollPath: override,
1943 }, nil
1944 }
1945
1946 // UpdateResourceBundle updates the parameters of a single ResourceBundle.
1947 func (c *restClient) UpdateResourceBundle(ctx context.Context, req *configdeliverypb.UpdateResourceBundleRequest, opts ...gax.CallOption) (*UpdateResourceBundleOperation, error) {
1948 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
1949 body := req.GetResourceBundle()
1950 jsonReq, err := m.Marshal(body)
1951 if err != nil {
1952 return nil, err
1953 }
1954
1955 baseUrl, err := url.Parse(c.endpoint)
1956 if err != nil {
1957 return nil, err
1958 }
1959 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetResourceBundle().GetName())
1960
1961 params := url.Values{}
1962 params.Add("$alt", "json;enum-encoding=int")
1963 if req.GetRequestId() != "" {
1964 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
1965 }
1966 if req.GetUpdateMask() != nil {
1967 field, err := protojson.Marshal(req.GetUpdateMask())
1968 if err != nil {
1969 return nil, err
1970 }
1971 params.Add("updateMask", string(field[1:len(field)-1]))
1972 }
1973
1974 baseUrl.RawQuery = params.Encode()
1975
1976 // Build HTTP headers from client and context metadata.
1977 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "resource_bundle.name", url.QueryEscape(req.GetResourceBundle().GetName()))}
1978
1979 hds = append(c.xGoogHeaders, hds...)
1980 hds = append(hds, "Content-Type", "application/json")
1981 headers := gax.BuildHeaders(ctx, hds...)
1982 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
1983 resp := &longrunningpb.Operation{}
1984 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
1985 if settings.Path != "" {
1986 baseUrl.Path = settings.Path
1987 }
1988 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
1989 if err != nil {
1990 return err
1991 }
1992 httpReq = httpReq.WithContext(ctx)
1993 httpReq.Header = headers
1994
1995 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateResourceBundle")
1996 if err != nil {
1997 return err
1998 }
1999 if err := unm.Unmarshal(buf, resp); err != nil {
2000 return err
2001 }
2002
2003 return nil
2004 }, opts...)
2005 if e != nil {
2006 return nil, e
2007 }
2008
2009 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
2010 return &UpdateResourceBundleOperation{
2011 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2012 pollPath: override,
2013 }, nil
2014 }
2015
2016 // DeleteResourceBundle deletes a single ResourceBundle.
2017 func (c *restClient) DeleteResourceBundle(ctx context.Context, req *configdeliverypb.DeleteResourceBundleRequest, opts ...gax.CallOption) (*DeleteResourceBundleOperation, error) {
2018 baseUrl, err := url.Parse(c.endpoint)
2019 if err != nil {
2020 return nil, err
2021 }
2022 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
2023
2024 params := url.Values{}
2025 params.Add("$alt", "json;enum-encoding=int")
2026 if req.GetForce() {
2027 params.Add("force", fmt.Sprintf("%v", req.GetForce()))
2028 }
2029 if req.GetRequestId() != "" {
2030 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2031 }
2032
2033 baseUrl.RawQuery = params.Encode()
2034
2035 // Build HTTP headers from client and context metadata.
2036 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2037
2038 hds = append(c.xGoogHeaders, hds...)
2039 hds = append(hds, "Content-Type", "application/json")
2040 headers := gax.BuildHeaders(ctx, hds...)
2041 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2042 resp := &longrunningpb.Operation{}
2043 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2044 if settings.Path != "" {
2045 baseUrl.Path = settings.Path
2046 }
2047 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2048 if err != nil {
2049 return err
2050 }
2051 httpReq = httpReq.WithContext(ctx)
2052 httpReq.Header = headers
2053
2054 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteResourceBundle")
2055 if err != nil {
2056 return err
2057 }
2058 if err := unm.Unmarshal(buf, resp); err != nil {
2059 return err
2060 }
2061
2062 return nil
2063 }, opts...)
2064 if e != nil {
2065 return nil, e
2066 }
2067
2068 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
2069 return &DeleteResourceBundleOperation{
2070 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2071 pollPath: override,
2072 }, nil
2073 }
2074
2075 // ListFleetPackages lists FleetPackages in a given project and location.
2076 func (c *restClient) ListFleetPackages(ctx context.Context, req *configdeliverypb.ListFleetPackagesRequest, opts ...gax.CallOption) *FleetPackageIterator {
2077 it := &FleetPackageIterator{}
2078 req = proto.Clone(req).(*configdeliverypb.ListFleetPackagesRequest)
2079 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2080 it.InternalFetch = func(pageSize int, pageToken string) ([]*configdeliverypb.FleetPackage, string, error) {
2081 resp := &configdeliverypb.ListFleetPackagesResponse{}
2082 if pageToken != "" {
2083 req.PageToken = pageToken
2084 }
2085 if pageSize > math.MaxInt32 {
2086 req.PageSize = math.MaxInt32
2087 } else if pageSize != 0 {
2088 req.PageSize = int32(pageSize)
2089 }
2090 baseUrl, err := url.Parse(c.endpoint)
2091 if err != nil {
2092 return nil, "", err
2093 }
2094 baseUrl.Path += fmt.Sprintf("/v1beta/%v/fleetPackages", req.GetParent())
2095
2096 params := url.Values{}
2097 params.Add("$alt", "json;enum-encoding=int")
2098 if req.GetFilter() != "" {
2099 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2100 }
2101 if req.GetOrderBy() != "" {
2102 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
2103 }
2104 if req.GetPageSize() != 0 {
2105 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2106 }
2107 if req.GetPageToken() != "" {
2108 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2109 }
2110
2111 baseUrl.RawQuery = params.Encode()
2112
2113 // Build HTTP headers from client and context metadata.
2114 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2115 headers := gax.BuildHeaders(ctx, hds...)
2116 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2117 if settings.Path != "" {
2118 baseUrl.Path = settings.Path
2119 }
2120 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2121 if err != nil {
2122 return err
2123 }
2124 httpReq.Header = headers
2125
2126 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListFleetPackages")
2127 if err != nil {
2128 return err
2129 }
2130 if err := unm.Unmarshal(buf, resp); err != nil {
2131 return err
2132 }
2133
2134 return nil
2135 }, opts...)
2136 if e != nil {
2137 return nil, "", e
2138 }
2139 it.Response = resp
2140 return resp.GetFleetPackages(), resp.GetNextPageToken(), nil
2141 }
2142
2143 fetch := func(pageSize int, pageToken string) (string, error) {
2144 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2145 if err != nil {
2146 return "", err
2147 }
2148 it.items = append(it.items, items...)
2149 return nextPageToken, nil
2150 }
2151
2152 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2153 it.pageInfo.MaxSize = int(req.GetPageSize())
2154 it.pageInfo.Token = req.GetPageToken()
2155
2156 return it
2157 }
2158
2159 // GetFleetPackage gets details of a single FleetPackage.
2160 func (c *restClient) GetFleetPackage(ctx context.Context, req *configdeliverypb.GetFleetPackageRequest, opts ...gax.CallOption) (*configdeliverypb.FleetPackage, error) {
2161 baseUrl, err := url.Parse(c.endpoint)
2162 if err != nil {
2163 return nil, err
2164 }
2165 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
2166
2167 params := url.Values{}
2168 params.Add("$alt", "json;enum-encoding=int")
2169
2170 baseUrl.RawQuery = params.Encode()
2171
2172 // Build HTTP headers from client and context metadata.
2173 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2174
2175 hds = append(c.xGoogHeaders, hds...)
2176 hds = append(hds, "Content-Type", "application/json")
2177 headers := gax.BuildHeaders(ctx, hds...)
2178 opts = append((*c.CallOptions).GetFleetPackage[0:len((*c.CallOptions).GetFleetPackage):len((*c.CallOptions).GetFleetPackage)], opts...)
2179 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2180 resp := &configdeliverypb.FleetPackage{}
2181 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2182 if settings.Path != "" {
2183 baseUrl.Path = settings.Path
2184 }
2185 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2186 if err != nil {
2187 return err
2188 }
2189 httpReq = httpReq.WithContext(ctx)
2190 httpReq.Header = headers
2191
2192 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetFleetPackage")
2193 if err != nil {
2194 return err
2195 }
2196
2197 if err := unm.Unmarshal(buf, resp); err != nil {
2198 return err
2199 }
2200
2201 return nil
2202 }, opts...)
2203 if e != nil {
2204 return nil, e
2205 }
2206 return resp, nil
2207 }
2208
2209 // CreateFleetPackage creates a new FleetPackage in a given project and location.
2210 func (c *restClient) CreateFleetPackage(ctx context.Context, req *configdeliverypb.CreateFleetPackageRequest, opts ...gax.CallOption) (*CreateFleetPackageOperation, error) {
2211 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2212 body := req.GetFleetPackage()
2213 jsonReq, err := m.Marshal(body)
2214 if err != nil {
2215 return nil, err
2216 }
2217
2218 baseUrl, err := url.Parse(c.endpoint)
2219 if err != nil {
2220 return nil, err
2221 }
2222 baseUrl.Path += fmt.Sprintf("/v1beta/%v/fleetPackages", req.GetParent())
2223
2224 params := url.Values{}
2225 params.Add("$alt", "json;enum-encoding=int")
2226 params.Add("fleetPackageId", fmt.Sprintf("%v", req.GetFleetPackageId()))
2227 if req.GetRequestId() != "" {
2228 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2229 }
2230
2231 baseUrl.RawQuery = params.Encode()
2232
2233 // Build HTTP headers from client and context metadata.
2234 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2235
2236 hds = append(c.xGoogHeaders, hds...)
2237 hds = append(hds, "Content-Type", "application/json")
2238 headers := gax.BuildHeaders(ctx, hds...)
2239 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2240 resp := &longrunningpb.Operation{}
2241 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2242 if settings.Path != "" {
2243 baseUrl.Path = settings.Path
2244 }
2245 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2246 if err != nil {
2247 return err
2248 }
2249 httpReq = httpReq.WithContext(ctx)
2250 httpReq.Header = headers
2251
2252 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateFleetPackage")
2253 if err != nil {
2254 return err
2255 }
2256 if err := unm.Unmarshal(buf, resp); err != nil {
2257 return err
2258 }
2259
2260 return nil
2261 }, opts...)
2262 if e != nil {
2263 return nil, e
2264 }
2265
2266 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
2267 return &CreateFleetPackageOperation{
2268 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2269 pollPath: override,
2270 }, nil
2271 }
2272
2273 // UpdateFleetPackage updates the parameters of a single FleetPackage.
2274 func (c *restClient) UpdateFleetPackage(ctx context.Context, req *configdeliverypb.UpdateFleetPackageRequest, opts ...gax.CallOption) (*UpdateFleetPackageOperation, error) {
2275 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2276 body := req.GetFleetPackage()
2277 jsonReq, err := m.Marshal(body)
2278 if err != nil {
2279 return nil, err
2280 }
2281
2282 baseUrl, err := url.Parse(c.endpoint)
2283 if err != nil {
2284 return nil, err
2285 }
2286 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetFleetPackage().GetName())
2287
2288 params := url.Values{}
2289 params.Add("$alt", "json;enum-encoding=int")
2290 if req.GetRequestId() != "" {
2291 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2292 }
2293 if req.GetUpdateMask() != nil {
2294 field, err := protojson.Marshal(req.GetUpdateMask())
2295 if err != nil {
2296 return nil, err
2297 }
2298 params.Add("updateMask", string(field[1:len(field)-1]))
2299 }
2300
2301 baseUrl.RawQuery = params.Encode()
2302
2303 // Build HTTP headers from client and context metadata.
2304 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "fleet_package.name", url.QueryEscape(req.GetFleetPackage().GetName()))}
2305
2306 hds = append(c.xGoogHeaders, hds...)
2307 hds = append(hds, "Content-Type", "application/json")
2308 headers := gax.BuildHeaders(ctx, hds...)
2309 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2310 resp := &longrunningpb.Operation{}
2311 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2312 if settings.Path != "" {
2313 baseUrl.Path = settings.Path
2314 }
2315 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
2316 if err != nil {
2317 return err
2318 }
2319 httpReq = httpReq.WithContext(ctx)
2320 httpReq.Header = headers
2321
2322 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateFleetPackage")
2323 if err != nil {
2324 return err
2325 }
2326 if err := unm.Unmarshal(buf, resp); err != nil {
2327 return err
2328 }
2329
2330 return nil
2331 }, opts...)
2332 if e != nil {
2333 return nil, e
2334 }
2335
2336 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
2337 return &UpdateFleetPackageOperation{
2338 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2339 pollPath: override,
2340 }, nil
2341 }
2342
2343 // DeleteFleetPackage deletes a single FleetPackage.
2344 func (c *restClient) DeleteFleetPackage(ctx context.Context, req *configdeliverypb.DeleteFleetPackageRequest, opts ...gax.CallOption) (*DeleteFleetPackageOperation, error) {
2345 baseUrl, err := url.Parse(c.endpoint)
2346 if err != nil {
2347 return nil, err
2348 }
2349 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
2350
2351 params := url.Values{}
2352 params.Add("$alt", "json;enum-encoding=int")
2353 if req.GetAllowMissing() {
2354 params.Add("allowMissing", fmt.Sprintf("%v", req.GetAllowMissing()))
2355 }
2356 if req.GetForce() {
2357 params.Add("force", fmt.Sprintf("%v", req.GetForce()))
2358 }
2359 if req.GetRequestId() != "" {
2360 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2361 }
2362
2363 baseUrl.RawQuery = params.Encode()
2364
2365 // Build HTTP headers from client and context metadata.
2366 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2367
2368 hds = append(c.xGoogHeaders, hds...)
2369 hds = append(hds, "Content-Type", "application/json")
2370 headers := gax.BuildHeaders(ctx, hds...)
2371 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2372 resp := &longrunningpb.Operation{}
2373 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2374 if settings.Path != "" {
2375 baseUrl.Path = settings.Path
2376 }
2377 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2378 if err != nil {
2379 return err
2380 }
2381 httpReq = httpReq.WithContext(ctx)
2382 httpReq.Header = headers
2383
2384 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteFleetPackage")
2385 if err != nil {
2386 return err
2387 }
2388 if err := unm.Unmarshal(buf, resp); err != nil {
2389 return err
2390 }
2391
2392 return nil
2393 }, opts...)
2394 if e != nil {
2395 return nil, e
2396 }
2397
2398 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
2399 return &DeleteFleetPackageOperation{
2400 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2401 pollPath: override,
2402 }, nil
2403 }
2404
2405 // ListReleases lists Releases in a given project and location.
2406 func (c *restClient) ListReleases(ctx context.Context, req *configdeliverypb.ListReleasesRequest, opts ...gax.CallOption) *ReleaseIterator {
2407 it := &ReleaseIterator{}
2408 req = proto.Clone(req).(*configdeliverypb.ListReleasesRequest)
2409 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2410 it.InternalFetch = func(pageSize int, pageToken string) ([]*configdeliverypb.Release, string, error) {
2411 resp := &configdeliverypb.ListReleasesResponse{}
2412 if pageToken != "" {
2413 req.PageToken = pageToken
2414 }
2415 if pageSize > math.MaxInt32 {
2416 req.PageSize = math.MaxInt32
2417 } else if pageSize != 0 {
2418 req.PageSize = int32(pageSize)
2419 }
2420 baseUrl, err := url.Parse(c.endpoint)
2421 if err != nil {
2422 return nil, "", err
2423 }
2424 baseUrl.Path += fmt.Sprintf("/v1beta/%v/releases", req.GetParent())
2425
2426 params := url.Values{}
2427 params.Add("$alt", "json;enum-encoding=int")
2428 if req.GetFilter() != "" {
2429 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2430 }
2431 if req.GetOrderBy() != "" {
2432 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
2433 }
2434 if req.GetPageSize() != 0 {
2435 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2436 }
2437 if req.GetPageToken() != "" {
2438 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2439 }
2440
2441 baseUrl.RawQuery = params.Encode()
2442
2443 // Build HTTP headers from client and context metadata.
2444 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2445 headers := gax.BuildHeaders(ctx, hds...)
2446 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2447 if settings.Path != "" {
2448 baseUrl.Path = settings.Path
2449 }
2450 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2451 if err != nil {
2452 return err
2453 }
2454 httpReq.Header = headers
2455
2456 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListReleases")
2457 if err != nil {
2458 return err
2459 }
2460 if err := unm.Unmarshal(buf, resp); err != nil {
2461 return err
2462 }
2463
2464 return nil
2465 }, opts...)
2466 if e != nil {
2467 return nil, "", e
2468 }
2469 it.Response = resp
2470 return resp.GetReleases(), resp.GetNextPageToken(), nil
2471 }
2472
2473 fetch := func(pageSize int, pageToken string) (string, error) {
2474 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2475 if err != nil {
2476 return "", err
2477 }
2478 it.items = append(it.items, items...)
2479 return nextPageToken, nil
2480 }
2481
2482 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2483 it.pageInfo.MaxSize = int(req.GetPageSize())
2484 it.pageInfo.Token = req.GetPageToken()
2485
2486 return it
2487 }
2488
2489 // GetRelease gets details of a single Release.
2490 func (c *restClient) GetRelease(ctx context.Context, req *configdeliverypb.GetReleaseRequest, opts ...gax.CallOption) (*configdeliverypb.Release, error) {
2491 baseUrl, err := url.Parse(c.endpoint)
2492 if err != nil {
2493 return nil, err
2494 }
2495 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
2496
2497 params := url.Values{}
2498 params.Add("$alt", "json;enum-encoding=int")
2499
2500 baseUrl.RawQuery = params.Encode()
2501
2502 // Build HTTP headers from client and context metadata.
2503 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2504
2505 hds = append(c.xGoogHeaders, hds...)
2506 hds = append(hds, "Content-Type", "application/json")
2507 headers := gax.BuildHeaders(ctx, hds...)
2508 opts = append((*c.CallOptions).GetRelease[0:len((*c.CallOptions).GetRelease):len((*c.CallOptions).GetRelease)], opts...)
2509 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2510 resp := &configdeliverypb.Release{}
2511 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2512 if settings.Path != "" {
2513 baseUrl.Path = settings.Path
2514 }
2515 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2516 if err != nil {
2517 return err
2518 }
2519 httpReq = httpReq.WithContext(ctx)
2520 httpReq.Header = headers
2521
2522 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetRelease")
2523 if err != nil {
2524 return err
2525 }
2526
2527 if err := unm.Unmarshal(buf, resp); err != nil {
2528 return err
2529 }
2530
2531 return nil
2532 }, opts...)
2533 if e != nil {
2534 return nil, e
2535 }
2536 return resp, nil
2537 }
2538
2539 // CreateRelease creates a new Release in a given project, location and resource bundle.
2540 func (c *restClient) CreateRelease(ctx context.Context, req *configdeliverypb.CreateReleaseRequest, opts ...gax.CallOption) (*CreateReleaseOperation, error) {
2541 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2542 body := req.GetRelease()
2543 jsonReq, err := m.Marshal(body)
2544 if err != nil {
2545 return nil, err
2546 }
2547
2548 baseUrl, err := url.Parse(c.endpoint)
2549 if err != nil {
2550 return nil, err
2551 }
2552 baseUrl.Path += fmt.Sprintf("/v1beta/%v/releases", req.GetParent())
2553
2554 params := url.Values{}
2555 params.Add("$alt", "json;enum-encoding=int")
2556 params.Add("releaseId", fmt.Sprintf("%v", req.GetReleaseId()))
2557 if req.GetRequestId() != "" {
2558 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2559 }
2560
2561 baseUrl.RawQuery = params.Encode()
2562
2563 // Build HTTP headers from client and context metadata.
2564 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2565
2566 hds = append(c.xGoogHeaders, hds...)
2567 hds = append(hds, "Content-Type", "application/json")
2568 headers := gax.BuildHeaders(ctx, hds...)
2569 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2570 resp := &longrunningpb.Operation{}
2571 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2572 if settings.Path != "" {
2573 baseUrl.Path = settings.Path
2574 }
2575 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2576 if err != nil {
2577 return err
2578 }
2579 httpReq = httpReq.WithContext(ctx)
2580 httpReq.Header = headers
2581
2582 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateRelease")
2583 if err != nil {
2584 return err
2585 }
2586 if err := unm.Unmarshal(buf, resp); err != nil {
2587 return err
2588 }
2589
2590 return nil
2591 }, opts...)
2592 if e != nil {
2593 return nil, e
2594 }
2595
2596 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
2597 return &CreateReleaseOperation{
2598 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2599 pollPath: override,
2600 }, nil
2601 }
2602
2603 // UpdateRelease updates the parameters of a single Release.
2604 func (c *restClient) UpdateRelease(ctx context.Context, req *configdeliverypb.UpdateReleaseRequest, opts ...gax.CallOption) (*UpdateReleaseOperation, error) {
2605 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2606 body := req.GetRelease()
2607 jsonReq, err := m.Marshal(body)
2608 if err != nil {
2609 return nil, err
2610 }
2611
2612 baseUrl, err := url.Parse(c.endpoint)
2613 if err != nil {
2614 return nil, err
2615 }
2616 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetRelease().GetName())
2617
2618 params := url.Values{}
2619 params.Add("$alt", "json;enum-encoding=int")
2620 if req.GetRequestId() != "" {
2621 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2622 }
2623 if req.GetUpdateMask() != nil {
2624 field, err := protojson.Marshal(req.GetUpdateMask())
2625 if err != nil {
2626 return nil, err
2627 }
2628 params.Add("updateMask", string(field[1:len(field)-1]))
2629 }
2630
2631 baseUrl.RawQuery = params.Encode()
2632
2633 // Build HTTP headers from client and context metadata.
2634 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "release.name", url.QueryEscape(req.GetRelease().GetName()))}
2635
2636 hds = append(c.xGoogHeaders, hds...)
2637 hds = append(hds, "Content-Type", "application/json")
2638 headers := gax.BuildHeaders(ctx, hds...)
2639 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2640 resp := &longrunningpb.Operation{}
2641 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2642 if settings.Path != "" {
2643 baseUrl.Path = settings.Path
2644 }
2645 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
2646 if err != nil {
2647 return err
2648 }
2649 httpReq = httpReq.WithContext(ctx)
2650 httpReq.Header = headers
2651
2652 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateRelease")
2653 if err != nil {
2654 return err
2655 }
2656 if err := unm.Unmarshal(buf, resp); err != nil {
2657 return err
2658 }
2659
2660 return nil
2661 }, opts...)
2662 if e != nil {
2663 return nil, e
2664 }
2665
2666 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
2667 return &UpdateReleaseOperation{
2668 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2669 pollPath: override,
2670 }, nil
2671 }
2672
2673 // DeleteRelease deletes a single Release.
2674 func (c *restClient) DeleteRelease(ctx context.Context, req *configdeliverypb.DeleteReleaseRequest, opts ...gax.CallOption) (*DeleteReleaseOperation, error) {
2675 baseUrl, err := url.Parse(c.endpoint)
2676 if err != nil {
2677 return nil, err
2678 }
2679 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
2680
2681 params := url.Values{}
2682 params.Add("$alt", "json;enum-encoding=int")
2683 if req.GetForce() {
2684 params.Add("force", fmt.Sprintf("%v", req.GetForce()))
2685 }
2686 if req.GetRequestId() != "" {
2687 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2688 }
2689
2690 baseUrl.RawQuery = params.Encode()
2691
2692 // Build HTTP headers from client and context metadata.
2693 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2694
2695 hds = append(c.xGoogHeaders, hds...)
2696 hds = append(hds, "Content-Type", "application/json")
2697 headers := gax.BuildHeaders(ctx, hds...)
2698 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2699 resp := &longrunningpb.Operation{}
2700 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2701 if settings.Path != "" {
2702 baseUrl.Path = settings.Path
2703 }
2704 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
2705 if err != nil {
2706 return err
2707 }
2708 httpReq = httpReq.WithContext(ctx)
2709 httpReq.Header = headers
2710
2711 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteRelease")
2712 if err != nil {
2713 return err
2714 }
2715 if err := unm.Unmarshal(buf, resp); err != nil {
2716 return err
2717 }
2718
2719 return nil
2720 }, opts...)
2721 if e != nil {
2722 return nil, e
2723 }
2724
2725 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
2726 return &DeleteReleaseOperation{
2727 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2728 pollPath: override,
2729 }, nil
2730 }
2731
2732 // ListVariants lists Variants in a given project and location.
2733 func (c *restClient) ListVariants(ctx context.Context, req *configdeliverypb.ListVariantsRequest, opts ...gax.CallOption) *VariantIterator {
2734 it := &VariantIterator{}
2735 req = proto.Clone(req).(*configdeliverypb.ListVariantsRequest)
2736 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2737 it.InternalFetch = func(pageSize int, pageToken string) ([]*configdeliverypb.Variant, string, error) {
2738 resp := &configdeliverypb.ListVariantsResponse{}
2739 if pageToken != "" {
2740 req.PageToken = pageToken
2741 }
2742 if pageSize > math.MaxInt32 {
2743 req.PageSize = math.MaxInt32
2744 } else if pageSize != 0 {
2745 req.PageSize = int32(pageSize)
2746 }
2747 baseUrl, err := url.Parse(c.endpoint)
2748 if err != nil {
2749 return nil, "", err
2750 }
2751 baseUrl.Path += fmt.Sprintf("/v1beta/%v/variants", req.GetParent())
2752
2753 params := url.Values{}
2754 params.Add("$alt", "json;enum-encoding=int")
2755 if req.GetFilter() != "" {
2756 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
2757 }
2758 if req.GetOrderBy() != "" {
2759 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
2760 }
2761 if req.GetPageSize() != 0 {
2762 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
2763 }
2764 if req.GetPageToken() != "" {
2765 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
2766 }
2767
2768 baseUrl.RawQuery = params.Encode()
2769
2770 // Build HTTP headers from client and context metadata.
2771 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
2772 headers := gax.BuildHeaders(ctx, hds...)
2773 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2774 if settings.Path != "" {
2775 baseUrl.Path = settings.Path
2776 }
2777 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2778 if err != nil {
2779 return err
2780 }
2781 httpReq.Header = headers
2782
2783 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListVariants")
2784 if err != nil {
2785 return err
2786 }
2787 if err := unm.Unmarshal(buf, resp); err != nil {
2788 return err
2789 }
2790
2791 return nil
2792 }, opts...)
2793 if e != nil {
2794 return nil, "", e
2795 }
2796 it.Response = resp
2797 return resp.GetVariants(), resp.GetNextPageToken(), nil
2798 }
2799
2800 fetch := func(pageSize int, pageToken string) (string, error) {
2801 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
2802 if err != nil {
2803 return "", err
2804 }
2805 it.items = append(it.items, items...)
2806 return nextPageToken, nil
2807 }
2808
2809 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
2810 it.pageInfo.MaxSize = int(req.GetPageSize())
2811 it.pageInfo.Token = req.GetPageToken()
2812
2813 return it
2814 }
2815
2816 // GetVariant gets details of a single Variant.
2817 func (c *restClient) GetVariant(ctx context.Context, req *configdeliverypb.GetVariantRequest, opts ...gax.CallOption) (*configdeliverypb.Variant, error) {
2818 baseUrl, err := url.Parse(c.endpoint)
2819 if err != nil {
2820 return nil, err
2821 }
2822 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
2823
2824 params := url.Values{}
2825 params.Add("$alt", "json;enum-encoding=int")
2826
2827 baseUrl.RawQuery = params.Encode()
2828
2829 // Build HTTP headers from client and context metadata.
2830 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
2831
2832 hds = append(c.xGoogHeaders, hds...)
2833 hds = append(hds, "Content-Type", "application/json")
2834 headers := gax.BuildHeaders(ctx, hds...)
2835 opts = append((*c.CallOptions).GetVariant[0:len((*c.CallOptions).GetVariant):len((*c.CallOptions).GetVariant)], opts...)
2836 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2837 resp := &configdeliverypb.Variant{}
2838 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2839 if settings.Path != "" {
2840 baseUrl.Path = settings.Path
2841 }
2842 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
2843 if err != nil {
2844 return err
2845 }
2846 httpReq = httpReq.WithContext(ctx)
2847 httpReq.Header = headers
2848
2849 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetVariant")
2850 if err != nil {
2851 return err
2852 }
2853
2854 if err := unm.Unmarshal(buf, resp); err != nil {
2855 return err
2856 }
2857
2858 return nil
2859 }, opts...)
2860 if e != nil {
2861 return nil, e
2862 }
2863 return resp, nil
2864 }
2865
2866 // CreateVariant creates a new Variant in a given project, location, resource bundle, and
2867 // release.
2868 func (c *restClient) CreateVariant(ctx context.Context, req *configdeliverypb.CreateVariantRequest, opts ...gax.CallOption) (*CreateVariantOperation, error) {
2869 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2870 body := req.GetVariant()
2871 jsonReq, err := m.Marshal(body)
2872 if err != nil {
2873 return nil, err
2874 }
2875
2876 baseUrl, err := url.Parse(c.endpoint)
2877 if err != nil {
2878 return nil, err
2879 }
2880 baseUrl.Path += fmt.Sprintf("/v1beta/%v/variants", req.GetParent())
2881
2882 params := url.Values{}
2883 params.Add("$alt", "json;enum-encoding=int")
2884 if req.GetRequestId() != "" {
2885 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2886 }
2887 params.Add("variantId", fmt.Sprintf("%v", req.GetVariantId()))
2888
2889 baseUrl.RawQuery = params.Encode()
2890
2891 // Build HTTP headers from client and context metadata.
2892 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))}
2893
2894 hds = append(c.xGoogHeaders, hds...)
2895 hds = append(hds, "Content-Type", "application/json")
2896 headers := gax.BuildHeaders(ctx, hds...)
2897 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2898 resp := &longrunningpb.Operation{}
2899 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2900 if settings.Path != "" {
2901 baseUrl.Path = settings.Path
2902 }
2903 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
2904 if err != nil {
2905 return err
2906 }
2907 httpReq = httpReq.WithContext(ctx)
2908 httpReq.Header = headers
2909
2910 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateVariant")
2911 if err != nil {
2912 return err
2913 }
2914 if err := unm.Unmarshal(buf, resp); err != nil {
2915 return err
2916 }
2917
2918 return nil
2919 }, opts...)
2920 if e != nil {
2921 return nil, e
2922 }
2923
2924 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
2925 return &CreateVariantOperation{
2926 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2927 pollPath: override,
2928 }, nil
2929 }
2930
2931 // UpdateVariant updates the parameters of a single Variant.
2932 func (c *restClient) UpdateVariant(ctx context.Context, req *configdeliverypb.UpdateVariantRequest, opts ...gax.CallOption) (*UpdateVariantOperation, error) {
2933 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
2934 body := req.GetVariant()
2935 jsonReq, err := m.Marshal(body)
2936 if err != nil {
2937 return nil, err
2938 }
2939
2940 baseUrl, err := url.Parse(c.endpoint)
2941 if err != nil {
2942 return nil, err
2943 }
2944 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetVariant().GetName())
2945
2946 params := url.Values{}
2947 params.Add("$alt", "json;enum-encoding=int")
2948 if req.GetRequestId() != "" {
2949 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
2950 }
2951 if req.GetUpdateMask() != nil {
2952 field, err := protojson.Marshal(req.GetUpdateMask())
2953 if err != nil {
2954 return nil, err
2955 }
2956 params.Add("updateMask", string(field[1:len(field)-1]))
2957 }
2958
2959 baseUrl.RawQuery = params.Encode()
2960
2961 // Build HTTP headers from client and context metadata.
2962 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "variant.name", url.QueryEscape(req.GetVariant().GetName()))}
2963
2964 hds = append(c.xGoogHeaders, hds...)
2965 hds = append(hds, "Content-Type", "application/json")
2966 headers := gax.BuildHeaders(ctx, hds...)
2967 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
2968 resp := &longrunningpb.Operation{}
2969 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
2970 if settings.Path != "" {
2971 baseUrl.Path = settings.Path
2972 }
2973 httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
2974 if err != nil {
2975 return err
2976 }
2977 httpReq = httpReq.WithContext(ctx)
2978 httpReq.Header = headers
2979
2980 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateVariant")
2981 if err != nil {
2982 return err
2983 }
2984 if err := unm.Unmarshal(buf, resp); err != nil {
2985 return err
2986 }
2987
2988 return nil
2989 }, opts...)
2990 if e != nil {
2991 return nil, e
2992 }
2993
2994 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
2995 return &UpdateVariantOperation{
2996 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
2997 pollPath: override,
2998 }, nil
2999 }
3000
3001 // DeleteVariant deletes a single Variant.
3002 func (c *restClient) DeleteVariant(ctx context.Context, req *configdeliverypb.DeleteVariantRequest, opts ...gax.CallOption) (*DeleteVariantOperation, error) {
3003 baseUrl, err := url.Parse(c.endpoint)
3004 if err != nil {
3005 return nil, err
3006 }
3007 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
3008
3009 params := url.Values{}
3010 params.Add("$alt", "json;enum-encoding=int")
3011 if req.GetRequestId() != "" {
3012 params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
3013 }
3014
3015 baseUrl.RawQuery = params.Encode()
3016
3017 // Build HTTP headers from client and context metadata.
3018 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3019
3020 hds = append(c.xGoogHeaders, hds...)
3021 hds = append(hds, "Content-Type", "application/json")
3022 headers := gax.BuildHeaders(ctx, hds...)
3023 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3024 resp := &longrunningpb.Operation{}
3025 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3026 if settings.Path != "" {
3027 baseUrl.Path = settings.Path
3028 }
3029 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
3030 if err != nil {
3031 return err
3032 }
3033 httpReq = httpReq.WithContext(ctx)
3034 httpReq.Header = headers
3035
3036 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteVariant")
3037 if err != nil {
3038 return err
3039 }
3040 if err := unm.Unmarshal(buf, resp); err != nil {
3041 return err
3042 }
3043
3044 return nil
3045 }, opts...)
3046 if e != nil {
3047 return nil, e
3048 }
3049
3050 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
3051 return &DeleteVariantOperation{
3052 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3053 pollPath: override,
3054 }, nil
3055 }
3056
3057 // ListRollouts lists Rollouts in a given project, location, and Fleet Package.
3058 func (c *restClient) ListRollouts(ctx context.Context, req *configdeliverypb.ListRolloutsRequest, opts ...gax.CallOption) *RolloutIterator {
3059 it := &RolloutIterator{}
3060 req = proto.Clone(req).(*configdeliverypb.ListRolloutsRequest)
3061 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3062 it.InternalFetch = func(pageSize int, pageToken string) ([]*configdeliverypb.Rollout, string, error) {
3063 resp := &configdeliverypb.ListRolloutsResponse{}
3064 if pageToken != "" {
3065 req.PageToken = pageToken
3066 }
3067 if pageSize > math.MaxInt32 {
3068 req.PageSize = math.MaxInt32
3069 } else if pageSize != 0 {
3070 req.PageSize = int32(pageSize)
3071 }
3072 baseUrl, err := url.Parse(c.endpoint)
3073 if err != nil {
3074 return nil, "", err
3075 }
3076 baseUrl.Path += fmt.Sprintf("/v1beta/%v/rollouts", req.GetParent())
3077
3078 params := url.Values{}
3079 params.Add("$alt", "json;enum-encoding=int")
3080 if req.GetFilter() != "" {
3081 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
3082 }
3083 if req.GetOrderBy() != "" {
3084 params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
3085 }
3086 if req.GetPageSize() != 0 {
3087 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3088 }
3089 if req.GetPageToken() != "" {
3090 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3091 }
3092
3093 baseUrl.RawQuery = params.Encode()
3094
3095 // Build HTTP headers from client and context metadata.
3096 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3097 headers := gax.BuildHeaders(ctx, hds...)
3098 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3099 if settings.Path != "" {
3100 baseUrl.Path = settings.Path
3101 }
3102 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3103 if err != nil {
3104 return err
3105 }
3106 httpReq.Header = headers
3107
3108 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListRollouts")
3109 if err != nil {
3110 return err
3111 }
3112 if err := unm.Unmarshal(buf, resp); err != nil {
3113 return err
3114 }
3115
3116 return nil
3117 }, opts...)
3118 if e != nil {
3119 return nil, "", e
3120 }
3121 it.Response = resp
3122 return resp.GetRollouts(), resp.GetNextPageToken(), nil
3123 }
3124
3125 fetch := func(pageSize int, pageToken string) (string, error) {
3126 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3127 if err != nil {
3128 return "", err
3129 }
3130 it.items = append(it.items, items...)
3131 return nextPageToken, nil
3132 }
3133
3134 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3135 it.pageInfo.MaxSize = int(req.GetPageSize())
3136 it.pageInfo.Token = req.GetPageToken()
3137
3138 return it
3139 }
3140
3141 // GetRollout gets details of a single Rollout.
3142 func (c *restClient) GetRollout(ctx context.Context, req *configdeliverypb.GetRolloutRequest, opts ...gax.CallOption) (*configdeliverypb.Rollout, error) {
3143 baseUrl, err := url.Parse(c.endpoint)
3144 if err != nil {
3145 return nil, err
3146 }
3147 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
3148
3149 params := url.Values{}
3150 params.Add("$alt", "json;enum-encoding=int")
3151
3152 baseUrl.RawQuery = params.Encode()
3153
3154 // Build HTTP headers from client and context metadata.
3155 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3156
3157 hds = append(c.xGoogHeaders, hds...)
3158 hds = append(hds, "Content-Type", "application/json")
3159 headers := gax.BuildHeaders(ctx, hds...)
3160 opts = append((*c.CallOptions).GetRollout[0:len((*c.CallOptions).GetRollout):len((*c.CallOptions).GetRollout)], opts...)
3161 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3162 resp := &configdeliverypb.Rollout{}
3163 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3164 if settings.Path != "" {
3165 baseUrl.Path = settings.Path
3166 }
3167 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3168 if err != nil {
3169 return err
3170 }
3171 httpReq = httpReq.WithContext(ctx)
3172 httpReq.Header = headers
3173
3174 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetRollout")
3175 if err != nil {
3176 return err
3177 }
3178
3179 if err := unm.Unmarshal(buf, resp); err != nil {
3180 return err
3181 }
3182
3183 return nil
3184 }, opts...)
3185 if e != nil {
3186 return nil, e
3187 }
3188 return resp, nil
3189 }
3190
3191 // SuspendRollout suspend a Rollout.
3192 func (c *restClient) SuspendRollout(ctx context.Context, req *configdeliverypb.SuspendRolloutRequest, opts ...gax.CallOption) (*SuspendRolloutOperation, error) {
3193 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3194 jsonReq, err := m.Marshal(req)
3195 if err != nil {
3196 return nil, err
3197 }
3198
3199 baseUrl, err := url.Parse(c.endpoint)
3200 if err != nil {
3201 return nil, err
3202 }
3203 baseUrl.Path += fmt.Sprintf("/v1beta/%v:suspend", req.GetName())
3204
3205 params := url.Values{}
3206 params.Add("$alt", "json;enum-encoding=int")
3207
3208 baseUrl.RawQuery = params.Encode()
3209
3210 // Build HTTP headers from client and context metadata.
3211 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3212
3213 hds = append(c.xGoogHeaders, hds...)
3214 hds = append(hds, "Content-Type", "application/json")
3215 headers := gax.BuildHeaders(ctx, hds...)
3216 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3217 resp := &longrunningpb.Operation{}
3218 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3219 if settings.Path != "" {
3220 baseUrl.Path = settings.Path
3221 }
3222 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3223 if err != nil {
3224 return err
3225 }
3226 httpReq = httpReq.WithContext(ctx)
3227 httpReq.Header = headers
3228
3229 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "SuspendRollout")
3230 if err != nil {
3231 return err
3232 }
3233 if err := unm.Unmarshal(buf, resp); err != nil {
3234 return err
3235 }
3236
3237 return nil
3238 }, opts...)
3239 if e != nil {
3240 return nil, e
3241 }
3242
3243 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
3244 return &SuspendRolloutOperation{
3245 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3246 pollPath: override,
3247 }, nil
3248 }
3249
3250 // ResumeRollout resume a Rollout.
3251 func (c *restClient) ResumeRollout(ctx context.Context, req *configdeliverypb.ResumeRolloutRequest, opts ...gax.CallOption) (*ResumeRolloutOperation, error) {
3252 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3253 jsonReq, err := m.Marshal(req)
3254 if err != nil {
3255 return nil, err
3256 }
3257
3258 baseUrl, err := url.Parse(c.endpoint)
3259 if err != nil {
3260 return nil, err
3261 }
3262 baseUrl.Path += fmt.Sprintf("/v1beta/%v:resume", req.GetName())
3263
3264 params := url.Values{}
3265 params.Add("$alt", "json;enum-encoding=int")
3266
3267 baseUrl.RawQuery = params.Encode()
3268
3269 // Build HTTP headers from client and context metadata.
3270 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3271
3272 hds = append(c.xGoogHeaders, hds...)
3273 hds = append(hds, "Content-Type", "application/json")
3274 headers := gax.BuildHeaders(ctx, hds...)
3275 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3276 resp := &longrunningpb.Operation{}
3277 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3278 if settings.Path != "" {
3279 baseUrl.Path = settings.Path
3280 }
3281 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3282 if err != nil {
3283 return err
3284 }
3285 httpReq = httpReq.WithContext(ctx)
3286 httpReq.Header = headers
3287
3288 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ResumeRollout")
3289 if err != nil {
3290 return err
3291 }
3292 if err := unm.Unmarshal(buf, resp); err != nil {
3293 return err
3294 }
3295
3296 return nil
3297 }, opts...)
3298 if e != nil {
3299 return nil, e
3300 }
3301
3302 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
3303 return &ResumeRolloutOperation{
3304 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3305 pollPath: override,
3306 }, nil
3307 }
3308
3309 // AbortRollout abort a Rollout.
3310 func (c *restClient) AbortRollout(ctx context.Context, req *configdeliverypb.AbortRolloutRequest, opts ...gax.CallOption) (*AbortRolloutOperation, error) {
3311 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3312 jsonReq, err := m.Marshal(req)
3313 if err != nil {
3314 return nil, err
3315 }
3316
3317 baseUrl, err := url.Parse(c.endpoint)
3318 if err != nil {
3319 return nil, err
3320 }
3321 baseUrl.Path += fmt.Sprintf("/v1beta/%v:abort", req.GetName())
3322
3323 params := url.Values{}
3324 params.Add("$alt", "json;enum-encoding=int")
3325
3326 baseUrl.RawQuery = params.Encode()
3327
3328 // Build HTTP headers from client and context metadata.
3329 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3330
3331 hds = append(c.xGoogHeaders, hds...)
3332 hds = append(hds, "Content-Type", "application/json")
3333 headers := gax.BuildHeaders(ctx, hds...)
3334 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3335 resp := &longrunningpb.Operation{}
3336 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3337 if settings.Path != "" {
3338 baseUrl.Path = settings.Path
3339 }
3340 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3341 if err != nil {
3342 return err
3343 }
3344 httpReq = httpReq.WithContext(ctx)
3345 httpReq.Header = headers
3346
3347 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "AbortRollout")
3348 if err != nil {
3349 return err
3350 }
3351 if err := unm.Unmarshal(buf, resp); err != nil {
3352 return err
3353 }
3354
3355 return nil
3356 }, opts...)
3357 if e != nil {
3358 return nil, e
3359 }
3360
3361 override := fmt.Sprintf("/v1beta/%s", resp.GetName())
3362 return &AbortRolloutOperation{
3363 lro: longrunning.InternalNewOperation(*c.LROClient, resp),
3364 pollPath: override,
3365 }, nil
3366 }
3367
3368 // GetLocation gets information about a location.
3369 func (c *restClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) {
3370 baseUrl, err := url.Parse(c.endpoint)
3371 if err != nil {
3372 return nil, err
3373 }
3374 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
3375
3376 params := url.Values{}
3377 params.Add("$alt", "json;enum-encoding=int")
3378
3379 baseUrl.RawQuery = params.Encode()
3380
3381 // Build HTTP headers from client and context metadata.
3382 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3383
3384 hds = append(c.xGoogHeaders, hds...)
3385 hds = append(hds, "Content-Type", "application/json")
3386 headers := gax.BuildHeaders(ctx, hds...)
3387 opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...)
3388 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3389 resp := &locationpb.Location{}
3390 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3391 if settings.Path != "" {
3392 baseUrl.Path = settings.Path
3393 }
3394 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3395 if err != nil {
3396 return err
3397 }
3398 httpReq = httpReq.WithContext(ctx)
3399 httpReq.Header = headers
3400
3401 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetLocation")
3402 if err != nil {
3403 return err
3404 }
3405
3406 if err := unm.Unmarshal(buf, resp); err != nil {
3407 return err
3408 }
3409
3410 return nil
3411 }, opts...)
3412 if e != nil {
3413 return nil, e
3414 }
3415 return resp, nil
3416 }
3417
3418 // ListLocations lists information about the supported locations for this service.
3419 func (c *restClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator {
3420 it := &LocationIterator{}
3421 req = proto.Clone(req).(*locationpb.ListLocationsRequest)
3422 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3423 it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) {
3424 resp := &locationpb.ListLocationsResponse{}
3425 if pageToken != "" {
3426 req.PageToken = pageToken
3427 }
3428 if pageSize > math.MaxInt32 {
3429 req.PageSize = math.MaxInt32
3430 } else if pageSize != 0 {
3431 req.PageSize = int32(pageSize)
3432 }
3433 baseUrl, err := url.Parse(c.endpoint)
3434 if err != nil {
3435 return nil, "", err
3436 }
3437 baseUrl.Path += fmt.Sprintf("/v1beta/%v/locations", req.GetName())
3438
3439 params := url.Values{}
3440 params.Add("$alt", "json;enum-encoding=int")
3441 if req.GetFilter() != "" {
3442 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
3443 }
3444 if req.GetPageSize() != 0 {
3445 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3446 }
3447 if req.GetPageToken() != "" {
3448 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3449 }
3450
3451 baseUrl.RawQuery = params.Encode()
3452
3453 // Build HTTP headers from client and context metadata.
3454 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3455 headers := gax.BuildHeaders(ctx, hds...)
3456 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3457 if settings.Path != "" {
3458 baseUrl.Path = settings.Path
3459 }
3460 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3461 if err != nil {
3462 return err
3463 }
3464 httpReq.Header = headers
3465
3466 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListLocations")
3467 if err != nil {
3468 return err
3469 }
3470 if err := unm.Unmarshal(buf, resp); err != nil {
3471 return err
3472 }
3473
3474 return nil
3475 }, opts...)
3476 if e != nil {
3477 return nil, "", e
3478 }
3479 it.Response = resp
3480 return resp.GetLocations(), resp.GetNextPageToken(), nil
3481 }
3482
3483 fetch := func(pageSize int, pageToken string) (string, error) {
3484 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3485 if err != nil {
3486 return "", err
3487 }
3488 it.items = append(it.items, items...)
3489 return nextPageToken, nil
3490 }
3491
3492 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3493 it.pageInfo.MaxSize = int(req.GetPageSize())
3494 it.pageInfo.Token = req.GetPageToken()
3495
3496 return it
3497 }
3498
3499 // CancelOperation is a utility method from google.longrunning.Operations.
3500 func (c *restClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error {
3501 m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
3502 jsonReq, err := m.Marshal(req)
3503 if err != nil {
3504 return err
3505 }
3506
3507 baseUrl, err := url.Parse(c.endpoint)
3508 if err != nil {
3509 return err
3510 }
3511 baseUrl.Path += fmt.Sprintf("/v1beta/%v:cancel", req.GetName())
3512
3513 params := url.Values{}
3514 params.Add("$alt", "json;enum-encoding=int")
3515
3516 baseUrl.RawQuery = params.Encode()
3517
3518 // Build HTTP headers from client and context metadata.
3519 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3520
3521 hds = append(c.xGoogHeaders, hds...)
3522 hds = append(hds, "Content-Type", "application/json")
3523 headers := gax.BuildHeaders(ctx, hds...)
3524 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3525 if settings.Path != "" {
3526 baseUrl.Path = settings.Path
3527 }
3528 httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
3529 if err != nil {
3530 return err
3531 }
3532 httpReq = httpReq.WithContext(ctx)
3533 httpReq.Header = headers
3534
3535 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CancelOperation")
3536 return err
3537 }, opts...)
3538 }
3539
3540 // DeleteOperation is a utility method from google.longrunning.Operations.
3541 func (c *restClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error {
3542 baseUrl, err := url.Parse(c.endpoint)
3543 if err != nil {
3544 return err
3545 }
3546 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
3547
3548 params := url.Values{}
3549 params.Add("$alt", "json;enum-encoding=int")
3550
3551 baseUrl.RawQuery = params.Encode()
3552
3553 // Build HTTP headers from client and context metadata.
3554 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3555
3556 hds = append(c.xGoogHeaders, hds...)
3557 hds = append(hds, "Content-Type", "application/json")
3558 headers := gax.BuildHeaders(ctx, hds...)
3559 return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3560 if settings.Path != "" {
3561 baseUrl.Path = settings.Path
3562 }
3563 httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
3564 if err != nil {
3565 return err
3566 }
3567 httpReq = httpReq.WithContext(ctx)
3568 httpReq.Header = headers
3569
3570 _, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation")
3571 return err
3572 }, opts...)
3573 }
3574
3575 // GetOperation is a utility method from google.longrunning.Operations.
3576 func (c *restClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {
3577 baseUrl, err := url.Parse(c.endpoint)
3578 if err != nil {
3579 return nil, err
3580 }
3581 baseUrl.Path += fmt.Sprintf("/v1beta/%v", req.GetName())
3582
3583 params := url.Values{}
3584 params.Add("$alt", "json;enum-encoding=int")
3585
3586 baseUrl.RawQuery = params.Encode()
3587
3588 // Build HTTP headers from client and context metadata.
3589 hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))}
3590
3591 hds = append(c.xGoogHeaders, hds...)
3592 hds = append(hds, "Content-Type", "application/json")
3593 headers := gax.BuildHeaders(ctx, hds...)
3594 opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...)
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("GET", 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, "GetOperation")
3609 if err != nil {
3610 return err
3611 }
3612
3613 if err := unm.Unmarshal(buf, resp); err != nil {
3614 return err
3615 }
3616
3617 return nil
3618 }, opts...)
3619 if e != nil {
3620 return nil, e
3621 }
3622 return resp, nil
3623 }
3624
3625 // ListOperations is a utility method from google.longrunning.Operations.
3626 func (c *restClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {
3627 it := &OperationIterator{}
3628 req = proto.Clone(req).(*longrunningpb.ListOperationsRequest)
3629 unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
3630 it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {
3631 resp := &longrunningpb.ListOperationsResponse{}
3632 if pageToken != "" {
3633 req.PageToken = pageToken
3634 }
3635 if pageSize > math.MaxInt32 {
3636 req.PageSize = math.MaxInt32
3637 } else if pageSize != 0 {
3638 req.PageSize = int32(pageSize)
3639 }
3640 baseUrl, err := url.Parse(c.endpoint)
3641 if err != nil {
3642 return nil, "", err
3643 }
3644 baseUrl.Path += fmt.Sprintf("/v1beta/%v/operations", req.GetName())
3645
3646 params := url.Values{}
3647 params.Add("$alt", "json;enum-encoding=int")
3648 if req.GetFilter() != "" {
3649 params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
3650 }
3651 if req.GetPageSize() != 0 {
3652 params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize()))
3653 }
3654 if req.GetPageToken() != "" {
3655 params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
3656 }
3657
3658 baseUrl.RawQuery = params.Encode()
3659
3660 // Build HTTP headers from client and context metadata.
3661 hds := append(c.xGoogHeaders, "Content-Type", "application/json")
3662 headers := gax.BuildHeaders(ctx, hds...)
3663 e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
3664 if settings.Path != "" {
3665 baseUrl.Path = settings.Path
3666 }
3667 httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
3668 if err != nil {
3669 return err
3670 }
3671 httpReq.Header = headers
3672
3673 buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations")
3674 if err != nil {
3675 return err
3676 }
3677 if err := unm.Unmarshal(buf, resp); err != nil {
3678 return err
3679 }
3680
3681 return nil
3682 }, opts...)
3683 if e != nil {
3684 return nil, "", e
3685 }
3686 it.Response = resp
3687 return resp.GetOperations(), resp.GetNextPageToken(), nil
3688 }
3689
3690 fetch := func(pageSize int, pageToken string) (string, error) {
3691 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
3692 if err != nil {
3693 return "", err
3694 }
3695 it.items = append(it.items, items...)
3696 return nextPageToken, nil
3697 }
3698
3699 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
3700 it.pageInfo.MaxSize = int(req.GetPageSize())
3701 it.pageInfo.Token = req.GetPageToken()
3702
3703 return it
3704 }
3705
3706 // AbortRolloutOperation returns a new AbortRolloutOperation from a given name.
3707 // The name must be that of a previously created AbortRolloutOperation, possibly from a different process.
3708 func (c *gRPCClient) AbortRolloutOperation(name string) *AbortRolloutOperation {
3709 return &AbortRolloutOperation{
3710 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3711 }
3712 }
3713
3714 // AbortRolloutOperation returns a new AbortRolloutOperation from a given name.
3715 // The name must be that of a previously created AbortRolloutOperation, possibly from a different process.
3716 func (c *restClient) AbortRolloutOperation(name string) *AbortRolloutOperation {
3717 override := fmt.Sprintf("/v1beta/%s", name)
3718 return &AbortRolloutOperation{
3719 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3720 pollPath: override,
3721 }
3722 }
3723
3724 // CreateFleetPackageOperation returns a new CreateFleetPackageOperation from a given name.
3725 // The name must be that of a previously created CreateFleetPackageOperation, possibly from a different process.
3726 func (c *gRPCClient) CreateFleetPackageOperation(name string) *CreateFleetPackageOperation {
3727 return &CreateFleetPackageOperation{
3728 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3729 }
3730 }
3731
3732 // CreateFleetPackageOperation returns a new CreateFleetPackageOperation from a given name.
3733 // The name must be that of a previously created CreateFleetPackageOperation, possibly from a different process.
3734 func (c *restClient) CreateFleetPackageOperation(name string) *CreateFleetPackageOperation {
3735 override := fmt.Sprintf("/v1beta/%s", name)
3736 return &CreateFleetPackageOperation{
3737 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3738 pollPath: override,
3739 }
3740 }
3741
3742 // CreateReleaseOperation returns a new CreateReleaseOperation from a given name.
3743 // The name must be that of a previously created CreateReleaseOperation, possibly from a different process.
3744 func (c *gRPCClient) CreateReleaseOperation(name string) *CreateReleaseOperation {
3745 return &CreateReleaseOperation{
3746 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3747 }
3748 }
3749
3750 // CreateReleaseOperation returns a new CreateReleaseOperation from a given name.
3751 // The name must be that of a previously created CreateReleaseOperation, possibly from a different process.
3752 func (c *restClient) CreateReleaseOperation(name string) *CreateReleaseOperation {
3753 override := fmt.Sprintf("/v1beta/%s", name)
3754 return &CreateReleaseOperation{
3755 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3756 pollPath: override,
3757 }
3758 }
3759
3760 // CreateResourceBundleOperation returns a new CreateResourceBundleOperation from a given name.
3761 // The name must be that of a previously created CreateResourceBundleOperation, possibly from a different process.
3762 func (c *gRPCClient) CreateResourceBundleOperation(name string) *CreateResourceBundleOperation {
3763 return &CreateResourceBundleOperation{
3764 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3765 }
3766 }
3767
3768 // CreateResourceBundleOperation returns a new CreateResourceBundleOperation from a given name.
3769 // The name must be that of a previously created CreateResourceBundleOperation, possibly from a different process.
3770 func (c *restClient) CreateResourceBundleOperation(name string) *CreateResourceBundleOperation {
3771 override := fmt.Sprintf("/v1beta/%s", name)
3772 return &CreateResourceBundleOperation{
3773 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3774 pollPath: override,
3775 }
3776 }
3777
3778 // CreateVariantOperation returns a new CreateVariantOperation from a given name.
3779 // The name must be that of a previously created CreateVariantOperation, possibly from a different process.
3780 func (c *gRPCClient) CreateVariantOperation(name string) *CreateVariantOperation {
3781 return &CreateVariantOperation{
3782 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3783 }
3784 }
3785
3786 // CreateVariantOperation returns a new CreateVariantOperation from a given name.
3787 // The name must be that of a previously created CreateVariantOperation, possibly from a different process.
3788 func (c *restClient) CreateVariantOperation(name string) *CreateVariantOperation {
3789 override := fmt.Sprintf("/v1beta/%s", name)
3790 return &CreateVariantOperation{
3791 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3792 pollPath: override,
3793 }
3794 }
3795
3796 // DeleteFleetPackageOperation returns a new DeleteFleetPackageOperation from a given name.
3797 // The name must be that of a previously created DeleteFleetPackageOperation, possibly from a different process.
3798 func (c *gRPCClient) DeleteFleetPackageOperation(name string) *DeleteFleetPackageOperation {
3799 return &DeleteFleetPackageOperation{
3800 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3801 }
3802 }
3803
3804 // DeleteFleetPackageOperation returns a new DeleteFleetPackageOperation from a given name.
3805 // The name must be that of a previously created DeleteFleetPackageOperation, possibly from a different process.
3806 func (c *restClient) DeleteFleetPackageOperation(name string) *DeleteFleetPackageOperation {
3807 override := fmt.Sprintf("/v1beta/%s", name)
3808 return &DeleteFleetPackageOperation{
3809 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3810 pollPath: override,
3811 }
3812 }
3813
3814 // DeleteReleaseOperation returns a new DeleteReleaseOperation from a given name.
3815 // The name must be that of a previously created DeleteReleaseOperation, possibly from a different process.
3816 func (c *gRPCClient) DeleteReleaseOperation(name string) *DeleteReleaseOperation {
3817 return &DeleteReleaseOperation{
3818 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3819 }
3820 }
3821
3822 // DeleteReleaseOperation returns a new DeleteReleaseOperation from a given name.
3823 // The name must be that of a previously created DeleteReleaseOperation, possibly from a different process.
3824 func (c *restClient) DeleteReleaseOperation(name string) *DeleteReleaseOperation {
3825 override := fmt.Sprintf("/v1beta/%s", name)
3826 return &DeleteReleaseOperation{
3827 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3828 pollPath: override,
3829 }
3830 }
3831
3832 // DeleteResourceBundleOperation returns a new DeleteResourceBundleOperation from a given name.
3833 // The name must be that of a previously created DeleteResourceBundleOperation, possibly from a different process.
3834 func (c *gRPCClient) DeleteResourceBundleOperation(name string) *DeleteResourceBundleOperation {
3835 return &DeleteResourceBundleOperation{
3836 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3837 }
3838 }
3839
3840 // DeleteResourceBundleOperation returns a new DeleteResourceBundleOperation from a given name.
3841 // The name must be that of a previously created DeleteResourceBundleOperation, possibly from a different process.
3842 func (c *restClient) DeleteResourceBundleOperation(name string) *DeleteResourceBundleOperation {
3843 override := fmt.Sprintf("/v1beta/%s", name)
3844 return &DeleteResourceBundleOperation{
3845 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3846 pollPath: override,
3847 }
3848 }
3849
3850 // DeleteVariantOperation returns a new DeleteVariantOperation from a given name.
3851 // The name must be that of a previously created DeleteVariantOperation, possibly from a different process.
3852 func (c *gRPCClient) DeleteVariantOperation(name string) *DeleteVariantOperation {
3853 return &DeleteVariantOperation{
3854 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3855 }
3856 }
3857
3858 // DeleteVariantOperation returns a new DeleteVariantOperation from a given name.
3859 // The name must be that of a previously created DeleteVariantOperation, possibly from a different process.
3860 func (c *restClient) DeleteVariantOperation(name string) *DeleteVariantOperation {
3861 override := fmt.Sprintf("/v1beta/%s", name)
3862 return &DeleteVariantOperation{
3863 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3864 pollPath: override,
3865 }
3866 }
3867
3868 // ResumeRolloutOperation returns a new ResumeRolloutOperation from a given name.
3869 // The name must be that of a previously created ResumeRolloutOperation, possibly from a different process.
3870 func (c *gRPCClient) ResumeRolloutOperation(name string) *ResumeRolloutOperation {
3871 return &ResumeRolloutOperation{
3872 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3873 }
3874 }
3875
3876 // ResumeRolloutOperation returns a new ResumeRolloutOperation from a given name.
3877 // The name must be that of a previously created ResumeRolloutOperation, possibly from a different process.
3878 func (c *restClient) ResumeRolloutOperation(name string) *ResumeRolloutOperation {
3879 override := fmt.Sprintf("/v1beta/%s", name)
3880 return &ResumeRolloutOperation{
3881 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3882 pollPath: override,
3883 }
3884 }
3885
3886 // SuspendRolloutOperation returns a new SuspendRolloutOperation from a given name.
3887 // The name must be that of a previously created SuspendRolloutOperation, possibly from a different process.
3888 func (c *gRPCClient) SuspendRolloutOperation(name string) *SuspendRolloutOperation {
3889 return &SuspendRolloutOperation{
3890 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3891 }
3892 }
3893
3894 // SuspendRolloutOperation returns a new SuspendRolloutOperation from a given name.
3895 // The name must be that of a previously created SuspendRolloutOperation, possibly from a different process.
3896 func (c *restClient) SuspendRolloutOperation(name string) *SuspendRolloutOperation {
3897 override := fmt.Sprintf("/v1beta/%s", name)
3898 return &SuspendRolloutOperation{
3899 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3900 pollPath: override,
3901 }
3902 }
3903
3904 // UpdateFleetPackageOperation returns a new UpdateFleetPackageOperation from a given name.
3905 // The name must be that of a previously created UpdateFleetPackageOperation, possibly from a different process.
3906 func (c *gRPCClient) UpdateFleetPackageOperation(name string) *UpdateFleetPackageOperation {
3907 return &UpdateFleetPackageOperation{
3908 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3909 }
3910 }
3911
3912 // UpdateFleetPackageOperation returns a new UpdateFleetPackageOperation from a given name.
3913 // The name must be that of a previously created UpdateFleetPackageOperation, possibly from a different process.
3914 func (c *restClient) UpdateFleetPackageOperation(name string) *UpdateFleetPackageOperation {
3915 override := fmt.Sprintf("/v1beta/%s", name)
3916 return &UpdateFleetPackageOperation{
3917 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3918 pollPath: override,
3919 }
3920 }
3921
3922 // UpdateReleaseOperation returns a new UpdateReleaseOperation from a given name.
3923 // The name must be that of a previously created UpdateReleaseOperation, possibly from a different process.
3924 func (c *gRPCClient) UpdateReleaseOperation(name string) *UpdateReleaseOperation {
3925 return &UpdateReleaseOperation{
3926 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3927 }
3928 }
3929
3930 // UpdateReleaseOperation returns a new UpdateReleaseOperation from a given name.
3931 // The name must be that of a previously created UpdateReleaseOperation, possibly from a different process.
3932 func (c *restClient) UpdateReleaseOperation(name string) *UpdateReleaseOperation {
3933 override := fmt.Sprintf("/v1beta/%s", name)
3934 return &UpdateReleaseOperation{
3935 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3936 pollPath: override,
3937 }
3938 }
3939
3940 // UpdateResourceBundleOperation returns a new UpdateResourceBundleOperation from a given name.
3941 // The name must be that of a previously created UpdateResourceBundleOperation, possibly from a different process.
3942 func (c *gRPCClient) UpdateResourceBundleOperation(name string) *UpdateResourceBundleOperation {
3943 return &UpdateResourceBundleOperation{
3944 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3945 }
3946 }
3947
3948 // UpdateResourceBundleOperation returns a new UpdateResourceBundleOperation from a given name.
3949 // The name must be that of a previously created UpdateResourceBundleOperation, possibly from a different process.
3950 func (c *restClient) UpdateResourceBundleOperation(name string) *UpdateResourceBundleOperation {
3951 override := fmt.Sprintf("/v1beta/%s", name)
3952 return &UpdateResourceBundleOperation{
3953 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3954 pollPath: override,
3955 }
3956 }
3957
3958 // UpdateVariantOperation returns a new UpdateVariantOperation from a given name.
3959 // The name must be that of a previously created UpdateVariantOperation, possibly from a different process.
3960 func (c *gRPCClient) UpdateVariantOperation(name string) *UpdateVariantOperation {
3961 return &UpdateVariantOperation{
3962 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3963 }
3964 }
3965
3966 // UpdateVariantOperation returns a new UpdateVariantOperation from a given name.
3967 // The name must be that of a previously created UpdateVariantOperation, possibly from a different process.
3968 func (c *restClient) UpdateVariantOperation(name string) *UpdateVariantOperation {
3969 override := fmt.Sprintf("/v1beta/%s", name)
3970 return &UpdateVariantOperation{
3971 lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
3972 pollPath: override,
3973 }
3974 }