// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Code generated by protoc-gen-go_gapic. DO NOT EDIT. package gkemulticloud_test import ( "context" gkemulticloud "cloud.google.com/go/gkemulticloud/apiv1" gkemulticloudpb "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "google.golang.org/api/iterator" ) func ExampleNewAwsClustersClient() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func ExampleAwsClustersClient_CreateAwsCluster() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.CreateAwsClusterRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#CreateAwsClusterRequest. } op, err := c.CreateAwsCluster(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_CreateAwsNodePool() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.CreateAwsNodePoolRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#CreateAwsNodePoolRequest. } op, err := c.CreateAwsNodePool(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_DeleteAwsCluster() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.DeleteAwsClusterRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#DeleteAwsClusterRequest. } op, err := c.DeleteAwsCluster(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func ExampleAwsClustersClient_DeleteAwsNodePool() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.DeleteAwsNodePoolRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#DeleteAwsNodePoolRequest. } op, err := c.DeleteAwsNodePool(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func ExampleAwsClustersClient_GenerateAwsAccessToken() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.GenerateAwsAccessTokenRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GenerateAwsAccessTokenRequest. } resp, err := c.GenerateAwsAccessToken(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_GenerateAwsClusterAgentToken() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.GenerateAwsClusterAgentTokenRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GenerateAwsClusterAgentTokenRequest. } resp, err := c.GenerateAwsClusterAgentToken(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_GetAwsCluster() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.GetAwsClusterRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GetAwsClusterRequest. } resp, err := c.GetAwsCluster(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_GetAwsJsonWebKeys() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.GetAwsJsonWebKeysRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GetAwsJsonWebKeysRequest. } resp, err := c.GetAwsJsonWebKeys(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_GetAwsNodePool() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.GetAwsNodePoolRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GetAwsNodePoolRequest. } resp, err := c.GetAwsNodePool(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_GetAwsOpenIdConfig() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.GetAwsOpenIdConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GetAwsOpenIdConfigRequest. } resp, err := c.GetAwsOpenIdConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_GetAwsServerConfig() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.GetAwsServerConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#GetAwsServerConfigRequest. } resp, err := c.GetAwsServerConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_ListAwsClusters() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.ListAwsClustersRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#ListAwsClustersRequest. } it := c.ListAwsClusters(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*gkemulticloudpb.ListAwsClustersResponse) } } func ExampleAwsClustersClient_ListAwsNodePools() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.ListAwsNodePoolsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#ListAwsNodePoolsRequest. } it := c.ListAwsNodePools(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*gkemulticloudpb.ListAwsNodePoolsResponse) } } func ExampleAwsClustersClient_RollbackAwsNodePoolUpdate() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.RollbackAwsNodePoolUpdateRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#RollbackAwsNodePoolUpdateRequest. } op, err := c.RollbackAwsNodePoolUpdate(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_UpdateAwsCluster() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.UpdateAwsClusterRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#UpdateAwsClusterRequest. } op, err := c.UpdateAwsCluster(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_UpdateAwsNodePool() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &gkemulticloudpb.UpdateAwsNodePoolRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb#UpdateAwsNodePoolRequest. } op, err := c.UpdateAwsNodePool(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_CancelOperation() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func ExampleAwsClustersClient_DeleteOperation() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.DeleteOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. } err = c.DeleteOperation(ctx, req) if err != nil { // TODO: Handle error. } } func ExampleAwsClustersClient_GetOperation() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleAwsClustersClient_ListOperations() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := gkemulticloud.NewAwsClustersClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } }