Debian Codegraph @

artifactregistry/apiv1/artifact_registry_client_example_test.go

raw
1 // Copyright 2025 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Code generated by protoc-gen-go_gapic. DO NOT EDIT.
16
17 package artifactregistry_test
18
19 import (
20 "context"
21
22 artifactregistry "cloud.google.com/go/artifactregistry/apiv1"
23 artifactregistrypb "cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb"
24 iampb "cloud.google.com/go/iam/apiv1/iampb"
25 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
26 "google.golang.org/api/iterator"
27 locationpb "google.golang.org/genproto/googleapis/cloud/location"
28 )
29
30 func ExampleNewClient() {
31 ctx := context.Background()
32 // This snippet has been automatically generated and should be regarded as a code template only.
33 // It will require modifications to work:
34 // - It may require correct/in-range values for request initialization.
35 // - It may require specifying regional endpoints when creating the service client as shown in:
36 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
37 c, err := artifactregistry.NewClient(ctx)
38 if err != nil {
39 // TODO: Handle error.
40 }
41 defer c.Close()
42
43 // TODO: Use client.
44 _ = c
45 }
46
47 func ExampleNewRESTClient() {
48 ctx := context.Background()
49 // This snippet has been automatically generated and should be regarded as a code template only.
50 // It will require modifications to work:
51 // - It may require correct/in-range values for request initialization.
52 // - It may require specifying regional endpoints when creating the service client as shown in:
53 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
54 c, err := artifactregistry.NewRESTClient(ctx)
55 if err != nil {
56 // TODO: Handle error.
57 }
58 defer c.Close()
59
60 // TODO: Use client.
61 _ = c
62 }
63
64 func ExampleClient_BatchDeleteVersions() {
65 ctx := context.Background()
66 // This snippet has been automatically generated and should be regarded as a code template only.
67 // It will require modifications to work:
68 // - It may require correct/in-range values for request initialization.
69 // - It may require specifying regional endpoints when creating the service client as shown in:
70 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
71 c, err := artifactregistry.NewClient(ctx)
72 if err != nil {
73 // TODO: Handle error.
74 }
75 defer c.Close()
76
77 req := &artifactregistrypb.BatchDeleteVersionsRequest{
78 // TODO: Fill request struct fields.
79 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#BatchDeleteVersionsRequest.
80 }
81 op, err := c.BatchDeleteVersions(ctx, req)
82 if err != nil {
83 // TODO: Handle error.
84 }
85
86 err = op.Wait(ctx)
87 if err != nil {
88 // TODO: Handle error.
89 }
90 }
91
92 func ExampleClient_CreateAttachment() {
93 ctx := context.Background()
94 // This snippet has been automatically generated and should be regarded as a code template only.
95 // It will require modifications to work:
96 // - It may require correct/in-range values for request initialization.
97 // - It may require specifying regional endpoints when creating the service client as shown in:
98 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
99 c, err := artifactregistry.NewClient(ctx)
100 if err != nil {
101 // TODO: Handle error.
102 }
103 defer c.Close()
104
105 req := &artifactregistrypb.CreateAttachmentRequest{
106 // TODO: Fill request struct fields.
107 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#CreateAttachmentRequest.
108 }
109 op, err := c.CreateAttachment(ctx, req)
110 if err != nil {
111 // TODO: Handle error.
112 }
113
114 resp, err := op.Wait(ctx)
115 if err != nil {
116 // TODO: Handle error.
117 }
118 // TODO: Use resp.
119 _ = resp
120 }
121
122 func ExampleClient_CreateRepository() {
123 ctx := context.Background()
124 // This snippet has been automatically generated and should be regarded as a code template only.
125 // It will require modifications to work:
126 // - It may require correct/in-range values for request initialization.
127 // - It may require specifying regional endpoints when creating the service client as shown in:
128 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
129 c, err := artifactregistry.NewClient(ctx)
130 if err != nil {
131 // TODO: Handle error.
132 }
133 defer c.Close()
134
135 req := &artifactregistrypb.CreateRepositoryRequest{
136 // TODO: Fill request struct fields.
137 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#CreateRepositoryRequest.
138 }
139 op, err := c.CreateRepository(ctx, req)
140 if err != nil {
141 // TODO: Handle error.
142 }
143
144 resp, err := op.Wait(ctx)
145 if err != nil {
146 // TODO: Handle error.
147 }
148 // TODO: Use resp.
149 _ = resp
150 }
151
152 func ExampleClient_CreateRule() {
153 ctx := context.Background()
154 // This snippet has been automatically generated and should be regarded as a code template only.
155 // It will require modifications to work:
156 // - It may require correct/in-range values for request initialization.
157 // - It may require specifying regional endpoints when creating the service client as shown in:
158 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
159 c, err := artifactregistry.NewClient(ctx)
160 if err != nil {
161 // TODO: Handle error.
162 }
163 defer c.Close()
164
165 req := &artifactregistrypb.CreateRuleRequest{
166 // TODO: Fill request struct fields.
167 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#CreateRuleRequest.
168 }
169 resp, err := c.CreateRule(ctx, req)
170 if err != nil {
171 // TODO: Handle error.
172 }
173 // TODO: Use resp.
174 _ = resp
175 }
176
177 func ExampleClient_CreateTag() {
178 ctx := context.Background()
179 // This snippet has been automatically generated and should be regarded as a code template only.
180 // It will require modifications to work:
181 // - It may require correct/in-range values for request initialization.
182 // - It may require specifying regional endpoints when creating the service client as shown in:
183 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
184 c, err := artifactregistry.NewClient(ctx)
185 if err != nil {
186 // TODO: Handle error.
187 }
188 defer c.Close()
189
190 req := &artifactregistrypb.CreateTagRequest{
191 // TODO: Fill request struct fields.
192 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#CreateTagRequest.
193 }
194 resp, err := c.CreateTag(ctx, req)
195 if err != nil {
196 // TODO: Handle error.
197 }
198 // TODO: Use resp.
199 _ = resp
200 }
201
202 func ExampleClient_DeleteAttachment() {
203 ctx := context.Background()
204 // This snippet has been automatically generated and should be regarded as a code template only.
205 // It will require modifications to work:
206 // - It may require correct/in-range values for request initialization.
207 // - It may require specifying regional endpoints when creating the service client as shown in:
208 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
209 c, err := artifactregistry.NewClient(ctx)
210 if err != nil {
211 // TODO: Handle error.
212 }
213 defer c.Close()
214
215 req := &artifactregistrypb.DeleteAttachmentRequest{
216 // TODO: Fill request struct fields.
217 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#DeleteAttachmentRequest.
218 }
219 op, err := c.DeleteAttachment(ctx, req)
220 if err != nil {
221 // TODO: Handle error.
222 }
223
224 err = op.Wait(ctx)
225 if err != nil {
226 // TODO: Handle error.
227 }
228 }
229
230 func ExampleClient_DeleteFile() {
231 ctx := context.Background()
232 // This snippet has been automatically generated and should be regarded as a code template only.
233 // It will require modifications to work:
234 // - It may require correct/in-range values for request initialization.
235 // - It may require specifying regional endpoints when creating the service client as shown in:
236 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
237 c, err := artifactregistry.NewClient(ctx)
238 if err != nil {
239 // TODO: Handle error.
240 }
241 defer c.Close()
242
243 req := &artifactregistrypb.DeleteFileRequest{
244 // TODO: Fill request struct fields.
245 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#DeleteFileRequest.
246 }
247 op, err := c.DeleteFile(ctx, req)
248 if err != nil {
249 // TODO: Handle error.
250 }
251
252 err = op.Wait(ctx)
253 if err != nil {
254 // TODO: Handle error.
255 }
256 }
257
258 func ExampleClient_DeletePackage() {
259 ctx := context.Background()
260 // This snippet has been automatically generated and should be regarded as a code template only.
261 // It will require modifications to work:
262 // - It may require correct/in-range values for request initialization.
263 // - It may require specifying regional endpoints when creating the service client as shown in:
264 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
265 c, err := artifactregistry.NewClient(ctx)
266 if err != nil {
267 // TODO: Handle error.
268 }
269 defer c.Close()
270
271 req := &artifactregistrypb.DeletePackageRequest{
272 // TODO: Fill request struct fields.
273 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#DeletePackageRequest.
274 }
275 op, err := c.DeletePackage(ctx, req)
276 if err != nil {
277 // TODO: Handle error.
278 }
279
280 err = op.Wait(ctx)
281 if err != nil {
282 // TODO: Handle error.
283 }
284 }
285
286 func ExampleClient_DeleteRepository() {
287 ctx := context.Background()
288 // This snippet has been automatically generated and should be regarded as a code template only.
289 // It will require modifications to work:
290 // - It may require correct/in-range values for request initialization.
291 // - It may require specifying regional endpoints when creating the service client as shown in:
292 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
293 c, err := artifactregistry.NewClient(ctx)
294 if err != nil {
295 // TODO: Handle error.
296 }
297 defer c.Close()
298
299 req := &artifactregistrypb.DeleteRepositoryRequest{
300 // TODO: Fill request struct fields.
301 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#DeleteRepositoryRequest.
302 }
303 op, err := c.DeleteRepository(ctx, req)
304 if err != nil {
305 // TODO: Handle error.
306 }
307
308 err = op.Wait(ctx)
309 if err != nil {
310 // TODO: Handle error.
311 }
312 }
313
314 func ExampleClient_DeleteRule() {
315 ctx := context.Background()
316 // This snippet has been automatically generated and should be regarded as a code template only.
317 // It will require modifications to work:
318 // - It may require correct/in-range values for request initialization.
319 // - It may require specifying regional endpoints when creating the service client as shown in:
320 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
321 c, err := artifactregistry.NewClient(ctx)
322 if err != nil {
323 // TODO: Handle error.
324 }
325 defer c.Close()
326
327 req := &artifactregistrypb.DeleteRuleRequest{
328 // TODO: Fill request struct fields.
329 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#DeleteRuleRequest.
330 }
331 err = c.DeleteRule(ctx, req)
332 if err != nil {
333 // TODO: Handle error.
334 }
335 }
336
337 func ExampleClient_DeleteTag() {
338 ctx := context.Background()
339 // This snippet has been automatically generated and should be regarded as a code template only.
340 // It will require modifications to work:
341 // - It may require correct/in-range values for request initialization.
342 // - It may require specifying regional endpoints when creating the service client as shown in:
343 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
344 c, err := artifactregistry.NewClient(ctx)
345 if err != nil {
346 // TODO: Handle error.
347 }
348 defer c.Close()
349
350 req := &artifactregistrypb.DeleteTagRequest{
351 // TODO: Fill request struct fields.
352 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#DeleteTagRequest.
353 }
354 err = c.DeleteTag(ctx, req)
355 if err != nil {
356 // TODO: Handle error.
357 }
358 }
359
360 func ExampleClient_DeleteVersion() {
361 ctx := context.Background()
362 // This snippet has been automatically generated and should be regarded as a code template only.
363 // It will require modifications to work:
364 // - It may require correct/in-range values for request initialization.
365 // - It may require specifying regional endpoints when creating the service client as shown in:
366 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
367 c, err := artifactregistry.NewClient(ctx)
368 if err != nil {
369 // TODO: Handle error.
370 }
371 defer c.Close()
372
373 req := &artifactregistrypb.DeleteVersionRequest{
374 // TODO: Fill request struct fields.
375 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#DeleteVersionRequest.
376 }
377 op, err := c.DeleteVersion(ctx, req)
378 if err != nil {
379 // TODO: Handle error.
380 }
381
382 err = op.Wait(ctx)
383 if err != nil {
384 // TODO: Handle error.
385 }
386 }
387
388 func ExampleClient_GetAttachment() {
389 ctx := context.Background()
390 // This snippet has been automatically generated and should be regarded as a code template only.
391 // It will require modifications to work:
392 // - It may require correct/in-range values for request initialization.
393 // - It may require specifying regional endpoints when creating the service client as shown in:
394 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
395 c, err := artifactregistry.NewClient(ctx)
396 if err != nil {
397 // TODO: Handle error.
398 }
399 defer c.Close()
400
401 req := &artifactregistrypb.GetAttachmentRequest{
402 // TODO: Fill request struct fields.
403 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetAttachmentRequest.
404 }
405 resp, err := c.GetAttachment(ctx, req)
406 if err != nil {
407 // TODO: Handle error.
408 }
409 // TODO: Use resp.
410 _ = resp
411 }
412
413 func ExampleClient_GetDockerImage() {
414 ctx := context.Background()
415 // This snippet has been automatically generated and should be regarded as a code template only.
416 // It will require modifications to work:
417 // - It may require correct/in-range values for request initialization.
418 // - It may require specifying regional endpoints when creating the service client as shown in:
419 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
420 c, err := artifactregistry.NewClient(ctx)
421 if err != nil {
422 // TODO: Handle error.
423 }
424 defer c.Close()
425
426 req := &artifactregistrypb.GetDockerImageRequest{
427 // TODO: Fill request struct fields.
428 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetDockerImageRequest.
429 }
430 resp, err := c.GetDockerImage(ctx, req)
431 if err != nil {
432 // TODO: Handle error.
433 }
434 // TODO: Use resp.
435 _ = resp
436 }
437
438 func ExampleClient_GetFile() {
439 ctx := context.Background()
440 // This snippet has been automatically generated and should be regarded as a code template only.
441 // It will require modifications to work:
442 // - It may require correct/in-range values for request initialization.
443 // - It may require specifying regional endpoints when creating the service client as shown in:
444 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
445 c, err := artifactregistry.NewClient(ctx)
446 if err != nil {
447 // TODO: Handle error.
448 }
449 defer c.Close()
450
451 req := &artifactregistrypb.GetFileRequest{
452 // TODO: Fill request struct fields.
453 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetFileRequest.
454 }
455 resp, err := c.GetFile(ctx, req)
456 if err != nil {
457 // TODO: Handle error.
458 }
459 // TODO: Use resp.
460 _ = resp
461 }
462
463 func ExampleClient_GetIamPolicy() {
464 ctx := context.Background()
465 // This snippet has been automatically generated and should be regarded as a code template only.
466 // It will require modifications to work:
467 // - It may require correct/in-range values for request initialization.
468 // - It may require specifying regional endpoints when creating the service client as shown in:
469 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
470 c, err := artifactregistry.NewClient(ctx)
471 if err != nil {
472 // TODO: Handle error.
473 }
474 defer c.Close()
475
476 req := &iampb.GetIamPolicyRequest{
477 // TODO: Fill request struct fields.
478 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
479 }
480 resp, err := c.GetIamPolicy(ctx, req)
481 if err != nil {
482 // TODO: Handle error.
483 }
484 // TODO: Use resp.
485 _ = resp
486 }
487
488 func ExampleClient_GetMavenArtifact() {
489 ctx := context.Background()
490 // This snippet has been automatically generated and should be regarded as a code template only.
491 // It will require modifications to work:
492 // - It may require correct/in-range values for request initialization.
493 // - It may require specifying regional endpoints when creating the service client as shown in:
494 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
495 c, err := artifactregistry.NewClient(ctx)
496 if err != nil {
497 // TODO: Handle error.
498 }
499 defer c.Close()
500
501 req := &artifactregistrypb.GetMavenArtifactRequest{
502 // TODO: Fill request struct fields.
503 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetMavenArtifactRequest.
504 }
505 resp, err := c.GetMavenArtifact(ctx, req)
506 if err != nil {
507 // TODO: Handle error.
508 }
509 // TODO: Use resp.
510 _ = resp
511 }
512
513 func ExampleClient_GetNpmPackage() {
514 ctx := context.Background()
515 // This snippet has been automatically generated and should be regarded as a code template only.
516 // It will require modifications to work:
517 // - It may require correct/in-range values for request initialization.
518 // - It may require specifying regional endpoints when creating the service client as shown in:
519 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
520 c, err := artifactregistry.NewClient(ctx)
521 if err != nil {
522 // TODO: Handle error.
523 }
524 defer c.Close()
525
526 req := &artifactregistrypb.GetNpmPackageRequest{
527 // TODO: Fill request struct fields.
528 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetNpmPackageRequest.
529 }
530 resp, err := c.GetNpmPackage(ctx, req)
531 if err != nil {
532 // TODO: Handle error.
533 }
534 // TODO: Use resp.
535 _ = resp
536 }
537
538 func ExampleClient_GetPackage() {
539 ctx := context.Background()
540 // This snippet has been automatically generated and should be regarded as a code template only.
541 // It will require modifications to work:
542 // - It may require correct/in-range values for request initialization.
543 // - It may require specifying regional endpoints when creating the service client as shown in:
544 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
545 c, err := artifactregistry.NewClient(ctx)
546 if err != nil {
547 // TODO: Handle error.
548 }
549 defer c.Close()
550
551 req := &artifactregistrypb.GetPackageRequest{
552 // TODO: Fill request struct fields.
553 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetPackageRequest.
554 }
555 resp, err := c.GetPackage(ctx, req)
556 if err != nil {
557 // TODO: Handle error.
558 }
559 // TODO: Use resp.
560 _ = resp
561 }
562
563 func ExampleClient_GetProjectSettings() {
564 ctx := context.Background()
565 // This snippet has been automatically generated and should be regarded as a code template only.
566 // It will require modifications to work:
567 // - It may require correct/in-range values for request initialization.
568 // - It may require specifying regional endpoints when creating the service client as shown in:
569 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
570 c, err := artifactregistry.NewClient(ctx)
571 if err != nil {
572 // TODO: Handle error.
573 }
574 defer c.Close()
575
576 req := &artifactregistrypb.GetProjectSettingsRequest{
577 // TODO: Fill request struct fields.
578 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetProjectSettingsRequest.
579 }
580 resp, err := c.GetProjectSettings(ctx, req)
581 if err != nil {
582 // TODO: Handle error.
583 }
584 // TODO: Use resp.
585 _ = resp
586 }
587
588 func ExampleClient_GetPythonPackage() {
589 ctx := context.Background()
590 // This snippet has been automatically generated and should be regarded as a code template only.
591 // It will require modifications to work:
592 // - It may require correct/in-range values for request initialization.
593 // - It may require specifying regional endpoints when creating the service client as shown in:
594 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
595 c, err := artifactregistry.NewClient(ctx)
596 if err != nil {
597 // TODO: Handle error.
598 }
599 defer c.Close()
600
601 req := &artifactregistrypb.GetPythonPackageRequest{
602 // TODO: Fill request struct fields.
603 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetPythonPackageRequest.
604 }
605 resp, err := c.GetPythonPackage(ctx, req)
606 if err != nil {
607 // TODO: Handle error.
608 }
609 // TODO: Use resp.
610 _ = resp
611 }
612
613 func ExampleClient_GetRepository() {
614 ctx := context.Background()
615 // This snippet has been automatically generated and should be regarded as a code template only.
616 // It will require modifications to work:
617 // - It may require correct/in-range values for request initialization.
618 // - It may require specifying regional endpoints when creating the service client as shown in:
619 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
620 c, err := artifactregistry.NewClient(ctx)
621 if err != nil {
622 // TODO: Handle error.
623 }
624 defer c.Close()
625
626 req := &artifactregistrypb.GetRepositoryRequest{
627 // TODO: Fill request struct fields.
628 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetRepositoryRequest.
629 }
630 resp, err := c.GetRepository(ctx, req)
631 if err != nil {
632 // TODO: Handle error.
633 }
634 // TODO: Use resp.
635 _ = resp
636 }
637
638 func ExampleClient_GetRule() {
639 ctx := context.Background()
640 // This snippet has been automatically generated and should be regarded as a code template only.
641 // It will require modifications to work:
642 // - It may require correct/in-range values for request initialization.
643 // - It may require specifying regional endpoints when creating the service client as shown in:
644 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
645 c, err := artifactregistry.NewClient(ctx)
646 if err != nil {
647 // TODO: Handle error.
648 }
649 defer c.Close()
650
651 req := &artifactregistrypb.GetRuleRequest{
652 // TODO: Fill request struct fields.
653 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetRuleRequest.
654 }
655 resp, err := c.GetRule(ctx, req)
656 if err != nil {
657 // TODO: Handle error.
658 }
659 // TODO: Use resp.
660 _ = resp
661 }
662
663 func ExampleClient_GetTag() {
664 ctx := context.Background()
665 // This snippet has been automatically generated and should be regarded as a code template only.
666 // It will require modifications to work:
667 // - It may require correct/in-range values for request initialization.
668 // - It may require specifying regional endpoints when creating the service client as shown in:
669 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
670 c, err := artifactregistry.NewClient(ctx)
671 if err != nil {
672 // TODO: Handle error.
673 }
674 defer c.Close()
675
676 req := &artifactregistrypb.GetTagRequest{
677 // TODO: Fill request struct fields.
678 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetTagRequest.
679 }
680 resp, err := c.GetTag(ctx, req)
681 if err != nil {
682 // TODO: Handle error.
683 }
684 // TODO: Use resp.
685 _ = resp
686 }
687
688 func ExampleClient_GetVPCSCConfig() {
689 ctx := context.Background()
690 // This snippet has been automatically generated and should be regarded as a code template only.
691 // It will require modifications to work:
692 // - It may require correct/in-range values for request initialization.
693 // - It may require specifying regional endpoints when creating the service client as shown in:
694 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
695 c, err := artifactregistry.NewClient(ctx)
696 if err != nil {
697 // TODO: Handle error.
698 }
699 defer c.Close()
700
701 req := &artifactregistrypb.GetVPCSCConfigRequest{
702 // TODO: Fill request struct fields.
703 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetVPCSCConfigRequest.
704 }
705 resp, err := c.GetVPCSCConfig(ctx, req)
706 if err != nil {
707 // TODO: Handle error.
708 }
709 // TODO: Use resp.
710 _ = resp
711 }
712
713 func ExampleClient_GetVersion() {
714 ctx := context.Background()
715 // This snippet has been automatically generated and should be regarded as a code template only.
716 // It will require modifications to work:
717 // - It may require correct/in-range values for request initialization.
718 // - It may require specifying regional endpoints when creating the service client as shown in:
719 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
720 c, err := artifactregistry.NewClient(ctx)
721 if err != nil {
722 // TODO: Handle error.
723 }
724 defer c.Close()
725
726 req := &artifactregistrypb.GetVersionRequest{
727 // TODO: Fill request struct fields.
728 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#GetVersionRequest.
729 }
730 resp, err := c.GetVersion(ctx, req)
731 if err != nil {
732 // TODO: Handle error.
733 }
734 // TODO: Use resp.
735 _ = resp
736 }
737
738 func ExampleClient_ImportAptArtifacts() {
739 ctx := context.Background()
740 // This snippet has been automatically generated and should be regarded as a code template only.
741 // It will require modifications to work:
742 // - It may require correct/in-range values for request initialization.
743 // - It may require specifying regional endpoints when creating the service client as shown in:
744 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
745 c, err := artifactregistry.NewClient(ctx)
746 if err != nil {
747 // TODO: Handle error.
748 }
749 defer c.Close()
750
751 req := &artifactregistrypb.ImportAptArtifactsRequest{
752 // TODO: Fill request struct fields.
753 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ImportAptArtifactsRequest.
754 }
755 op, err := c.ImportAptArtifacts(ctx, req)
756 if err != nil {
757 // TODO: Handle error.
758 }
759
760 resp, err := op.Wait(ctx)
761 if err != nil {
762 // TODO: Handle error.
763 }
764 // TODO: Use resp.
765 _ = resp
766 }
767
768 func ExampleClient_ImportYumArtifacts() {
769 ctx := context.Background()
770 // This snippet has been automatically generated and should be regarded as a code template only.
771 // It will require modifications to work:
772 // - It may require correct/in-range values for request initialization.
773 // - It may require specifying regional endpoints when creating the service client as shown in:
774 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
775 c, err := artifactregistry.NewClient(ctx)
776 if err != nil {
777 // TODO: Handle error.
778 }
779 defer c.Close()
780
781 req := &artifactregistrypb.ImportYumArtifactsRequest{
782 // TODO: Fill request struct fields.
783 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ImportYumArtifactsRequest.
784 }
785 op, err := c.ImportYumArtifacts(ctx, req)
786 if err != nil {
787 // TODO: Handle error.
788 }
789
790 resp, err := op.Wait(ctx)
791 if err != nil {
792 // TODO: Handle error.
793 }
794 // TODO: Use resp.
795 _ = resp
796 }
797
798 func ExampleClient_ListAttachments() {
799 ctx := context.Background()
800 // This snippet has been automatically generated and should be regarded as a code template only.
801 // It will require modifications to work:
802 // - It may require correct/in-range values for request initialization.
803 // - It may require specifying regional endpoints when creating the service client as shown in:
804 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
805 c, err := artifactregistry.NewClient(ctx)
806 if err != nil {
807 // TODO: Handle error.
808 }
809 defer c.Close()
810
811 req := &artifactregistrypb.ListAttachmentsRequest{
812 // TODO: Fill request struct fields.
813 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListAttachmentsRequest.
814 }
815 it := c.ListAttachments(ctx, req)
816 for {
817 resp, err := it.Next()
818 if err == iterator.Done {
819 break
820 }
821 if err != nil {
822 // TODO: Handle error.
823 }
824 // TODO: Use resp.
825 _ = resp
826
827 // If you need to access the underlying RPC response,
828 // you can do so by casting the `Response` as below.
829 // Otherwise, remove this line. Only populated after
830 // first call to Next(). Not safe for concurrent access.
831 _ = it.Response.(*artifactregistrypb.ListAttachmentsResponse)
832 }
833 }
834
835 func ExampleClient_ListDockerImages() {
836 ctx := context.Background()
837 // This snippet has been automatically generated and should be regarded as a code template only.
838 // It will require modifications to work:
839 // - It may require correct/in-range values for request initialization.
840 // - It may require specifying regional endpoints when creating the service client as shown in:
841 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
842 c, err := artifactregistry.NewClient(ctx)
843 if err != nil {
844 // TODO: Handle error.
845 }
846 defer c.Close()
847
848 req := &artifactregistrypb.ListDockerImagesRequest{
849 // TODO: Fill request struct fields.
850 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListDockerImagesRequest.
851 }
852 it := c.ListDockerImages(ctx, req)
853 for {
854 resp, err := it.Next()
855 if err == iterator.Done {
856 break
857 }
858 if err != nil {
859 // TODO: Handle error.
860 }
861 // TODO: Use resp.
862 _ = resp
863
864 // If you need to access the underlying RPC response,
865 // you can do so by casting the `Response` as below.
866 // Otherwise, remove this line. Only populated after
867 // first call to Next(). Not safe for concurrent access.
868 _ = it.Response.(*artifactregistrypb.ListDockerImagesResponse)
869 }
870 }
871
872 func ExampleClient_ListFiles() {
873 ctx := context.Background()
874 // This snippet has been automatically generated and should be regarded as a code template only.
875 // It will require modifications to work:
876 // - It may require correct/in-range values for request initialization.
877 // - It may require specifying regional endpoints when creating the service client as shown in:
878 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
879 c, err := artifactregistry.NewClient(ctx)
880 if err != nil {
881 // TODO: Handle error.
882 }
883 defer c.Close()
884
885 req := &artifactregistrypb.ListFilesRequest{
886 // TODO: Fill request struct fields.
887 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListFilesRequest.
888 }
889 it := c.ListFiles(ctx, req)
890 for {
891 resp, err := it.Next()
892 if err == iterator.Done {
893 break
894 }
895 if err != nil {
896 // TODO: Handle error.
897 }
898 // TODO: Use resp.
899 _ = resp
900
901 // If you need to access the underlying RPC response,
902 // you can do so by casting the `Response` as below.
903 // Otherwise, remove this line. Only populated after
904 // first call to Next(). Not safe for concurrent access.
905 _ = it.Response.(*artifactregistrypb.ListFilesResponse)
906 }
907 }
908
909 func ExampleClient_ListMavenArtifacts() {
910 ctx := context.Background()
911 // This snippet has been automatically generated and should be regarded as a code template only.
912 // It will require modifications to work:
913 // - It may require correct/in-range values for request initialization.
914 // - It may require specifying regional endpoints when creating the service client as shown in:
915 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
916 c, err := artifactregistry.NewClient(ctx)
917 if err != nil {
918 // TODO: Handle error.
919 }
920 defer c.Close()
921
922 req := &artifactregistrypb.ListMavenArtifactsRequest{
923 // TODO: Fill request struct fields.
924 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListMavenArtifactsRequest.
925 }
926 it := c.ListMavenArtifacts(ctx, req)
927 for {
928 resp, err := it.Next()
929 if err == iterator.Done {
930 break
931 }
932 if err != nil {
933 // TODO: Handle error.
934 }
935 // TODO: Use resp.
936 _ = resp
937
938 // If you need to access the underlying RPC response,
939 // you can do so by casting the `Response` as below.
940 // Otherwise, remove this line. Only populated after
941 // first call to Next(). Not safe for concurrent access.
942 _ = it.Response.(*artifactregistrypb.ListMavenArtifactsResponse)
943 }
944 }
945
946 func ExampleClient_ListNpmPackages() {
947 ctx := context.Background()
948 // This snippet has been automatically generated and should be regarded as a code template only.
949 // It will require modifications to work:
950 // - It may require correct/in-range values for request initialization.
951 // - It may require specifying regional endpoints when creating the service client as shown in:
952 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
953 c, err := artifactregistry.NewClient(ctx)
954 if err != nil {
955 // TODO: Handle error.
956 }
957 defer c.Close()
958
959 req := &artifactregistrypb.ListNpmPackagesRequest{
960 // TODO: Fill request struct fields.
961 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListNpmPackagesRequest.
962 }
963 it := c.ListNpmPackages(ctx, req)
964 for {
965 resp, err := it.Next()
966 if err == iterator.Done {
967 break
968 }
969 if err != nil {
970 // TODO: Handle error.
971 }
972 // TODO: Use resp.
973 _ = resp
974
975 // If you need to access the underlying RPC response,
976 // you can do so by casting the `Response` as below.
977 // Otherwise, remove this line. Only populated after
978 // first call to Next(). Not safe for concurrent access.
979 _ = it.Response.(*artifactregistrypb.ListNpmPackagesResponse)
980 }
981 }
982
983 func ExampleClient_ListPackages() {
984 ctx := context.Background()
985 // This snippet has been automatically generated and should be regarded as a code template only.
986 // It will require modifications to work:
987 // - It may require correct/in-range values for request initialization.
988 // - It may require specifying regional endpoints when creating the service client as shown in:
989 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
990 c, err := artifactregistry.NewClient(ctx)
991 if err != nil {
992 // TODO: Handle error.
993 }
994 defer c.Close()
995
996 req := &artifactregistrypb.ListPackagesRequest{
997 // TODO: Fill request struct fields.
998 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListPackagesRequest.
999 }
1000 it := c.ListPackages(ctx, req)
1001 for {
1002 resp, err := it.Next()
1003 if err == iterator.Done {
1004 break
1005 }
1006 if err != nil {
1007 // TODO: Handle error.
1008 }
1009 // TODO: Use resp.
1010 _ = resp
1011
1012 // If you need to access the underlying RPC response,
1013 // you can do so by casting the `Response` as below.
1014 // Otherwise, remove this line. Only populated after
1015 // first call to Next(). Not safe for concurrent access.
1016 _ = it.Response.(*artifactregistrypb.ListPackagesResponse)
1017 }
1018 }
1019
1020 func ExampleClient_ListPythonPackages() {
1021 ctx := context.Background()
1022 // This snippet has been automatically generated and should be regarded as a code template only.
1023 // It will require modifications to work:
1024 // - It may require correct/in-range values for request initialization.
1025 // - It may require specifying regional endpoints when creating the service client as shown in:
1026 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1027 c, err := artifactregistry.NewClient(ctx)
1028 if err != nil {
1029 // TODO: Handle error.
1030 }
1031 defer c.Close()
1032
1033 req := &artifactregistrypb.ListPythonPackagesRequest{
1034 // TODO: Fill request struct fields.
1035 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListPythonPackagesRequest.
1036 }
1037 it := c.ListPythonPackages(ctx, req)
1038 for {
1039 resp, err := it.Next()
1040 if err == iterator.Done {
1041 break
1042 }
1043 if err != nil {
1044 // TODO: Handle error.
1045 }
1046 // TODO: Use resp.
1047 _ = resp
1048
1049 // If you need to access the underlying RPC response,
1050 // you can do so by casting the `Response` as below.
1051 // Otherwise, remove this line. Only populated after
1052 // first call to Next(). Not safe for concurrent access.
1053 _ = it.Response.(*artifactregistrypb.ListPythonPackagesResponse)
1054 }
1055 }
1056
1057 func ExampleClient_ListRepositories() {
1058 ctx := context.Background()
1059 // This snippet has been automatically generated and should be regarded as a code template only.
1060 // It will require modifications to work:
1061 // - It may require correct/in-range values for request initialization.
1062 // - It may require specifying regional endpoints when creating the service client as shown in:
1063 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1064 c, err := artifactregistry.NewClient(ctx)
1065 if err != nil {
1066 // TODO: Handle error.
1067 }
1068 defer c.Close()
1069
1070 req := &artifactregistrypb.ListRepositoriesRequest{
1071 // TODO: Fill request struct fields.
1072 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListRepositoriesRequest.
1073 }
1074 it := c.ListRepositories(ctx, req)
1075 for {
1076 resp, err := it.Next()
1077 if err == iterator.Done {
1078 break
1079 }
1080 if err != nil {
1081 // TODO: Handle error.
1082 }
1083 // TODO: Use resp.
1084 _ = resp
1085
1086 // If you need to access the underlying RPC response,
1087 // you can do so by casting the `Response` as below.
1088 // Otherwise, remove this line. Only populated after
1089 // first call to Next(). Not safe for concurrent access.
1090 _ = it.Response.(*artifactregistrypb.ListRepositoriesResponse)
1091 }
1092 }
1093
1094 func ExampleClient_ListRules() {
1095 ctx := context.Background()
1096 // This snippet has been automatically generated and should be regarded as a code template only.
1097 // It will require modifications to work:
1098 // - It may require correct/in-range values for request initialization.
1099 // - It may require specifying regional endpoints when creating the service client as shown in:
1100 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1101 c, err := artifactregistry.NewClient(ctx)
1102 if err != nil {
1103 // TODO: Handle error.
1104 }
1105 defer c.Close()
1106
1107 req := &artifactregistrypb.ListRulesRequest{
1108 // TODO: Fill request struct fields.
1109 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListRulesRequest.
1110 }
1111 it := c.ListRules(ctx, req)
1112 for {
1113 resp, err := it.Next()
1114 if err == iterator.Done {
1115 break
1116 }
1117 if err != nil {
1118 // TODO: Handle error.
1119 }
1120 // TODO: Use resp.
1121 _ = resp
1122
1123 // If you need to access the underlying RPC response,
1124 // you can do so by casting the `Response` as below.
1125 // Otherwise, remove this line. Only populated after
1126 // first call to Next(). Not safe for concurrent access.
1127 _ = it.Response.(*artifactregistrypb.ListRulesResponse)
1128 }
1129 }
1130
1131 func ExampleClient_ListTags() {
1132 ctx := context.Background()
1133 // This snippet has been automatically generated and should be regarded as a code template only.
1134 // It will require modifications to work:
1135 // - It may require correct/in-range values for request initialization.
1136 // - It may require specifying regional endpoints when creating the service client as shown in:
1137 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1138 c, err := artifactregistry.NewClient(ctx)
1139 if err != nil {
1140 // TODO: Handle error.
1141 }
1142 defer c.Close()
1143
1144 req := &artifactregistrypb.ListTagsRequest{
1145 // TODO: Fill request struct fields.
1146 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListTagsRequest.
1147 }
1148 it := c.ListTags(ctx, req)
1149 for {
1150 resp, err := it.Next()
1151 if err == iterator.Done {
1152 break
1153 }
1154 if err != nil {
1155 // TODO: Handle error.
1156 }
1157 // TODO: Use resp.
1158 _ = resp
1159
1160 // If you need to access the underlying RPC response,
1161 // you can do so by casting the `Response` as below.
1162 // Otherwise, remove this line. Only populated after
1163 // first call to Next(). Not safe for concurrent access.
1164 _ = it.Response.(*artifactregistrypb.ListTagsResponse)
1165 }
1166 }
1167
1168 func ExampleClient_ListVersions() {
1169 ctx := context.Background()
1170 // This snippet has been automatically generated and should be regarded as a code template only.
1171 // It will require modifications to work:
1172 // - It may require correct/in-range values for request initialization.
1173 // - It may require specifying regional endpoints when creating the service client as shown in:
1174 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1175 c, err := artifactregistry.NewClient(ctx)
1176 if err != nil {
1177 // TODO: Handle error.
1178 }
1179 defer c.Close()
1180
1181 req := &artifactregistrypb.ListVersionsRequest{
1182 // TODO: Fill request struct fields.
1183 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#ListVersionsRequest.
1184 }
1185 it := c.ListVersions(ctx, req)
1186 for {
1187 resp, err := it.Next()
1188 if err == iterator.Done {
1189 break
1190 }
1191 if err != nil {
1192 // TODO: Handle error.
1193 }
1194 // TODO: Use resp.
1195 _ = resp
1196
1197 // If you need to access the underlying RPC response,
1198 // you can do so by casting the `Response` as below.
1199 // Otherwise, remove this line. Only populated after
1200 // first call to Next(). Not safe for concurrent access.
1201 _ = it.Response.(*artifactregistrypb.ListVersionsResponse)
1202 }
1203 }
1204
1205 func ExampleClient_SetIamPolicy() {
1206 ctx := context.Background()
1207 // This snippet has been automatically generated and should be regarded as a code template only.
1208 // It will require modifications to work:
1209 // - It may require correct/in-range values for request initialization.
1210 // - It may require specifying regional endpoints when creating the service client as shown in:
1211 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1212 c, err := artifactregistry.NewClient(ctx)
1213 if err != nil {
1214 // TODO: Handle error.
1215 }
1216 defer c.Close()
1217
1218 req := &iampb.SetIamPolicyRequest{
1219 // TODO: Fill request struct fields.
1220 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
1221 }
1222 resp, err := c.SetIamPolicy(ctx, req)
1223 if err != nil {
1224 // TODO: Handle error.
1225 }
1226 // TODO: Use resp.
1227 _ = resp
1228 }
1229
1230 func ExampleClient_TestIamPermissions() {
1231 ctx := context.Background()
1232 // This snippet has been automatically generated and should be regarded as a code template only.
1233 // It will require modifications to work:
1234 // - It may require correct/in-range values for request initialization.
1235 // - It may require specifying regional endpoints when creating the service client as shown in:
1236 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1237 c, err := artifactregistry.NewClient(ctx)
1238 if err != nil {
1239 // TODO: Handle error.
1240 }
1241 defer c.Close()
1242
1243 req := &iampb.TestIamPermissionsRequest{
1244 // TODO: Fill request struct fields.
1245 // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
1246 }
1247 resp, err := c.TestIamPermissions(ctx, req)
1248 if err != nil {
1249 // TODO: Handle error.
1250 }
1251 // TODO: Use resp.
1252 _ = resp
1253 }
1254
1255 func ExampleClient_UpdateFile() {
1256 ctx := context.Background()
1257 // This snippet has been automatically generated and should be regarded as a code template only.
1258 // It will require modifications to work:
1259 // - It may require correct/in-range values for request initialization.
1260 // - It may require specifying regional endpoints when creating the service client as shown in:
1261 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1262 c, err := artifactregistry.NewClient(ctx)
1263 if err != nil {
1264 // TODO: Handle error.
1265 }
1266 defer c.Close()
1267
1268 req := &artifactregistrypb.UpdateFileRequest{
1269 // TODO: Fill request struct fields.
1270 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#UpdateFileRequest.
1271 }
1272 resp, err := c.UpdateFile(ctx, req)
1273 if err != nil {
1274 // TODO: Handle error.
1275 }
1276 // TODO: Use resp.
1277 _ = resp
1278 }
1279
1280 func ExampleClient_UpdatePackage() {
1281 ctx := context.Background()
1282 // This snippet has been automatically generated and should be regarded as a code template only.
1283 // It will require modifications to work:
1284 // - It may require correct/in-range values for request initialization.
1285 // - It may require specifying regional endpoints when creating the service client as shown in:
1286 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1287 c, err := artifactregistry.NewClient(ctx)
1288 if err != nil {
1289 // TODO: Handle error.
1290 }
1291 defer c.Close()
1292
1293 req := &artifactregistrypb.UpdatePackageRequest{
1294 // TODO: Fill request struct fields.
1295 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#UpdatePackageRequest.
1296 }
1297 resp, err := c.UpdatePackage(ctx, req)
1298 if err != nil {
1299 // TODO: Handle error.
1300 }
1301 // TODO: Use resp.
1302 _ = resp
1303 }
1304
1305 func ExampleClient_UpdateProjectSettings() {
1306 ctx := context.Background()
1307 // This snippet has been automatically generated and should be regarded as a code template only.
1308 // It will require modifications to work:
1309 // - It may require correct/in-range values for request initialization.
1310 // - It may require specifying regional endpoints when creating the service client as shown in:
1311 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1312 c, err := artifactregistry.NewClient(ctx)
1313 if err != nil {
1314 // TODO: Handle error.
1315 }
1316 defer c.Close()
1317
1318 req := &artifactregistrypb.UpdateProjectSettingsRequest{
1319 // TODO: Fill request struct fields.
1320 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#UpdateProjectSettingsRequest.
1321 }
1322 resp, err := c.UpdateProjectSettings(ctx, req)
1323 if err != nil {
1324 // TODO: Handle error.
1325 }
1326 // TODO: Use resp.
1327 _ = resp
1328 }
1329
1330 func ExampleClient_UpdateRepository() {
1331 ctx := context.Background()
1332 // This snippet has been automatically generated and should be regarded as a code template only.
1333 // It will require modifications to work:
1334 // - It may require correct/in-range values for request initialization.
1335 // - It may require specifying regional endpoints when creating the service client as shown in:
1336 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1337 c, err := artifactregistry.NewClient(ctx)
1338 if err != nil {
1339 // TODO: Handle error.
1340 }
1341 defer c.Close()
1342
1343 req := &artifactregistrypb.UpdateRepositoryRequest{
1344 // TODO: Fill request struct fields.
1345 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#UpdateRepositoryRequest.
1346 }
1347 resp, err := c.UpdateRepository(ctx, req)
1348 if err != nil {
1349 // TODO: Handle error.
1350 }
1351 // TODO: Use resp.
1352 _ = resp
1353 }
1354
1355 func ExampleClient_UpdateRule() {
1356 ctx := context.Background()
1357 // This snippet has been automatically generated and should be regarded as a code template only.
1358 // It will require modifications to work:
1359 // - It may require correct/in-range values for request initialization.
1360 // - It may require specifying regional endpoints when creating the service client as shown in:
1361 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1362 c, err := artifactregistry.NewClient(ctx)
1363 if err != nil {
1364 // TODO: Handle error.
1365 }
1366 defer c.Close()
1367
1368 req := &artifactregistrypb.UpdateRuleRequest{
1369 // TODO: Fill request struct fields.
1370 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#UpdateRuleRequest.
1371 }
1372 resp, err := c.UpdateRule(ctx, req)
1373 if err != nil {
1374 // TODO: Handle error.
1375 }
1376 // TODO: Use resp.
1377 _ = resp
1378 }
1379
1380 func ExampleClient_UpdateTag() {
1381 ctx := context.Background()
1382 // This snippet has been automatically generated and should be regarded as a code template only.
1383 // It will require modifications to work:
1384 // - It may require correct/in-range values for request initialization.
1385 // - It may require specifying regional endpoints when creating the service client as shown in:
1386 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1387 c, err := artifactregistry.NewClient(ctx)
1388 if err != nil {
1389 // TODO: Handle error.
1390 }
1391 defer c.Close()
1392
1393 req := &artifactregistrypb.UpdateTagRequest{
1394 // TODO: Fill request struct fields.
1395 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#UpdateTagRequest.
1396 }
1397 resp, err := c.UpdateTag(ctx, req)
1398 if err != nil {
1399 // TODO: Handle error.
1400 }
1401 // TODO: Use resp.
1402 _ = resp
1403 }
1404
1405 func ExampleClient_UpdateVPCSCConfig() {
1406 ctx := context.Background()
1407 // This snippet has been automatically generated and should be regarded as a code template only.
1408 // It will require modifications to work:
1409 // - It may require correct/in-range values for request initialization.
1410 // - It may require specifying regional endpoints when creating the service client as shown in:
1411 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1412 c, err := artifactregistry.NewClient(ctx)
1413 if err != nil {
1414 // TODO: Handle error.
1415 }
1416 defer c.Close()
1417
1418 req := &artifactregistrypb.UpdateVPCSCConfigRequest{
1419 // TODO: Fill request struct fields.
1420 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#UpdateVPCSCConfigRequest.
1421 }
1422 resp, err := c.UpdateVPCSCConfig(ctx, req)
1423 if err != nil {
1424 // TODO: Handle error.
1425 }
1426 // TODO: Use resp.
1427 _ = resp
1428 }
1429
1430 func ExampleClient_UpdateVersion() {
1431 ctx := context.Background()
1432 // This snippet has been automatically generated and should be regarded as a code template only.
1433 // It will require modifications to work:
1434 // - It may require correct/in-range values for request initialization.
1435 // - It may require specifying regional endpoints when creating the service client as shown in:
1436 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1437 c, err := artifactregistry.NewClient(ctx)
1438 if err != nil {
1439 // TODO: Handle error.
1440 }
1441 defer c.Close()
1442
1443 req := &artifactregistrypb.UpdateVersionRequest{
1444 // TODO: Fill request struct fields.
1445 // See https://pkg.go.dev/cloud.google.com/go/artifactregistry/apiv1/artifactregistrypb#UpdateVersionRequest.
1446 }
1447 resp, err := c.UpdateVersion(ctx, req)
1448 if err != nil {
1449 // TODO: Handle error.
1450 }
1451 // TODO: Use resp.
1452 _ = resp
1453 }
1454
1455 func ExampleClient_GetLocation() {
1456 ctx := context.Background()
1457 // This snippet has been automatically generated and should be regarded as a code template only.
1458 // It will require modifications to work:
1459 // - It may require correct/in-range values for request initialization.
1460 // - It may require specifying regional endpoints when creating the service client as shown in:
1461 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1462 c, err := artifactregistry.NewClient(ctx)
1463 if err != nil {
1464 // TODO: Handle error.
1465 }
1466 defer c.Close()
1467
1468 req := &locationpb.GetLocationRequest{
1469 // TODO: Fill request struct fields.
1470 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
1471 }
1472 resp, err := c.GetLocation(ctx, req)
1473 if err != nil {
1474 // TODO: Handle error.
1475 }
1476 // TODO: Use resp.
1477 _ = resp
1478 }
1479
1480 func ExampleClient_ListLocations() {
1481 ctx := context.Background()
1482 // This snippet has been automatically generated and should be regarded as a code template only.
1483 // It will require modifications to work:
1484 // - It may require correct/in-range values for request initialization.
1485 // - It may require specifying regional endpoints when creating the service client as shown in:
1486 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1487 c, err := artifactregistry.NewClient(ctx)
1488 if err != nil {
1489 // TODO: Handle error.
1490 }
1491 defer c.Close()
1492
1493 req := &locationpb.ListLocationsRequest{
1494 // TODO: Fill request struct fields.
1495 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
1496 }
1497 it := c.ListLocations(ctx, req)
1498 for {
1499 resp, err := it.Next()
1500 if err == iterator.Done {
1501 break
1502 }
1503 if err != nil {
1504 // TODO: Handle error.
1505 }
1506 // TODO: Use resp.
1507 _ = resp
1508
1509 // If you need to access the underlying RPC response,
1510 // you can do so by casting the `Response` as below.
1511 // Otherwise, remove this line. Only populated after
1512 // first call to Next(). Not safe for concurrent access.
1513 _ = it.Response.(*locationpb.ListLocationsResponse)
1514 }
1515 }
1516
1517 func ExampleClient_GetOperation() {
1518 ctx := context.Background()
1519 // This snippet has been automatically generated and should be regarded as a code template only.
1520 // It will require modifications to work:
1521 // - It may require correct/in-range values for request initialization.
1522 // - It may require specifying regional endpoints when creating the service client as shown in:
1523 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
1524 c, err := artifactregistry.NewClient(ctx)
1525 if err != nil {
1526 // TODO: Handle error.
1527 }
1528 defer c.Close()
1529
1530 req := &longrunningpb.GetOperationRequest{
1531 // TODO: Fill request struct fields.
1532 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
1533 }
1534 resp, err := c.GetOperation(ctx, req)
1535 if err != nil {
1536 // TODO: Handle error.
1537 }
1538 // TODO: Use resp.
1539 _ = resp
1540 }