// 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 apihub_test import ( "context" apihub "cloud.google.com/go/apihub/apiv1" apihubpb "cloud.google.com/go/apihub/apiv1/apihubpb" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "google.golang.org/api/iterator" locationpb "google.golang.org/genproto/googleapis/cloud/location" ) func ExampleNewRESTClient() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func ExampleClient_CreateApi() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.CreateApiRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateApiRequest. } resp, err := c.CreateApi(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_CreateApiOperation() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.CreateApiOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateApiOperationRequest. } resp, err := c.CreateApiOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_CreateAttribute() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.CreateAttributeRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateAttributeRequest. } resp, err := c.CreateAttribute(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_CreateDeployment() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.CreateDeploymentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateDeploymentRequest. } resp, err := c.CreateDeployment(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_CreateExternalApi() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.CreateExternalApiRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateExternalApiRequest. } resp, err := c.CreateExternalApi(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_CreateSpec() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.CreateSpecRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateSpecRequest. } resp, err := c.CreateSpec(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_CreateVersion() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.CreateVersionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#CreateVersionRequest. } resp, err := c.CreateVersion(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_DeleteApi() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.DeleteApiRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteApiRequest. } err = c.DeleteApi(ctx, req) if err != nil { // TODO: Handle error. } } func ExampleClient_DeleteApiOperation() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.DeleteApiOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteApiOperationRequest. } err = c.DeleteApiOperation(ctx, req) if err != nil { // TODO: Handle error. } } func ExampleClient_DeleteAttribute() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.DeleteAttributeRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteAttributeRequest. } err = c.DeleteAttribute(ctx, req) if err != nil { // TODO: Handle error. } } func ExampleClient_DeleteDeployment() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.DeleteDeploymentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteDeploymentRequest. } err = c.DeleteDeployment(ctx, req) if err != nil { // TODO: Handle error. } } func ExampleClient_DeleteExternalApi() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.DeleteExternalApiRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteExternalApiRequest. } err = c.DeleteExternalApi(ctx, req) if err != nil { // TODO: Handle error. } } func ExampleClient_DeleteSpec() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.DeleteSpecRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteSpecRequest. } err = c.DeleteSpec(ctx, req) if err != nil { // TODO: Handle error. } } func ExampleClient_DeleteVersion() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.DeleteVersionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#DeleteVersionRequest. } err = c.DeleteVersion(ctx, req) if err != nil { // TODO: Handle error. } } func ExampleClient_GetApi() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.GetApiRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetApiRequest. } resp, err := c.GetApi(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_GetApiOperation() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.GetApiOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetApiOperationRequest. } resp, err := c.GetApiOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_GetAttribute() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.GetAttributeRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetAttributeRequest. } resp, err := c.GetAttribute(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_GetDefinition() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.GetDefinitionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetDefinitionRequest. } resp, err := c.GetDefinition(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_GetDeployment() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.GetDeploymentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetDeploymentRequest. } resp, err := c.GetDeployment(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_GetExternalApi() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.GetExternalApiRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetExternalApiRequest. } resp, err := c.GetExternalApi(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_GetSpec() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.GetSpecRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetSpecRequest. } resp, err := c.GetSpec(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_GetSpecContents() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.GetSpecContentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetSpecContentsRequest. } resp, err := c.GetSpecContents(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_GetVersion() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.GetVersionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#GetVersionRequest. } resp, err := c.GetVersion(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_ListApiOperations() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.ListApiOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListApiOperationsRequest. } it := c.ListApiOperations(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.(*apihubpb.ListApiOperationsResponse) } } func ExampleClient_ListApis() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.ListApisRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListApisRequest. } it := c.ListApis(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.(*apihubpb.ListApisResponse) } } func ExampleClient_ListAttributes() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.ListAttributesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListAttributesRequest. } it := c.ListAttributes(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.(*apihubpb.ListAttributesResponse) } } func ExampleClient_ListDeployments() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.ListDeploymentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListDeploymentsRequest. } it := c.ListDeployments(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.(*apihubpb.ListDeploymentsResponse) } } func ExampleClient_ListExternalApis() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.ListExternalApisRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListExternalApisRequest. } it := c.ListExternalApis(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.(*apihubpb.ListExternalApisResponse) } } func ExampleClient_ListSpecs() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.ListSpecsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListSpecsRequest. } it := c.ListSpecs(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.(*apihubpb.ListSpecsResponse) } } func ExampleClient_ListVersions() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.ListVersionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#ListVersionsRequest. } it := c.ListVersions(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.(*apihubpb.ListVersionsResponse) } } func ExampleClient_SearchResources() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.SearchResourcesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#SearchResourcesRequest. } it := c.SearchResources(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.(*apihubpb.SearchResourcesResponse) } } func ExampleClient_UpdateApi() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.UpdateApiRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateApiRequest. } resp, err := c.UpdateApi(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_UpdateApiOperation() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.UpdateApiOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateApiOperationRequest. } resp, err := c.UpdateApiOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_UpdateAttribute() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.UpdateAttributeRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateAttributeRequest. } resp, err := c.UpdateAttribute(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_UpdateDeployment() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.UpdateDeploymentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateDeploymentRequest. } resp, err := c.UpdateDeployment(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_UpdateExternalApi() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.UpdateExternalApiRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateExternalApiRequest. } resp, err := c.UpdateExternalApi(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_UpdateSpec() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.UpdateSpecRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateSpecRequest. } resp, err := c.UpdateSpec(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_UpdateVersion() { 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 := apihub.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apihubpb.UpdateVersionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apihub/apiv1/apihubpb#UpdateVersionRequest. } resp, err := c.UpdateVersion(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func ExampleClient_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 := apihub.NewRESTClient(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 ExampleClient_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 := apihub.NewRESTClient(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 ExampleClient_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 := apihub.NewRESTClient(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 ExampleClient_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 := apihub.NewRESTClient(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 ExampleClient_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 := apihub.NewRESTClient(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 ExampleClient_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 := apihub.NewRESTClient(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) } }