| 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 | //go:build go1.23 |
| 18 | |
| 19 | package gkehub_test |
| 20 | |
| 21 | import ( |
| 22 | "context" |
| 23 | |
| 24 | gkehub "cloud.google.com/go/gkehub/apiv1beta1" |
| 25 | gkehubpb "cloud.google.com/go/gkehub/apiv1beta1/gkehubpb" |
| 26 | longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 27 | locationpb "google.golang.org/genproto/googleapis/cloud/location" |
| 28 | ) |
| 29 | |
| 30 | func ExampleGkeHubMembershipClient_ListMemberships_all() { |
| 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 := gkehub.NewGkeHubMembershipClient(ctx) |
| 38 | if err != nil { |
| 39 | // TODO: Handle error. |
| 40 | } |
| 41 | defer c.Close() |
| 42 | |
| 43 | req := &gkehubpb.ListMembershipsRequest{ |
| 44 | // TODO: Fill request struct fields. |
| 45 | // See https://pkg.go.dev/cloud.google.com/go/gkehub/apiv1beta1/gkehubpb#ListMembershipsRequest. |
| 46 | } |
| 47 | for resp, err := range c.ListMemberships(ctx, req).All() { |
| 48 | if err != nil { |
| 49 | // TODO: Handle error and break/return/continue. Iteration will stop after any error. |
| 50 | } |
| 51 | // TODO: Use resp. |
| 52 | _ = resp |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | func ExampleGkeHubMembershipClient_ListLocations_all() { |
| 57 | ctx := context.Background() |
| 58 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 59 | // It will require modifications to work: |
| 60 | // - It may require correct/in-range values for request initialization. |
| 61 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 62 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 63 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 64 | if err != nil { |
| 65 | // TODO: Handle error. |
| 66 | } |
| 67 | defer c.Close() |
| 68 | |
| 69 | req := &locationpb.ListLocationsRequest{ |
| 70 | // TODO: Fill request struct fields. |
| 71 | // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. |
| 72 | } |
| 73 | for resp, err := range c.ListLocations(ctx, req).All() { |
| 74 | if err != nil { |
| 75 | // TODO: Handle error and break/return/continue. Iteration will stop after any error. |
| 76 | } |
| 77 | // TODO: Use resp. |
| 78 | _ = resp |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | func ExampleGkeHubMembershipClient_ListOperations_all() { |
| 83 | ctx := context.Background() |
| 84 | // This snippet has been automatically generated and should be regarded as a code template only. |
| 85 | // It will require modifications to work: |
| 86 | // - It may require correct/in-range values for request initialization. |
| 87 | // - It may require specifying regional endpoints when creating the service client as shown in: |
| 88 | // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 89 | c, err := gkehub.NewGkeHubMembershipClient(ctx) |
| 90 | if err != nil { |
| 91 | // TODO: Handle error. |
| 92 | } |
| 93 | defer c.Close() |
| 94 | |
| 95 | req := &longrunningpb.ListOperationsRequest{ |
| 96 | // TODO: Fill request struct fields. |
| 97 | // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. |
| 98 | } |
| 99 | for resp, err := range c.ListOperations(ctx, req).All() { |
| 100 | if err != nil { |
| 101 | // TODO: Handle error and break/return/continue. Iteration will stop after any error. |
| 102 | } |
| 103 | // TODO: Use resp. |
| 104 | _ = resp |
| 105 | } |
| 106 | } |