1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package artifactregistry
18
19 import (
20 "context"
21 "time"
22
23 artifactregistrypb "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb"
24 "cloud.google.com/go/longrunning"
25 gax "github.com/googleapis/gax-go/v2"
26 "google.golang.org/api/iterator"
27 locationpb "google.golang.org/genproto/googleapis/cloud/location"
28 )
29
30
31 type BatchDeleteVersionsOperation struct {
32 lro *longrunning.Operation
33 pollPath string
34 }
35
36
37
38
39 func (op *BatchDeleteVersionsOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
40 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
41 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
42 }
43
44
45
46
47
48
49
50
51
52
53 func (op *BatchDeleteVersionsOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
54 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
55 return op.lro.Poll(ctx, nil, opts...)
56 }
57
58
59
60
61
62 func (op *BatchDeleteVersionsOperation) Metadata() (*artifactregistrypb.BatchDeleteVersionsMetadata, error) {
63 var meta artifactregistrypb.BatchDeleteVersionsMetadata
64 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
65 return nil, nil
66 } else if err != nil {
67 return nil, err
68 }
69 return &meta, nil
70 }
71
72
73 func (op *BatchDeleteVersionsOperation) Done() bool {
74 return op.lro.Done()
75 }
76
77
78
79 func (op *BatchDeleteVersionsOperation) Name() string {
80 return op.lro.Name()
81 }
82
83
84 type CreateRepositoryOperation struct {
85 lro *longrunning.Operation
86 pollPath string
87 }
88
89
90
91
92 func (op *CreateRepositoryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
93 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
94 var resp artifactregistrypb.Repository
95 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
96 return nil, err
97 }
98 return &resp, nil
99 }
100
101
102
103
104
105
106
107
108
109
110 func (op *CreateRepositoryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.Repository, error) {
111 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
112 var resp artifactregistrypb.Repository
113 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
114 return nil, err
115 }
116 if !op.Done() {
117 return nil, nil
118 }
119 return &resp, nil
120 }
121
122
123
124
125
126 func (op *CreateRepositoryOperation) Metadata() (*artifactregistrypb.OperationMetadata, error) {
127 var meta artifactregistrypb.OperationMetadata
128 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
129 return nil, nil
130 } else if err != nil {
131 return nil, err
132 }
133 return &meta, nil
134 }
135
136
137 func (op *CreateRepositoryOperation) Done() bool {
138 return op.lro.Done()
139 }
140
141
142
143 func (op *CreateRepositoryOperation) Name() string {
144 return op.lro.Name()
145 }
146
147
148 type DeletePackageOperation struct {
149 lro *longrunning.Operation
150 pollPath string
151 }
152
153
154
155
156 func (op *DeletePackageOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
157 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
158 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
159 }
160
161
162
163
164
165
166
167
168
169
170 func (op *DeletePackageOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
171 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
172 return op.lro.Poll(ctx, nil, opts...)
173 }
174
175
176
177
178
179 func (op *DeletePackageOperation) Metadata() (*artifactregistrypb.OperationMetadata, error) {
180 var meta artifactregistrypb.OperationMetadata
181 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
182 return nil, nil
183 } else if err != nil {
184 return nil, err
185 }
186 return &meta, nil
187 }
188
189
190 func (op *DeletePackageOperation) Done() bool {
191 return op.lro.Done()
192 }
193
194
195
196 func (op *DeletePackageOperation) Name() string {
197 return op.lro.Name()
198 }
199
200
201 type DeleteRepositoryOperation struct {
202 lro *longrunning.Operation
203 pollPath string
204 }
205
206
207
208
209 func (op *DeleteRepositoryOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
210 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
211 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
212 }
213
214
215
216
217
218
219
220
221
222
223 func (op *DeleteRepositoryOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
224 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
225 return op.lro.Poll(ctx, nil, opts...)
226 }
227
228
229
230
231
232 func (op *DeleteRepositoryOperation) Metadata() (*artifactregistrypb.OperationMetadata, error) {
233 var meta artifactregistrypb.OperationMetadata
234 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
235 return nil, nil
236 } else if err != nil {
237 return nil, err
238 }
239 return &meta, nil
240 }
241
242
243 func (op *DeleteRepositoryOperation) Done() bool {
244 return op.lro.Done()
245 }
246
247
248
249 func (op *DeleteRepositoryOperation) Name() string {
250 return op.lro.Name()
251 }
252
253
254 type DeleteVersionOperation struct {
255 lro *longrunning.Operation
256 pollPath string
257 }
258
259
260
261
262 func (op *DeleteVersionOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
263 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
264 return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
265 }
266
267
268
269
270
271
272
273
274
275
276 func (op *DeleteVersionOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
277 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
278 return op.lro.Poll(ctx, nil, opts...)
279 }
280
281
282
283
284
285 func (op *DeleteVersionOperation) Metadata() (*artifactregistrypb.OperationMetadata, error) {
286 var meta artifactregistrypb.OperationMetadata
287 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
288 return nil, nil
289 } else if err != nil {
290 return nil, err
291 }
292 return &meta, nil
293 }
294
295
296 func (op *DeleteVersionOperation) Done() bool {
297 return op.lro.Done()
298 }
299
300
301
302 func (op *DeleteVersionOperation) Name() string {
303 return op.lro.Name()
304 }
305
306
307 type ImportAptArtifactsOperation struct {
308 lro *longrunning.Operation
309 pollPath string
310 }
311
312
313
314
315 func (op *ImportAptArtifactsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportAptArtifactsResponse, error) {
316 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
317 var resp artifactregistrypb.ImportAptArtifactsResponse
318 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
319 return nil, err
320 }
321 return &resp, nil
322 }
323
324
325
326
327
328
329
330
331
332
333 func (op *ImportAptArtifactsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportAptArtifactsResponse, error) {
334 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
335 var resp artifactregistrypb.ImportAptArtifactsResponse
336 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
337 return nil, err
338 }
339 if !op.Done() {
340 return nil, nil
341 }
342 return &resp, nil
343 }
344
345
346
347
348
349 func (op *ImportAptArtifactsOperation) Metadata() (*artifactregistrypb.ImportAptArtifactsMetadata, error) {
350 var meta artifactregistrypb.ImportAptArtifactsMetadata
351 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
352 return nil, nil
353 } else if err != nil {
354 return nil, err
355 }
356 return &meta, nil
357 }
358
359
360 func (op *ImportAptArtifactsOperation) Done() bool {
361 return op.lro.Done()
362 }
363
364
365
366 func (op *ImportAptArtifactsOperation) Name() string {
367 return op.lro.Name()
368 }
369
370
371 type ImportYumArtifactsOperation struct {
372 lro *longrunning.Operation
373 pollPath string
374 }
375
376
377
378
379 func (op *ImportYumArtifactsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportYumArtifactsResponse, error) {
380 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
381 var resp artifactregistrypb.ImportYumArtifactsResponse
382 if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
383 return nil, err
384 }
385 return &resp, nil
386 }
387
388
389
390
391
392
393
394
395
396
397 func (op *ImportYumArtifactsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*artifactregistrypb.ImportYumArtifactsResponse, error) {
398 opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
399 var resp artifactregistrypb.ImportYumArtifactsResponse
400 if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
401 return nil, err
402 }
403 if !op.Done() {
404 return nil, nil
405 }
406 return &resp, nil
407 }
408
409
410
411
412
413 func (op *ImportYumArtifactsOperation) Metadata() (*artifactregistrypb.ImportYumArtifactsMetadata, error) {
414 var meta artifactregistrypb.ImportYumArtifactsMetadata
415 if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
416 return nil, nil
417 } else if err != nil {
418 return nil, err
419 }
420 return &meta, nil
421 }
422
423
424 func (op *ImportYumArtifactsOperation) Done() bool {
425 return op.lro.Done()
426 }
427
428
429
430 func (op *ImportYumArtifactsOperation) Name() string {
431 return op.lro.Name()
432 }
433
434
435 type DockerImageIterator struct {
436 items []*artifactregistrypb.DockerImage
437 pageInfo *iterator.PageInfo
438 nextFunc func() error
439
440
441
442
443 Response interface{}
444
445
446
447
448
449
450
451 InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.DockerImage, nextPageToken string, err error)
452 }
453
454
455 func (it *DockerImageIterator) PageInfo() *iterator.PageInfo {
456 return it.pageInfo
457 }
458
459
460
461 func (it *DockerImageIterator) Next() (*artifactregistrypb.DockerImage, error) {
462 var item *artifactregistrypb.DockerImage
463 if err := it.nextFunc(); err != nil {
464 return item, err
465 }
466 item = it.items[0]
467 it.items = it.items[1:]
468 return item, nil
469 }
470
471 func (it *DockerImageIterator) bufLen() int {
472 return len(it.items)
473 }
474
475 func (it *DockerImageIterator) takeBuf() interface{} {
476 b := it.items
477 it.items = nil
478 return b
479 }
480
481
482 type FileIterator struct {
483 items []*artifactregistrypb.File
484 pageInfo *iterator.PageInfo
485 nextFunc func() error
486
487
488
489
490 Response interface{}
491
492
493
494
495
496
497
498 InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.File, nextPageToken string, err error)
499 }
500
501
502 func (it *FileIterator) PageInfo() *iterator.PageInfo {
503 return it.pageInfo
504 }
505
506
507
508 func (it *FileIterator) Next() (*artifactregistrypb.File, error) {
509 var item *artifactregistrypb.File
510 if err := it.nextFunc(); err != nil {
511 return item, err
512 }
513 item = it.items[0]
514 it.items = it.items[1:]
515 return item, nil
516 }
517
518 func (it *FileIterator) bufLen() int {
519 return len(it.items)
520 }
521
522 func (it *FileIterator) takeBuf() interface{} {
523 b := it.items
524 it.items = nil
525 return b
526 }
527
528
529 type LocationIterator struct {
530 items []*locationpb.Location
531 pageInfo *iterator.PageInfo
532 nextFunc func() error
533
534
535
536
537 Response interface{}
538
539
540
541
542
543
544
545 InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error)
546 }
547
548
549 func (it *LocationIterator) PageInfo() *iterator.PageInfo {
550 return it.pageInfo
551 }
552
553
554
555 func (it *LocationIterator) Next() (*locationpb.Location, error) {
556 var item *locationpb.Location
557 if err := it.nextFunc(); err != nil {
558 return item, err
559 }
560 item = it.items[0]
561 it.items = it.items[1:]
562 return item, nil
563 }
564
565 func (it *LocationIterator) bufLen() int {
566 return len(it.items)
567 }
568
569 func (it *LocationIterator) takeBuf() interface{} {
570 b := it.items
571 it.items = nil
572 return b
573 }
574
575
576 type MavenArtifactIterator struct {
577 items []*artifactregistrypb.MavenArtifact
578 pageInfo *iterator.PageInfo
579 nextFunc func() error
580
581
582
583
584 Response interface{}
585
586
587
588
589
590
591
592 InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.MavenArtifact, nextPageToken string, err error)
593 }
594
595
596 func (it *MavenArtifactIterator) PageInfo() *iterator.PageInfo {
597 return it.pageInfo
598 }
599
600
601
602 func (it *MavenArtifactIterator) Next() (*artifactregistrypb.MavenArtifact, error) {
603 var item *artifactregistrypb.MavenArtifact
604 if err := it.nextFunc(); err != nil {
605 return item, err
606 }
607 item = it.items[0]
608 it.items = it.items[1:]
609 return item, nil
610 }
611
612 func (it *MavenArtifactIterator) bufLen() int {
613 return len(it.items)
614 }
615
616 func (it *MavenArtifactIterator) takeBuf() interface{} {
617 b := it.items
618 it.items = nil
619 return b
620 }
621
622
623 type NpmPackageIterator struct {
624 items []*artifactregistrypb.NpmPackage
625 pageInfo *iterator.PageInfo
626 nextFunc func() error
627
628
629
630
631 Response interface{}
632
633
634
635
636
637
638
639 InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.NpmPackage, nextPageToken string, err error)
640 }
641
642
643 func (it *NpmPackageIterator) PageInfo() *iterator.PageInfo {
644 return it.pageInfo
645 }
646
647
648
649 func (it *NpmPackageIterator) Next() (*artifactregistrypb.NpmPackage, error) {
650 var item *artifactregistrypb.NpmPackage
651 if err := it.nextFunc(); err != nil {
652 return item, err
653 }
654 item = it.items[0]
655 it.items = it.items[1:]
656 return item, nil
657 }
658
659 func (it *NpmPackageIterator) bufLen() int {
660 return len(it.items)
661 }
662
663 func (it *NpmPackageIterator) takeBuf() interface{} {
664 b := it.items
665 it.items = nil
666 return b
667 }
668
669
670 type PackageIterator struct {
671 items []*artifactregistrypb.Package
672 pageInfo *iterator.PageInfo
673 nextFunc func() error
674
675
676
677
678 Response interface{}
679
680
681
682
683
684
685
686 InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Package, nextPageToken string, err error)
687 }
688
689
690 func (it *PackageIterator) PageInfo() *iterator.PageInfo {
691 return it.pageInfo
692 }
693
694
695
696 func (it *PackageIterator) Next() (*artifactregistrypb.Package, error) {
697 var item *artifactregistrypb.Package
698 if err := it.nextFunc(); err != nil {
699 return item, err
700 }
701 item = it.items[0]
702 it.items = it.items[1:]
703 return item, nil
704 }
705
706 func (it *PackageIterator) bufLen() int {
707 return len(it.items)
708 }
709
710 func (it *PackageIterator) takeBuf() interface{} {
711 b := it.items
712 it.items = nil
713 return b
714 }
715
716
717 type PythonPackageIterator struct {
718 items []*artifactregistrypb.PythonPackage
719 pageInfo *iterator.PageInfo
720 nextFunc func() error
721
722
723
724
725 Response interface{}
726
727
728
729
730
731
732
733 InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.PythonPackage, nextPageToken string, err error)
734 }
735
736
737 func (it *PythonPackageIterator) PageInfo() *iterator.PageInfo {
738 return it.pageInfo
739 }
740
741
742
743 func (it *PythonPackageIterator) Next() (*artifactregistrypb.PythonPackage, error) {
744 var item *artifactregistrypb.PythonPackage
745 if err := it.nextFunc(); err != nil {
746 return item, err
747 }
748 item = it.items[0]
749 it.items = it.items[1:]
750 return item, nil
751 }
752
753 func (it *PythonPackageIterator) bufLen() int {
754 return len(it.items)
755 }
756
757 func (it *PythonPackageIterator) takeBuf() interface{} {
758 b := it.items
759 it.items = nil
760 return b
761 }
762
763
764 type RepositoryIterator struct {
765 items []*artifactregistrypb.Repository
766 pageInfo *iterator.PageInfo
767 nextFunc func() error
768
769
770
771
772 Response interface{}
773
774
775
776
777
778
779
780 InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Repository, nextPageToken string, err error)
781 }
782
783
784 func (it *RepositoryIterator) PageInfo() *iterator.PageInfo {
785 return it.pageInfo
786 }
787
788
789
790 func (it *RepositoryIterator) Next() (*artifactregistrypb.Repository, error) {
791 var item *artifactregistrypb.Repository
792 if err := it.nextFunc(); err != nil {
793 return item, err
794 }
795 item = it.items[0]
796 it.items = it.items[1:]
797 return item, nil
798 }
799
800 func (it *RepositoryIterator) bufLen() int {
801 return len(it.items)
802 }
803
804 func (it *RepositoryIterator) takeBuf() interface{} {
805 b := it.items
806 it.items = nil
807 return b
808 }
809
810
811 type TagIterator struct {
812 items []*artifactregistrypb.Tag
813 pageInfo *iterator.PageInfo
814 nextFunc func() error
815
816
817
818
819 Response interface{}
820
821
822
823
824
825
826
827 InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Tag, nextPageToken string, err error)
828 }
829
830
831 func (it *TagIterator) PageInfo() *iterator.PageInfo {
832 return it.pageInfo
833 }
834
835
836
837 func (it *TagIterator) Next() (*artifactregistrypb.Tag, error) {
838 var item *artifactregistrypb.Tag
839 if err := it.nextFunc(); err != nil {
840 return item, err
841 }
842 item = it.items[0]
843 it.items = it.items[1:]
844 return item, nil
845 }
846
847 func (it *TagIterator) bufLen() int {
848 return len(it.items)
849 }
850
851 func (it *TagIterator) takeBuf() interface{} {
852 b := it.items
853 it.items = nil
854 return b
855 }
856
857
858 type VersionIterator struct {
859 items []*artifactregistrypb.Version
860 pageInfo *iterator.PageInfo
861 nextFunc func() error
862
863
864
865
866 Response interface{}
867
868
869
870
871
872
873
874 InternalFetch func(pageSize int, pageToken string) (results []*artifactregistrypb.Version, nextPageToken string, err error)
875 }
876
877
878 func (it *VersionIterator) PageInfo() *iterator.PageInfo {
879 return it.pageInfo
880 }
881
882
883
884 func (it *VersionIterator) Next() (*artifactregistrypb.Version, error) {
885 var item *artifactregistrypb.Version
886 if err := it.nextFunc(); err != nil {
887 return item, err
888 }
889 item = it.items[0]
890 it.items = it.items[1:]
891 return item, nil
892 }
893
894 func (it *VersionIterator) bufLen() int {
895 return len(it.items)
896 }
897
898 func (it *VersionIterator) takeBuf() interface{} {
899 b := it.items
900 it.items = nil
901 return b
902 }
903
View as plain text