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