// 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 networkservices_test import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" networkservices "cloud.google.com/go/networkservices/apiv1" networkservicespb "cloud.google.com/go/networkservices/apiv1/networkservicespb" "google.golang.org/api/iterator" locationpb "google.golang.org/genproto/googleapis/cloud/location" ) func ExampleNewDepClient() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func ExampleNewDepRESTClient() { 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 := networkservices.NewDepRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func ExampleDepClient_CreateAuthzExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.CreateAuthzExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateAuthzExtensionRequest. } op, err := c.CreateAuthzExtension(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_CreateLbRouteExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.CreateLbRouteExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateLbRouteExtensionRequest. } op, err := c.CreateLbRouteExtension(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_CreateLbTrafficExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.CreateLbTrafficExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#CreateLbTrafficExtensionRequest. } op, err := c.CreateLbTrafficExtension(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_DeleteAuthzExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.DeleteAuthzExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteAuthzExtensionRequest. } op, err := c.DeleteAuthzExtension(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func ExampleDepClient_DeleteLbRouteExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.DeleteLbRouteExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteLbRouteExtensionRequest. } op, err := c.DeleteLbRouteExtension(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func ExampleDepClient_DeleteLbTrafficExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.DeleteLbTrafficExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#DeleteLbTrafficExtensionRequest. } op, err := c.DeleteLbTrafficExtension(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func ExampleDepClient_GetAuthzExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.GetAuthzExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetAuthzExtensionRequest. } resp, err := c.GetAuthzExtension(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_GetLbRouteExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.GetLbRouteExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetLbRouteExtensionRequest. } resp, err := c.GetLbRouteExtension(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_GetLbTrafficExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.GetLbTrafficExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#GetLbTrafficExtensionRequest. } resp, err := c.GetLbTrafficExtension(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_ListAuthzExtensions() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.ListAuthzExtensionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListAuthzExtensionsRequest. } it := c.ListAuthzExtensions(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.(*networkservicespb.ListAuthzExtensionsResponse) } } func ExampleDepClient_ListLbRouteExtensions() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.ListLbRouteExtensionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListLbRouteExtensionsRequest. } it := c.ListLbRouteExtensions(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.(*networkservicespb.ListLbRouteExtensionsResponse) } } func ExampleDepClient_ListLbTrafficExtensions() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.ListLbTrafficExtensionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#ListLbTrafficExtensionsRequest. } it := c.ListLbTrafficExtensions(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.(*networkservicespb.ListLbTrafficExtensionsResponse) } } func ExampleDepClient_UpdateAuthzExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.UpdateAuthzExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateAuthzExtensionRequest. } op, err := c.UpdateAuthzExtension(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_UpdateLbRouteExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.UpdateLbRouteExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateLbRouteExtensionRequest. } op, err := c.UpdateLbRouteExtension(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_UpdateLbTrafficExtension() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &networkservicespb.UpdateLbTrafficExtensionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/networkservices/apiv1/networkservicespb#UpdateLbTrafficExtensionRequest. } op, err := c.UpdateLbTrafficExtension(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_GetLocation() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &locationpb.GetLocationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. } resp, err := c.GetLocation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_ListLocations() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &locationpb.ListLocationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. } it := c.ListLocations(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.(*locationpb.ListLocationsResponse) } } func ExampleDepClient_GetIamPolicy() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &iampb.GetIamPolicyRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest. } resp, err := c.GetIamPolicy(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_SetIamPolicy() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &iampb.SetIamPolicyRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest. } resp, err := c.SetIamPolicy(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_TestIamPermissions() { 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 := networkservices.NewDepClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &iampb.TestIamPermissionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest. } resp, err := c.TestIamPermissions(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleDepClient_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 := networkservices.NewDepClient(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 ExampleDepClient_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 := networkservices.NewDepClient(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 ExampleDepClient_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 := networkservices.NewDepClient(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 ExampleDepClient_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 := networkservices.NewDepClient(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) } }