Google Compute Engine API v1 - Package cloud.google.com/go/compute/apiv1 (v1.42.0) Stay organized with collections Save and categorize content based on your preferences.
Package compute is an auto-generated package for theGoogle Compute Engine API.
General documentation
For information that is relevant for all client libraries please referencehttps://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on thispage includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/compute/apiv1@latestctx:=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_Optionsc,err:=compute.NewAcceleratorTypesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed.The methods of Client are safe for concurrent use by multiple goroutines.The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client, mentioned above.
req:=&computepb.AggregatedListAcceleratorTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListAcceleratorTypesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.AcceleratorTypeAggregatedList)}
Use of Context
The ctx passed to NewAcceleratorTypesClient is used for authentication requests andfor creating the underlying connection, but is not used for subsequent calls.Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Functions
func DefaultAuthScopes
funcDefaultAuthScopes()[]stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
AcceleratorTypeIterator
typeAcceleratorTypeIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.AcceleratorType,nextPageTokenstring,errerror)// contains filtered or unexported fields}AcceleratorTypeIterator manages a stream of *computepb.AcceleratorType.
func (*AcceleratorTypeIterator) All
func(it*AcceleratorTypeIterator)All()iter.Seq2[*computepb.AcceleratorType,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*AcceleratorTypeIterator) Next
func(it*AcceleratorTypeIterator)Next()(*computepb.AcceleratorType,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*AcceleratorTypeIterator) PageInfo
func(it*AcceleratorTypeIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
AcceleratorTypesCallOptions
typeAcceleratorTypesCallOptionsstruct{AggregatedList[]gax.CallOptionGet[]gax.CallOptionList[]gax.CallOption}AcceleratorTypesCallOptions contains the retry settings for each method of AcceleratorTypesClient.
AcceleratorTypesClient
typeAcceleratorTypesClientstruct{// The call options for this service.CallOptions*AcceleratorTypesCallOptions// contains filtered or unexported fields}AcceleratorTypesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Services
The AcceleratorTypes API.
func NewAcceleratorTypesRESTClient
funcNewAcceleratorTypesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*AcceleratorTypesClient,error)NewAcceleratorTypesRESTClient creates a new accelerator types rest client.
Services
The AcceleratorTypes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewAcceleratorTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*AcceleratorTypesClient) AggregatedList
func(c*AcceleratorTypesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListAcceleratorTypesRequest,opts...gax.CallOption)*AcceleratorTypesScopedListPairIteratorAggregatedList retrieves an aggregated list of accelerator types. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewAcceleratorTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListAcceleratorTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListAcceleratorTypesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.AcceleratorTypeAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAcceleratorTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListAcceleratorTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListAcceleratorTypesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*AcceleratorTypesClient) Close
func(c*AcceleratorTypesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*AcceleratorTypesClient) Connection (deprecated)
func(c*AcceleratorTypesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*AcceleratorTypesClient) Get
func(c*AcceleratorTypesClient)Get(ctxcontext.Context,req*computepb.GetAcceleratorTypeRequest,opts...gax.CallOption)(*computepb.AcceleratorType,error)Get returns the specified accelerator type.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAcceleratorTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetAcceleratorTypeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetAcceleratorTypeRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*AcceleratorTypesClient) List
func(c*AcceleratorTypesClient)List(ctxcontext.Context,req*computepb.ListAcceleratorTypesRequest,opts...gax.CallOption)*AcceleratorTypeIteratorList retrieves a list of accelerator types that are available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewAcceleratorTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListAcceleratorTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListAcceleratorTypesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.AcceleratorTypeList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAcceleratorTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListAcceleratorTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListAcceleratorTypesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}AcceleratorTypesScopedListPair
typeAcceleratorTypesScopedListPairstruct{KeystringValue*computepb.AcceleratorTypesScopedList}AcceleratorTypesScopedListPair is a holder type for string/*computepb.AcceleratorTypesScopedList map entries
AcceleratorTypesScopedListPairIterator
typeAcceleratorTypesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]AcceleratorTypesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}AcceleratorTypesScopedListPairIterator manages a stream of AcceleratorTypesScopedListPair.
func (*AcceleratorTypesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*AcceleratorTypesScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*AcceleratorTypesScopedListPairIterator) PageInfo
func(it*AcceleratorTypesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
AddressIterator
typeAddressIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Address,nextPageTokenstring,errerror)// contains filtered or unexported fields}AddressIterator manages a stream of *computepb.Address.
func (*AddressIterator) All
func(it*AddressIterator)All()iter.Seq2[*computepb.Address,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*AddressIterator) Next
func(it*AddressIterator)Next()(*computepb.Address,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*AddressIterator) PageInfo
func(it*AddressIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
AddressesCallOptions
typeAddressesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionMove[]gax.CallOptionSetLabels[]gax.CallOption}AddressesCallOptions contains the retry settings for each method of AddressesClient.
AddressesClient
typeAddressesClientstruct{// The call options for this service.CallOptions*AddressesCallOptions// contains filtered or unexported fields}AddressesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Addresses API.
func NewAddressesRESTClient
funcNewAddressesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*AddressesClient,error)NewAddressesRESTClient creates a new addresses rest client.
The Addresses API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*AddressesClient) AggregatedList
func(c*AddressesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListAddressesRequest,opts...gax.CallOption)*AddressesScopedListPairIteratorAggregatedList retrieves an aggregated list of addresses. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListAddressesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListAddressesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.AddressAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListAddressesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListAddressesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*AddressesClient) Close
func(c*AddressesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*AddressesClient) Connection (deprecated)
func(c*AddressesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*AddressesClient) Delete
func(c*AddressesClient)Delete(ctxcontext.Context,req*computepb.DeleteAddressRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified address resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteAddressRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteAddressRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*AddressesClient) Get
func(c*AddressesClient)Get(ctxcontext.Context,req*computepb.GetAddressRequest,opts...gax.CallOption)(*computepb.Address,error)Get returns the specified address resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetAddressRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetAddressRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*AddressesClient) Insert
func(c*AddressesClient)Insert(ctxcontext.Context,req*computepb.InsertAddressRequest,opts...gax.CallOption)(*Operation,error)Insert creates an address resource in the specified project by using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertAddressRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertAddressRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*AddressesClient) List
func(c*AddressesClient)List(ctxcontext.Context,req*computepb.ListAddressesRequest,opts...gax.CallOption)*AddressIteratorList retrieves a list of addresses contained within the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListAddressesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListAddressesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.AddressList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListAddressesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListAddressesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*AddressesClient) Move
func(c*AddressesClient)Move(ctxcontext.Context,req*computepb.MoveAddressRequest,opts...gax.CallOption)(*Operation,error)Move moves the specified address resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.MoveAddressRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#MoveAddressRequest.}op,err:=c.Move(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*AddressesClient) SetLabels
func(c*AddressesClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsAddressRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on an Address. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsAddressRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsAddressRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}AddressesScopedListPair
typeAddressesScopedListPairstruct{KeystringValue*computepb.AddressesScopedList}AddressesScopedListPair is a holder type for string/*computepb.AddressesScopedList map entries
AddressesScopedListPairIterator
typeAddressesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]AddressesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}AddressesScopedListPairIterator manages a stream of AddressesScopedListPair.
func (*AddressesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*AddressesScopedListPairIterator) Next
func(it*AddressesScopedListPairIterator)Next()(AddressesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*AddressesScopedListPairIterator) PageInfo
func(it*AddressesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
AutoscalerIterator
typeAutoscalerIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Autoscaler,nextPageTokenstring,errerror)// contains filtered or unexported fields}AutoscalerIterator manages a stream of *computepb.Autoscaler.
func (*AutoscalerIterator) All
func(it*AutoscalerIterator)All()iter.Seq2[*computepb.Autoscaler,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*AutoscalerIterator) Next
func(it*AutoscalerIterator)Next()(*computepb.Autoscaler,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*AutoscalerIterator) PageInfo
func(it*AutoscalerIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
AutoscalersCallOptions
typeAutoscalersCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionUpdate[]gax.CallOption}AutoscalersCallOptions contains the retry settings for each method of AutoscalersClient.
AutoscalersClient
typeAutoscalersClientstruct{// The call options for this service.CallOptions*AutoscalersCallOptions// contains filtered or unexported fields}AutoscalersClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Autoscalers API.
func NewAutoscalersRESTClient
funcNewAutoscalersRESTClient(ctxcontext.Context,opts...option.ClientOption)(*AutoscalersClient,error)NewAutoscalersRESTClient creates a new autoscalers rest client.
The Autoscalers API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*AutoscalersClient) AggregatedList
func(c*AutoscalersClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListAutoscalersRequest,opts...gax.CallOption)*AutoscalersScopedListPairIteratorAggregatedList retrieves an aggregated list of autoscalers. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListAutoscalersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListAutoscalersRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.AutoscalerAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListAutoscalersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListAutoscalersRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*AutoscalersClient) Close
func(c*AutoscalersClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*AutoscalersClient) Connection (deprecated)
func(c*AutoscalersClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*AutoscalersClient) Delete
func(c*AutoscalersClient)Delete(ctxcontext.Context,req*computepb.DeleteAutoscalerRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified autoscaler.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteAutoscalerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteAutoscalerRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*AutoscalersClient) Get
func(c*AutoscalersClient)Get(ctxcontext.Context,req*computepb.GetAutoscalerRequest,opts...gax.CallOption)(*computepb.Autoscaler,error)Get returns the specified autoscaler resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetAutoscalerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetAutoscalerRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*AutoscalersClient) Insert
func(c*AutoscalersClient)Insert(ctxcontext.Context,req*computepb.InsertAutoscalerRequest,opts...gax.CallOption)(*Operation,error)Insert creates an autoscaler in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertAutoscalerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertAutoscalerRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*AutoscalersClient) List
func(c*AutoscalersClient)List(ctxcontext.Context,req*computepb.ListAutoscalersRequest,opts...gax.CallOption)*AutoscalerIteratorList retrieves a list of autoscalers contained within the specified zone.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListAutoscalersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListAutoscalersRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.AutoscalerList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListAutoscalersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListAutoscalersRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*AutoscalersClient) Patch
func(c*AutoscalersClient)Patch(ctxcontext.Context,req*computepb.PatchAutoscalerRequest,opts...gax.CallOption)(*Operation,error)Patch updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchAutoscalerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchAutoscalerRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*AutoscalersClient) Update
func(c*AutoscalersClient)Update(ctxcontext.Context,req*computepb.UpdateAutoscalerRequest,opts...gax.CallOption)(*Operation,error)Update updates an autoscaler in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateAutoscalerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateAutoscalerRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}AutoscalersScopedListPair
typeAutoscalersScopedListPairstruct{KeystringValue*computepb.AutoscalersScopedList}AutoscalersScopedListPair is a holder type for string/*computepb.AutoscalersScopedList map entries
AutoscalersScopedListPairIterator
typeAutoscalersScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]AutoscalersScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}AutoscalersScopedListPairIterator manages a stream of AutoscalersScopedListPair.
func (*AutoscalersScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*AutoscalersScopedListPairIterator) Next
func(it*AutoscalersScopedListPairIterator)Next()(AutoscalersScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*AutoscalersScopedListPairIterator) PageInfo
func(it*AutoscalersScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
BackendBucketIterator
typeBackendBucketIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.BackendBucket,nextPageTokenstring,errerror)// contains filtered or unexported fields}BackendBucketIterator manages a stream of *computepb.BackendBucket.
func (*BackendBucketIterator) All
func(it*BackendBucketIterator)All()iter.Seq2[*computepb.BackendBucket,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*BackendBucketIterator) Next
func(it*BackendBucketIterator)Next()(*computepb.BackendBucket,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*BackendBucketIterator) PageInfo
func(it*BackendBucketIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
BackendBucketsCallOptions
typeBackendBucketsCallOptionsstruct{AddSignedUrlKey[]gax.CallOptionDelete[]gax.CallOptionDeleteSignedUrlKey[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetEdgeSecurityPolicy[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOptionUpdate[]gax.CallOption}BackendBucketsCallOptions contains the retry settings for each method of BackendBucketsClient.
BackendBucketsClient
typeBackendBucketsClientstruct{// The call options for this service.CallOptions*BackendBucketsCallOptions// contains filtered or unexported fields}BackendBucketsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The BackendBuckets API.
func NewBackendBucketsRESTClient
funcNewBackendBucketsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*BackendBucketsClient,error)NewBackendBucketsRESTClient creates a new backend buckets rest client.
The BackendBuckets API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*BackendBucketsClient) AddSignedUrlKey
func(c*BackendBucketsClient)AddSignedUrlKey(ctxcontext.Context,req*computepb.AddSignedUrlKeyBackendBucketRequest,opts...gax.CallOption)(*Operation,error)AddSignedUrlKey adds a key for validating requests with signed URLs for this backend bucket.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddSignedUrlKeyBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddSignedUrlKeyBackendBucketRequest.}op,err:=c.AddSignedUrlKey(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendBucketsClient) Close
func(c*BackendBucketsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*BackendBucketsClient) Connection (deprecated)
func(c*BackendBucketsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*BackendBucketsClient) Delete
func(c*BackendBucketsClient)Delete(ctxcontext.Context,req*computepb.DeleteBackendBucketRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified BackendBucket resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteBackendBucketRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendBucketsClient) DeleteSignedUrlKey
func(c*BackendBucketsClient)DeleteSignedUrlKey(ctxcontext.Context,req*computepb.DeleteSignedUrlKeyBackendBucketRequest,opts...gax.CallOption)(*Operation,error)DeleteSignedUrlKey deletes a key for validating requests with signed URLs for this backend bucket.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteSignedUrlKeyBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteSignedUrlKeyBackendBucketRequest.}op,err:=c.DeleteSignedUrlKey(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendBucketsClient) Get
func(c*BackendBucketsClient)Get(ctxcontext.Context,req*computepb.GetBackendBucketRequest,opts...gax.CallOption)(*computepb.BackendBucket,error)Get returns the specified BackendBucket resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetBackendBucketRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BackendBucketsClient) GetIamPolicy
func(c*BackendBucketsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyBackendBucketRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyBackendBucketRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BackendBucketsClient) Insert
func(c*BackendBucketsClient)Insert(ctxcontext.Context,req*computepb.InsertBackendBucketRequest,opts...gax.CallOption)(*Operation,error)Insert creates a BackendBucket resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertBackendBucketRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendBucketsClient) List
func(c*BackendBucketsClient)List(ctxcontext.Context,req*computepb.ListBackendBucketsRequest,opts...gax.CallOption)*BackendBucketIteratorList retrieves the list of BackendBucket resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListBackendBucketsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListBackendBucketsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.BackendBucketList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListBackendBucketsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListBackendBucketsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*BackendBucketsClient) Patch
func(c*BackendBucketsClient)Patch(ctxcontext.Context,req*computepb.PatchBackendBucketRequest,opts...gax.CallOption)(*Operation,error)Patch updates the specified BackendBucket resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchBackendBucketRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendBucketsClient) SetEdgeSecurityPolicy
func(c*BackendBucketsClient)SetEdgeSecurityPolicy(ctxcontext.Context,req*computepb.SetEdgeSecurityPolicyBackendBucketRequest,opts...gax.CallOption)(*Operation,error)SetEdgeSecurityPolicy sets the edge security policy for the specified backend bucket.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetEdgeSecurityPolicyBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetEdgeSecurityPolicyBackendBucketRequest.}op,err:=c.SetEdgeSecurityPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendBucketsClient) SetIamPolicy
func(c*BackendBucketsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyBackendBucketRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyBackendBucketRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BackendBucketsClient) TestIamPermissions
func(c*BackendBucketsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsBackendBucketRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsBackendBucketRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BackendBucketsClient) Update
func(c*BackendBucketsClient)Update(ctxcontext.Context,req*computepb.UpdateBackendBucketRequest,opts...gax.CallOption)(*Operation,error)Update updates the specified BackendBucket resource with the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendBucketsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateBackendBucketRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateBackendBucketRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}BackendServiceIterator
typeBackendServiceIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.BackendService,nextPageTokenstring,errerror)// contains filtered or unexported fields}BackendServiceIterator manages a stream of *computepb.BackendService.
func (*BackendServiceIterator) All
func(it*BackendServiceIterator)All()iter.Seq2[*computepb.BackendService,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*BackendServiceIterator) Next
func(it*BackendServiceIterator)Next()(*computepb.BackendService,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*BackendServiceIterator) PageInfo
func(it*BackendServiceIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
BackendServicesCallOptions
typeBackendServicesCallOptionsstruct{AddSignedUrlKey[]gax.CallOptionAggregatedList[]gax.CallOptionDelete[]gax.CallOptionDeleteSignedUrlKey[]gax.CallOptionGet[]gax.CallOptionGetHealth[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListUsable[]gax.CallOptionPatch[]gax.CallOptionSetEdgeSecurityPolicy[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetSecurityPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOptionUpdate[]gax.CallOption}BackendServicesCallOptions contains the retry settings for each method of BackendServicesClient.
BackendServicesClient
typeBackendServicesClientstruct{// The call options for this service.CallOptions*BackendServicesCallOptions// contains filtered or unexported fields}BackendServicesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The BackendServices API.
func NewBackendServicesRESTClient
funcNewBackendServicesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*BackendServicesClient,error)NewBackendServicesRESTClient creates a new backend services rest client.
The BackendServices API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*BackendServicesClient) AddSignedUrlKey
func(c*BackendServicesClient)AddSignedUrlKey(ctxcontext.Context,req*computepb.AddSignedUrlKeyBackendServiceRequest,opts...gax.CallOption)(*Operation,error)AddSignedUrlKey adds a key for validating requests with signed URLs for this backend service.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddSignedUrlKeyBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddSignedUrlKeyBackendServiceRequest.}op,err:=c.AddSignedUrlKey(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendServicesClient) AggregatedList
func(c*BackendServicesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListBackendServicesRequest,opts...gax.CallOption)*BackendServicesScopedListPairIteratorAggregatedList retrieves the list of all BackendService resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListBackendServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListBackendServicesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.BackendServiceAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListBackendServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListBackendServicesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*BackendServicesClient) Close
func(c*BackendServicesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*BackendServicesClient) Connection (deprecated)
func(c*BackendServicesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*BackendServicesClient) Delete
func(c*BackendServicesClient)Delete(ctxcontext.Context,req*computepb.DeleteBackendServiceRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified BackendService resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteBackendServiceRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendServicesClient) DeleteSignedUrlKey
func(c*BackendServicesClient)DeleteSignedUrlKey(ctxcontext.Context,req*computepb.DeleteSignedUrlKeyBackendServiceRequest,opts...gax.CallOption)(*Operation,error)DeleteSignedUrlKey deletes a key for validating requests with signed URLs for this backend service.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteSignedUrlKeyBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteSignedUrlKeyBackendServiceRequest.}op,err:=c.DeleteSignedUrlKey(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendServicesClient) Get
func(c*BackendServicesClient)Get(ctxcontext.Context,req*computepb.GetBackendServiceRequest,opts...gax.CallOption)(*computepb.BackendService,error)Get returns the specified BackendService resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetBackendServiceRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BackendServicesClient) GetHealth
func(c*BackendServicesClient)GetHealth(ctxcontext.Context,req*computepb.GetHealthBackendServiceRequest,opts...gax.CallOption)(*computepb.BackendServiceGroupHealth,error)GetHealth gets the most recent health check results for this BackendService. Example request body: { “group”: “/zones/us-east1-b/instanceGroups/lb-backend-example” }
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetHealthBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetHealthBackendServiceRequest.}resp,err:=c.GetHealth(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BackendServicesClient) GetIamPolicy
func(c*BackendServicesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyBackendServiceRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyBackendServiceRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BackendServicesClient) Insert
func(c*BackendServicesClient)Insert(ctxcontext.Context,req*computepb.InsertBackendServiceRequest,opts...gax.CallOption)(*Operation,error)Insert creates a BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview .
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertBackendServiceRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendServicesClient) List
func(c*BackendServicesClient)List(ctxcontext.Context,req*computepb.ListBackendServicesRequest,opts...gax.CallOption)*BackendServiceIteratorList retrieves the list of BackendService resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListBackendServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListBackendServicesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.BackendServiceList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListBackendServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListBackendServicesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*BackendServicesClient) ListUsable
func(c*BackendServicesClient)ListUsable(ctxcontext.Context,req*computepb.ListUsableBackendServicesRequest,opts...gax.CallOption)*BackendServiceIteratorListUsable retrieves a list of all usable backend services in the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListUsableBackendServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListUsableBackendServicesRequest.}it:=c.ListUsable(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.BackendServiceListUsable)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListUsableBackendServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListUsableBackendServicesRequest.}forresp,err:=rangec.ListUsable(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*BackendServicesClient) Patch
func(c*BackendServicesClient)Patch(ctxcontext.Context,req*computepb.PatchBackendServiceRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified BackendService resource with the data included in the request. For more information, see Backend services overview. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchBackendServiceRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendServicesClient) SetEdgeSecurityPolicy
func(c*BackendServicesClient)SetEdgeSecurityPolicy(ctxcontext.Context,req*computepb.SetEdgeSecurityPolicyBackendServiceRequest,opts...gax.CallOption)(*Operation,error)SetEdgeSecurityPolicy sets the edge security policy for the specified backend service.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetEdgeSecurityPolicyBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetEdgeSecurityPolicyBackendServiceRequest.}op,err:=c.SetEdgeSecurityPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendServicesClient) SetIamPolicy
func(c*BackendServicesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyBackendServiceRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyBackendServiceRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BackendServicesClient) SetSecurityPolicy
func(c*BackendServicesClient)SetSecurityPolicy(ctxcontext.Context,req*computepb.SetSecurityPolicyBackendServiceRequest,opts...gax.CallOption)(*Operation,error)SetSecurityPolicy sets the Google Cloud Armor security policy for the specified backend service. For more information, see Google Cloud Armor Overview
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSecurityPolicyBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSecurityPolicyBackendServiceRequest.}op,err:=c.SetSecurityPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*BackendServicesClient) TestIamPermissions
func(c*BackendServicesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsBackendServiceRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsBackendServiceRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BackendServicesClient) Update
func(c*BackendServicesClient)Update(ctxcontext.Context,req*computepb.UpdateBackendServiceRequest,opts...gax.CallOption)(*Operation,error)Update updates the specified BackendService resource with the data included in the request. For more information, see Backend services overview.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateBackendServiceRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}BackendServicesScopedListPair
typeBackendServicesScopedListPairstruct{KeystringValue*computepb.BackendServicesScopedList}BackendServicesScopedListPair is a holder type for string/*computepb.BackendServicesScopedList map entries
BackendServicesScopedListPairIterator
typeBackendServicesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]BackendServicesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}BackendServicesScopedListPairIterator manages a stream of BackendServicesScopedListPair.
func (*BackendServicesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*BackendServicesScopedListPairIterator) Next
func(it*BackendServicesScopedListPairIterator)Next()(BackendServicesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*BackendServicesScopedListPairIterator) PageInfo
func(it*BackendServicesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
BgpRouteIterator
typeBgpRouteIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.BgpRoute,nextPageTokenstring,errerror)// contains filtered or unexported fields}BgpRouteIterator manages a stream of *computepb.BgpRoute.
func (*BgpRouteIterator) All
func(it*BgpRouteIterator)All()iter.Seq2[*computepb.BgpRoute,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*BgpRouteIterator) Next
func(it*BgpRouteIterator)Next()(*computepb.BgpRoute,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*BgpRouteIterator) PageInfo
func(it*BgpRouteIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CommitmentIterator
typeCommitmentIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Commitment,nextPageTokenstring,errerror)// contains filtered or unexported fields}CommitmentIterator manages a stream of *computepb.Commitment.
func (*CommitmentIterator) All
func(it*CommitmentIterator)All()iter.Seq2[*computepb.Commitment,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*CommitmentIterator) Next
func(it*CommitmentIterator)Next()(*computepb.Commitment,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*CommitmentIterator) PageInfo
func(it*CommitmentIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CommitmentsScopedListPair
typeCommitmentsScopedListPairstruct{KeystringValue*computepb.CommitmentsScopedList}CommitmentsScopedListPair is a holder type for string/*computepb.CommitmentsScopedList map entries
CommitmentsScopedListPairIterator
typeCommitmentsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]CommitmentsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}CommitmentsScopedListPairIterator manages a stream of CommitmentsScopedListPair.
func (*CommitmentsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*CommitmentsScopedListPairIterator) Next
func(it*CommitmentsScopedListPairIterator)Next()(CommitmentsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*CommitmentsScopedListPairIterator) PageInfo
func(it*CommitmentsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
DiskIterator
typeDiskIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Disk,nextPageTokenstring,errerror)// contains filtered or unexported fields}DiskIterator manages a stream of *computepb.Disk.
func (*DiskIterator) All
func(it*DiskIterator)All()iter.Seq2[*computepb.Disk,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*DiskIterator) Next
func(it*DiskIterator)Next()(*computepb.Disk,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*DiskIterator) PageInfo
func(it*DiskIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
DiskTypeIterator
typeDiskTypeIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.DiskType,nextPageTokenstring,errerror)// contains filtered or unexported fields}DiskTypeIterator manages a stream of *computepb.DiskType.
func (*DiskTypeIterator) All
func(it*DiskTypeIterator)All()iter.Seq2[*computepb.DiskType,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*DiskTypeIterator) Next
func(it*DiskTypeIterator)Next()(*computepb.DiskType,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*DiskTypeIterator) PageInfo
func(it*DiskTypeIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
DiskTypesCallOptions
typeDiskTypesCallOptionsstruct{AggregatedList[]gax.CallOptionGet[]gax.CallOptionList[]gax.CallOption}DiskTypesCallOptions contains the retry settings for each method of DiskTypesClient.
DiskTypesClient
typeDiskTypesClientstruct{// The call options for this service.CallOptions*DiskTypesCallOptions// contains filtered or unexported fields}DiskTypesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The DiskTypes API.
func NewDiskTypesRESTClient
funcNewDiskTypesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*DiskTypesClient,error)NewDiskTypesRESTClient creates a new disk types rest client.
The DiskTypes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewDiskTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*DiskTypesClient) AggregatedList
func(c*DiskTypesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListDiskTypesRequest,opts...gax.CallOption)*DiskTypesScopedListPairIteratorAggregatedList retrieves an aggregated list of disk types. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewDiskTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListDiskTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListDiskTypesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.DiskTypeAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDiskTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListDiskTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListDiskTypesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*DiskTypesClient) Close
func(c*DiskTypesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*DiskTypesClient) Connection (deprecated)
func(c*DiskTypesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*DiskTypesClient) Get
func(c*DiskTypesClient)Get(ctxcontext.Context,req*computepb.GetDiskTypeRequest,opts...gax.CallOption)(*computepb.DiskType,error)Get returns the specified disk type.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDiskTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetDiskTypeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetDiskTypeRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*DiskTypesClient) List
func(c*DiskTypesClient)List(ctxcontext.Context,req*computepb.ListDiskTypesRequest,opts...gax.CallOption)*DiskTypeIteratorList retrieves a list of disk types available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewDiskTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListDiskTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListDiskTypesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.DiskTypeList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDiskTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListDiskTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListDiskTypesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}DiskTypesScopedListPair
typeDiskTypesScopedListPairstruct{KeystringValue*computepb.DiskTypesScopedList}DiskTypesScopedListPair is a holder type for string/*computepb.DiskTypesScopedList map entries
DiskTypesScopedListPairIterator
typeDiskTypesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]DiskTypesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}DiskTypesScopedListPairIterator manages a stream of DiskTypesScopedListPair.
func (*DiskTypesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*DiskTypesScopedListPairIterator) Next
func(it*DiskTypesScopedListPairIterator)Next()(DiskTypesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*DiskTypesScopedListPairIterator) PageInfo
func(it*DiskTypesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
DisksCallOptions
typeDisksCallOptionsstruct{AddResourcePolicies[]gax.CallOptionAggregatedList[]gax.CallOptionBulkInsert[]gax.CallOptionBulkSetLabels[]gax.CallOptionCreateSnapshot[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionRemoveResourcePolicies[]gax.CallOptionResize[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetLabels[]gax.CallOptionStartAsyncReplication[]gax.CallOptionStopAsyncReplication[]gax.CallOptionStopGroupAsyncReplication[]gax.CallOptionTestIamPermissions[]gax.CallOptionUpdate[]gax.CallOption}DisksCallOptions contains the retry settings for each method of DisksClient.
DisksClient
typeDisksClientstruct{// The call options for this service.CallOptions*DisksCallOptions// contains filtered or unexported fields}DisksClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Disks API.
func NewDisksRESTClient
funcNewDisksRESTClient(ctxcontext.Context,opts...option.ClientOption)(*DisksClient,error)NewDisksRESTClient creates a new disks rest client.
The Disks API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*DisksClient) AddResourcePolicies
func(c*DisksClient)AddResourcePolicies(ctxcontext.Context,req*computepb.AddResourcePoliciesDiskRequest,opts...gax.CallOption)(*Operation,error)AddResourcePolicies adds existing resource policies to a disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddResourcePoliciesDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddResourcePoliciesDiskRequest.}op,err:=c.AddResourcePolicies(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) AggregatedList
func(c*DisksClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListDisksRequest,opts...gax.CallOption)*DisksScopedListPairIteratorAggregatedList retrieves an aggregated list of persistent disks. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListDisksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListDisksRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.DiskAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListDisksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListDisksRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*DisksClient) BulkInsert
func(c*DisksClient)BulkInsert(ctxcontext.Context,req*computepb.BulkInsertDiskRequest,opts...gax.CallOption)(*Operation,error)BulkInsert bulk create a set of disks.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.BulkInsertDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#BulkInsertDiskRequest.}op,err:=c.BulkInsert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) BulkSetLabels
func(c*DisksClient)BulkSetLabels(ctxcontext.Context,req*computepb.BulkSetLabelsDiskRequest,opts...gax.CallOption)(*Operation,error)BulkSetLabels sets the labels on many disks at once. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.BulkSetLabelsDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#BulkSetLabelsDiskRequest.}op,err:=c.BulkSetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) Close
func(c*DisksClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*DisksClient) Connection (deprecated)
func(c*DisksClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*DisksClient) CreateSnapshot
func(c*DisksClient)CreateSnapshot(ctxcontext.Context,req*computepb.CreateSnapshotDiskRequest,opts...gax.CallOption)(*Operation,error)CreateSnapshot creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.CreateSnapshotDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#CreateSnapshotDiskRequest.}op,err:=c.CreateSnapshot(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) Delete
func(c*DisksClient)Delete(ctxcontext.Context,req*computepb.DeleteDiskRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified persistent disk. Deleting a disk removes its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteDiskRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) Get
func(c*DisksClient)Get(ctxcontext.Context,req*computepb.GetDiskRequest,opts...gax.CallOption)(*computepb.Disk,error)Get returns the specified persistent disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetDiskRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*DisksClient) GetIamPolicy
func(c*DisksClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyDiskRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyDiskRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*DisksClient) Insert
func(c*DisksClient)Insert(ctxcontext.Context,req*computepb.InsertDiskRequest,opts...gax.CallOption)(*Operation,error)Insert creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, or sourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertDiskRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) List
func(c*DisksClient)List(ctxcontext.Context,req*computepb.ListDisksRequest,opts...gax.CallOption)*DiskIteratorList retrieves a list of persistent disks contained within the specified zone.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListDisksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListDisksRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.DiskList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListDisksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListDisksRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*DisksClient) RemoveResourcePolicies
func(c*DisksClient)RemoveResourcePolicies(ctxcontext.Context,req*computepb.RemoveResourcePoliciesDiskRequest,opts...gax.CallOption)(*Operation,error)RemoveResourcePolicies removes resource policies from a disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveResourcePoliciesDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveResourcePoliciesDiskRequest.}op,err:=c.RemoveResourcePolicies(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) Resize
func(c*DisksClient)Resize(ctxcontext.Context,req*computepb.ResizeDiskRequest,opts...gax.CallOption)(*Operation,error)Resize resizes the specified persistent disk. You can only increase the size of the disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ResizeDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ResizeDiskRequest.}op,err:=c.Resize(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) SetIamPolicy
func(c*DisksClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyDiskRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyDiskRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*DisksClient) SetLabels
func(c*DisksClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsDiskRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsDiskRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) StartAsyncReplication
func(c*DisksClient)StartAsyncReplication(ctxcontext.Context,req*computepb.StartAsyncReplicationDiskRequest,opts...gax.CallOption)(*Operation,error)StartAsyncReplication starts asynchronous replication. Must be invoked on the primary disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StartAsyncReplicationDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StartAsyncReplicationDiskRequest.}op,err:=c.StartAsyncReplication(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) StopAsyncReplication
func(c*DisksClient)StopAsyncReplication(ctxcontext.Context,req*computepb.StopAsyncReplicationDiskRequest,opts...gax.CallOption)(*Operation,error)StopAsyncReplication stops asynchronous replication. Can be invoked either on the primary or on the secondary disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StopAsyncReplicationDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StopAsyncReplicationDiskRequest.}op,err:=c.StopAsyncReplication(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) StopGroupAsyncReplication
func(c*DisksClient)StopGroupAsyncReplication(ctxcontext.Context,req*computepb.StopGroupAsyncReplicationDiskRequest,opts...gax.CallOption)(*Operation,error)StopGroupAsyncReplication stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StopGroupAsyncReplicationDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StopGroupAsyncReplicationDiskRequest.}op,err:=c.StopGroupAsyncReplication(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*DisksClient) TestIamPermissions
func(c*DisksClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsDiskRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsDiskRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*DisksClient) Update
func(c*DisksClient)Update(ctxcontext.Context,req*computepb.UpdateDiskRequest,opts...gax.CallOption)(*Operation,error)Update updates the specified disk with the data included in the request. The update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: user_license.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateDiskRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}DisksScopedListPair
typeDisksScopedListPairstruct{KeystringValue*computepb.DisksScopedList}DisksScopedListPair is a holder type for string/*computepb.DisksScopedList map entries
DisksScopedListPairIterator
typeDisksScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]DisksScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}DisksScopedListPairIterator manages a stream of DisksScopedListPair.
func (*DisksScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*DisksScopedListPairIterator) Next
func(it*DisksScopedListPairIterator)Next()(DisksScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*DisksScopedListPairIterator) PageInfo
func(it*DisksScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ExchangedPeeringRouteIterator
typeExchangedPeeringRouteIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.ExchangedPeeringRoute,nextPageTokenstring,errerror)// contains filtered or unexported fields}ExchangedPeeringRouteIterator manages a stream of *computepb.ExchangedPeeringRoute.
func (*ExchangedPeeringRouteIterator) All
func(it*ExchangedPeeringRouteIterator)All()iter.Seq2[*computepb.ExchangedPeeringRoute,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ExchangedPeeringRouteIterator) Next
func(it*ExchangedPeeringRouteIterator)Next()(*computepb.ExchangedPeeringRoute,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ExchangedPeeringRouteIterator) PageInfo
func(it*ExchangedPeeringRouteIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ExternalVpnGatewayIterator
typeExternalVpnGatewayIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.ExternalVpnGateway,nextPageTokenstring,errerror)// contains filtered or unexported fields}ExternalVpnGatewayIterator manages a stream of *computepb.ExternalVpnGateway.
func (*ExternalVpnGatewayIterator) All
func(it*ExternalVpnGatewayIterator)All()iter.Seq2[*computepb.ExternalVpnGateway,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ExternalVpnGatewayIterator) Next
func(it*ExternalVpnGatewayIterator)Next()(*computepb.ExternalVpnGateway,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ExternalVpnGatewayIterator) PageInfo
func(it*ExternalVpnGatewayIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ExternalVpnGatewaysCallOptions
typeExternalVpnGatewaysCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetLabels[]gax.CallOptionTestIamPermissions[]gax.CallOption}ExternalVpnGatewaysCallOptions contains the retry settings for each method of ExternalVpnGatewaysClient.
ExternalVpnGatewaysClient
typeExternalVpnGatewaysClientstruct{// The call options for this service.CallOptions*ExternalVpnGatewaysCallOptions// contains filtered or unexported fields}ExternalVpnGatewaysClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The ExternalVpnGateways API.
func NewExternalVpnGatewaysRESTClient
funcNewExternalVpnGatewaysRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ExternalVpnGatewaysClient,error)NewExternalVpnGatewaysRESTClient creates a new external vpn gateways rest client.
The ExternalVpnGateways API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewExternalVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ExternalVpnGatewaysClient) Close
func(c*ExternalVpnGatewaysClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ExternalVpnGatewaysClient) Connection (deprecated)
func(c*ExternalVpnGatewaysClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ExternalVpnGatewaysClient) Delete
func(c*ExternalVpnGatewaysClient)Delete(ctxcontext.Context,req*computepb.DeleteExternalVpnGatewayRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified externalVpnGateway.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewExternalVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteExternalVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteExternalVpnGatewayRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ExternalVpnGatewaysClient) Get
func(c*ExternalVpnGatewaysClient)Get(ctxcontext.Context,req*computepb.GetExternalVpnGatewayRequest,opts...gax.CallOption)(*computepb.ExternalVpnGateway,error)Get returns the specified externalVpnGateway. Get a list of available externalVpnGateways by making a list() request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewExternalVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetExternalVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetExternalVpnGatewayRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ExternalVpnGatewaysClient) Insert
func(c*ExternalVpnGatewaysClient)Insert(ctxcontext.Context,req*computepb.InsertExternalVpnGatewayRequest,opts...gax.CallOption)(*Operation,error)Insert creates a ExternalVpnGateway in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewExternalVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertExternalVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertExternalVpnGatewayRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ExternalVpnGatewaysClient) List
func(c*ExternalVpnGatewaysClient)List(ctxcontext.Context,req*computepb.ListExternalVpnGatewaysRequest,opts...gax.CallOption)*ExternalVpnGatewayIteratorList retrieves the list of ExternalVpnGateway available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewExternalVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListExternalVpnGatewaysRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListExternalVpnGatewaysRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ExternalVpnGatewayList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewExternalVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListExternalVpnGatewaysRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListExternalVpnGatewaysRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ExternalVpnGatewaysClient) SetLabels
func(c*ExternalVpnGatewaysClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsExternalVpnGatewayRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on an ExternalVpnGateway. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewExternalVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsExternalVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsExternalVpnGatewayRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ExternalVpnGatewaysClient) TestIamPermissions
func(c*ExternalVpnGatewaysClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsExternalVpnGatewayRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewExternalVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsExternalVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsExternalVpnGatewayRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}FirewallIterator
typeFirewallIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Firewall,nextPageTokenstring,errerror)// contains filtered or unexported fields}FirewallIterator manages a stream of *computepb.Firewall.
func (*FirewallIterator) All
func(it*FirewallIterator)All()iter.Seq2[*computepb.Firewall,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*FirewallIterator) Next
func(it*FirewallIterator)Next()(*computepb.Firewall,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*FirewallIterator) PageInfo
func(it*FirewallIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
FirewallPoliciesCallOptions
typeFirewallPoliciesCallOptionsstruct{AddAssociation[]gax.CallOptionAddRule[]gax.CallOptionCloneRules[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetAssociation[]gax.CallOptionGetIamPolicy[]gax.CallOptionGetRule[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListAssociations[]gax.CallOptionMove[]gax.CallOptionPatch[]gax.CallOptionPatchRule[]gax.CallOptionRemoveAssociation[]gax.CallOptionRemoveRule[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOption}FirewallPoliciesCallOptions contains the retry settings for each method of FirewallPoliciesClient.
FirewallPoliciesClient
typeFirewallPoliciesClientstruct{// The call options for this service.CallOptions*FirewallPoliciesCallOptions// contains filtered or unexported fields}FirewallPoliciesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The FirewallPolicies API.
func NewFirewallPoliciesRESTClient
funcNewFirewallPoliciesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*FirewallPoliciesClient,error)NewFirewallPoliciesRESTClient creates a new firewall policies rest client.
The FirewallPolicies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*FirewallPoliciesClient) AddAssociation
func(c*FirewallPoliciesClient)AddAssociation(ctxcontext.Context,req*computepb.AddAssociationFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)AddAssociation inserts an association for the specified firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddAssociationFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddAssociationFirewallPolicyRequest.}op,err:=c.AddAssociation(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallPoliciesClient) AddRule
func(c*FirewallPoliciesClient)AddRule(ctxcontext.Context,req*computepb.AddRuleFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)AddRule inserts a rule into a firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddRuleFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddRuleFirewallPolicyRequest.}op,err:=c.AddRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallPoliciesClient) CloneRules
func(c*FirewallPoliciesClient)CloneRules(ctxcontext.Context,req*computepb.CloneRulesFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)CloneRules copies rules to the specified firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.CloneRulesFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#CloneRulesFirewallPolicyRequest.}op,err:=c.CloneRules(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallPoliciesClient) Close
func(c*FirewallPoliciesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*FirewallPoliciesClient) Connection (deprecated)
func(c*FirewallPoliciesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*FirewallPoliciesClient) Delete
func(c*FirewallPoliciesClient)Delete(ctxcontext.Context,req*computepb.DeleteFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteFirewallPolicyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallPoliciesClient) Get
func(c*FirewallPoliciesClient)Get(ctxcontext.Context,req*computepb.GetFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPolicy,error)Get returns the specified firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetFirewallPolicyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*FirewallPoliciesClient) GetAssociation
func(c*FirewallPoliciesClient)GetAssociation(ctxcontext.Context,req*computepb.GetAssociationFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPolicyAssociation,error)GetAssociation gets an association with the specified name.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetAssociationFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetAssociationFirewallPolicyRequest.}resp,err:=c.GetAssociation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*FirewallPoliciesClient) GetIamPolicy
func(c*FirewallPoliciesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyFirewallPolicyRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyFirewallPolicyRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*FirewallPoliciesClient) GetRule
func(c*FirewallPoliciesClient)GetRule(ctxcontext.Context,req*computepb.GetRuleFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPolicyRule,error)GetRule gets a rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRuleFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRuleFirewallPolicyRequest.}resp,err:=c.GetRule(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*FirewallPoliciesClient) Insert
func(c*FirewallPoliciesClient)Insert(ctxcontext.Context,req*computepb.InsertFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a new policy in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertFirewallPolicyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallPoliciesClient) List
func(c*FirewallPoliciesClient)List(ctxcontext.Context,req*computepb.ListFirewallPoliciesRequest,opts...gax.CallOption)*FirewallPolicyIteratorList lists all the policies that have been configured for the specified folder or organization.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListFirewallPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListFirewallPoliciesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.FirewallPolicyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListFirewallPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListFirewallPoliciesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*FirewallPoliciesClient) ListAssociations
func(c*FirewallPoliciesClient)ListAssociations(ctxcontext.Context,req*computepb.ListAssociationsFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPoliciesListAssociationsResponse,error)ListAssociations lists associations of a specified target, i.e., organization or folder.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListAssociationsFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListAssociationsFirewallPolicyRequest.}resp,err:=c.ListAssociations(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*FirewallPoliciesClient) Move
func(c*FirewallPoliciesClient)Move(ctxcontext.Context,req*computepb.MoveFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)Move moves the specified firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.MoveFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#MoveFirewallPolicyRequest.}op,err:=c.Move(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallPoliciesClient) Patch
func(c*FirewallPoliciesClient)Patch(ctxcontext.Context,req*computepb.PatchFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified policy with the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchFirewallPolicyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallPoliciesClient) PatchRule
func(c*FirewallPoliciesClient)PatchRule(ctxcontext.Context,req*computepb.PatchRuleFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)PatchRule patches a rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRuleFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRuleFirewallPolicyRequest.}op,err:=c.PatchRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallPoliciesClient) RemoveAssociation
func(c*FirewallPoliciesClient)RemoveAssociation(ctxcontext.Context,req*computepb.RemoveAssociationFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)RemoveAssociation removes an association for the specified firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveAssociationFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveAssociationFirewallPolicyRequest.}op,err:=c.RemoveAssociation(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallPoliciesClient) RemoveRule
func(c*FirewallPoliciesClient)RemoveRule(ctxcontext.Context,req*computepb.RemoveRuleFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)RemoveRule deletes a rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveRuleFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveRuleFirewallPolicyRequest.}op,err:=c.RemoveRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallPoliciesClient) SetIamPolicy
func(c*FirewallPoliciesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyFirewallPolicyRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyFirewallPolicyRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*FirewallPoliciesClient) TestIamPermissions
func(c*FirewallPoliciesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsFirewallPolicyRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsFirewallPolicyRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}FirewallPoliciesScopedListPair
typeFirewallPoliciesScopedListPairstruct{KeystringValue*computepb.FirewallPoliciesScopedList}FirewallPoliciesScopedListPair is a holder type for string/*computepb.FirewallPoliciesScopedList map entries
FirewallPoliciesScopedListPairIterator
typeFirewallPoliciesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]FirewallPoliciesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}FirewallPoliciesScopedListPairIterator manages a stream of FirewallPoliciesScopedListPair.
func (*FirewallPoliciesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*FirewallPoliciesScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*FirewallPoliciesScopedListPairIterator) PageInfo
func(it*FirewallPoliciesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
FirewallPolicyIterator
typeFirewallPolicyIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.FirewallPolicy,nextPageTokenstring,errerror)// contains filtered or unexported fields}FirewallPolicyIterator manages a stream of *computepb.FirewallPolicy.
func (*FirewallPolicyIterator) All
func(it*FirewallPolicyIterator)All()iter.Seq2[*computepb.FirewallPolicy,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*FirewallPolicyIterator) Next
func(it*FirewallPolicyIterator)Next()(*computepb.FirewallPolicy,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*FirewallPolicyIterator) PageInfo
func(it*FirewallPolicyIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
FirewallsCallOptions
typeFirewallsCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionUpdate[]gax.CallOption}FirewallsCallOptions contains the retry settings for each method of FirewallsClient.
FirewallsClient
typeFirewallsClientstruct{// The call options for this service.CallOptions*FirewallsCallOptions// contains filtered or unexported fields}FirewallsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Firewalls API.
func NewFirewallsRESTClient
funcNewFirewallsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*FirewallsClient,error)NewFirewallsRESTClient creates a new firewalls rest client.
The Firewalls API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewFirewallsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*FirewallsClient) Close
func(c*FirewallsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*FirewallsClient) Connection (deprecated)
func(c*FirewallsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*FirewallsClient) Delete
func(c*FirewallsClient)Delete(ctxcontext.Context,req*computepb.DeleteFirewallRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified firewall.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteFirewallRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteFirewallRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallsClient) Get
func(c*FirewallsClient)Get(ctxcontext.Context,req*computepb.GetFirewallRequest,opts...gax.CallOption)(*computepb.Firewall,error)Get returns the specified firewall.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetFirewallRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetFirewallRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*FirewallsClient) Insert
func(c*FirewallsClient)Insert(ctxcontext.Context,req*computepb.InsertFirewallRequest,opts...gax.CallOption)(*Operation,error)Insert creates a firewall rule in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertFirewallRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertFirewallRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallsClient) List
func(c*FirewallsClient)List(ctxcontext.Context,req*computepb.ListFirewallsRequest,opts...gax.CallOption)*FirewallIteratorList retrieves the list of firewall rules available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewFirewallsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListFirewallsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListFirewallsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.FirewallList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListFirewallsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListFirewallsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*FirewallsClient) Patch
func(c*FirewallsClient)Patch(ctxcontext.Context,req*computepb.PatchFirewallRequest,opts...gax.CallOption)(*Operation,error)Patch updates the specified firewall rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchFirewallRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchFirewallRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*FirewallsClient) Update
func(c*FirewallsClient)Update(ctxcontext.Context,req*computepb.UpdateFirewallRequest,opts...gax.CallOption)(*Operation,error)Update updates the specified firewall rule with the data included in the request. Note that all fields will be updated if using PUT, even fields that are not specified. To update individual fields, please use PATCH instead.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewFirewallsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateFirewallRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateFirewallRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}ForwardingRuleIterator
typeForwardingRuleIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.ForwardingRule,nextPageTokenstring,errerror)// contains filtered or unexported fields}ForwardingRuleIterator manages a stream of *computepb.ForwardingRule.
func (*ForwardingRuleIterator) All
func(it*ForwardingRuleIterator)All()iter.Seq2[*computepb.ForwardingRule,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ForwardingRuleIterator) Next
func(it*ForwardingRuleIterator)Next()(*computepb.ForwardingRule,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ForwardingRuleIterator) PageInfo
func(it*ForwardingRuleIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ForwardingRulesCallOptions
typeForwardingRulesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetLabels[]gax.CallOptionSetTarget[]gax.CallOption}ForwardingRulesCallOptions contains the retry settings for each method of ForwardingRulesClient.
ForwardingRulesClient
typeForwardingRulesClientstruct{// The call options for this service.CallOptions*ForwardingRulesCallOptions// contains filtered or unexported fields}ForwardingRulesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The ForwardingRules API.
func NewForwardingRulesRESTClient
funcNewForwardingRulesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ForwardingRulesClient,error)NewForwardingRulesRESTClient creates a new forwarding rules rest client.
The ForwardingRules API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ForwardingRulesClient) AggregatedList
func(c*ForwardingRulesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListForwardingRulesRequest,opts...gax.CallOption)*ForwardingRulesScopedListPairIteratorAggregatedList retrieves an aggregated list of forwarding rules. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListForwardingRulesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListForwardingRulesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ForwardingRuleAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListForwardingRulesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListForwardingRulesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ForwardingRulesClient) Close
func(c*ForwardingRulesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ForwardingRulesClient) Connection (deprecated)
func(c*ForwardingRulesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ForwardingRulesClient) Delete
func(c*ForwardingRulesClient)Delete(ctxcontext.Context,req*computepb.DeleteForwardingRuleRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified ForwardingRule resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteForwardingRuleRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ForwardingRulesClient) Get
func(c*ForwardingRulesClient)Get(ctxcontext.Context,req*computepb.GetForwardingRuleRequest,opts...gax.CallOption)(*computepb.ForwardingRule,error)Get returns the specified ForwardingRule resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetForwardingRuleRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ForwardingRulesClient) Insert
func(c*ForwardingRulesClient)Insert(ctxcontext.Context,req*computepb.InsertForwardingRuleRequest,opts...gax.CallOption)(*Operation,error)Insert creates a ForwardingRule resource in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertForwardingRuleRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ForwardingRulesClient) List
func(c*ForwardingRulesClient)List(ctxcontext.Context,req*computepb.ListForwardingRulesRequest,opts...gax.CallOption)*ForwardingRuleIteratorList retrieves a list of ForwardingRule resources available to the specified project and region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListForwardingRulesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListForwardingRulesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ForwardingRuleList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListForwardingRulesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListForwardingRulesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ForwardingRulesClient) Patch
func(c*ForwardingRulesClient)Patch(ctxcontext.Context,req*computepb.PatchForwardingRuleRequest,opts...gax.CallOption)(*Operation,error)Patch updates the specified forwarding rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently, you can only patch the network_tier field.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchForwardingRuleRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ForwardingRulesClient) SetLabels
func(c*ForwardingRulesClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsForwardingRuleRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on the specified resource. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsForwardingRuleRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ForwardingRulesClient) SetTarget
func(c*ForwardingRulesClient)SetTarget(ctxcontext.Context,req*computepb.SetTargetForwardingRuleRequest,opts...gax.CallOption)(*Operation,error)SetTarget changes target URL for forwarding rule. The new target should be of the same type as the old target.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetTargetForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetTargetForwardingRuleRequest.}op,err:=c.SetTarget(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}ForwardingRulesScopedListPair
typeForwardingRulesScopedListPairstruct{KeystringValue*computepb.ForwardingRulesScopedList}ForwardingRulesScopedListPair is a holder type for string/*computepb.ForwardingRulesScopedList map entries
ForwardingRulesScopedListPairIterator
typeForwardingRulesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]ForwardingRulesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}ForwardingRulesScopedListPairIterator manages a stream of ForwardingRulesScopedListPair.
func (*ForwardingRulesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ForwardingRulesScopedListPairIterator) Next
func(it*ForwardingRulesScopedListPairIterator)Next()(ForwardingRulesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ForwardingRulesScopedListPairIterator) PageInfo
func(it*ForwardingRulesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
GlobalAddressesCallOptions
typeGlobalAddressesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionMove[]gax.CallOptionSetLabels[]gax.CallOption}GlobalAddressesCallOptions contains the retry settings for each method of GlobalAddressesClient.
GlobalAddressesClient
typeGlobalAddressesClientstruct{// The call options for this service.CallOptions*GlobalAddressesCallOptions// contains filtered or unexported fields}GlobalAddressesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The GlobalAddresses API.
func NewGlobalAddressesRESTClient
funcNewGlobalAddressesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*GlobalAddressesClient,error)NewGlobalAddressesRESTClient creates a new global addresses rest client.
The GlobalAddresses API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewGlobalAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*GlobalAddressesClient) Close
func(c*GlobalAddressesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*GlobalAddressesClient) Connection (deprecated)
func(c*GlobalAddressesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*GlobalAddressesClient) Delete
func(c*GlobalAddressesClient)Delete(ctxcontext.Context,req*computepb.DeleteGlobalAddressRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified address resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteGlobalAddressRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteGlobalAddressRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalAddressesClient) Get
func(c*GlobalAddressesClient)Get(ctxcontext.Context,req*computepb.GetGlobalAddressRequest,opts...gax.CallOption)(*computepb.Address,error)Get returns the specified address resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetGlobalAddressRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetGlobalAddressRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*GlobalAddressesClient) Insert
func(c*GlobalAddressesClient)Insert(ctxcontext.Context,req*computepb.InsertGlobalAddressRequest,opts...gax.CallOption)(*Operation,error)Insert creates an address resource in the specified project by using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertGlobalAddressRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertGlobalAddressRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalAddressesClient) List
func(c*GlobalAddressesClient)List(ctxcontext.Context,req*computepb.ListGlobalAddressesRequest,opts...gax.CallOption)*AddressIteratorList retrieves a list of global addresses.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewGlobalAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalAddressesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalAddressesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.AddressList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalAddressesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalAddressesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*GlobalAddressesClient) Move
func(c*GlobalAddressesClient)Move(ctxcontext.Context,req*computepb.MoveGlobalAddressRequest,opts...gax.CallOption)(*Operation,error)Move moves the specified address resource from one project to another project.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.MoveGlobalAddressRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#MoveGlobalAddressRequest.}op,err:=c.Move(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalAddressesClient) SetLabels
func(c*GlobalAddressesClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsGlobalAddressRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a GlobalAddress. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalAddressesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsGlobalAddressRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsGlobalAddressRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}GlobalForwardingRulesCallOptions
typeGlobalForwardingRulesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetLabels[]gax.CallOptionSetTarget[]gax.CallOption}GlobalForwardingRulesCallOptions contains the retry settings for each method of GlobalForwardingRulesClient.
GlobalForwardingRulesClient
typeGlobalForwardingRulesClientstruct{// The call options for this service.CallOptions*GlobalForwardingRulesCallOptions// contains filtered or unexported fields}GlobalForwardingRulesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The GlobalForwardingRules API.
func NewGlobalForwardingRulesRESTClient
funcNewGlobalForwardingRulesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*GlobalForwardingRulesClient,error)NewGlobalForwardingRulesRESTClient creates a new global forwarding rules rest client.
The GlobalForwardingRules API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewGlobalForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*GlobalForwardingRulesClient) Close
func(c*GlobalForwardingRulesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*GlobalForwardingRulesClient) Connection (deprecated)
func(c*GlobalForwardingRulesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*GlobalForwardingRulesClient) Delete
func(c*GlobalForwardingRulesClient)Delete(ctxcontext.Context,req*computepb.DeleteGlobalForwardingRuleRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified GlobalForwardingRule resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteGlobalForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteGlobalForwardingRuleRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalForwardingRulesClient) Get
func(c*GlobalForwardingRulesClient)Get(ctxcontext.Context,req*computepb.GetGlobalForwardingRuleRequest,opts...gax.CallOption)(*computepb.ForwardingRule,error)Get returns the specified GlobalForwardingRule resource. Gets a list of available forwarding rules by making a list() request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetGlobalForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetGlobalForwardingRuleRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*GlobalForwardingRulesClient) Insert
func(c*GlobalForwardingRulesClient)Insert(ctxcontext.Context,req*computepb.InsertGlobalForwardingRuleRequest,opts...gax.CallOption)(*Operation,error)Insert creates a GlobalForwardingRule resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertGlobalForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertGlobalForwardingRuleRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalForwardingRulesClient) List
func(c*GlobalForwardingRulesClient)List(ctxcontext.Context,req*computepb.ListGlobalForwardingRulesRequest,opts...gax.CallOption)*ForwardingRuleIteratorList retrieves a list of GlobalForwardingRule resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewGlobalForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalForwardingRulesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalForwardingRulesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ForwardingRuleList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalForwardingRulesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalForwardingRulesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*GlobalForwardingRulesClient) Patch
func(c*GlobalForwardingRulesClient)Patch(ctxcontext.Context,req*computepb.PatchGlobalForwardingRuleRequest,opts...gax.CallOption)(*Operation,error)Patch updates the specified forwarding rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently, you can only patch the network_tier field.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchGlobalForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchGlobalForwardingRuleRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalForwardingRulesClient) SetLabels
func(c*GlobalForwardingRulesClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsGlobalForwardingRuleRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on the specified resource. To learn more about labels, read the Labeling resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsGlobalForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsGlobalForwardingRuleRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalForwardingRulesClient) SetTarget
func(c*GlobalForwardingRulesClient)SetTarget(ctxcontext.Context,req*computepb.SetTargetGlobalForwardingRuleRequest,opts...gax.CallOption)(*Operation,error)SetTarget changes target URL for the GlobalForwardingRule resource. The new target should be of the same type as the old target.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalForwardingRulesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetTargetGlobalForwardingRuleRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetTargetGlobalForwardingRuleRequest.}op,err:=c.SetTarget(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}GlobalNetworkEndpointGroupsCallOptions
typeGlobalNetworkEndpointGroupsCallOptionsstruct{AttachNetworkEndpoints[]gax.CallOptionDelete[]gax.CallOptionDetachNetworkEndpoints[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListNetworkEndpoints[]gax.CallOption}GlobalNetworkEndpointGroupsCallOptions contains the retry settings for each method of GlobalNetworkEndpointGroupsClient.
GlobalNetworkEndpointGroupsClient
typeGlobalNetworkEndpointGroupsClientstruct{// The call options for this service.CallOptions*GlobalNetworkEndpointGroupsCallOptions// contains filtered or unexported fields}GlobalNetworkEndpointGroupsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The GlobalNetworkEndpointGroups API.
func NewGlobalNetworkEndpointGroupsRESTClient
funcNewGlobalNetworkEndpointGroupsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*GlobalNetworkEndpointGroupsClient,error)NewGlobalNetworkEndpointGroupsRESTClient creates a new global network endpoint groups rest client.
The GlobalNetworkEndpointGroups API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*GlobalNetworkEndpointGroupsClient) AttachNetworkEndpoints
func(c*GlobalNetworkEndpointGroupsClient)AttachNetworkEndpoints(ctxcontext.Context,req*computepb.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)AttachNetworkEndpoints attach a network endpoint to the specified network endpoint group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest.}op,err:=c.AttachNetworkEndpoints(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalNetworkEndpointGroupsClient) Close
func(c*GlobalNetworkEndpointGroupsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*GlobalNetworkEndpointGroupsClient) Connection (deprecated)
func(c*GlobalNetworkEndpointGroupsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*GlobalNetworkEndpointGroupsClient) Delete
func(c*GlobalNetworkEndpointGroupsClient)Delete(ctxcontext.Context,req*computepb.DeleteGlobalNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified network endpoint group.Note that the NEG cannot be deleted if there are backend services referencing it.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteGlobalNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteGlobalNetworkEndpointGroupRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalNetworkEndpointGroupsClient) DetachNetworkEndpoints
func(c*GlobalNetworkEndpointGroupsClient)DetachNetworkEndpoints(ctxcontext.Context,req*computepb.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)DetachNetworkEndpoints detach the network endpoint from the specified network endpoint group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest.}op,err:=c.DetachNetworkEndpoints(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalNetworkEndpointGroupsClient) Get
func(c*GlobalNetworkEndpointGroupsClient)Get(ctxcontext.Context,req*computepb.GetGlobalNetworkEndpointGroupRequest,opts...gax.CallOption)(*computepb.NetworkEndpointGroup,error)Get returns the specified network endpoint group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetGlobalNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetGlobalNetworkEndpointGroupRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*GlobalNetworkEndpointGroupsClient) Insert
func(c*GlobalNetworkEndpointGroupsClient)Insert(ctxcontext.Context,req*computepb.InsertGlobalNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)Insert creates a network endpoint group in the specified project using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertGlobalNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertGlobalNetworkEndpointGroupRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalNetworkEndpointGroupsClient) List
func(c*GlobalNetworkEndpointGroupsClient)List(ctxcontext.Context,req*computepb.ListGlobalNetworkEndpointGroupsRequest,opts...gax.CallOption)*NetworkEndpointGroupIteratorList retrieves the list of network endpoint groups that are located in the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalNetworkEndpointGroupsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkEndpointGroupList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalNetworkEndpointGroupsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*GlobalNetworkEndpointGroupsClient) ListNetworkEndpoints
func(c*GlobalNetworkEndpointGroupsClient)ListNetworkEndpoints(ctxcontext.Context,req*computepb.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest,opts...gax.CallOption)*NetworkEndpointWithHealthStatusIteratorListNetworkEndpoints lists the network endpoints in the specified network endpoint group.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest.}it:=c.ListNetworkEndpoints(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkEndpointGroupsListNetworkEndpoints)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest.}forresp,err:=rangec.ListNetworkEndpoints(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}GlobalOperationsCallOptions
typeGlobalOperationsCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionList[]gax.CallOptionWait[]gax.CallOption}GlobalOperationsCallOptions contains the retry settings for each method of GlobalOperationsClient.
GlobalOperationsClient
typeGlobalOperationsClientstruct{// The call options for this service.CallOptions*GlobalOperationsCallOptions// contains filtered or unexported fields}GlobalOperationsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The GlobalOperations API.
func NewGlobalOperationsRESTClient
funcNewGlobalOperationsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*GlobalOperationsClient,error)NewGlobalOperationsRESTClient creates a new global operations rest client.
The GlobalOperations API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewGlobalOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*GlobalOperationsClient) AggregatedList
func(c*GlobalOperationsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListGlobalOperationsRequest,opts...gax.CallOption)*OperationsScopedListPairIteratorAggregatedList retrieves an aggregated list of all operations. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewGlobalOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListGlobalOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListGlobalOperationsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.OperationAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListGlobalOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListGlobalOperationsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*GlobalOperationsClient) Close
func(c*GlobalOperationsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*GlobalOperationsClient) Connection (deprecated)
func(c*GlobalOperationsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*GlobalOperationsClient) Delete
func(c*GlobalOperationsClient)Delete(ctxcontext.Context,req*computepb.DeleteGlobalOperationRequest,opts...gax.CallOption)(*computepb.DeleteGlobalOperationResponse,error)Delete deletes the specified Operations resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteGlobalOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteGlobalOperationRequest.}resp,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*GlobalOperationsClient) Get
func(c*GlobalOperationsClient)Get(ctxcontext.Context,req*computepb.GetGlobalOperationRequest,opts...gax.CallOption)(*computepb.Operation,error)Get retrieves the specified Operations resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetGlobalOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetGlobalOperationRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*GlobalOperationsClient) List
func(c*GlobalOperationsClient)List(ctxcontext.Context,req*computepb.ListGlobalOperationsRequest,opts...gax.CallOption)*OperationIteratorList retrieves a list of Operation resources contained within the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewGlobalOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalOperationsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.OperationList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalOperationsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*GlobalOperationsClient) Wait
func(c*GlobalOperationsClient)Wait(ctxcontext.Context,req*computepb.WaitGlobalOperationRequest,opts...gax.CallOption)(*computepb.Operation,error)Wait waits for the specified Operation resource to return as DONE or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the GET method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be DONE or still in progress. This method is called on a best-effort basis. Specifically: - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.WaitGlobalOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#WaitGlobalOperationRequest.}resp,err:=c.Wait(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}GlobalOrganizationOperationsCallOptions
typeGlobalOrganizationOperationsCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionList[]gax.CallOption}GlobalOrganizationOperationsCallOptions contains the retry settings for each method of GlobalOrganizationOperationsClient.
GlobalOrganizationOperationsClient
typeGlobalOrganizationOperationsClientstruct{// The call options for this service.CallOptions*GlobalOrganizationOperationsCallOptions// contains filtered or unexported fields}GlobalOrganizationOperationsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The GlobalOrganizationOperations API.
func NewGlobalOrganizationOperationsRESTClient
funcNewGlobalOrganizationOperationsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*GlobalOrganizationOperationsClient,error)NewGlobalOrganizationOperationsRESTClient creates a new global organization operations rest client.
The GlobalOrganizationOperations API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewGlobalOrganizationOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*GlobalOrganizationOperationsClient) Close
func(c*GlobalOrganizationOperationsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*GlobalOrganizationOperationsClient) Connection (deprecated)
func(c*GlobalOrganizationOperationsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*GlobalOrganizationOperationsClient) Delete
func(c*GlobalOrganizationOperationsClient)Delete(ctxcontext.Context,req*computepb.DeleteGlobalOrganizationOperationRequest,opts...gax.CallOption)(*computepb.DeleteGlobalOrganizationOperationResponse,error)Delete deletes the specified Operations resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalOrganizationOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteGlobalOrganizationOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteGlobalOrganizationOperationRequest.}resp,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*GlobalOrganizationOperationsClient) Get
func(c*GlobalOrganizationOperationsClient)Get(ctxcontext.Context,req*computepb.GetGlobalOrganizationOperationRequest,opts...gax.CallOption)(*computepb.Operation,error)Get retrieves the specified Operations resource. Gets a list of operations by making a list() request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalOrganizationOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetGlobalOrganizationOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetGlobalOrganizationOperationRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*GlobalOrganizationOperationsClient) List
func(c*GlobalOrganizationOperationsClient)List(ctxcontext.Context,req*computepb.ListGlobalOrganizationOperationsRequest,opts...gax.CallOption)*OperationIteratorList retrieves a list of Operation resources contained within the specified organization.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewGlobalOrganizationOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalOrganizationOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalOrganizationOperationsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.OperationList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalOrganizationOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalOrganizationOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalOrganizationOperationsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}GlobalPublicDelegatedPrefixesCallOptions
typeGlobalPublicDelegatedPrefixesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOption}GlobalPublicDelegatedPrefixesCallOptions contains the retry settings for each method of GlobalPublicDelegatedPrefixesClient.
GlobalPublicDelegatedPrefixesClient
typeGlobalPublicDelegatedPrefixesClientstruct{// The call options for this service.CallOptions*GlobalPublicDelegatedPrefixesCallOptions// contains filtered or unexported fields}GlobalPublicDelegatedPrefixesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The GlobalPublicDelegatedPrefixes API.
func NewGlobalPublicDelegatedPrefixesRESTClient
funcNewGlobalPublicDelegatedPrefixesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*GlobalPublicDelegatedPrefixesClient,error)NewGlobalPublicDelegatedPrefixesRESTClient creates a new global public delegated prefixes rest client.
The GlobalPublicDelegatedPrefixes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*GlobalPublicDelegatedPrefixesClient) Close
func(c*GlobalPublicDelegatedPrefixesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*GlobalPublicDelegatedPrefixesClient) Connection (deprecated)
func(c*GlobalPublicDelegatedPrefixesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*GlobalPublicDelegatedPrefixesClient) Delete
func(c*GlobalPublicDelegatedPrefixesClient)Delete(ctxcontext.Context,req*computepb.DeleteGlobalPublicDelegatedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified global PublicDelegatedPrefix.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteGlobalPublicDelegatedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteGlobalPublicDelegatedPrefixeRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalPublicDelegatedPrefixesClient) Get
func(c*GlobalPublicDelegatedPrefixesClient)Get(ctxcontext.Context,req*computepb.GetGlobalPublicDelegatedPrefixeRequest,opts...gax.CallOption)(*computepb.PublicDelegatedPrefix,error)Get returns the specified global PublicDelegatedPrefix resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetGlobalPublicDelegatedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetGlobalPublicDelegatedPrefixeRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*GlobalPublicDelegatedPrefixesClient) Insert
func(c*GlobalPublicDelegatedPrefixesClient)Insert(ctxcontext.Context,req*computepb.InsertGlobalPublicDelegatedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Insert creates a global PublicDelegatedPrefix in the specified project using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertGlobalPublicDelegatedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertGlobalPublicDelegatedPrefixeRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*GlobalPublicDelegatedPrefixesClient) List
func(c*GlobalPublicDelegatedPrefixesClient)List(ctxcontext.Context,req*computepb.ListGlobalPublicDelegatedPrefixesRequest,opts...gax.CallOption)*PublicDelegatedPrefixIteratorList lists the global PublicDelegatedPrefixes for a project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalPublicDelegatedPrefixesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalPublicDelegatedPrefixesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.PublicDelegatedPrefixList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListGlobalPublicDelegatedPrefixesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListGlobalPublicDelegatedPrefixesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*GlobalPublicDelegatedPrefixesClient) Patch
func(c*GlobalPublicDelegatedPrefixesClient)Patch(ctxcontext.Context,req*computepb.PatchGlobalPublicDelegatedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified global PublicDelegatedPrefix resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewGlobalPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchGlobalPublicDelegatedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchGlobalPublicDelegatedPrefixeRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}HealthCheckIterator
typeHealthCheckIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.HealthCheck,nextPageTokenstring,errerror)// contains filtered or unexported fields}HealthCheckIterator manages a stream of *computepb.HealthCheck.
func (*HealthCheckIterator) All
func(it*HealthCheckIterator)All()iter.Seq2[*computepb.HealthCheck,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*HealthCheckIterator) Next
func(it*HealthCheckIterator)Next()(*computepb.HealthCheck,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*HealthCheckIterator) PageInfo
func(it*HealthCheckIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
HealthCheckServiceIterator
typeHealthCheckServiceIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.HealthCheckService,nextPageTokenstring,errerror)// contains filtered or unexported fields}HealthCheckServiceIterator manages a stream of *computepb.HealthCheckService.
func (*HealthCheckServiceIterator) All
func(it*HealthCheckServiceIterator)All()iter.Seq2[*computepb.HealthCheckService,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*HealthCheckServiceIterator) Next
func(it*HealthCheckServiceIterator)Next()(*computepb.HealthCheckService,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*HealthCheckServiceIterator) PageInfo
func(it*HealthCheckServiceIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
HealthChecksCallOptions
typeHealthChecksCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionUpdate[]gax.CallOption}HealthChecksCallOptions contains the retry settings for each method of HealthChecksClient.
HealthChecksClient
typeHealthChecksClientstruct{// The call options for this service.CallOptions*HealthChecksCallOptions// contains filtered or unexported fields}HealthChecksClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The HealthChecks API.
func NewHealthChecksRESTClient
funcNewHealthChecksRESTClient(ctxcontext.Context,opts...option.ClientOption)(*HealthChecksClient,error)NewHealthChecksRESTClient creates a new health checks rest client.
The HealthChecks API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*HealthChecksClient) AggregatedList
func(c*HealthChecksClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListHealthChecksRequest,opts...gax.CallOption)*HealthChecksScopedListPairIteratorAggregatedList retrieves the list of all HealthCheck resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListHealthChecksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListHealthChecksRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.HealthChecksAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListHealthChecksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListHealthChecksRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*HealthChecksClient) Close
func(c*HealthChecksClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*HealthChecksClient) Connection (deprecated)
func(c*HealthChecksClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*HealthChecksClient) Delete
func(c*HealthChecksClient)Delete(ctxcontext.Context,req*computepb.DeleteHealthCheckRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified HealthCheck resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteHealthCheckRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteHealthCheckRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*HealthChecksClient) Get
func(c*HealthChecksClient)Get(ctxcontext.Context,req*computepb.GetHealthCheckRequest,opts...gax.CallOption)(*computepb.HealthCheck,error)Get returns the specified HealthCheck resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetHealthCheckRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetHealthCheckRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*HealthChecksClient) Insert
func(c*HealthChecksClient)Insert(ctxcontext.Context,req*computepb.InsertHealthCheckRequest,opts...gax.CallOption)(*Operation,error)Insert creates a HealthCheck resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertHealthCheckRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertHealthCheckRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*HealthChecksClient) List
func(c*HealthChecksClient)List(ctxcontext.Context,req*computepb.ListHealthChecksRequest,opts...gax.CallOption)*HealthCheckIteratorList retrieves the list of HealthCheck resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListHealthChecksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListHealthChecksRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.HealthCheckList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListHealthChecksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListHealthChecksRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*HealthChecksClient) Patch
func(c*HealthChecksClient)Patch(ctxcontext.Context,req*computepb.PatchHealthCheckRequest,opts...gax.CallOption)(*Operation,error)Patch updates a HealthCheck resource in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchHealthCheckRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchHealthCheckRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*HealthChecksClient) Update
func(c*HealthChecksClient)Update(ctxcontext.Context,req*computepb.UpdateHealthCheckRequest,opts...gax.CallOption)(*Operation,error)Update updates a HealthCheck resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateHealthCheckRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateHealthCheckRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}HealthChecksScopedListPair
typeHealthChecksScopedListPairstruct{KeystringValue*computepb.HealthChecksScopedList}HealthChecksScopedListPair is a holder type for string/*computepb.HealthChecksScopedList map entries
HealthChecksScopedListPairIterator
typeHealthChecksScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]HealthChecksScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}HealthChecksScopedListPairIterator manages a stream of HealthChecksScopedListPair.
func (*HealthChecksScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*HealthChecksScopedListPairIterator) Next
func(it*HealthChecksScopedListPairIterator)Next()(HealthChecksScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*HealthChecksScopedListPairIterator) PageInfo
func(it*HealthChecksScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ImageFamilyViewsCallOptions
typeImageFamilyViewsCallOptionsstruct{Get[]gax.CallOption}ImageFamilyViewsCallOptions contains the retry settings for each method of ImageFamilyViewsClient.
ImageFamilyViewsClient
typeImageFamilyViewsClientstruct{// The call options for this service.CallOptions*ImageFamilyViewsCallOptions// contains filtered or unexported fields}ImageFamilyViewsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The ImageFamilyViews API.
func NewImageFamilyViewsRESTClient
funcNewImageFamilyViewsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ImageFamilyViewsClient,error)NewImageFamilyViewsRESTClient creates a new image family views rest client.
The ImageFamilyViews API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewImageFamilyViewsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ImageFamilyViewsClient) Close
func(c*ImageFamilyViewsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ImageFamilyViewsClient) Connection (deprecated)
func(c*ImageFamilyViewsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ImageFamilyViewsClient) Get
func(c*ImageFamilyViewsClient)Get(ctxcontext.Context,req*computepb.GetImageFamilyViewRequest,opts...gax.CallOption)(*computepb.ImageFamilyView,error)Get returns the latest image that is part of an image family, is not deprecated and is rolled out in the specified zone.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImageFamilyViewsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetImageFamilyViewRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetImageFamilyViewRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}ImageIterator
typeImageIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Image,nextPageTokenstring,errerror)// contains filtered or unexported fields}ImageIterator manages a stream of *computepb.Image.
func (*ImageIterator) All
func(it*ImageIterator)All()iter.Seq2[*computepb.Image,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ImageIterator) Next
func(it*ImageIterator)Next()(*computepb.Image,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ImageIterator) PageInfo
func(it*ImageIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ImagesCallOptions
typeImagesCallOptionsstruct{Delete[]gax.CallOptionDeprecate[]gax.CallOptionGet[]gax.CallOptionGetFromFamily[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetLabels[]gax.CallOptionTestIamPermissions[]gax.CallOption}ImagesCallOptions contains the retry settings for each method of ImagesClient.
ImagesClient
typeImagesClientstruct{// The call options for this service.CallOptions*ImagesCallOptions// contains filtered or unexported fields}ImagesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Images API.
func NewImagesRESTClient
funcNewImagesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ImagesClient,error)NewImagesRESTClient creates a new images rest client.
The Images API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ImagesClient) Close
func(c*ImagesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ImagesClient) Connection (deprecated)
func(c*ImagesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ImagesClient) Delete
func(c*ImagesClient)Delete(ctxcontext.Context,req*computepb.DeleteImageRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified image.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteImageRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ImagesClient) Deprecate
func(c*ImagesClient)Deprecate(ctxcontext.Context,req*computepb.DeprecateImageRequest,opts...gax.CallOption)(*Operation,error)Deprecate sets the deprecation status of an image. If an empty request body is given, clears the deprecation status instead.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeprecateImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeprecateImageRequest.}op,err:=c.Deprecate(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ImagesClient) Get
func(c*ImagesClient)Get(ctxcontext.Context,req*computepb.GetImageRequest,opts...gax.CallOption)(*computepb.Image,error)Get returns the specified image.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetImageRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ImagesClient) GetFromFamily
func(c*ImagesClient)GetFromFamily(ctxcontext.Context,req*computepb.GetFromFamilyImageRequest,opts...gax.CallOption)(*computepb.Image,error)GetFromFamily returns the latest image that is part of an image family and is not deprecated. For more information on image families, see Public image families documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetFromFamilyImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetFromFamilyImageRequest.}resp,err:=c.GetFromFamily(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ImagesClient) GetIamPolicy
func(c*ImagesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyImageRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyImageRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ImagesClient) Insert
func(c*ImagesClient)Insert(ctxcontext.Context,req*computepb.InsertImageRequest,opts...gax.CallOption)(*Operation,error)Insert creates an image in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertImageRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ImagesClient) List
func(c*ImagesClient)List(ctxcontext.Context,req*computepb.ListImagesRequest,opts...gax.CallOption)*ImageIteratorList retrieves the list of custom images available to the specified project. Custom images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 8. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListImagesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListImagesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ImageList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListImagesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListImagesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ImagesClient) Patch
func(c*ImagesClient)Patch(ctxcontext.Context,req*computepb.PatchImageRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified image with the data included in the request. Only the following fields can be modified: family, description, deprecation status.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchImageRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ImagesClient) SetIamPolicy
func(c*ImagesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyImageRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyImageRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ImagesClient) SetLabels
func(c*ImagesClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsImageRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on an image. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsImageRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ImagesClient) TestIamPermissions
func(c*ImagesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsImageRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsImageRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}InstanceGroupIterator
typeInstanceGroupIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InstanceGroup,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceGroupIterator manages a stream of *computepb.InstanceGroup.
func (*InstanceGroupIterator) All
func(it*InstanceGroupIterator)All()iter.Seq2[*computepb.InstanceGroup,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceGroupIterator) Next
func(it*InstanceGroupIterator)Next()(*computepb.InstanceGroup,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceGroupIterator) PageInfo
func(it*InstanceGroupIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstanceGroupManagerIterator
typeInstanceGroupManagerIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InstanceGroupManager,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceGroupManagerIterator manages a stream of *computepb.InstanceGroupManager.
func (*InstanceGroupManagerIterator) All
func(it*InstanceGroupManagerIterator)All()iter.Seq2[*computepb.InstanceGroupManager,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceGroupManagerIterator) Next
func(it*InstanceGroupManagerIterator)Next()(*computepb.InstanceGroupManager,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceGroupManagerIterator) PageInfo
func(it*InstanceGroupManagerIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstanceGroupManagerResizeRequestIterator
typeInstanceGroupManagerResizeRequestIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InstanceGroupManagerResizeRequest,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceGroupManagerResizeRequestIterator manages a stream of *computepb.InstanceGroupManagerResizeRequest.
func (*InstanceGroupManagerResizeRequestIterator) All
func(it*InstanceGroupManagerResizeRequestIterator)All()iter.Seq2[*computepb.InstanceGroupManagerResizeRequest,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceGroupManagerResizeRequestIterator) Next
func(it*InstanceGroupManagerResizeRequestIterator)Next()(*computepb.InstanceGroupManagerResizeRequest,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceGroupManagerResizeRequestIterator) PageInfo
func(it*InstanceGroupManagerResizeRequestIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstanceGroupManagerResizeRequestsCallOptions
typeInstanceGroupManagerResizeRequestsCallOptionsstruct{Cancel[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOption}InstanceGroupManagerResizeRequestsCallOptions contains the retry settings for each method of InstanceGroupManagerResizeRequestsClient.
InstanceGroupManagerResizeRequestsClient
typeInstanceGroupManagerResizeRequestsClientstruct{// The call options for this service.CallOptions*InstanceGroupManagerResizeRequestsCallOptions// contains filtered or unexported fields}InstanceGroupManagerResizeRequestsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InstanceGroupManagerResizeRequests API.
func NewInstanceGroupManagerResizeRequestsRESTClient
funcNewInstanceGroupManagerResizeRequestsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InstanceGroupManagerResizeRequestsClient,error)NewInstanceGroupManagerResizeRequestsRESTClient creates a new instance group manager resize requests rest client.
The InstanceGroupManagerResizeRequests API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagerResizeRequestsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InstanceGroupManagerResizeRequestsClient) Cancel
func(c*InstanceGroupManagerResizeRequestsClient)Cancel(ctxcontext.Context,req*computepb.CancelInstanceGroupManagerResizeRequestRequest,opts...gax.CallOption)(*Operation,error)Cancel cancels the specified resize request and removes it from the queue. Cancelled resize request does no longer wait for the resources to be provisioned. Cancel is only possible for requests that are accepted in the queue.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagerResizeRequestsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.CancelInstanceGroupManagerResizeRequestRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#CancelInstanceGroupManagerResizeRequestRequest.}op,err:=c.Cancel(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagerResizeRequestsClient) Close
func(c*InstanceGroupManagerResizeRequestsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InstanceGroupManagerResizeRequestsClient) Connection (deprecated)
func(c*InstanceGroupManagerResizeRequestsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InstanceGroupManagerResizeRequestsClient) Delete
func(c*InstanceGroupManagerResizeRequestsClient)Delete(ctxcontext.Context,req*computepb.DeleteInstanceGroupManagerResizeRequestRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified, inactive resize request. Requests that are still active cannot be deleted. Deleting request does not delete instances that were provisioned previously.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagerResizeRequestsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInstanceGroupManagerResizeRequestRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInstanceGroupManagerResizeRequestRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagerResizeRequestsClient) Get
func(c*InstanceGroupManagerResizeRequestsClient)Get(ctxcontext.Context,req*computepb.GetInstanceGroupManagerResizeRequestRequest,opts...gax.CallOption)(*computepb.InstanceGroupManagerResizeRequest,error)Get returns all of the details about the specified resize request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagerResizeRequestsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInstanceGroupManagerResizeRequestRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInstanceGroupManagerResizeRequestRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstanceGroupManagerResizeRequestsClient) Insert
func(c*InstanceGroupManagerResizeRequestsClient)Insert(ctxcontext.Context,req*computepb.InsertInstanceGroupManagerResizeRequestRequest,opts...gax.CallOption)(*Operation,error)Insert creates a new resize request that starts provisioning VMs immediately or queues VM creation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagerResizeRequestsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertInstanceGroupManagerResizeRequestRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertInstanceGroupManagerResizeRequestRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagerResizeRequestsClient) List
func(c*InstanceGroupManagerResizeRequestsClient)List(ctxcontext.Context,req*computepb.ListInstanceGroupManagerResizeRequestsRequest,opts...gax.CallOption)*InstanceGroupManagerResizeRequestIteratorList retrieves a list of resize requests that are contained in the managed instance group.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagerResizeRequestsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstanceGroupManagerResizeRequestsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstanceGroupManagerResizeRequestsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceGroupManagerResizeRequestsListResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagerResizeRequestsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstanceGroupManagerResizeRequestsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstanceGroupManagerResizeRequestsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}InstanceGroupManagersCallOptions
typeInstanceGroupManagersCallOptionsstruct{AbandonInstances[]gax.CallOptionAggregatedList[]gax.CallOptionApplyUpdatesToInstances[]gax.CallOptionCreateInstances[]gax.CallOptionDelete[]gax.CallOptionDeleteInstances[]gax.CallOptionDeletePerInstanceConfigs[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListErrors[]gax.CallOptionListManagedInstances[]gax.CallOptionListPerInstanceConfigs[]gax.CallOptionPatch[]gax.CallOptionPatchPerInstanceConfigs[]gax.CallOptionRecreateInstances[]gax.CallOptionResize[]gax.CallOptionResumeInstances[]gax.CallOptionSetInstanceTemplate[]gax.CallOptionSetTargetPools[]gax.CallOptionStartInstances[]gax.CallOptionStopInstances[]gax.CallOptionSuspendInstances[]gax.CallOptionUpdatePerInstanceConfigs[]gax.CallOption}InstanceGroupManagersCallOptions contains the retry settings for each method of InstanceGroupManagersClient.
InstanceGroupManagersClient
typeInstanceGroupManagersClientstruct{// The call options for this service.CallOptions*InstanceGroupManagersCallOptions// contains filtered or unexported fields}InstanceGroupManagersClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InstanceGroupManagers API.
func NewInstanceGroupManagersRESTClient
funcNewInstanceGroupManagersRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InstanceGroupManagersClient,error)NewInstanceGroupManagersRESTClient creates a new instance group managers rest client.
The InstanceGroupManagers API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InstanceGroupManagersClient) AbandonInstances
func(c*InstanceGroupManagersClient)AbandonInstances(ctxcontext.Context,req*computepb.AbandonInstancesInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)AbandonInstances flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AbandonInstancesInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AbandonInstancesInstanceGroupManagerRequest.}op,err:=c.AbandonInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) AggregatedList
func(c*InstanceGroupManagersClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListInstanceGroupManagersRequest,opts...gax.CallOption)*InstanceGroupManagersScopedListPairIteratorAggregatedList retrieves the list of managed instance groups and groups them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInstanceGroupManagersRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceGroupManagerAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInstanceGroupManagersRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstanceGroupManagersClient) ApplyUpdatesToInstances
func(c*InstanceGroupManagersClient)ApplyUpdatesToInstances(ctxcontext.Context,req*computepb.ApplyUpdatesToInstancesInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)ApplyUpdatesToInstances applies changes to selected instances on the managed instance group. This method can be used to apply new overrides and/or new versions.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ApplyUpdatesToInstancesInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ApplyUpdatesToInstancesInstanceGroupManagerRequest.}op,err:=c.ApplyUpdatesToInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) Close
func(c*InstanceGroupManagersClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InstanceGroupManagersClient) Connection (deprecated)
func(c*InstanceGroupManagersClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InstanceGroupManagersClient) CreateInstances
func(c*InstanceGroupManagersClient)CreateInstances(ctxcontext.Context,req*computepb.CreateInstancesInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)CreateInstances creates instances with per-instance configurations in this managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.CreateInstancesInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#CreateInstancesInstanceGroupManagerRequest.}op,err:=c.CreateInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) Delete
func(c*InstanceGroupManagersClient)Delete(ctxcontext.Context,req*computepb.DeleteInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInstanceGroupManagerRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) DeleteInstances
func(c*InstanceGroupManagersClient)DeleteInstances(ctxcontext.Context,req*computepb.DeleteInstancesInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)DeleteInstances flags the specified instances in the managed instance group for immediate deletion. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInstancesInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInstancesInstanceGroupManagerRequest.}op,err:=c.DeleteInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) DeletePerInstanceConfigs
func(c*InstanceGroupManagersClient)DeletePerInstanceConfigs(ctxcontext.Context,req*computepb.DeletePerInstanceConfigsInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)DeletePerInstanceConfigs deletes selected per-instance configurations for the managed instance group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeletePerInstanceConfigsInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeletePerInstanceConfigsInstanceGroupManagerRequest.}op,err:=c.DeletePerInstanceConfigs(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) Get
func(c*InstanceGroupManagersClient)Get(ctxcontext.Context,req*computepb.GetInstanceGroupManagerRequest,opts...gax.CallOption)(*computepb.InstanceGroupManager,error)Get returns all of the details about the specified managed instance group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInstanceGroupManagerRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstanceGroupManagersClient) Insert
func(c*InstanceGroupManagersClient)Insert(ctxcontext.Context,req*computepb.InsertInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)Insert creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertInstanceGroupManagerRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) List
func(c*InstanceGroupManagersClient)List(ctxcontext.Context,req*computepb.ListInstanceGroupManagersRequest,opts...gax.CallOption)*InstanceGroupManagerIteratorList retrieves a list of managed instance groups that are contained within the specified project and zone.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstanceGroupManagersRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceGroupManagerList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstanceGroupManagersRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstanceGroupManagersClient) ListErrors
func(c*InstanceGroupManagersClient)ListErrors(ctxcontext.Context,req*computepb.ListErrorsInstanceGroupManagersRequest,opts...gax.CallOption)*InstanceManagedByIgmErrorIteratorListErrors lists all errors thrown by actions on instances for a given managed instance group. The filter and orderBy query parameters are not supported.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListErrorsInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListErrorsInstanceGroupManagersRequest.}it:=c.ListErrors(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceGroupManagersListErrorsResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListErrorsInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListErrorsInstanceGroupManagersRequest.}forresp,err:=rangec.ListErrors(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstanceGroupManagersClient) ListManagedInstances
func(c*InstanceGroupManagersClient)ListManagedInstances(ctxcontext.Context,req*computepb.ListManagedInstancesInstanceGroupManagersRequest,opts...gax.CallOption)*ManagedInstanceIteratorListManagedInstances lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action. The orderBy query parameter is not supported. The pageToken query parameter is supported only if the group’s listManagedInstancesResults field is set to PAGINATED.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListManagedInstancesInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListManagedInstancesInstanceGroupManagersRequest.}it:=c.ListManagedInstances(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceGroupManagersListManagedInstancesResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListManagedInstancesInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListManagedInstancesInstanceGroupManagersRequest.}forresp,err:=rangec.ListManagedInstances(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstanceGroupManagersClient) ListPerInstanceConfigs
func(c*InstanceGroupManagersClient)ListPerInstanceConfigs(ctxcontext.Context,req*computepb.ListPerInstanceConfigsInstanceGroupManagersRequest,opts...gax.CallOption)*PerInstanceConfigIteratorListPerInstanceConfigs lists all of the per-instance configurations defined for the managed instance group. The orderBy query parameter is not supported.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPerInstanceConfigsInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPerInstanceConfigsInstanceGroupManagersRequest.}it:=c.ListPerInstanceConfigs(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceGroupManagersListPerInstanceConfigsResp)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPerInstanceConfigsInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPerInstanceConfigsInstanceGroupManagersRequest.}forresp,err:=rangec.ListPerInstanceConfigs(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstanceGroupManagersClient) Patch
func(c*InstanceGroupManagersClient)Patch(ctxcontext.Context,req*computepb.PatchInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)Patch updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. If you update your group to specify a new template or instance configuration, it’s possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchInstanceGroupManagerRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) PatchPerInstanceConfigs
func(c*InstanceGroupManagersClient)PatchPerInstanceConfigs(ctxcontext.Context,req*computepb.PatchPerInstanceConfigsInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)PatchPerInstanceConfigs inserts or patches per-instance configurations for the managed instance group. perInstanceConfig.name (athttp://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchPerInstanceConfigsInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchPerInstanceConfigsInstanceGroupManagerRequest.}op,err:=c.PatchPerInstanceConfigs(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) RecreateInstances
func(c*InstanceGroupManagersClient)RecreateInstances(ctxcontext.Context,req*computepb.RecreateInstancesInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)RecreateInstances flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group’s current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RecreateInstancesInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RecreateInstancesInstanceGroupManagerRequest.}op,err:=c.RecreateInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) Resize
func(c*InstanceGroupManagersClient)Resize(ctxcontext.Context,req*computepb.ResizeInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)Resize resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: + The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. This list is subject to change. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ResizeInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ResizeInstanceGroupManagerRequest.}op,err:=c.Resize(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) ResumeInstances
func(c*InstanceGroupManagersClient)ResumeInstances(ctxcontext.Context,req*computepb.ResumeInstancesInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)ResumeInstances flags the specified instances in the managed instance group to be resumed. This method increases the targetSize and decreases the targetSuspendedSize of the managed instance group by the number of instances that you resume. The resumeInstances operation is marked DONE if the resumeInstances request is successful. The underlying actions take additional time. You must separately verify the status of the RESUMING action with the listmanagedinstances method. In this request, you can only specify instances that are suspended. For example, if an instance was previously suspended using the suspendInstances method, it can be resumed using the resumeInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are resumed. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ResumeInstancesInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ResumeInstancesInstanceGroupManagerRequest.}op,err:=c.ResumeInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) SetInstanceTemplate
func(c*InstanceGroupManagersClient)SetInstanceTemplate(ctxcontext.Context,req*computepb.SetInstanceTemplateInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)SetInstanceTemplate specifies the instance template to use when creating new instances in this group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group’s updatePolicy.type to PROACTIVE.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetInstanceTemplateInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetInstanceTemplateInstanceGroupManagerRequest.}op,err:=c.SetInstanceTemplate(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) SetTargetPools
func(c*InstanceGroupManagersClient)SetTargetPools(ctxcontext.Context,req*computepb.SetTargetPoolsInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)SetTargetPools modifies the target pools to which all instances in this managed instance group are assigned. The target pools automatically apply to all of the instances in the managed instance group. This operation is marked DONE when you make the request even if the instances have not yet been added to their target pools. The change might take some time to apply to all of the instances in the group depending on the size of the group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetTargetPoolsInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetTargetPoolsInstanceGroupManagerRequest.}op,err:=c.SetTargetPools(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) StartInstances
func(c*InstanceGroupManagersClient)StartInstances(ctxcontext.Context,req*computepb.StartInstancesInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)StartInstances flags the specified instances in the managed instance group to be started. This method increases the targetSize and decreases the targetStoppedSize of the managed instance group by the number of instances that you start. The startInstances operation is marked DONE if the startInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STARTING action with the listmanagedinstances method. In this request, you can only specify instances that are stopped. For example, if an instance was previously stopped using the stopInstances method, it can be started using the startInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are started. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StartInstancesInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StartInstancesInstanceGroupManagerRequest.}op,err:=c.StartInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) StopInstances
func(c*InstanceGroupManagersClient)StopInstances(ctxcontext.Context,req*computepb.StopInstancesInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)StopInstances flags the specified instances in the managed instance group to be immediately stopped. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetStoppedSize of the managed instance group by the number of instances that you stop. The stopInstances operation is marked DONE if the stopInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STOPPING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays stopping the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is stopped. Stopped instances can be started using the startInstances method. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StopInstancesInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StopInstancesInstanceGroupManagerRequest.}op,err:=c.StopInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) SuspendInstances
func(c*InstanceGroupManagersClient)SuspendInstances(ctxcontext.Context,req*computepb.SuspendInstancesInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)SuspendInstances flags the specified instances in the managed instance group to be immediately suspended. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetSuspendedSize of the managed instance group by the number of instances that you suspend. The suspendInstances operation is marked DONE if the suspendInstances request is successful. The underlying actions take additional time. You must separately verify the status of the SUSPENDING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays suspension of the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is suspended. Suspended instances can be resumed using the resumeInstances method. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SuspendInstancesInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SuspendInstancesInstanceGroupManagerRequest.}op,err:=c.SuspendInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupManagersClient) UpdatePerInstanceConfigs
func(c*InstanceGroupManagersClient)UpdatePerInstanceConfigs(ctxcontext.Context,req*computepb.UpdatePerInstanceConfigsInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)UpdatePerInstanceConfigs inserts or updates per-instance configurations for the managed instance group. perInstanceConfig.name (athttp://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdatePerInstanceConfigsInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdatePerInstanceConfigsInstanceGroupManagerRequest.}op,err:=c.UpdatePerInstanceConfigs(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}InstanceGroupManagersScopedListPair
typeInstanceGroupManagersScopedListPairstruct{KeystringValue*computepb.InstanceGroupManagersScopedList}InstanceGroupManagersScopedListPair is a holder type for string/*computepb.InstanceGroupManagersScopedList map entries
InstanceGroupManagersScopedListPairIterator
typeInstanceGroupManagersScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]InstanceGroupManagersScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceGroupManagersScopedListPairIterator manages a stream of InstanceGroupManagersScopedListPair.
func (*InstanceGroupManagersScopedListPairIterator) All
func(it*InstanceGroupManagersScopedListPairIterator)All()iter.Seq2[InstanceGroupManagersScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceGroupManagersScopedListPairIterator) Next
func(it*InstanceGroupManagersScopedListPairIterator)Next()(InstanceGroupManagersScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceGroupManagersScopedListPairIterator) PageInfo
func(it*InstanceGroupManagersScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstanceGroupsCallOptions
typeInstanceGroupsCallOptionsstruct{AddInstances[]gax.CallOptionAggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListInstances[]gax.CallOptionRemoveInstances[]gax.CallOptionSetNamedPorts[]gax.CallOption}InstanceGroupsCallOptions contains the retry settings for each method of InstanceGroupsClient.
InstanceGroupsClient
typeInstanceGroupsClientstruct{// The call options for this service.CallOptions*InstanceGroupsCallOptions// contains filtered or unexported fields}InstanceGroupsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InstanceGroups API.
func NewInstanceGroupsRESTClient
funcNewInstanceGroupsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InstanceGroupsClient,error)NewInstanceGroupsRESTClient creates a new instance groups rest client.
The InstanceGroups API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InstanceGroupsClient) AddInstances
func(c*InstanceGroupsClient)AddInstances(ctxcontext.Context,req*computepb.AddInstancesInstanceGroupRequest,opts...gax.CallOption)(*Operation,error)AddInstances adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddInstancesInstanceGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddInstancesInstanceGroupRequest.}op,err:=c.AddInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupsClient) AggregatedList
func(c*InstanceGroupsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListInstanceGroupsRequest,opts...gax.CallOption)*InstanceGroupsScopedListPairIteratorAggregatedList retrieves the list of instance groups and sorts them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInstanceGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInstanceGroupsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceGroupAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInstanceGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInstanceGroupsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstanceGroupsClient) Close
func(c*InstanceGroupsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InstanceGroupsClient) Connection (deprecated)
func(c*InstanceGroupsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InstanceGroupsClient) Delete
func(c*InstanceGroupsClient)Delete(ctxcontext.Context,req*computepb.DeleteInstanceGroupRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInstanceGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInstanceGroupRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupsClient) Get
func(c*InstanceGroupsClient)Get(ctxcontext.Context,req*computepb.GetInstanceGroupRequest,opts...gax.CallOption)(*computepb.InstanceGroup,error)Get returns the specified zonal instance group. Get a list of available zonal instance groups by making a list() request. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInstanceGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInstanceGroupRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstanceGroupsClient) Insert
func(c*InstanceGroupsClient)Insert(ctxcontext.Context,req*computepb.InsertInstanceGroupRequest,opts...gax.CallOption)(*Operation,error)Insert creates an instance group in the specified project using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertInstanceGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertInstanceGroupRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupsClient) List
func(c*InstanceGroupsClient)List(ctxcontext.Context,req*computepb.ListInstanceGroupsRequest,opts...gax.CallOption)*InstanceGroupIteratorList retrieves the list of zonal instance group resources contained within the specified zone. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstanceGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstanceGroupsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceGroupList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstanceGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstanceGroupsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstanceGroupsClient) ListInstances
func(c*InstanceGroupsClient)ListInstances(ctxcontext.Context,req*computepb.ListInstancesInstanceGroupsRequest,opts...gax.CallOption)*InstanceWithNamedPortsIteratorListInstances lists the instances in the specified instance group. The orderBy query parameter is not supported. The filter query parameter is supported, but only for expressions that use eq (equal) or ne (not equal) operators.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstancesInstanceGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstancesInstanceGroupsRequest.}it:=c.ListInstances(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceGroupsListInstances)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstancesInstanceGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstancesInstanceGroupsRequest.}forresp,err:=rangec.ListInstances(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstanceGroupsClient) RemoveInstances
func(c*InstanceGroupsClient)RemoveInstances(ctxcontext.Context,req*computepb.RemoveInstancesInstanceGroupRequest,opts...gax.CallOption)(*Operation,error)RemoveInstances removes one or more instances from the specified instance group, but does not delete those instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration before the VM instance is removed or deleted.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveInstancesInstanceGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveInstancesInstanceGroupRequest.}op,err:=c.RemoveInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceGroupsClient) SetNamedPorts
func(c*InstanceGroupsClient)SetNamedPorts(ctxcontext.Context,req*computepb.SetNamedPortsInstanceGroupRequest,opts...gax.CallOption)(*Operation,error)SetNamedPorts sets the named ports for the specified instance group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetNamedPortsInstanceGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetNamedPortsInstanceGroupRequest.}op,err:=c.SetNamedPorts(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}InstanceGroupsScopedListPair
typeInstanceGroupsScopedListPairstruct{KeystringValue*computepb.InstanceGroupsScopedList}InstanceGroupsScopedListPair is a holder type for string/*computepb.InstanceGroupsScopedList map entries
InstanceGroupsScopedListPairIterator
typeInstanceGroupsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]InstanceGroupsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceGroupsScopedListPairIterator manages a stream of InstanceGroupsScopedListPair.
func (*InstanceGroupsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceGroupsScopedListPairIterator) Next
func(it*InstanceGroupsScopedListPairIterator)Next()(InstanceGroupsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceGroupsScopedListPairIterator) PageInfo
func(it*InstanceGroupsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstanceIterator
typeInstanceIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Instance,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceIterator manages a stream of *computepb.Instance.
func (*InstanceIterator) All
func(it*InstanceIterator)All()iter.Seq2[*computepb.Instance,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceIterator) Next
func(it*InstanceIterator)Next()(*computepb.Instance,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceIterator) PageInfo
func(it*InstanceIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstanceManagedByIgmErrorIterator
typeInstanceManagedByIgmErrorIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InstanceManagedByIgmError,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceManagedByIgmErrorIterator manages a stream of *computepb.InstanceManagedByIgmError.
func (*InstanceManagedByIgmErrorIterator) All
func(it*InstanceManagedByIgmErrorIterator)All()iter.Seq2[*computepb.InstanceManagedByIgmError,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceManagedByIgmErrorIterator) Next
func(it*InstanceManagedByIgmErrorIterator)Next()(*computepb.InstanceManagedByIgmError,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceManagedByIgmErrorIterator) PageInfo
func(it*InstanceManagedByIgmErrorIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstanceSettingsCallOptions
typeInstanceSettingsCallOptionsstruct{Get[]gax.CallOptionPatch[]gax.CallOption}InstanceSettingsCallOptions contains the retry settings for each method of InstanceSettingsClient.
InstanceSettingsClient
typeInstanceSettingsClientstruct{// The call options for this service.CallOptions*InstanceSettingsCallOptions// contains filtered or unexported fields}InstanceSettingsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InstanceSettings API.
func NewInstanceSettingsRESTClient
funcNewInstanceSettingsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InstanceSettingsClient,error)NewInstanceSettingsRESTClient creates a new instance settings service rest client.
The InstanceSettings API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInstanceSettingsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InstanceSettingsClient) Close
func(c*InstanceSettingsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InstanceSettingsClient) Connection (deprecated)
func(c*InstanceSettingsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InstanceSettingsClient) Get
func(c*InstanceSettingsClient)Get(ctxcontext.Context,req*computepb.GetInstanceSettingRequest,opts...gax.CallOption)(*computepb.InstanceSettings,error)Get get Instance settings.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceSettingsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInstanceSettingRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInstanceSettingRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstanceSettingsClient) Patch
func(c*InstanceSettingsClient)Patch(ctxcontext.Context,req*computepb.PatchInstanceSettingRequest,opts...gax.CallOption)(*Operation,error)Patch patch Instance settings
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceSettingsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchInstanceSettingRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchInstanceSettingRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}InstanceTemplateIterator
typeInstanceTemplateIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InstanceTemplate,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceTemplateIterator manages a stream of *computepb.InstanceTemplate.
func (*InstanceTemplateIterator) All
func(it*InstanceTemplateIterator)All()iter.Seq2[*computepb.InstanceTemplate,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceTemplateIterator) Next
func(it*InstanceTemplateIterator)Next()(*computepb.InstanceTemplate,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceTemplateIterator) PageInfo
func(it*InstanceTemplateIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstanceTemplatesCallOptions
typeInstanceTemplatesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOption}InstanceTemplatesCallOptions contains the retry settings for each method of InstanceTemplatesClient.
InstanceTemplatesClient
typeInstanceTemplatesClientstruct{// The call options for this service.CallOptions*InstanceTemplatesCallOptions// contains filtered or unexported fields}InstanceTemplatesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InstanceTemplates API.
func NewInstanceTemplatesRESTClient
funcNewInstanceTemplatesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InstanceTemplatesClient,error)NewInstanceTemplatesRESTClient creates a new instance templates rest client.
The InstanceTemplates API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InstanceTemplatesClient) AggregatedList
func(c*InstanceTemplatesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListInstanceTemplatesRequest,opts...gax.CallOption)*InstanceTemplatesScopedListPairIteratorAggregatedList retrieves the list of all InstanceTemplates resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInstanceTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInstanceTemplatesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceTemplateAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInstanceTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInstanceTemplatesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstanceTemplatesClient) Close
func(c*InstanceTemplatesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InstanceTemplatesClient) Connection (deprecated)
func(c*InstanceTemplatesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InstanceTemplatesClient) Delete
func(c*InstanceTemplatesClient)Delete(ctxcontext.Context,req*computepb.DeleteInstanceTemplateRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. It is not possible to delete templates that are already in use by a managed instance group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInstanceTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInstanceTemplateRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceTemplatesClient) Get
func(c*InstanceTemplatesClient)Get(ctxcontext.Context,req*computepb.GetInstanceTemplateRequest,opts...gax.CallOption)(*computepb.InstanceTemplate,error)Get returns the specified instance template.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInstanceTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInstanceTemplateRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstanceTemplatesClient) GetIamPolicy
func(c*InstanceTemplatesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyInstanceTemplateRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyInstanceTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyInstanceTemplateRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstanceTemplatesClient) Insert
func(c*InstanceTemplatesClient)Insert(ctxcontext.Context,req*computepb.InsertInstanceTemplateRequest,opts...gax.CallOption)(*Operation,error)Insert creates an instance template in the specified project using the data that is included in the request. If you are creating a new template to update an existing instance group, your new instance template must use the same network or, if applicable, the same subnetwork as the original template.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertInstanceTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertInstanceTemplateRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstanceTemplatesClient) List
func(c*InstanceTemplatesClient)List(ctxcontext.Context,req*computepb.ListInstanceTemplatesRequest,opts...gax.CallOption)*InstanceTemplateIteratorList retrieves a list of instance templates that are contained within the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstanceTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstanceTemplatesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceTemplateList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstanceTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstanceTemplatesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstanceTemplatesClient) SetIamPolicy
func(c*InstanceTemplatesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyInstanceTemplateRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyInstanceTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyInstanceTemplateRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstanceTemplatesClient) TestIamPermissions
func(c*InstanceTemplatesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsInstanceTemplateRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsInstanceTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsInstanceTemplateRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}InstanceTemplatesScopedListPair
typeInstanceTemplatesScopedListPairstruct{KeystringValue*computepb.InstanceTemplatesScopedList}InstanceTemplatesScopedListPair is a holder type for string/*computepb.InstanceTemplatesScopedList map entries
InstanceTemplatesScopedListPairIterator
typeInstanceTemplatesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]InstanceTemplatesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceTemplatesScopedListPairIterator manages a stream of InstanceTemplatesScopedListPair.
func (*InstanceTemplatesScopedListPairIterator) All
func(it*InstanceTemplatesScopedListPairIterator)All()iter.Seq2[InstanceTemplatesScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceTemplatesScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceTemplatesScopedListPairIterator) PageInfo
func(it*InstanceTemplatesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstanceWithNamedPortsIterator
typeInstanceWithNamedPortsIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InstanceWithNamedPorts,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceWithNamedPortsIterator manages a stream of *computepb.InstanceWithNamedPorts.
func (*InstanceWithNamedPortsIterator) All
func(it*InstanceWithNamedPortsIterator)All()iter.Seq2[*computepb.InstanceWithNamedPorts,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceWithNamedPortsIterator) Next
func(it*InstanceWithNamedPortsIterator)Next()(*computepb.InstanceWithNamedPorts,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceWithNamedPortsIterator) PageInfo
func(it*InstanceWithNamedPortsIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstancesCallOptions
typeInstancesCallOptionsstruct{AddAccessConfig[]gax.CallOptionAddResourcePolicies[]gax.CallOptionAggregatedList[]gax.CallOptionAttachDisk[]gax.CallOptionBulkInsert[]gax.CallOptionDelete[]gax.CallOptionDeleteAccessConfig[]gax.CallOptionDetachDisk[]gax.CallOptionGet[]gax.CallOptionGetEffectiveFirewalls[]gax.CallOptionGetGuestAttributes[]gax.CallOptionGetIamPolicy[]gax.CallOptionGetScreenshot[]gax.CallOptionGetSerialPortOutput[]gax.CallOptionGetShieldedInstanceIdentity[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListReferrers[]gax.CallOptionPerformMaintenance[]gax.CallOptionRemoveResourcePolicies[]gax.CallOptionReportHostAsFaulty[]gax.CallOptionReset[]gax.CallOptionResume[]gax.CallOptionSendDiagnosticInterrupt[]gax.CallOptionSetDeletionProtection[]gax.CallOptionSetDiskAutoDelete[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetLabels[]gax.CallOptionSetMachineResources[]gax.CallOptionSetMachineType[]gax.CallOptionSetMetadata[]gax.CallOptionSetMinCpuPlatform[]gax.CallOptionSetName[]gax.CallOptionSetScheduling[]gax.CallOptionSetSecurityPolicy[]gax.CallOptionSetServiceAccount[]gax.CallOptionSetShieldedInstanceIntegrityPolicy[]gax.CallOptionSetTags[]gax.CallOptionSimulateMaintenanceEvent[]gax.CallOptionStart[]gax.CallOptionStartWithEncryptionKey[]gax.CallOptionStop[]gax.CallOptionSuspend[]gax.CallOptionTestIamPermissions[]gax.CallOptionUpdate[]gax.CallOptionUpdateAccessConfig[]gax.CallOptionUpdateDisplayDevice[]gax.CallOptionUpdateNetworkInterface[]gax.CallOptionUpdateShieldedInstanceConfig[]gax.CallOption}InstancesCallOptions contains the retry settings for each method of InstancesClient.
InstancesClient
typeInstancesClientstruct{// The call options for this service.CallOptions*InstancesCallOptions// contains filtered or unexported fields}InstancesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Instances API.
func NewInstancesRESTClient
funcNewInstancesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InstancesClient,error)NewInstancesRESTClient creates a new instances rest client.
The Instances API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InstancesClient) AddAccessConfig
func(c*InstancesClient)AddAccessConfig(ctxcontext.Context,req*computepb.AddAccessConfigInstanceRequest,opts...gax.CallOption)(*Operation,error)AddAccessConfig adds an access config to an instance’s network interface.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddAccessConfigInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddAccessConfigInstanceRequest.}op,err:=c.AddAccessConfig(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) AddResourcePolicies
func(c*InstancesClient)AddResourcePolicies(ctxcontext.Context,req*computepb.AddResourcePoliciesInstanceRequest,opts...gax.CallOption)(*Operation,error)AddResourcePolicies adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddResourcePoliciesInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddResourcePoliciesInstanceRequest.}op,err:=c.AddResourcePolicies(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) AggregatedList
func(c*InstancesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListInstancesRequest,opts...gax.CallOption)*InstancesScopedListPairIteratorAggregatedList retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInstancesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInstancesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstancesClient) AttachDisk
func(c*InstancesClient)AttachDisk(ctxcontext.Context,req*computepb.AttachDiskInstanceRequest,opts...gax.CallOption)(*Operation,error)AttachDisk attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AttachDiskInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AttachDiskInstanceRequest.}op,err:=c.AttachDisk(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) BulkInsert
func(c*InstancesClient)BulkInsert(ctxcontext.Context,req*computepb.BulkInsertInstanceRequest,opts...gax.CallOption)(*Operation,error)BulkInsert creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.BulkInsertInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#BulkInsertInstanceRequest.}op,err:=c.BulkInsert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) Close
func(c*InstancesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InstancesClient) Connection (deprecated)
func(c*InstancesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InstancesClient) Delete
func(c*InstancesClient)Delete(ctxcontext.Context,req*computepb.DeleteInstanceRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified Instance resource. For more information, see Deleting an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInstanceRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) DeleteAccessConfig
func(c*InstancesClient)DeleteAccessConfig(ctxcontext.Context,req*computepb.DeleteAccessConfigInstanceRequest,opts...gax.CallOption)(*Operation,error)DeleteAccessConfig deletes an access config from an instance’s network interface.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteAccessConfigInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteAccessConfigInstanceRequest.}op,err:=c.DeleteAccessConfig(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) DetachDisk
func(c*InstancesClient)DetachDisk(ctxcontext.Context,req*computepb.DetachDiskInstanceRequest,opts...gax.CallOption)(*Operation,error)DetachDisk detaches a disk from an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DetachDiskInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DetachDiskInstanceRequest.}op,err:=c.DetachDisk(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) Get
func(c*InstancesClient)Get(ctxcontext.Context,req*computepb.GetInstanceRequest,opts...gax.CallOption)(*computepb.Instance,error)Get returns the specified Instance resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInstanceRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstancesClient) GetEffectiveFirewalls
func(c*InstancesClient)GetEffectiveFirewalls(ctxcontext.Context,req*computepb.GetEffectiveFirewallsInstanceRequest,opts...gax.CallOption)(*computepb.InstancesGetEffectiveFirewallsResponse,error)GetEffectiveFirewalls returns effective firewalls applied to an interface of the instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetEffectiveFirewallsInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetEffectiveFirewallsInstanceRequest.}resp,err:=c.GetEffectiveFirewalls(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstancesClient) GetGuestAttributes
func(c*InstancesClient)GetGuestAttributes(ctxcontext.Context,req*computepb.GetGuestAttributesInstanceRequest,opts...gax.CallOption)(*computepb.GuestAttributes,error)GetGuestAttributes returns the specified guest attributes entry.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetGuestAttributesInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetGuestAttributesInstanceRequest.}resp,err:=c.GetGuestAttributes(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstancesClient) GetIamPolicy
func(c*InstancesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyInstanceRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyInstanceRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstancesClient) GetScreenshot
func(c*InstancesClient)GetScreenshot(ctxcontext.Context,req*computepb.GetScreenshotInstanceRequest,opts...gax.CallOption)(*computepb.Screenshot,error)GetScreenshot returns the screenshot from the specified instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetScreenshotInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetScreenshotInstanceRequest.}resp,err:=c.GetScreenshot(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstancesClient) GetSerialPortOutput
func(c*InstancesClient)GetSerialPortOutput(ctxcontext.Context,req*computepb.GetSerialPortOutputInstanceRequest,opts...gax.CallOption)(*computepb.SerialPortOutput,error)GetSerialPortOutput returns the last 1 MB of serial port output from the specified instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetSerialPortOutputInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetSerialPortOutputInstanceRequest.}resp,err:=c.GetSerialPortOutput(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstancesClient) GetShieldedInstanceIdentity
func(c*InstancesClient)GetShieldedInstanceIdentity(ctxcontext.Context,req*computepb.GetShieldedInstanceIdentityInstanceRequest,opts...gax.CallOption)(*computepb.ShieldedInstanceIdentity,error)GetShieldedInstanceIdentity returns the Shielded Instance Identity of an instance
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetShieldedInstanceIdentityInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetShieldedInstanceIdentityInstanceRequest.}resp,err:=c.GetShieldedInstanceIdentity(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstancesClient) Insert
func(c*InstancesClient)Insert(ctxcontext.Context,req*computepb.InsertInstanceRequest,opts...gax.CallOption)(*Operation,error)Insert creates an instance resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertInstanceRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) List
func(c*InstancesClient)List(ctxcontext.Context,req*computepb.ListInstancesRequest,opts...gax.CallOption)*InstanceIteratorList retrieves the list of instances contained within the specified zone.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstancesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstancesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstancesClient) ListReferrers
func(c*InstancesClient)ListReferrers(ctxcontext.Context,req*computepb.ListReferrersInstancesRequest,opts...gax.CallOption)*ReferenceIteratorListReferrers retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListReferrersInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListReferrersInstancesRequest.}it:=c.ListReferrers(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceListReferrers)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListReferrersInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListReferrersInstancesRequest.}forresp,err:=rangec.ListReferrers(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstancesClient) PerformMaintenance
func(c*InstancesClient)PerformMaintenance(ctxcontext.Context,req*computepb.PerformMaintenanceInstanceRequest,opts...gax.CallOption)(*Operation,error)PerformMaintenance perform a manual maintenance on the instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PerformMaintenanceInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PerformMaintenanceInstanceRequest.}op,err:=c.PerformMaintenance(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) RemoveResourcePolicies
func(c*InstancesClient)RemoveResourcePolicies(ctxcontext.Context,req*computepb.RemoveResourcePoliciesInstanceRequest,opts...gax.CallOption)(*Operation,error)RemoveResourcePolicies removes resource policies from an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveResourcePoliciesInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveResourcePoliciesInstanceRequest.}op,err:=c.RemoveResourcePolicies(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) ReportHostAsFaulty
func(c*InstancesClient)ReportHostAsFaulty(ctxcontext.Context,req*computepb.ReportHostAsFaultyInstanceRequest,opts...gax.CallOption)(*Operation,error)ReportHostAsFaulty mark the host as faulty and try to restart the instance on a new host.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ReportHostAsFaultyInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ReportHostAsFaultyInstanceRequest.}op,err:=c.ReportHostAsFaulty(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) Reset
func(c*InstancesClient)Reset(ctxcontext.Context,req*computepb.ResetInstanceRequest,opts...gax.CallOption)(*Operation,error)Reset performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ResetInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ResetInstanceRequest.}op,err:=c.Reset(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) Resume
func(c*InstancesClient)Resume(ctxcontext.Context,req*computepb.ResumeInstanceRequest,opts...gax.CallOption)(*Operation,error)Resume resumes an instance that was suspended using the instances().suspend method.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ResumeInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ResumeInstanceRequest.}op,err:=c.Resume(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SendDiagnosticInterrupt
func(c*InstancesClient)SendDiagnosticInterrupt(ctxcontext.Context,req*computepb.SendDiagnosticInterruptInstanceRequest,opts...gax.CallOption)(*computepb.SendDiagnosticInterruptInstanceResponse,error)SendDiagnosticInterrupt sends diagnostic interrupt to the instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SendDiagnosticInterruptInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SendDiagnosticInterruptInstanceRequest.}resp,err:=c.SendDiagnosticInterrupt(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstancesClient) SetDeletionProtection
func(c*InstancesClient)SetDeletionProtection(ctxcontext.Context,req*computepb.SetDeletionProtectionInstanceRequest,opts...gax.CallOption)(*Operation,error)SetDeletionProtection sets deletion protection on the instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetDeletionProtectionInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetDeletionProtectionInstanceRequest.}op,err:=c.SetDeletionProtection(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetDiskAutoDelete
func(c*InstancesClient)SetDiskAutoDelete(ctxcontext.Context,req*computepb.SetDiskAutoDeleteInstanceRequest,opts...gax.CallOption)(*Operation,error)SetDiskAutoDelete sets the auto-delete flag for a disk attached to an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetDiskAutoDeleteInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetDiskAutoDeleteInstanceRequest.}op,err:=c.SetDiskAutoDelete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetIamPolicy
func(c*InstancesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyInstanceRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyInstanceRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstancesClient) SetLabels
func(c*InstancesClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsInstanceRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsInstanceRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetMachineResources
func(c*InstancesClient)SetMachineResources(ctxcontext.Context,req*computepb.SetMachineResourcesInstanceRequest,opts...gax.CallOption)(*Operation,error)SetMachineResources changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetMachineResourcesInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetMachineResourcesInstanceRequest.}op,err:=c.SetMachineResources(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetMachineType
func(c*InstancesClient)SetMachineType(ctxcontext.Context,req*computepb.SetMachineTypeInstanceRequest,opts...gax.CallOption)(*Operation,error)SetMachineType changes the machine type for a stopped instance to the machine type specified in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetMachineTypeInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetMachineTypeInstanceRequest.}op,err:=c.SetMachineType(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetMetadata
func(c*InstancesClient)SetMetadata(ctxcontext.Context,req*computepb.SetMetadataInstanceRequest,opts...gax.CallOption)(*Operation,error)SetMetadata sets metadata for the specified instance to the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetMetadataInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetMetadataInstanceRequest.}op,err:=c.SetMetadata(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetMinCpuPlatform
func(c*InstancesClient)SetMinCpuPlatform(ctxcontext.Context,req*computepb.SetMinCpuPlatformInstanceRequest,opts...gax.CallOption)(*Operation,error)SetMinCpuPlatform changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetMinCpuPlatformInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetMinCpuPlatformInstanceRequest.}op,err:=c.SetMinCpuPlatform(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetName
func(c*InstancesClient)SetName(ctxcontext.Context,req*computepb.SetNameInstanceRequest,opts...gax.CallOption)(*Operation,error)SetName sets name of an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetNameInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetNameInstanceRequest.}op,err:=c.SetName(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetScheduling
func(c*InstancesClient)SetScheduling(ctxcontext.Context,req*computepb.SetSchedulingInstanceRequest,opts...gax.CallOption)(*Operation,error)SetScheduling sets an instance’s scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSchedulingInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSchedulingInstanceRequest.}op,err:=c.SetScheduling(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetSecurityPolicy
func(c*InstancesClient)SetSecurityPolicy(ctxcontext.Context,req*computepb.SetSecurityPolicyInstanceRequest,opts...gax.CallOption)(*Operation,error)SetSecurityPolicy sets the Google Cloud Armor security policy for the specified instance. For more information, see Google Cloud Armor Overview
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSecurityPolicyInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSecurityPolicyInstanceRequest.}op,err:=c.SetSecurityPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetServiceAccount
func(c*InstancesClient)SetServiceAccount(ctxcontext.Context,req*computepb.SetServiceAccountInstanceRequest,opts...gax.CallOption)(*Operation,error)SetServiceAccount sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetServiceAccountInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetServiceAccountInstanceRequest.}op,err:=c.SetServiceAccount(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetShieldedInstanceIntegrityPolicy
func(c*InstancesClient)SetShieldedInstanceIntegrityPolicy(ctxcontext.Context,req*computepb.SetShieldedInstanceIntegrityPolicyInstanceRequest,opts...gax.CallOption)(*Operation,error)SetShieldedInstanceIntegrityPolicy sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetShieldedInstanceIntegrityPolicyInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetShieldedInstanceIntegrityPolicyInstanceRequest.}op,err:=c.SetShieldedInstanceIntegrityPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SetTags
func(c*InstancesClient)SetTags(ctxcontext.Context,req*computepb.SetTagsInstanceRequest,opts...gax.CallOption)(*Operation,error)SetTags sets network tags for the specified instance to the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetTagsInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetTagsInstanceRequest.}op,err:=c.SetTags(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) SimulateMaintenanceEvent
func(c*InstancesClient)SimulateMaintenanceEvent(ctxcontext.Context,req*computepb.SimulateMaintenanceEventInstanceRequest,opts...gax.CallOption)(*Operation,error)SimulateMaintenanceEvent simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SimulateMaintenanceEventInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SimulateMaintenanceEventInstanceRequest.}op,err:=c.SimulateMaintenanceEvent(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) Start
func(c*InstancesClient)Start(ctxcontext.Context,req*computepb.StartInstanceRequest,opts...gax.CallOption)(*Operation,error)Start starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StartInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StartInstanceRequest.}op,err:=c.Start(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) StartWithEncryptionKey
func(c*InstancesClient)StartWithEncryptionKey(ctxcontext.Context,req*computepb.StartWithEncryptionKeyInstanceRequest,opts...gax.CallOption)(*Operation,error)StartWithEncryptionKey starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StartWithEncryptionKeyInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StartWithEncryptionKeyInstanceRequest.}op,err:=c.StartWithEncryptionKey(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) Stop
func(c*InstancesClient)Stop(ctxcontext.Context,req*computepb.StopInstanceRequest,opts...gax.CallOption)(*Operation,error)Stop stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StopInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StopInstanceRequest.}op,err:=c.Stop(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) Suspend
func(c*InstancesClient)Suspend(ctxcontext.Context,req*computepb.SuspendInstanceRequest,opts...gax.CallOption)(*Operation,error)Suspend this method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SuspendInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SuspendInstanceRequest.}op,err:=c.Suspend(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) TestIamPermissions
func(c*InstancesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsInstanceRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsInstanceRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstancesClient) Update
func(c*InstancesClient)Update(ctxcontext.Context,req*computepb.UpdateInstanceRequest,opts...gax.CallOption)(*Operation,error)Update updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateInstanceRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) UpdateAccessConfig
func(c*InstancesClient)UpdateAccessConfig(ctxcontext.Context,req*computepb.UpdateAccessConfigInstanceRequest,opts...gax.CallOption)(*Operation,error)UpdateAccessConfig updates the specified access config from an instance’s network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateAccessConfigInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateAccessConfigInstanceRequest.}op,err:=c.UpdateAccessConfig(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) UpdateDisplayDevice
func(c*InstancesClient)UpdateDisplayDevice(ctxcontext.Context,req*computepb.UpdateDisplayDeviceInstanceRequest,opts...gax.CallOption)(*Operation,error)UpdateDisplayDevice updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateDisplayDeviceInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateDisplayDeviceInstanceRequest.}op,err:=c.UpdateDisplayDevice(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) UpdateNetworkInterface
func(c*InstancesClient)UpdateNetworkInterface(ctxcontext.Context,req*computepb.UpdateNetworkInterfaceInstanceRequest,opts...gax.CallOption)(*Operation,error)UpdateNetworkInterface updates an instance’s network interface. This method can only update an interface’s alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateNetworkInterfaceInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateNetworkInterfaceInstanceRequest.}op,err:=c.UpdateNetworkInterface(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstancesClient) UpdateShieldedInstanceConfig
func(c*InstancesClient)UpdateShieldedInstanceConfig(ctxcontext.Context,req*computepb.UpdateShieldedInstanceConfigInstanceRequest,opts...gax.CallOption)(*Operation,error)UpdateShieldedInstanceConfig updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateShieldedInstanceConfigInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateShieldedInstanceConfigInstanceRequest.}op,err:=c.UpdateShieldedInstanceConfig(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}InstancesScopedListPair
typeInstancesScopedListPairstruct{KeystringValue*computepb.InstancesScopedList}InstancesScopedListPair is a holder type for string/*computepb.InstancesScopedList map entries
InstancesScopedListPairIterator
typeInstancesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]InstancesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstancesScopedListPairIterator manages a stream of InstancesScopedListPair.
func (*InstancesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstancesScopedListPairIterator) Next
func(it*InstancesScopedListPairIterator)Next()(InstancesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstancesScopedListPairIterator) PageInfo
func(it*InstancesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstantSnapshotIterator
typeInstantSnapshotIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InstantSnapshot,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstantSnapshotIterator manages a stream of *computepb.InstantSnapshot.
func (*InstantSnapshotIterator) All
func(it*InstantSnapshotIterator)All()iter.Seq2[*computepb.InstantSnapshot,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstantSnapshotIterator) Next
func(it*InstantSnapshotIterator)Next()(*computepb.InstantSnapshot,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstantSnapshotIterator) PageInfo
func(it*InstantSnapshotIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InstantSnapshotsCallOptions
typeInstantSnapshotsCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetLabels[]gax.CallOptionTestIamPermissions[]gax.CallOption}InstantSnapshotsCallOptions contains the retry settings for each method of InstantSnapshotsClient.
InstantSnapshotsClient
typeInstantSnapshotsClientstruct{// The call options for this service.CallOptions*InstantSnapshotsCallOptions// contains filtered or unexported fields}InstantSnapshotsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InstantSnapshots API.
func NewInstantSnapshotsRESTClient
funcNewInstantSnapshotsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InstantSnapshotsClient,error)NewInstantSnapshotsRESTClient creates a new instant snapshots rest client.
The InstantSnapshots API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InstantSnapshotsClient) AggregatedList
func(c*InstantSnapshotsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListInstantSnapshotsRequest,opts...gax.CallOption)*InstantSnapshotsScopedListPairIteratorAggregatedList retrieves an aggregated list of instantSnapshots. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInstantSnapshotsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInstantSnapshotsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstantSnapshotAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInstantSnapshotsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInstantSnapshotsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstantSnapshotsClient) Close
func(c*InstantSnapshotsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InstantSnapshotsClient) Connection (deprecated)
func(c*InstantSnapshotsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InstantSnapshotsClient) Delete
func(c*InstantSnapshotsClient)Delete(ctxcontext.Context,req*computepb.DeleteInstantSnapshotRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified InstantSnapshot resource. Keep in mind that deleting a single instantSnapshot might not necessarily delete all the data on that instantSnapshot. If any data on the instantSnapshot that is marked for deletion is needed for subsequent instantSnapshots, the data will be moved to the next corresponding instantSnapshot. For more information, see Deleting instantSnapshots.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInstantSnapshotRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstantSnapshotsClient) Get
func(c*InstantSnapshotsClient)Get(ctxcontext.Context,req*computepb.GetInstantSnapshotRequest,opts...gax.CallOption)(*computepb.InstantSnapshot,error)Get returns the specified InstantSnapshot resource in the specified zone.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInstantSnapshotRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstantSnapshotsClient) GetIamPolicy
func(c*InstantSnapshotsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyInstantSnapshotRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyInstantSnapshotRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstantSnapshotsClient) Insert
func(c*InstantSnapshotsClient)Insert(ctxcontext.Context,req*computepb.InsertInstantSnapshotRequest,opts...gax.CallOption)(*Operation,error)Insert creates an instant snapshot in the specified zone.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertInstantSnapshotRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstantSnapshotsClient) List
func(c*InstantSnapshotsClient)List(ctxcontext.Context,req*computepb.ListInstantSnapshotsRequest,opts...gax.CallOption)*InstantSnapshotIteratorList retrieves the list of InstantSnapshot resources contained within the specified zone.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstantSnapshotsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstantSnapshotsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstantSnapshotList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstantSnapshotsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstantSnapshotsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InstantSnapshotsClient) SetIamPolicy
func(c*InstantSnapshotsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyInstantSnapshotRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyInstantSnapshotRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InstantSnapshotsClient) SetLabels
func(c*InstantSnapshotsClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsInstantSnapshotRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a instantSnapshot in the given zone. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsInstantSnapshotRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InstantSnapshotsClient) TestIamPermissions
func(c*InstantSnapshotsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsInstantSnapshotRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsInstantSnapshotRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}InstantSnapshotsScopedListPair
typeInstantSnapshotsScopedListPairstruct{KeystringValue*computepb.InstantSnapshotsScopedList}InstantSnapshotsScopedListPair is a holder type for string/*computepb.InstantSnapshotsScopedList map entries
InstantSnapshotsScopedListPairIterator
typeInstantSnapshotsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]InstantSnapshotsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstantSnapshotsScopedListPairIterator manages a stream of InstantSnapshotsScopedListPair.
func (*InstantSnapshotsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstantSnapshotsScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstantSnapshotsScopedListPairIterator) PageInfo
func(it*InstantSnapshotsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InterconnectAttachmentGroupIterator
typeInterconnectAttachmentGroupIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InterconnectAttachmentGroup,nextPageTokenstring,errerror)// contains filtered or unexported fields}InterconnectAttachmentGroupIterator manages a stream of *computepb.InterconnectAttachmentGroup.
func (*InterconnectAttachmentGroupIterator) All
func(it*InterconnectAttachmentGroupIterator)All()iter.Seq2[*computepb.InterconnectAttachmentGroup,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InterconnectAttachmentGroupIterator) Next
func(it*InterconnectAttachmentGroupIterator)Next()(*computepb.InterconnectAttachmentGroup,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InterconnectAttachmentGroupIterator) PageInfo
func(it*InterconnectAttachmentGroupIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InterconnectAttachmentGroupsCallOptions
typeInterconnectAttachmentGroupsCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionGetOperationalStatus[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOption}InterconnectAttachmentGroupsCallOptions contains the retry settings for each method of InterconnectAttachmentGroupsClient.
InterconnectAttachmentGroupsClient
typeInterconnectAttachmentGroupsClientstruct{// The call options for this service.CallOptions*InterconnectAttachmentGroupsCallOptions// contains filtered or unexported fields}InterconnectAttachmentGroupsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InterconnectAttachmentGroups API.
func NewInterconnectAttachmentGroupsRESTClient
funcNewInterconnectAttachmentGroupsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InterconnectAttachmentGroupsClient,error)NewInterconnectAttachmentGroupsRESTClient creates a new interconnect attachment groups rest client.
The InterconnectAttachmentGroups API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InterconnectAttachmentGroupsClient) Close
func(c*InterconnectAttachmentGroupsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InterconnectAttachmentGroupsClient) Connection (deprecated)
func(c*InterconnectAttachmentGroupsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InterconnectAttachmentGroupsClient) Delete
func(c*InterconnectAttachmentGroupsClient)Delete(ctxcontext.Context,req*computepb.DeleteInterconnectAttachmentGroupRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified InterconnectAttachmentGroup in the given scope
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInterconnectAttachmentGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInterconnectAttachmentGroupRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectAttachmentGroupsClient) Get
func(c*InterconnectAttachmentGroupsClient)Get(ctxcontext.Context,req*computepb.GetInterconnectAttachmentGroupRequest,opts...gax.CallOption)(*computepb.InterconnectAttachmentGroup,error)Get returns the specified InterconnectAttachmentGroup resource in the given scope.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInterconnectAttachmentGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInterconnectAttachmentGroupRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectAttachmentGroupsClient) GetIamPolicy
func(c*InterconnectAttachmentGroupsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyInterconnectAttachmentGroupRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyInterconnectAttachmentGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyInterconnectAttachmentGroupRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectAttachmentGroupsClient) GetOperationalStatus
func(c*InterconnectAttachmentGroupsClient)GetOperationalStatus(ctxcontext.Context,req*computepb.GetOperationalStatusInterconnectAttachmentGroupRequest,opts...gax.CallOption)(*computepb.InterconnectAttachmentGroupsGetOperationalStatusResponse,error)GetOperationalStatus returns the InterconnectAttachmentStatuses for the specified InterconnectAttachmentGroup resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetOperationalStatusInterconnectAttachmentGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetOperationalStatusInterconnectAttachmentGroupRequest.}resp,err:=c.GetOperationalStatus(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectAttachmentGroupsClient) Insert
func(c*InterconnectAttachmentGroupsClient)Insert(ctxcontext.Context,req*computepb.InsertInterconnectAttachmentGroupRequest,opts...gax.CallOption)(*Operation,error)Insert creates a InterconnectAttachmentGroup in the specified project in the given scope using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertInterconnectAttachmentGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertInterconnectAttachmentGroupRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectAttachmentGroupsClient) List
func(c*InterconnectAttachmentGroupsClient)List(ctxcontext.Context,req*computepb.ListInterconnectAttachmentGroupsRequest,opts...gax.CallOption)*InterconnectAttachmentGroupIteratorList lists the InterconnectAttachmentGroups for a project in the given scope.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectAttachmentGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectAttachmentGroupsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InterconnectAttachmentGroupsListResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectAttachmentGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectAttachmentGroupsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InterconnectAttachmentGroupsClient) Patch
func(c*InterconnectAttachmentGroupsClient)Patch(ctxcontext.Context,req*computepb.PatchInterconnectAttachmentGroupRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified InterconnectAttachmentGroup resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchInterconnectAttachmentGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchInterconnectAttachmentGroupRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectAttachmentGroupsClient) SetIamPolicy
func(c*InterconnectAttachmentGroupsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyInterconnectAttachmentGroupRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyInterconnectAttachmentGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyInterconnectAttachmentGroupRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectAttachmentGroupsClient) TestIamPermissions
func(c*InterconnectAttachmentGroupsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsInterconnectAttachmentGroupRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsInterconnectAttachmentGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsInterconnectAttachmentGroupRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}InterconnectAttachmentIterator
typeInterconnectAttachmentIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InterconnectAttachment,nextPageTokenstring,errerror)// contains filtered or unexported fields}InterconnectAttachmentIterator manages a stream of *computepb.InterconnectAttachment.
func (*InterconnectAttachmentIterator) All
func(it*InterconnectAttachmentIterator)All()iter.Seq2[*computepb.InterconnectAttachment,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InterconnectAttachmentIterator) Next
func(it*InterconnectAttachmentIterator)Next()(*computepb.InterconnectAttachment,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InterconnectAttachmentIterator) PageInfo
func(it*InterconnectAttachmentIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InterconnectAttachmentsCallOptions
typeInterconnectAttachmentsCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetLabels[]gax.CallOption}InterconnectAttachmentsCallOptions contains the retry settings for each method of InterconnectAttachmentsClient.
InterconnectAttachmentsClient
typeInterconnectAttachmentsClientstruct{// The call options for this service.CallOptions*InterconnectAttachmentsCallOptions// contains filtered or unexported fields}InterconnectAttachmentsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InterconnectAttachments API.
func NewInterconnectAttachmentsRESTClient
funcNewInterconnectAttachmentsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InterconnectAttachmentsClient,error)NewInterconnectAttachmentsRESTClient creates a new interconnect attachments rest client.
The InterconnectAttachments API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InterconnectAttachmentsClient) AggregatedList
func(c*InterconnectAttachmentsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListInterconnectAttachmentsRequest,opts...gax.CallOption)*InterconnectAttachmentsScopedListPairIteratorAggregatedList retrieves an aggregated list of interconnect attachments. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInterconnectAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInterconnectAttachmentsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InterconnectAttachmentAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListInterconnectAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListInterconnectAttachmentsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InterconnectAttachmentsClient) Close
func(c*InterconnectAttachmentsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InterconnectAttachmentsClient) Connection (deprecated)
func(c*InterconnectAttachmentsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InterconnectAttachmentsClient) Delete
func(c*InterconnectAttachmentsClient)Delete(ctxcontext.Context,req*computepb.DeleteInterconnectAttachmentRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified interconnect attachment.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInterconnectAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInterconnectAttachmentRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectAttachmentsClient) Get
func(c*InterconnectAttachmentsClient)Get(ctxcontext.Context,req*computepb.GetInterconnectAttachmentRequest,opts...gax.CallOption)(*computepb.InterconnectAttachment,error)Get returns the specified interconnect attachment.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInterconnectAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInterconnectAttachmentRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectAttachmentsClient) Insert
func(c*InterconnectAttachmentsClient)Insert(ctxcontext.Context,req*computepb.InsertInterconnectAttachmentRequest,opts...gax.CallOption)(*Operation,error)Insert creates an InterconnectAttachment in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertInterconnectAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertInterconnectAttachmentRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectAttachmentsClient) List
func(c*InterconnectAttachmentsClient)List(ctxcontext.Context,req*computepb.ListInterconnectAttachmentsRequest,opts...gax.CallOption)*InterconnectAttachmentIteratorList retrieves the list of interconnect attachments contained within the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectAttachmentsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InterconnectAttachmentList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectAttachmentsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InterconnectAttachmentsClient) Patch
func(c*InterconnectAttachmentsClient)Patch(ctxcontext.Context,req*computepb.PatchInterconnectAttachmentRequest,opts...gax.CallOption)(*Operation,error)Patch updates the specified interconnect attachment with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchInterconnectAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchInterconnectAttachmentRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectAttachmentsClient) SetLabels
func(c*InterconnectAttachmentsClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsInterconnectAttachmentRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on an InterconnectAttachment. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsInterconnectAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsInterconnectAttachmentRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}InterconnectAttachmentsScopedListPair
typeInterconnectAttachmentsScopedListPairstruct{KeystringValue*computepb.InterconnectAttachmentsScopedList}InterconnectAttachmentsScopedListPair is a holder type for string/*computepb.InterconnectAttachmentsScopedList map entries
InterconnectAttachmentsScopedListPairIterator
typeInterconnectAttachmentsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]InterconnectAttachmentsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}InterconnectAttachmentsScopedListPairIterator manages a stream of InterconnectAttachmentsScopedListPair.
func (*InterconnectAttachmentsScopedListPairIterator) All
func(it*InterconnectAttachmentsScopedListPairIterator)All()iter.Seq2[InterconnectAttachmentsScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InterconnectAttachmentsScopedListPairIterator) Next
func(it*InterconnectAttachmentsScopedListPairIterator)Next()(InterconnectAttachmentsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InterconnectAttachmentsScopedListPairIterator) PageInfo
func(it*InterconnectAttachmentsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InterconnectGroupIterator
typeInterconnectGroupIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InterconnectGroup,nextPageTokenstring,errerror)// contains filtered or unexported fields}InterconnectGroupIterator manages a stream of *computepb.InterconnectGroup.
func (*InterconnectGroupIterator) All
func(it*InterconnectGroupIterator)All()iter.Seq2[*computepb.InterconnectGroup,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InterconnectGroupIterator) Next
func(it*InterconnectGroupIterator)Next()(*computepb.InterconnectGroup,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InterconnectGroupIterator) PageInfo
func(it*InterconnectGroupIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InterconnectGroupsCallOptions
typeInterconnectGroupsCallOptionsstruct{CreateMembers[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionGetOperationalStatus[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOption}InterconnectGroupsCallOptions contains the retry settings for each method of InterconnectGroupsClient.
InterconnectGroupsClient
typeInterconnectGroupsClientstruct{// The call options for this service.CallOptions*InterconnectGroupsCallOptions// contains filtered or unexported fields}InterconnectGroupsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InterconnectGroups API.
func NewInterconnectGroupsRESTClient
funcNewInterconnectGroupsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InterconnectGroupsClient,error)NewInterconnectGroupsRESTClient creates a new interconnect groups rest client.
The InterconnectGroups API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InterconnectGroupsClient) Close
func(c*InterconnectGroupsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InterconnectGroupsClient) Connection (deprecated)
func(c*InterconnectGroupsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InterconnectGroupsClient) CreateMembers
func(c*InterconnectGroupsClient)CreateMembers(ctxcontext.Context,req*computepb.CreateMembersInterconnectGroupRequest,opts...gax.CallOption)(*Operation,error)CreateMembers create Interconnects with redundancy by creating them in a specified interconnect group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.CreateMembersInterconnectGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#CreateMembersInterconnectGroupRequest.}op,err:=c.CreateMembers(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectGroupsClient) Delete
func(c*InterconnectGroupsClient)Delete(ctxcontext.Context,req*computepb.DeleteInterconnectGroupRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified InterconnectGroup in the given scope
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInterconnectGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInterconnectGroupRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectGroupsClient) Get
func(c*InterconnectGroupsClient)Get(ctxcontext.Context,req*computepb.GetInterconnectGroupRequest,opts...gax.CallOption)(*computepb.InterconnectGroup,error)Get returns the specified InterconnectGroup resource in the given scope.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInterconnectGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInterconnectGroupRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectGroupsClient) GetIamPolicy
func(c*InterconnectGroupsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyInterconnectGroupRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyInterconnectGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyInterconnectGroupRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectGroupsClient) GetOperationalStatus
func(c*InterconnectGroupsClient)GetOperationalStatus(ctxcontext.Context,req*computepb.GetOperationalStatusInterconnectGroupRequest,opts...gax.CallOption)(*computepb.InterconnectGroupsGetOperationalStatusResponse,error)GetOperationalStatus returns the interconnectStatuses for the specified InterconnectGroup.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetOperationalStatusInterconnectGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetOperationalStatusInterconnectGroupRequest.}resp,err:=c.GetOperationalStatus(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectGroupsClient) Insert
func(c*InterconnectGroupsClient)Insert(ctxcontext.Context,req*computepb.InsertInterconnectGroupRequest,opts...gax.CallOption)(*Operation,error)Insert creates a InterconnectGroup in the specified project in the given scope using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertInterconnectGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertInterconnectGroupRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectGroupsClient) List
func(c*InterconnectGroupsClient)List(ctxcontext.Context,req*computepb.ListInterconnectGroupsRequest,opts...gax.CallOption)*InterconnectGroupIteratorList lists the InterconnectGroups for a project in the given scope.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectGroupsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InterconnectGroupsListResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectGroupsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InterconnectGroupsClient) Patch
func(c*InterconnectGroupsClient)Patch(ctxcontext.Context,req*computepb.PatchInterconnectGroupRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified InterconnectGroup resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchInterconnectGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchInterconnectGroupRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectGroupsClient) SetIamPolicy
func(c*InterconnectGroupsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyInterconnectGroupRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyInterconnectGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyInterconnectGroupRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectGroupsClient) TestIamPermissions
func(c*InterconnectGroupsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsInterconnectGroupRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsInterconnectGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsInterconnectGroupRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}InterconnectIterator
typeInterconnectIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Interconnect,nextPageTokenstring,errerror)// contains filtered or unexported fields}InterconnectIterator manages a stream of *computepb.Interconnect.
func (*InterconnectIterator) All
func(it*InterconnectIterator)All()iter.Seq2[*computepb.Interconnect,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InterconnectIterator) Next
func(it*InterconnectIterator)Next()(*computepb.Interconnect,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InterconnectIterator) PageInfo
func(it*InterconnectIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InterconnectLocationIterator
typeInterconnectLocationIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InterconnectLocation,nextPageTokenstring,errerror)// contains filtered or unexported fields}InterconnectLocationIterator manages a stream of *computepb.InterconnectLocation.
func (*InterconnectLocationIterator) All
func(it*InterconnectLocationIterator)All()iter.Seq2[*computepb.InterconnectLocation,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InterconnectLocationIterator) Next
func(it*InterconnectLocationIterator)Next()(*computepb.InterconnectLocation,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InterconnectLocationIterator) PageInfo
func(it*InterconnectLocationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InterconnectLocationsCallOptions
typeInterconnectLocationsCallOptionsstruct{Get[]gax.CallOptionList[]gax.CallOption}InterconnectLocationsCallOptions contains the retry settings for each method of InterconnectLocationsClient.
InterconnectLocationsClient
typeInterconnectLocationsClientstruct{// The call options for this service.CallOptions*InterconnectLocationsCallOptions// contains filtered or unexported fields}InterconnectLocationsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InterconnectLocations API.
func NewInterconnectLocationsRESTClient
funcNewInterconnectLocationsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InterconnectLocationsClient,error)NewInterconnectLocationsRESTClient creates a new interconnect locations rest client.
The InterconnectLocations API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInterconnectLocationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InterconnectLocationsClient) Close
func(c*InterconnectLocationsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InterconnectLocationsClient) Connection (deprecated)
func(c*InterconnectLocationsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InterconnectLocationsClient) Get
func(c*InterconnectLocationsClient)Get(ctxcontext.Context,req*computepb.GetInterconnectLocationRequest,opts...gax.CallOption)(*computepb.InterconnectLocation,error)Get returns the details for the specified interconnect location. Gets a list of available interconnect locations by making a list() request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectLocationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInterconnectLocationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInterconnectLocationRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectLocationsClient) List
func(c*InterconnectLocationsClient)List(ctxcontext.Context,req*computepb.ListInterconnectLocationsRequest,opts...gax.CallOption)*InterconnectLocationIteratorList retrieves the list of interconnect locations available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInterconnectLocationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectLocationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectLocationsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InterconnectLocationList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectLocationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectLocationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectLocationsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}InterconnectRemoteLocationIterator
typeInterconnectRemoteLocationIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.InterconnectRemoteLocation,nextPageTokenstring,errerror)// contains filtered or unexported fields}InterconnectRemoteLocationIterator manages a stream of *computepb.InterconnectRemoteLocation.
func (*InterconnectRemoteLocationIterator) All
func(it*InterconnectRemoteLocationIterator)All()iter.Seq2[*computepb.InterconnectRemoteLocation,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InterconnectRemoteLocationIterator) Next
func(it*InterconnectRemoteLocationIterator)Next()(*computepb.InterconnectRemoteLocation,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InterconnectRemoteLocationIterator) PageInfo
func(it*InterconnectRemoteLocationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InterconnectRemoteLocationsCallOptions
typeInterconnectRemoteLocationsCallOptionsstruct{Get[]gax.CallOptionList[]gax.CallOption}InterconnectRemoteLocationsCallOptions contains the retry settings for each method of InterconnectRemoteLocationsClient.
InterconnectRemoteLocationsClient
typeInterconnectRemoteLocationsClientstruct{// The call options for this service.CallOptions*InterconnectRemoteLocationsCallOptions// contains filtered or unexported fields}InterconnectRemoteLocationsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The InterconnectRemoteLocations API.
func NewInterconnectRemoteLocationsRESTClient
funcNewInterconnectRemoteLocationsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InterconnectRemoteLocationsClient,error)NewInterconnectRemoteLocationsRESTClient creates a new interconnect remote locations rest client.
The InterconnectRemoteLocations API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInterconnectRemoteLocationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InterconnectRemoteLocationsClient) Close
func(c*InterconnectRemoteLocationsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InterconnectRemoteLocationsClient) Connection (deprecated)
func(c*InterconnectRemoteLocationsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InterconnectRemoteLocationsClient) Get
func(c*InterconnectRemoteLocationsClient)Get(ctxcontext.Context,req*computepb.GetInterconnectRemoteLocationRequest,opts...gax.CallOption)(*computepb.InterconnectRemoteLocation,error)Get returns the details for the specified interconnect remote location. Gets a list of available interconnect remote locations by making a list() request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectRemoteLocationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInterconnectRemoteLocationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInterconnectRemoteLocationRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectRemoteLocationsClient) List
func(c*InterconnectRemoteLocationsClient)List(ctxcontext.Context,req*computepb.ListInterconnectRemoteLocationsRequest,opts...gax.CallOption)*InterconnectRemoteLocationIteratorList retrieves the list of interconnect remote locations available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInterconnectRemoteLocationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectRemoteLocationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectRemoteLocationsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InterconnectRemoteLocationList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectRemoteLocationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectRemoteLocationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectRemoteLocationsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}InterconnectsCallOptions
typeInterconnectsCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionGetDiagnostics[]gax.CallOptionGetMacsecConfig[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetLabels[]gax.CallOption}InterconnectsCallOptions contains the retry settings for each method of InterconnectsClient.
InterconnectsClient
typeInterconnectsClientstruct{// The call options for this service.CallOptions*InterconnectsCallOptions// contains filtered or unexported fields}InterconnectsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Interconnects API.
func NewInterconnectsRESTClient
funcNewInterconnectsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*InterconnectsClient,error)NewInterconnectsRESTClient creates a new interconnects rest client.
The Interconnects API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewInterconnectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*InterconnectsClient) Close
func(c*InterconnectsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*InterconnectsClient) Connection (deprecated)
func(c*InterconnectsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*InterconnectsClient) Delete
func(c*InterconnectsClient)Delete(ctxcontext.Context,req*computepb.DeleteInterconnectRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified Interconnect.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInterconnectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInterconnectRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectsClient) Get
func(c*InterconnectsClient)Get(ctxcontext.Context,req*computepb.GetInterconnectRequest,opts...gax.CallOption)(*computepb.Interconnect,error)Get returns the specified Interconnect. Get a list of available Interconnects by making a list() request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetInterconnectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetInterconnectRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectsClient) GetDiagnostics
func(c*InterconnectsClient)GetDiagnostics(ctxcontext.Context,req*computepb.GetDiagnosticsInterconnectRequest,opts...gax.CallOption)(*computepb.InterconnectsGetDiagnosticsResponse,error)GetDiagnostics returns the interconnectDiagnostics for the specified Interconnect. In the event of a global outage, do not use this API to make decisions about where to redirect your network traffic. Unlike a VLAN attachment, which is regional, a Cloud Interconnect connection is a global resource. A global outage can prevent this API from functioning properly.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetDiagnosticsInterconnectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetDiagnosticsInterconnectRequest.}resp,err:=c.GetDiagnostics(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectsClient) GetMacsecConfig
func(c*InterconnectsClient)GetMacsecConfig(ctxcontext.Context,req*computepb.GetMacsecConfigInterconnectRequest,opts...gax.CallOption)(*computepb.InterconnectsGetMacsecConfigResponse,error)GetMacsecConfig returns the interconnectMacsecConfig for the specified Interconnect.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetMacsecConfigInterconnectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetMacsecConfigInterconnectRequest.}resp,err:=c.GetMacsecConfig(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*InterconnectsClient) Insert
func(c*InterconnectsClient)Insert(ctxcontext.Context,req*computepb.InsertInterconnectRequest,opts...gax.CallOption)(*Operation,error)Insert creates an Interconnect in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertInterconnectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertInterconnectRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectsClient) List
func(c*InterconnectsClient)List(ctxcontext.Context,req*computepb.ListInterconnectsRequest,opts...gax.CallOption)*InterconnectIteratorList retrieves the list of Interconnects available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewInterconnectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InterconnectList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInterconnectsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInterconnectsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*InterconnectsClient) Patch
func(c*InterconnectsClient)Patch(ctxcontext.Context,req*computepb.PatchInterconnectRequest,opts...gax.CallOption)(*Operation,error)Patch updates the specified Interconnect with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchInterconnectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchInterconnectRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*InterconnectsClient) SetLabels
func(c*InterconnectsClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsInterconnectRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on an Interconnect. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewInterconnectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsInterconnectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsInterconnectRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}LicenseCodesCallOptions
typeLicenseCodesCallOptionsstruct{Get[]gax.CallOptionTestIamPermissions[]gax.CallOption}LicenseCodesCallOptions contains the retry settings for each method of LicenseCodesClient.
LicenseCodesClient
typeLicenseCodesClientstruct{// The call options for this service.CallOptions*LicenseCodesCallOptions// contains filtered or unexported fields}LicenseCodesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The LicenseCodes API.
func NewLicenseCodesRESTClient
funcNewLicenseCodesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*LicenseCodesClient,error)NewLicenseCodesRESTClient creates a new license codes rest client.
The LicenseCodes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewLicenseCodesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*LicenseCodesClient) Close
func(c*LicenseCodesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*LicenseCodesClient) Connection (deprecated)
func(c*LicenseCodesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*LicenseCodesClient) Get
func(c*LicenseCodesClient)Get(ctxcontext.Context,req*computepb.GetLicenseCodeRequest,opts...gax.CallOption)(*computepb.LicenseCode,error)Get return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewLicenseCodesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetLicenseCodeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetLicenseCodeRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*LicenseCodesClient) TestIamPermissions
func(c*LicenseCodesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsLicenseCodeRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewLicenseCodesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsLicenseCodeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsLicenseCodeRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}LicenseIterator
typeLicenseIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.License,nextPageTokenstring,errerror)// contains filtered or unexported fields}LicenseIterator manages a stream of *computepb.License.
func (*LicenseIterator) All
func(it*LicenseIterator)All()iter.Seq2[*computepb.License,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*LicenseIterator) Next
func(it*LicenseIterator)Next()(*computepb.License,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*LicenseIterator) PageInfo
func(it*LicenseIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
LicensesCallOptions
typeLicensesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOptionUpdate[]gax.CallOption}LicensesCallOptions contains the retry settings for each method of LicensesClient.
LicensesClient
typeLicensesClientstruct{// The call options for this service.CallOptions*LicensesCallOptions// contains filtered or unexported fields}LicensesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Licenses API.
func NewLicensesRESTClient
funcNewLicensesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*LicensesClient,error)NewLicensesRESTClient creates a new licenses rest client.
The Licenses API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewLicensesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*LicensesClient) Close
func(c*LicensesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*LicensesClient) Connection (deprecated)
func(c*LicensesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*LicensesClient) Delete
func(c*LicensesClient)Delete(ctxcontext.Context,req*computepb.DeleteLicenseRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified license. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewLicensesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteLicenseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteLicenseRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*LicensesClient) Get
func(c*LicensesClient)Get(ctxcontext.Context,req*computepb.GetLicenseRequest,opts...gax.CallOption)(*computepb.License,error)Get returns the specified License resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewLicensesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetLicenseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetLicenseRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*LicensesClient) GetIamPolicy
func(c*LicensesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyLicenseRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewLicensesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyLicenseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyLicenseRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*LicensesClient) Insert
func(c*LicensesClient)Insert(ctxcontext.Context,req*computepb.InsertLicenseRequest,opts...gax.CallOption)(*Operation,error)Insert create a License resource in the specified project. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewLicensesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertLicenseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertLicenseRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*LicensesClient) List
func(c*LicensesClient)List(ctxcontext.Context,req*computepb.ListLicensesRequest,opts...gax.CallOption)*LicenseIteratorList retrieves the list of licenses available in the specified project. This method does not get any licenses that belong to other projects, including licenses attached to publicly-available images, like Debian 9. If you want to get a list of publicly-available licenses, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewLicensesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListLicensesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListLicensesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.LicensesListResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewLicensesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListLicensesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListLicensesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*LicensesClient) SetIamPolicy
func(c*LicensesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyLicenseRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewLicensesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyLicenseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyLicenseRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*LicensesClient) TestIamPermissions
func(c*LicensesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsLicenseRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewLicensesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsLicenseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsLicenseRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*LicensesClient) Update
func(c*LicensesClient)Update(ctxcontext.Context,req*computepb.UpdateLicenseRequest,opts...gax.CallOption)(*Operation,error)Update updates a License resource in the specified project. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewLicensesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateLicenseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateLicenseRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}MachineImageIterator
typeMachineImageIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.MachineImage,nextPageTokenstring,errerror)// contains filtered or unexported fields}MachineImageIterator manages a stream of *computepb.MachineImage.
func (*MachineImageIterator) All
func(it*MachineImageIterator)All()iter.Seq2[*computepb.MachineImage,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*MachineImageIterator) Next
func(it*MachineImageIterator)Next()(*computepb.MachineImage,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*MachineImageIterator) PageInfo
func(it*MachineImageIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
MachineImagesCallOptions
typeMachineImagesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetLabels[]gax.CallOptionTestIamPermissions[]gax.CallOption}MachineImagesCallOptions contains the retry settings for each method of MachineImagesClient.
MachineImagesClient
typeMachineImagesClientstruct{// The call options for this service.CallOptions*MachineImagesCallOptions// contains filtered or unexported fields}MachineImagesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The MachineImages API.
func NewMachineImagesRESTClient
funcNewMachineImagesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*MachineImagesClient,error)NewMachineImagesRESTClient creates a new machine images rest client.
The MachineImages API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewMachineImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*MachineImagesClient) Close
func(c*MachineImagesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*MachineImagesClient) Connection (deprecated)
func(c*MachineImagesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*MachineImagesClient) Delete
func(c*MachineImagesClient)Delete(ctxcontext.Context,req*computepb.DeleteMachineImageRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified machine image. Deleting a machine image is permanent and cannot be undone.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteMachineImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteMachineImageRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*MachineImagesClient) Get
func(c*MachineImagesClient)Get(ctxcontext.Context,req*computepb.GetMachineImageRequest,opts...gax.CallOption)(*computepb.MachineImage,error)Get returns the specified machine image.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetMachineImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetMachineImageRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*MachineImagesClient) GetIamPolicy
func(c*MachineImagesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyMachineImageRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyMachineImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyMachineImageRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*MachineImagesClient) Insert
func(c*MachineImagesClient)Insert(ctxcontext.Context,req*computepb.InsertMachineImageRequest,opts...gax.CallOption)(*Operation,error)Insert creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertMachineImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertMachineImageRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*MachineImagesClient) List
func(c*MachineImagesClient)List(ctxcontext.Context,req*computepb.ListMachineImagesRequest,opts...gax.CallOption)*MachineImageIteratorList retrieves a list of machine images that are contained within the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewMachineImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListMachineImagesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListMachineImagesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.MachineImageList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListMachineImagesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListMachineImagesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*MachineImagesClient) SetIamPolicy
func(c*MachineImagesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyMachineImageRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyMachineImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyMachineImageRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*MachineImagesClient) SetLabels
func(c*MachineImagesClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsMachineImageRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a machine image. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsMachineImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsMachineImageRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*MachineImagesClient) TestIamPermissions
func(c*MachineImagesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsMachineImageRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineImagesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsMachineImageRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsMachineImageRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}MachineTypeIterator
typeMachineTypeIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.MachineType,nextPageTokenstring,errerror)// contains filtered or unexported fields}MachineTypeIterator manages a stream of *computepb.MachineType.
func (*MachineTypeIterator) All
func(it*MachineTypeIterator)All()iter.Seq2[*computepb.MachineType,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*MachineTypeIterator) Next
func(it*MachineTypeIterator)Next()(*computepb.MachineType,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*MachineTypeIterator) PageInfo
func(it*MachineTypeIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
MachineTypesCallOptions
typeMachineTypesCallOptionsstruct{AggregatedList[]gax.CallOptionGet[]gax.CallOptionList[]gax.CallOption}MachineTypesCallOptions contains the retry settings for each method of MachineTypesClient.
MachineTypesClient
typeMachineTypesClientstruct{// The call options for this service.CallOptions*MachineTypesCallOptions// contains filtered or unexported fields}MachineTypesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The MachineTypes API.
func NewMachineTypesRESTClient
funcNewMachineTypesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*MachineTypesClient,error)NewMachineTypesRESTClient creates a new machine types rest client.
The MachineTypes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewMachineTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*MachineTypesClient) AggregatedList
func(c*MachineTypesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListMachineTypesRequest,opts...gax.CallOption)*MachineTypesScopedListPairIteratorAggregatedList retrieves an aggregated list of machine types. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewMachineTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListMachineTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListMachineTypesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.MachineTypeAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListMachineTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListMachineTypesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*MachineTypesClient) Close
func(c*MachineTypesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*MachineTypesClient) Connection (deprecated)
func(c*MachineTypesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*MachineTypesClient) Get
func(c*MachineTypesClient)Get(ctxcontext.Context,req*computepb.GetMachineTypeRequest,opts...gax.CallOption)(*computepb.MachineType,error)Get returns the specified machine type.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetMachineTypeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetMachineTypeRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*MachineTypesClient) List
func(c*MachineTypesClient)List(ctxcontext.Context,req*computepb.ListMachineTypesRequest,opts...gax.CallOption)*MachineTypeIteratorList retrieves a list of machine types available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewMachineTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListMachineTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListMachineTypesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.MachineTypeList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewMachineTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListMachineTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListMachineTypesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}MachineTypesScopedListPair
typeMachineTypesScopedListPairstruct{KeystringValue*computepb.MachineTypesScopedList}MachineTypesScopedListPair is a holder type for string/*computepb.MachineTypesScopedList map entries
MachineTypesScopedListPairIterator
typeMachineTypesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]MachineTypesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}MachineTypesScopedListPairIterator manages a stream of MachineTypesScopedListPair.
func (*MachineTypesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*MachineTypesScopedListPairIterator) Next
func(it*MachineTypesScopedListPairIterator)Next()(MachineTypesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*MachineTypesScopedListPairIterator) PageInfo
func(it*MachineTypesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ManagedInstanceIterator
typeManagedInstanceIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.ManagedInstance,nextPageTokenstring,errerror)// contains filtered or unexported fields}ManagedInstanceIterator manages a stream of *computepb.ManagedInstance.
func (*ManagedInstanceIterator) All
func(it*ManagedInstanceIterator)All()iter.Seq2[*computepb.ManagedInstance,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ManagedInstanceIterator) Next
func(it*ManagedInstanceIterator)Next()(*computepb.ManagedInstance,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ManagedInstanceIterator) PageInfo
func(it*ManagedInstanceIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NetworkAttachmentIterator
typeNetworkAttachmentIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.NetworkAttachment,nextPageTokenstring,errerror)// contains filtered or unexported fields}NetworkAttachmentIterator manages a stream of *computepb.NetworkAttachment.
func (*NetworkAttachmentIterator) All
func(it*NetworkAttachmentIterator)All()iter.Seq2[*computepb.NetworkAttachment,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NetworkAttachmentIterator) Next
func(it*NetworkAttachmentIterator)Next()(*computepb.NetworkAttachment,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NetworkAttachmentIterator) PageInfo
func(it*NetworkAttachmentIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NetworkAttachmentsCallOptions
typeNetworkAttachmentsCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOption}NetworkAttachmentsCallOptions contains the retry settings for each method of NetworkAttachmentsClient.
NetworkAttachmentsClient
typeNetworkAttachmentsClientstruct{// The call options for this service.CallOptions*NetworkAttachmentsCallOptions// contains filtered or unexported fields}NetworkAttachmentsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The NetworkAttachments API.
func NewNetworkAttachmentsRESTClient
funcNewNetworkAttachmentsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*NetworkAttachmentsClient,error)NewNetworkAttachmentsRESTClient creates a new network attachments rest client.
The NetworkAttachments API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*NetworkAttachmentsClient) AggregatedList
func(c*NetworkAttachmentsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListNetworkAttachmentsRequest,opts...gax.CallOption)*NetworkAttachmentsScopedListPairIteratorAggregatedList retrieves the list of all NetworkAttachment resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNetworkAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNetworkAttachmentsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkAttachmentAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNetworkAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNetworkAttachmentsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NetworkAttachmentsClient) Close
func(c*NetworkAttachmentsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*NetworkAttachmentsClient) Connection (deprecated)
func(c*NetworkAttachmentsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*NetworkAttachmentsClient) Delete
func(c*NetworkAttachmentsClient)Delete(ctxcontext.Context,req*computepb.DeleteNetworkAttachmentRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified NetworkAttachment in the given scope
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteNetworkAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteNetworkAttachmentRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkAttachmentsClient) Get
func(c*NetworkAttachmentsClient)Get(ctxcontext.Context,req*computepb.GetNetworkAttachmentRequest,opts...gax.CallOption)(*computepb.NetworkAttachment,error)Get returns the specified NetworkAttachment resource in the given scope.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNetworkAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNetworkAttachmentRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkAttachmentsClient) GetIamPolicy
func(c*NetworkAttachmentsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyNetworkAttachmentRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyNetworkAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyNetworkAttachmentRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkAttachmentsClient) Insert
func(c*NetworkAttachmentsClient)Insert(ctxcontext.Context,req*computepb.InsertNetworkAttachmentRequest,opts...gax.CallOption)(*Operation,error)Insert creates a NetworkAttachment in the specified project in the given scope using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertNetworkAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertNetworkAttachmentRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkAttachmentsClient) List
func(c*NetworkAttachmentsClient)List(ctxcontext.Context,req*computepb.ListNetworkAttachmentsRequest,opts...gax.CallOption)*NetworkAttachmentIteratorList lists the NetworkAttachments for a project in the given scope.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkAttachmentsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkAttachmentList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkAttachmentsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NetworkAttachmentsClient) Patch
func(c*NetworkAttachmentsClient)Patch(ctxcontext.Context,req*computepb.PatchNetworkAttachmentRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified NetworkAttachment resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchNetworkAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchNetworkAttachmentRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkAttachmentsClient) SetIamPolicy
func(c*NetworkAttachmentsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyNetworkAttachmentRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyNetworkAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyNetworkAttachmentRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkAttachmentsClient) TestIamPermissions
func(c*NetworkAttachmentsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsNetworkAttachmentRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsNetworkAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsNetworkAttachmentRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}NetworkAttachmentsScopedListPair
typeNetworkAttachmentsScopedListPairstruct{KeystringValue*computepb.NetworkAttachmentsScopedList}NetworkAttachmentsScopedListPair is a holder type for string/*computepb.NetworkAttachmentsScopedList map entries
NetworkAttachmentsScopedListPairIterator
typeNetworkAttachmentsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]NetworkAttachmentsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}NetworkAttachmentsScopedListPairIterator manages a stream of NetworkAttachmentsScopedListPair.
func (*NetworkAttachmentsScopedListPairIterator) All
func(it*NetworkAttachmentsScopedListPairIterator)All()iter.Seq2[NetworkAttachmentsScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NetworkAttachmentsScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NetworkAttachmentsScopedListPairIterator) PageInfo
func(it*NetworkAttachmentsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NetworkEdgeSecurityServicesCallOptions
typeNetworkEdgeSecurityServicesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionPatch[]gax.CallOption}NetworkEdgeSecurityServicesCallOptions contains the retry settings for each method of NetworkEdgeSecurityServicesClient.
NetworkEdgeSecurityServicesClient
typeNetworkEdgeSecurityServicesClientstruct{// The call options for this service.CallOptions*NetworkEdgeSecurityServicesCallOptions// contains filtered or unexported fields}NetworkEdgeSecurityServicesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The NetworkEdgeSecurityServices API.
func NewNetworkEdgeSecurityServicesRESTClient
funcNewNetworkEdgeSecurityServicesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*NetworkEdgeSecurityServicesClient,error)NewNetworkEdgeSecurityServicesRESTClient creates a new network edge security services rest client.
The NetworkEdgeSecurityServices API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewNetworkEdgeSecurityServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*NetworkEdgeSecurityServicesClient) AggregatedList
func(c*NetworkEdgeSecurityServicesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListNetworkEdgeSecurityServicesRequest,opts...gax.CallOption)*NetworkEdgeSecurityServicesScopedListPairIteratorAggregatedList retrieves the list of all NetworkEdgeSecurityService resources available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworkEdgeSecurityServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNetworkEdgeSecurityServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNetworkEdgeSecurityServicesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkEdgeSecurityServiceAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEdgeSecurityServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNetworkEdgeSecurityServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNetworkEdgeSecurityServicesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NetworkEdgeSecurityServicesClient) Close
func(c*NetworkEdgeSecurityServicesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*NetworkEdgeSecurityServicesClient) Connection (deprecated)
func(c*NetworkEdgeSecurityServicesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*NetworkEdgeSecurityServicesClient) Delete
func(c*NetworkEdgeSecurityServicesClient)Delete(ctxcontext.Context,req*computepb.DeleteNetworkEdgeSecurityServiceRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified service.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEdgeSecurityServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteNetworkEdgeSecurityServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteNetworkEdgeSecurityServiceRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkEdgeSecurityServicesClient) Get
func(c*NetworkEdgeSecurityServicesClient)Get(ctxcontext.Context,req*computepb.GetNetworkEdgeSecurityServiceRequest,opts...gax.CallOption)(*computepb.NetworkEdgeSecurityService,error)Get gets a specified NetworkEdgeSecurityService.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEdgeSecurityServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNetworkEdgeSecurityServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNetworkEdgeSecurityServiceRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkEdgeSecurityServicesClient) Insert
func(c*NetworkEdgeSecurityServicesClient)Insert(ctxcontext.Context,req*computepb.InsertNetworkEdgeSecurityServiceRequest,opts...gax.CallOption)(*Operation,error)Insert creates a new service in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEdgeSecurityServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertNetworkEdgeSecurityServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertNetworkEdgeSecurityServiceRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkEdgeSecurityServicesClient) Patch
func(c*NetworkEdgeSecurityServicesClient)Patch(ctxcontext.Context,req*computepb.PatchNetworkEdgeSecurityServiceRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified policy with the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEdgeSecurityServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchNetworkEdgeSecurityServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchNetworkEdgeSecurityServiceRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}NetworkEdgeSecurityServicesScopedListPair
typeNetworkEdgeSecurityServicesScopedListPairstruct{KeystringValue*computepb.NetworkEdgeSecurityServicesScopedList}NetworkEdgeSecurityServicesScopedListPair is a holder type for string/*computepb.NetworkEdgeSecurityServicesScopedList map entries
NetworkEdgeSecurityServicesScopedListPairIterator
typeNetworkEdgeSecurityServicesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]NetworkEdgeSecurityServicesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}NetworkEdgeSecurityServicesScopedListPairIterator manages a stream of NetworkEdgeSecurityServicesScopedListPair.
func (*NetworkEdgeSecurityServicesScopedListPairIterator) All
func(it*NetworkEdgeSecurityServicesScopedListPairIterator)All()iter.Seq2[NetworkEdgeSecurityServicesScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NetworkEdgeSecurityServicesScopedListPairIterator) Next
func(it*NetworkEdgeSecurityServicesScopedListPairIterator)Next()(NetworkEdgeSecurityServicesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NetworkEdgeSecurityServicesScopedListPairIterator) PageInfo
func(it*NetworkEdgeSecurityServicesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NetworkEndpointGroupIterator
typeNetworkEndpointGroupIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.NetworkEndpointGroup,nextPageTokenstring,errerror)// contains filtered or unexported fields}NetworkEndpointGroupIterator manages a stream of *computepb.NetworkEndpointGroup.
func (*NetworkEndpointGroupIterator) All
func(it*NetworkEndpointGroupIterator)All()iter.Seq2[*computepb.NetworkEndpointGroup,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NetworkEndpointGroupIterator) Next
func(it*NetworkEndpointGroupIterator)Next()(*computepb.NetworkEndpointGroup,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NetworkEndpointGroupIterator) PageInfo
func(it*NetworkEndpointGroupIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NetworkEndpointGroupsCallOptions
typeNetworkEndpointGroupsCallOptionsstruct{AggregatedList[]gax.CallOptionAttachNetworkEndpoints[]gax.CallOptionDelete[]gax.CallOptionDetachNetworkEndpoints[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListNetworkEndpoints[]gax.CallOptionTestIamPermissions[]gax.CallOption}NetworkEndpointGroupsCallOptions contains the retry settings for each method of NetworkEndpointGroupsClient.
NetworkEndpointGroupsClient
typeNetworkEndpointGroupsClientstruct{// The call options for this service.CallOptions*NetworkEndpointGroupsCallOptions// contains filtered or unexported fields}NetworkEndpointGroupsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The NetworkEndpointGroups API.
func NewNetworkEndpointGroupsRESTClient
funcNewNetworkEndpointGroupsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*NetworkEndpointGroupsClient,error)NewNetworkEndpointGroupsRESTClient creates a new network endpoint groups rest client.
The NetworkEndpointGroups API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*NetworkEndpointGroupsClient) AggregatedList
func(c*NetworkEndpointGroupsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListNetworkEndpointGroupsRequest,opts...gax.CallOption)*NetworkEndpointGroupsScopedListPairIteratorAggregatedList retrieves the list of network endpoint groups and sorts them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNetworkEndpointGroupsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkEndpointGroupAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNetworkEndpointGroupsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NetworkEndpointGroupsClient) AttachNetworkEndpoints
func(c*NetworkEndpointGroupsClient)AttachNetworkEndpoints(ctxcontext.Context,req*computepb.AttachNetworkEndpointsNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)AttachNetworkEndpoints attach a list of network endpoints to the specified network endpoint group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AttachNetworkEndpointsNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AttachNetworkEndpointsNetworkEndpointGroupRequest.}op,err:=c.AttachNetworkEndpoints(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkEndpointGroupsClient) Close
func(c*NetworkEndpointGroupsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*NetworkEndpointGroupsClient) Connection (deprecated)
func(c*NetworkEndpointGroupsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*NetworkEndpointGroupsClient) Delete
func(c*NetworkEndpointGroupsClient)Delete(ctxcontext.Context,req*computepb.DeleteNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified network endpoint group. The network endpoints in the NEG and the VM instances they belong to are not terminated when the NEG is deleted. Note that the NEG cannot be deleted if there are backend services referencing it.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteNetworkEndpointGroupRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkEndpointGroupsClient) DetachNetworkEndpoints
func(c*NetworkEndpointGroupsClient)DetachNetworkEndpoints(ctxcontext.Context,req*computepb.DetachNetworkEndpointsNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)DetachNetworkEndpoints detach a list of network endpoints from the specified network endpoint group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DetachNetworkEndpointsNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DetachNetworkEndpointsNetworkEndpointGroupRequest.}op,err:=c.DetachNetworkEndpoints(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkEndpointGroupsClient) Get
func(c*NetworkEndpointGroupsClient)Get(ctxcontext.Context,req*computepb.GetNetworkEndpointGroupRequest,opts...gax.CallOption)(*computepb.NetworkEndpointGroup,error)Get returns the specified network endpoint group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNetworkEndpointGroupRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkEndpointGroupsClient) Insert
func(c*NetworkEndpointGroupsClient)Insert(ctxcontext.Context,req*computepb.InsertNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)Insert creates a network endpoint group in the specified project using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertNetworkEndpointGroupRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkEndpointGroupsClient) List
func(c*NetworkEndpointGroupsClient)List(ctxcontext.Context,req*computepb.ListNetworkEndpointGroupsRequest,opts...gax.CallOption)*NetworkEndpointGroupIteratorList retrieves the list of network endpoint groups that are located in the specified project and zone.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkEndpointGroupsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkEndpointGroupList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkEndpointGroupsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NetworkEndpointGroupsClient) ListNetworkEndpoints
func(c*NetworkEndpointGroupsClient)ListNetworkEndpoints(ctxcontext.Context,req*computepb.ListNetworkEndpointsNetworkEndpointGroupsRequest,opts...gax.CallOption)*NetworkEndpointWithHealthStatusIteratorListNetworkEndpoints lists the network endpoints in the specified network endpoint group.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkEndpointsNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkEndpointsNetworkEndpointGroupsRequest.}it:=c.ListNetworkEndpoints(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkEndpointGroupsListNetworkEndpoints)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkEndpointsNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkEndpointsNetworkEndpointGroupsRequest.}forresp,err:=rangec.ListNetworkEndpoints(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NetworkEndpointGroupsClient) TestIamPermissions
func(c*NetworkEndpointGroupsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsNetworkEndpointGroupRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsNetworkEndpointGroupRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}NetworkEndpointGroupsScopedListPair
typeNetworkEndpointGroupsScopedListPairstruct{KeystringValue*computepb.NetworkEndpointGroupsScopedList}NetworkEndpointGroupsScopedListPair is a holder type for string/*computepb.NetworkEndpointGroupsScopedList map entries
NetworkEndpointGroupsScopedListPairIterator
typeNetworkEndpointGroupsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]NetworkEndpointGroupsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}NetworkEndpointGroupsScopedListPairIterator manages a stream of NetworkEndpointGroupsScopedListPair.
func (*NetworkEndpointGroupsScopedListPairIterator) All
func(it*NetworkEndpointGroupsScopedListPairIterator)All()iter.Seq2[NetworkEndpointGroupsScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NetworkEndpointGroupsScopedListPairIterator) Next
func(it*NetworkEndpointGroupsScopedListPairIterator)Next()(NetworkEndpointGroupsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NetworkEndpointGroupsScopedListPairIterator) PageInfo
func(it*NetworkEndpointGroupsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NetworkEndpointWithHealthStatusIterator
typeNetworkEndpointWithHealthStatusIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.NetworkEndpointWithHealthStatus,nextPageTokenstring,errerror)// contains filtered or unexported fields}NetworkEndpointWithHealthStatusIterator manages a stream of *computepb.NetworkEndpointWithHealthStatus.
func (*NetworkEndpointWithHealthStatusIterator) All
func(it*NetworkEndpointWithHealthStatusIterator)All()iter.Seq2[*computepb.NetworkEndpointWithHealthStatus,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NetworkEndpointWithHealthStatusIterator) Next
func(it*NetworkEndpointWithHealthStatusIterator)Next()(*computepb.NetworkEndpointWithHealthStatus,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NetworkEndpointWithHealthStatusIterator) PageInfo
func(it*NetworkEndpointWithHealthStatusIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NetworkFirewallPoliciesCallOptions
typeNetworkFirewallPoliciesCallOptionsstruct{AddAssociation[]gax.CallOptionAddPacketMirroringRule[]gax.CallOptionAddRule[]gax.CallOptionAggregatedList[]gax.CallOptionCloneRules[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetAssociation[]gax.CallOptionGetIamPolicy[]gax.CallOptionGetPacketMirroringRule[]gax.CallOptionGetRule[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionPatchPacketMirroringRule[]gax.CallOptionPatchRule[]gax.CallOptionRemoveAssociation[]gax.CallOptionRemovePacketMirroringRule[]gax.CallOptionRemoveRule[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOption}NetworkFirewallPoliciesCallOptions contains the retry settings for each method of NetworkFirewallPoliciesClient.
NetworkFirewallPoliciesClient
typeNetworkFirewallPoliciesClientstruct{// The call options for this service.CallOptions*NetworkFirewallPoliciesCallOptions// contains filtered or unexported fields}NetworkFirewallPoliciesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The NetworkFirewallPolicies API.
func NewNetworkFirewallPoliciesRESTClient
funcNewNetworkFirewallPoliciesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*NetworkFirewallPoliciesClient,error)NewNetworkFirewallPoliciesRESTClient creates a new network firewall policies rest client.
The NetworkFirewallPolicies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*NetworkFirewallPoliciesClient) AddAssociation
func(c*NetworkFirewallPoliciesClient)AddAssociation(ctxcontext.Context,req*computepb.AddAssociationNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)AddAssociation inserts an association for the specified firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddAssociationNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddAssociationNetworkFirewallPolicyRequest.}op,err:=c.AddAssociation(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) AddPacketMirroringRule
func(c*NetworkFirewallPoliciesClient)AddPacketMirroringRule(ctxcontext.Context,req*computepb.AddPacketMirroringRuleNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)AddPacketMirroringRule inserts a packet mirroring rule into a firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddPacketMirroringRuleNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddPacketMirroringRuleNetworkFirewallPolicyRequest.}op,err:=c.AddPacketMirroringRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) AddRule
func(c*NetworkFirewallPoliciesClient)AddRule(ctxcontext.Context,req*computepb.AddRuleNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)AddRule inserts a rule into a firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddRuleNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddRuleNetworkFirewallPolicyRequest.}op,err:=c.AddRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) AggregatedList
func(c*NetworkFirewallPoliciesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListNetworkFirewallPoliciesRequest,opts...gax.CallOption)*FirewallPoliciesScopedListPairIteratorAggregatedList retrieves an aggregated list of network firewall policies, listing network firewall policies from all applicable scopes (global and regional) and grouping the results per scope. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNetworkFirewallPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNetworkFirewallPoliciesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkFirewallPolicyAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNetworkFirewallPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNetworkFirewallPoliciesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NetworkFirewallPoliciesClient) CloneRules
func(c*NetworkFirewallPoliciesClient)CloneRules(ctxcontext.Context,req*computepb.CloneRulesNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)CloneRules copies rules to the specified firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.CloneRulesNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#CloneRulesNetworkFirewallPolicyRequest.}op,err:=c.CloneRules(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) Close
func(c*NetworkFirewallPoliciesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*NetworkFirewallPoliciesClient) Connection (deprecated)
func(c*NetworkFirewallPoliciesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*NetworkFirewallPoliciesClient) Delete
func(c*NetworkFirewallPoliciesClient)Delete(ctxcontext.Context,req*computepb.DeleteNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteNetworkFirewallPolicyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) Get
func(c*NetworkFirewallPoliciesClient)Get(ctxcontext.Context,req*computepb.GetNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPolicy,error)Get returns the specified network firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNetworkFirewallPolicyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkFirewallPoliciesClient) GetAssociation
func(c*NetworkFirewallPoliciesClient)GetAssociation(ctxcontext.Context,req*computepb.GetAssociationNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPolicyAssociation,error)GetAssociation gets an association with the specified name.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetAssociationNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetAssociationNetworkFirewallPolicyRequest.}resp,err:=c.GetAssociation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkFirewallPoliciesClient) GetIamPolicy
func(c*NetworkFirewallPoliciesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyNetworkFirewallPolicyRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkFirewallPoliciesClient) GetPacketMirroringRule
func(c*NetworkFirewallPoliciesClient)GetPacketMirroringRule(ctxcontext.Context,req*computepb.GetPacketMirroringRuleNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPolicyRule,error)GetPacketMirroringRule gets a packet mirroring rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetPacketMirroringRuleNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetPacketMirroringRuleNetworkFirewallPolicyRequest.}resp,err:=c.GetPacketMirroringRule(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkFirewallPoliciesClient) GetRule
func(c*NetworkFirewallPoliciesClient)GetRule(ctxcontext.Context,req*computepb.GetRuleNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPolicyRule,error)GetRule gets a rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRuleNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRuleNetworkFirewallPolicyRequest.}resp,err:=c.GetRule(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkFirewallPoliciesClient) Insert
func(c*NetworkFirewallPoliciesClient)Insert(ctxcontext.Context,req*computepb.InsertNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a new policy in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertNetworkFirewallPolicyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) List
func(c*NetworkFirewallPoliciesClient)List(ctxcontext.Context,req*computepb.ListNetworkFirewallPoliciesRequest,opts...gax.CallOption)*FirewallPolicyIteratorList lists all the policies that have been configured for the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkFirewallPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkFirewallPoliciesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.FirewallPolicyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkFirewallPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkFirewallPoliciesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NetworkFirewallPoliciesClient) Patch
func(c*NetworkFirewallPoliciesClient)Patch(ctxcontext.Context,req*computepb.PatchNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified policy with the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchNetworkFirewallPolicyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) PatchPacketMirroringRule
func(c*NetworkFirewallPoliciesClient)PatchPacketMirroringRule(ctxcontext.Context,req*computepb.PatchPacketMirroringRuleNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)PatchPacketMirroringRule patches a packet mirroring rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchPacketMirroringRuleNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchPacketMirroringRuleNetworkFirewallPolicyRequest.}op,err:=c.PatchPacketMirroringRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) PatchRule
func(c*NetworkFirewallPoliciesClient)PatchRule(ctxcontext.Context,req*computepb.PatchRuleNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)PatchRule patches a rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRuleNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRuleNetworkFirewallPolicyRequest.}op,err:=c.PatchRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) RemoveAssociation
func(c*NetworkFirewallPoliciesClient)RemoveAssociation(ctxcontext.Context,req*computepb.RemoveAssociationNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)RemoveAssociation removes an association for the specified firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveAssociationNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveAssociationNetworkFirewallPolicyRequest.}op,err:=c.RemoveAssociation(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) RemovePacketMirroringRule
func(c*NetworkFirewallPoliciesClient)RemovePacketMirroringRule(ctxcontext.Context,req*computepb.RemovePacketMirroringRuleNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)RemovePacketMirroringRule deletes a packet mirroring rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemovePacketMirroringRuleNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemovePacketMirroringRuleNetworkFirewallPolicyRequest.}op,err:=c.RemovePacketMirroringRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) RemoveRule
func(c*NetworkFirewallPoliciesClient)RemoveRule(ctxcontext.Context,req*computepb.RemoveRuleNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)RemoveRule deletes a rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveRuleNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveRuleNetworkFirewallPolicyRequest.}op,err:=c.RemoveRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworkFirewallPoliciesClient) SetIamPolicy
func(c*NetworkFirewallPoliciesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyNetworkFirewallPolicyRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkFirewallPoliciesClient) TestIamPermissions
func(c*NetworkFirewallPoliciesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsNetworkFirewallPolicyRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}NetworkIterator
typeNetworkIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Network,nextPageTokenstring,errerror)// contains filtered or unexported fields}NetworkIterator manages a stream of *computepb.Network.
func (*NetworkIterator) All
func(it*NetworkIterator)All()iter.Seq2[*computepb.Network,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NetworkIterator) Next
func(it*NetworkIterator)Next()(*computepb.Network,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NetworkIterator) PageInfo
func(it*NetworkIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NetworkProfileIterator
typeNetworkProfileIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.NetworkProfile,nextPageTokenstring,errerror)// contains filtered or unexported fields}NetworkProfileIterator manages a stream of *computepb.NetworkProfile.
func (*NetworkProfileIterator) All
func(it*NetworkProfileIterator)All()iter.Seq2[*computepb.NetworkProfile,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NetworkProfileIterator) Next
func(it*NetworkProfileIterator)Next()(*computepb.NetworkProfile,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NetworkProfileIterator) PageInfo
func(it*NetworkProfileIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NetworkProfilesCallOptions
typeNetworkProfilesCallOptionsstruct{Get[]gax.CallOptionList[]gax.CallOption}NetworkProfilesCallOptions contains the retry settings for each method of NetworkProfilesClient.
NetworkProfilesClient
typeNetworkProfilesClientstruct{// The call options for this service.CallOptions*NetworkProfilesCallOptions// contains filtered or unexported fields}NetworkProfilesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The NetworkProfiles API.
func NewNetworkProfilesRESTClient
funcNewNetworkProfilesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*NetworkProfilesClient,error)NewNetworkProfilesRESTClient creates a new network profiles rest client.
The NetworkProfiles API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewNetworkProfilesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*NetworkProfilesClient) Close
func(c*NetworkProfilesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*NetworkProfilesClient) Connection (deprecated)
func(c*NetworkProfilesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*NetworkProfilesClient) Get
func(c*NetworkProfilesClient)Get(ctxcontext.Context,req*computepb.GetNetworkProfileRequest,opts...gax.CallOption)(*computepb.NetworkProfile,error)Get returns the specified network profile.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkProfilesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNetworkProfileRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNetworkProfileRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworkProfilesClient) List
func(c*NetworkProfilesClient)List(ctxcontext.Context,req*computepb.ListNetworkProfilesRequest,opts...gax.CallOption)*NetworkProfileIteratorList retrieves a list of network profiles available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworkProfilesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkProfilesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkProfilesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkProfilesListResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworkProfilesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkProfilesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkProfilesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}NetworksCallOptions
typeNetworksCallOptionsstruct{AddPeering[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetEffectiveFirewalls[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListPeeringRoutes[]gax.CallOptionPatch[]gax.CallOptionRemovePeering[]gax.CallOptionSwitchToCustomMode[]gax.CallOptionUpdatePeering[]gax.CallOption}NetworksCallOptions contains the retry settings for each method of NetworksClient.
NetworksClient
typeNetworksClientstruct{// The call options for this service.CallOptions*NetworksCallOptions// contains filtered or unexported fields}NetworksClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Networks API.
func NewNetworksRESTClient
funcNewNetworksRESTClient(ctxcontext.Context,opts...option.ClientOption)(*NetworksClient,error)NewNetworksRESTClient creates a new networks rest client.
The Networks API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*NetworksClient) AddPeering
func(c*NetworksClient)AddPeering(ctxcontext.Context,req*computepb.AddPeeringNetworkRequest,opts...gax.CallOption)(*Operation,error)AddPeering adds a peering to the specified network.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddPeeringNetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddPeeringNetworkRequest.}op,err:=c.AddPeering(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworksClient) Close
func(c*NetworksClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*NetworksClient) Connection (deprecated)
func(c*NetworksClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*NetworksClient) Delete
func(c*NetworksClient)Delete(ctxcontext.Context,req*computepb.DeleteNetworkRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified network.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteNetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteNetworkRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworksClient) Get
func(c*NetworksClient)Get(ctxcontext.Context,req*computepb.GetNetworkRequest,opts...gax.CallOption)(*computepb.Network,error)Get returns the specified network.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNetworkRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworksClient) GetEffectiveFirewalls
func(c*NetworksClient)GetEffectiveFirewalls(ctxcontext.Context,req*computepb.GetEffectiveFirewallsNetworkRequest,opts...gax.CallOption)(*computepb.NetworksGetEffectiveFirewallsResponse,error)GetEffectiveFirewalls returns the effective firewalls on a given network.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetEffectiveFirewallsNetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetEffectiveFirewallsNetworkRequest.}resp,err:=c.GetEffectiveFirewalls(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NetworksClient) Insert
func(c*NetworksClient)Insert(ctxcontext.Context,req*computepb.InsertNetworkRequest,opts...gax.CallOption)(*Operation,error)Insert creates a network in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertNetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertNetworkRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworksClient) List
func(c*NetworksClient)List(ctxcontext.Context,req*computepb.ListNetworksRequest,opts...gax.CallOption)*NetworkIteratorList retrieves the list of networks available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworksRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworksRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NetworksClient) ListPeeringRoutes
func(c*NetworksClient)ListPeeringRoutes(ctxcontext.Context,req*computepb.ListPeeringRoutesNetworksRequest,opts...gax.CallOption)*ExchangedPeeringRouteIteratorListPeeringRoutes lists the peering routes exchanged over peering connection.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPeeringRoutesNetworksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPeeringRoutesNetworksRequest.}it:=c.ListPeeringRoutes(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ExchangedPeeringRoutesList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPeeringRoutesNetworksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPeeringRoutesNetworksRequest.}forresp,err:=rangec.ListPeeringRoutes(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NetworksClient) Patch
func(c*NetworksClient)Patch(ctxcontext.Context,req*computepb.PatchNetworkRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified network with the data included in the request. Only routingConfig can be modified.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchNetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchNetworkRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworksClient) RemovePeering
func(c*NetworksClient)RemovePeering(ctxcontext.Context,req*computepb.RemovePeeringNetworkRequest,opts...gax.CallOption)(*Operation,error)RemovePeering removes a peering from the specified network.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemovePeeringNetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemovePeeringNetworkRequest.}op,err:=c.RemovePeering(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworksClient) SwitchToCustomMode
func(c*NetworksClient)SwitchToCustomMode(ctxcontext.Context,req*computepb.SwitchToCustomModeNetworkRequest,opts...gax.CallOption)(*Operation,error)SwitchToCustomMode switches the network mode from auto subnet mode to custom subnet mode.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SwitchToCustomModeNetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SwitchToCustomModeNetworkRequest.}op,err:=c.SwitchToCustomMode(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NetworksClient) UpdatePeering
func(c*NetworksClient)UpdatePeering(ctxcontext.Context,req*computepb.UpdatePeeringNetworkRequest,opts...gax.CallOption)(*Operation,error)UpdatePeering updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdatePeeringNetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdatePeeringNetworkRequest.}op,err:=c.UpdatePeering(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}NodeGroupIterator
typeNodeGroupIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.NodeGroup,nextPageTokenstring,errerror)// contains filtered or unexported fields}NodeGroupIterator manages a stream of *computepb.NodeGroup.
func (*NodeGroupIterator) All
func(it*NodeGroupIterator)All()iter.Seq2[*computepb.NodeGroup,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NodeGroupIterator) Next
func(it*NodeGroupIterator)Next()(*computepb.NodeGroup,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NodeGroupIterator) PageInfo
func(it*NodeGroupIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NodeGroupNodeIterator
typeNodeGroupNodeIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.NodeGroupNode,nextPageTokenstring,errerror)// contains filtered or unexported fields}NodeGroupNodeIterator manages a stream of *computepb.NodeGroupNode.
func (*NodeGroupNodeIterator) All
func(it*NodeGroupNodeIterator)All()iter.Seq2[*computepb.NodeGroupNode,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NodeGroupNodeIterator) Next
func(it*NodeGroupNodeIterator)Next()(*computepb.NodeGroupNode,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NodeGroupNodeIterator) PageInfo
func(it*NodeGroupNodeIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NodeGroupsCallOptions
typeNodeGroupsCallOptionsstruct{AddNodes[]gax.CallOptionAggregatedList[]gax.CallOptionDelete[]gax.CallOptionDeleteNodes[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListNodes[]gax.CallOptionPatch[]gax.CallOptionPerformMaintenance[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetNodeTemplate[]gax.CallOptionSimulateMaintenanceEvent[]gax.CallOptionTestIamPermissions[]gax.CallOption}NodeGroupsCallOptions contains the retry settings for each method of NodeGroupsClient.
NodeGroupsClient
typeNodeGroupsClientstruct{// The call options for this service.CallOptions*NodeGroupsCallOptions// contains filtered or unexported fields}NodeGroupsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The NodeGroups API.
func NewNodeGroupsRESTClient
funcNewNodeGroupsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*NodeGroupsClient,error)NewNodeGroupsRESTClient creates a new node groups rest client.
The NodeGroups API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*NodeGroupsClient) AddNodes
func(c*NodeGroupsClient)AddNodes(ctxcontext.Context,req*computepb.AddNodesNodeGroupRequest,opts...gax.CallOption)(*Operation,error)AddNodes adds specified number of nodes to the node group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddNodesNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddNodesNodeGroupRequest.}op,err:=c.AddNodes(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NodeGroupsClient) AggregatedList
func(c*NodeGroupsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListNodeGroupsRequest,opts...gax.CallOption)*NodeGroupsScopedListPairIteratorAggregatedList retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details about each group. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNodeGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNodeGroupsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NodeGroupAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNodeGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNodeGroupsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NodeGroupsClient) Close
func(c*NodeGroupsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*NodeGroupsClient) Connection (deprecated)
func(c*NodeGroupsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*NodeGroupsClient) Delete
func(c*NodeGroupsClient)Delete(ctxcontext.Context,req*computepb.DeleteNodeGroupRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified NodeGroup resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteNodeGroupRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NodeGroupsClient) DeleteNodes
func(c*NodeGroupsClient)DeleteNodes(ctxcontext.Context,req*computepb.DeleteNodesNodeGroupRequest,opts...gax.CallOption)(*Operation,error)DeleteNodes deletes specified nodes from the node group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteNodesNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteNodesNodeGroupRequest.}op,err:=c.DeleteNodes(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NodeGroupsClient) Get
func(c*NodeGroupsClient)Get(ctxcontext.Context,req*computepb.GetNodeGroupRequest,opts...gax.CallOption)(*computepb.NodeGroup,error)Get returns the specified NodeGroup. Get a list of available NodeGroups by making a list() request. Note: the “nodes” field should not be used. Use nodeGroups.listNodes instead.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNodeGroupRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NodeGroupsClient) GetIamPolicy
func(c*NodeGroupsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyNodeGroupRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyNodeGroupRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NodeGroupsClient) Insert
func(c*NodeGroupsClient)Insert(ctxcontext.Context,req*computepb.InsertNodeGroupRequest,opts...gax.CallOption)(*Operation,error)Insert creates a NodeGroup resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertNodeGroupRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NodeGroupsClient) List
func(c*NodeGroupsClient)List(ctxcontext.Context,req*computepb.ListNodeGroupsRequest,opts...gax.CallOption)*NodeGroupIteratorList retrieves a list of node groups available to the specified project. Note: use nodeGroups.listNodes for more details about each group.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNodeGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNodeGroupsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NodeGroupList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNodeGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNodeGroupsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NodeGroupsClient) ListNodes
func(c*NodeGroupsClient)ListNodes(ctxcontext.Context,req*computepb.ListNodesNodeGroupsRequest,opts...gax.CallOption)*NodeGroupNodeIteratorListNodes lists nodes in the node group.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNodesNodeGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNodesNodeGroupsRequest.}it:=c.ListNodes(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NodeGroupsListNodes)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNodesNodeGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNodesNodeGroupsRequest.}forresp,err:=rangec.ListNodes(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NodeGroupsClient) Patch
func(c*NodeGroupsClient)Patch(ctxcontext.Context,req*computepb.PatchNodeGroupRequest,opts...gax.CallOption)(*Operation,error)Patch updates the specified node group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchNodeGroupRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NodeGroupsClient) PerformMaintenance
func(c*NodeGroupsClient)PerformMaintenance(ctxcontext.Context,req*computepb.PerformMaintenanceNodeGroupRequest,opts...gax.CallOption)(*Operation,error)PerformMaintenance perform maintenance on a subset of nodes in the node group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PerformMaintenanceNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PerformMaintenanceNodeGroupRequest.}op,err:=c.PerformMaintenance(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NodeGroupsClient) SetIamPolicy
func(c*NodeGroupsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyNodeGroupRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyNodeGroupRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NodeGroupsClient) SetNodeTemplate
func(c*NodeGroupsClient)SetNodeTemplate(ctxcontext.Context,req*computepb.SetNodeTemplateNodeGroupRequest,opts...gax.CallOption)(*Operation,error)SetNodeTemplate updates the node template of the node group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetNodeTemplateNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetNodeTemplateNodeGroupRequest.}op,err:=c.SetNodeTemplate(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NodeGroupsClient) SimulateMaintenanceEvent
func(c*NodeGroupsClient)SimulateMaintenanceEvent(ctxcontext.Context,req*computepb.SimulateMaintenanceEventNodeGroupRequest,opts...gax.CallOption)(*Operation,error)SimulateMaintenanceEvent simulates maintenance event on specified nodes from the node group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SimulateMaintenanceEventNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SimulateMaintenanceEventNodeGroupRequest.}op,err:=c.SimulateMaintenanceEvent(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NodeGroupsClient) TestIamPermissions
func(c*NodeGroupsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsNodeGroupRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsNodeGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsNodeGroupRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}NodeGroupsScopedListPair
typeNodeGroupsScopedListPairstruct{KeystringValue*computepb.NodeGroupsScopedList}NodeGroupsScopedListPair is a holder type for string/*computepb.NodeGroupsScopedList map entries
NodeGroupsScopedListPairIterator
typeNodeGroupsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]NodeGroupsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}NodeGroupsScopedListPairIterator manages a stream of NodeGroupsScopedListPair.
func (*NodeGroupsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NodeGroupsScopedListPairIterator) Next
func(it*NodeGroupsScopedListPairIterator)Next()(NodeGroupsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NodeGroupsScopedListPairIterator) PageInfo
func(it*NodeGroupsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NodeTemplateIterator
typeNodeTemplateIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.NodeTemplate,nextPageTokenstring,errerror)// contains filtered or unexported fields}NodeTemplateIterator manages a stream of *computepb.NodeTemplate.
func (*NodeTemplateIterator) All
func(it*NodeTemplateIterator)All()iter.Seq2[*computepb.NodeTemplate,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NodeTemplateIterator) Next
func(it*NodeTemplateIterator)Next()(*computepb.NodeTemplate,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NodeTemplateIterator) PageInfo
func(it*NodeTemplateIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NodeTemplatesCallOptions
typeNodeTemplatesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOption}NodeTemplatesCallOptions contains the retry settings for each method of NodeTemplatesClient.
NodeTemplatesClient
typeNodeTemplatesClientstruct{// The call options for this service.CallOptions*NodeTemplatesCallOptions// contains filtered or unexported fields}NodeTemplatesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The NodeTemplates API.
func NewNodeTemplatesRESTClient
funcNewNodeTemplatesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*NodeTemplatesClient,error)NewNodeTemplatesRESTClient creates a new node templates rest client.
The NodeTemplates API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*NodeTemplatesClient) AggregatedList
func(c*NodeTemplatesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListNodeTemplatesRequest,opts...gax.CallOption)*NodeTemplatesScopedListPairIteratorAggregatedList retrieves an aggregated list of node templates. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNodeTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNodeTemplatesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NodeTemplateAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNodeTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNodeTemplatesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NodeTemplatesClient) Close
func(c*NodeTemplatesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*NodeTemplatesClient) Connection (deprecated)
func(c*NodeTemplatesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*NodeTemplatesClient) Delete
func(c*NodeTemplatesClient)Delete(ctxcontext.Context,req*computepb.DeleteNodeTemplateRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified NodeTemplate resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteNodeTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteNodeTemplateRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NodeTemplatesClient) Get
func(c*NodeTemplatesClient)Get(ctxcontext.Context,req*computepb.GetNodeTemplateRequest,opts...gax.CallOption)(*computepb.NodeTemplate,error)Get returns the specified node template.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNodeTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNodeTemplateRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NodeTemplatesClient) GetIamPolicy
func(c*NodeTemplatesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyNodeTemplateRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyNodeTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyNodeTemplateRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NodeTemplatesClient) Insert
func(c*NodeTemplatesClient)Insert(ctxcontext.Context,req*computepb.InsertNodeTemplateRequest,opts...gax.CallOption)(*Operation,error)Insert creates a NodeTemplate resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertNodeTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertNodeTemplateRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*NodeTemplatesClient) List
func(c*NodeTemplatesClient)List(ctxcontext.Context,req*computepb.ListNodeTemplatesRequest,opts...gax.CallOption)*NodeTemplateIteratorList retrieves a list of node templates available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNodeTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNodeTemplatesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NodeTemplateList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNodeTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNodeTemplatesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NodeTemplatesClient) SetIamPolicy
func(c*NodeTemplatesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyNodeTemplateRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyNodeTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyNodeTemplateRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NodeTemplatesClient) TestIamPermissions
func(c*NodeTemplatesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsNodeTemplateRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsNodeTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsNodeTemplateRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}NodeTemplatesScopedListPair
typeNodeTemplatesScopedListPairstruct{KeystringValue*computepb.NodeTemplatesScopedList}NodeTemplatesScopedListPair is a holder type for string/*computepb.NodeTemplatesScopedList map entries
NodeTemplatesScopedListPairIterator
typeNodeTemplatesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]NodeTemplatesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}NodeTemplatesScopedListPairIterator manages a stream of NodeTemplatesScopedListPair.
func (*NodeTemplatesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NodeTemplatesScopedListPairIterator) Next
func(it*NodeTemplatesScopedListPairIterator)Next()(NodeTemplatesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NodeTemplatesScopedListPairIterator) PageInfo
func(it*NodeTemplatesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NodeTypeIterator
typeNodeTypeIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.NodeType,nextPageTokenstring,errerror)// contains filtered or unexported fields}NodeTypeIterator manages a stream of *computepb.NodeType.
func (*NodeTypeIterator) All
func(it*NodeTypeIterator)All()iter.Seq2[*computepb.NodeType,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NodeTypeIterator) Next
func(it*NodeTypeIterator)Next()(*computepb.NodeType,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NodeTypeIterator) PageInfo
func(it*NodeTypeIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NodeTypesCallOptions
typeNodeTypesCallOptionsstruct{AggregatedList[]gax.CallOptionGet[]gax.CallOptionList[]gax.CallOption}NodeTypesCallOptions contains the retry settings for each method of NodeTypesClient.
NodeTypesClient
typeNodeTypesClientstruct{// The call options for this service.CallOptions*NodeTypesCallOptions// contains filtered or unexported fields}NodeTypesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The NodeTypes API.
func NewNodeTypesRESTClient
funcNewNodeTypesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*NodeTypesClient,error)NewNodeTypesRESTClient creates a new node types rest client.
The NodeTypes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewNodeTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*NodeTypesClient) AggregatedList
func(c*NodeTypesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListNodeTypesRequest,opts...gax.CallOption)*NodeTypesScopedListPairIteratorAggregatedList retrieves an aggregated list of node types. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNodeTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNodeTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNodeTypesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NodeTypeAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListNodeTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListNodeTypesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*NodeTypesClient) Close
func(c*NodeTypesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*NodeTypesClient) Connection (deprecated)
func(c*NodeTypesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*NodeTypesClient) Get
func(c*NodeTypesClient)Get(ctxcontext.Context,req*computepb.GetNodeTypeRequest,opts...gax.CallOption)(*computepb.NodeType,error)Get returns the specified node type.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNodeTypeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNodeTypeRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*NodeTypesClient) List
func(c*NodeTypesClient)List(ctxcontext.Context,req*computepb.ListNodeTypesRequest,opts...gax.CallOption)*NodeTypeIteratorList retrieves a list of node types available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewNodeTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNodeTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNodeTypesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NodeTypeList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewNodeTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNodeTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNodeTypesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}NodeTypesScopedListPair
typeNodeTypesScopedListPairstruct{KeystringValue*computepb.NodeTypesScopedList}NodeTypesScopedListPair is a holder type for string/*computepb.NodeTypesScopedList map entries
NodeTypesScopedListPairIterator
typeNodeTypesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]NodeTypesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}NodeTypesScopedListPairIterator manages a stream of NodeTypesScopedListPair.
func (*NodeTypesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NodeTypesScopedListPairIterator) Next
func(it*NodeTypesScopedListPairIterator)Next()(NodeTypesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NodeTypesScopedListPairIterator) PageInfo
func(it*NodeTypesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
NotificationEndpointIterator
typeNotificationEndpointIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.NotificationEndpoint,nextPageTokenstring,errerror)// contains filtered or unexported fields}NotificationEndpointIterator manages a stream of *computepb.NotificationEndpoint.
func (*NotificationEndpointIterator) All
func(it*NotificationEndpointIterator)All()iter.Seq2[*computepb.NotificationEndpoint,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*NotificationEndpointIterator) Next
func(it*NotificationEndpointIterator)Next()(*computepb.NotificationEndpoint,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*NotificationEndpointIterator) PageInfo
func(it*NotificationEndpointIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
Operation
typeOperationstruct{// contains filtered or unexported fields}Operation represents a long-running operation for this API.
func (*Operation) Done
Done reports whether the long-running operation has completed.
func (*Operation) Name
Name returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*Operation) Wait
Wait blocks until the operation is complete, polling regularlyafter an initial period of backing off between attempts.
OperationIterator
typeOperationIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Operation,nextPageTokenstring,errerror)// contains filtered or unexported fields}OperationIterator manages a stream of *computepb.Operation.
func (*OperationIterator) All
func(it*OperationIterator)All()iter.Seq2[*computepb.Operation,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*OperationIterator) Next
func(it*OperationIterator)Next()(*computepb.Operation,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo
func(it*OperationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
OperationsScopedListPair
typeOperationsScopedListPairstruct{KeystringValue*computepb.OperationsScopedList}OperationsScopedListPair is a holder type for string/*computepb.OperationsScopedList map entries
OperationsScopedListPairIterator
typeOperationsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]OperationsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}OperationsScopedListPairIterator manages a stream of OperationsScopedListPair.
func (*OperationsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*OperationsScopedListPairIterator) Next
func(it*OperationsScopedListPairIterator)Next()(OperationsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*OperationsScopedListPairIterator) PageInfo
func(it*OperationsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
PacketMirroringIterator
typePacketMirroringIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.PacketMirroring,nextPageTokenstring,errerror)// contains filtered or unexported fields}PacketMirroringIterator manages a stream of *computepb.PacketMirroring.
func (*PacketMirroringIterator) All
func(it*PacketMirroringIterator)All()iter.Seq2[*computepb.PacketMirroring,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*PacketMirroringIterator) Next
func(it*PacketMirroringIterator)Next()(*computepb.PacketMirroring,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*PacketMirroringIterator) PageInfo
func(it*PacketMirroringIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
PacketMirroringsCallOptions
typePacketMirroringsCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionTestIamPermissions[]gax.CallOption}PacketMirroringsCallOptions contains the retry settings for each method of PacketMirroringsClient.
PacketMirroringsClient
typePacketMirroringsClientstruct{// The call options for this service.CallOptions*PacketMirroringsCallOptions// contains filtered or unexported fields}PacketMirroringsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The PacketMirrorings API.
func NewPacketMirroringsRESTClient
funcNewPacketMirroringsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*PacketMirroringsClient,error)NewPacketMirroringsRESTClient creates a new packet mirrorings rest client.
The PacketMirrorings API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewPacketMirroringsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*PacketMirroringsClient) AggregatedList
func(c*PacketMirroringsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListPacketMirroringsRequest,opts...gax.CallOption)*PacketMirroringsScopedListPairIteratorAggregatedList retrieves an aggregated list of packetMirrorings. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewPacketMirroringsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListPacketMirroringsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListPacketMirroringsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.PacketMirroringAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPacketMirroringsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListPacketMirroringsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListPacketMirroringsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*PacketMirroringsClient) Close
func(c*PacketMirroringsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*PacketMirroringsClient) Connection (deprecated)
func(c*PacketMirroringsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*PacketMirroringsClient) Delete
func(c*PacketMirroringsClient)Delete(ctxcontext.Context,req*computepb.DeletePacketMirroringRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified PacketMirroring resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPacketMirroringsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeletePacketMirroringRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeletePacketMirroringRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PacketMirroringsClient) Get
func(c*PacketMirroringsClient)Get(ctxcontext.Context,req*computepb.GetPacketMirroringRequest,opts...gax.CallOption)(*computepb.PacketMirroring,error)Get returns the specified PacketMirroring resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPacketMirroringsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetPacketMirroringRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetPacketMirroringRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*PacketMirroringsClient) Insert
func(c*PacketMirroringsClient)Insert(ctxcontext.Context,req*computepb.InsertPacketMirroringRequest,opts...gax.CallOption)(*Operation,error)Insert creates a PacketMirroring resource in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPacketMirroringsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertPacketMirroringRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertPacketMirroringRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PacketMirroringsClient) List
func(c*PacketMirroringsClient)List(ctxcontext.Context,req*computepb.ListPacketMirroringsRequest,opts...gax.CallOption)*PacketMirroringIteratorList retrieves a list of PacketMirroring resources available to the specified project and region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewPacketMirroringsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPacketMirroringsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPacketMirroringsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.PacketMirroringList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPacketMirroringsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPacketMirroringsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPacketMirroringsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*PacketMirroringsClient) Patch
func(c*PacketMirroringsClient)Patch(ctxcontext.Context,req*computepb.PatchPacketMirroringRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified PacketMirroring resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPacketMirroringsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchPacketMirroringRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchPacketMirroringRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PacketMirroringsClient) TestIamPermissions
func(c*PacketMirroringsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsPacketMirroringRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPacketMirroringsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsPacketMirroringRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsPacketMirroringRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}PacketMirroringsScopedListPair
typePacketMirroringsScopedListPairstruct{KeystringValue*computepb.PacketMirroringsScopedList}PacketMirroringsScopedListPair is a holder type for string/*computepb.PacketMirroringsScopedList map entries
PacketMirroringsScopedListPairIterator
typePacketMirroringsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]PacketMirroringsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}PacketMirroringsScopedListPairIterator manages a stream of PacketMirroringsScopedListPair.
func (*PacketMirroringsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*PacketMirroringsScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*PacketMirroringsScopedListPairIterator) PageInfo
func(it*PacketMirroringsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
PerInstanceConfigIterator
typePerInstanceConfigIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.PerInstanceConfig,nextPageTokenstring,errerror)// contains filtered or unexported fields}PerInstanceConfigIterator manages a stream of *computepb.PerInstanceConfig.
func (*PerInstanceConfigIterator) All
func(it*PerInstanceConfigIterator)All()iter.Seq2[*computepb.PerInstanceConfig,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*PerInstanceConfigIterator) Next
func(it*PerInstanceConfigIterator)Next()(*computepb.PerInstanceConfig,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*PerInstanceConfigIterator) PageInfo
func(it*PerInstanceConfigIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ProjectIterator
typeProjectIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Project,nextPageTokenstring,errerror)// contains filtered or unexported fields}ProjectIterator manages a stream of *computepb.Project.
func (*ProjectIterator) All
func(it*ProjectIterator)All()iter.Seq2[*computepb.Project,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ProjectIterator) Next
func(it*ProjectIterator)Next()(*computepb.Project,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ProjectIterator) PageInfo
func(it*ProjectIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ProjectsCallOptions
typeProjectsCallOptionsstruct{DisableXpnHost[]gax.CallOptionDisableXpnResource[]gax.CallOptionEnableXpnHost[]gax.CallOptionEnableXpnResource[]gax.CallOptionGet[]gax.CallOptionGetXpnHost[]gax.CallOptionGetXpnResources[]gax.CallOptionListXpnHosts[]gax.CallOptionMoveDisk[]gax.CallOptionMoveInstance[]gax.CallOptionSetCloudArmorTier[]gax.CallOptionSetCommonInstanceMetadata[]gax.CallOptionSetDefaultNetworkTier[]gax.CallOptionSetUsageExportBucket[]gax.CallOption}ProjectsCallOptions contains the retry settings for each method of ProjectsClient.
ProjectsClient
typeProjectsClientstruct{// The call options for this service.CallOptions*ProjectsCallOptions// contains filtered or unexported fields}ProjectsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Projects API.
func NewProjectsRESTClient
funcNewProjectsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ProjectsClient,error)NewProjectsRESTClient creates a new projects rest client.
The Projects API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ProjectsClient) Close
func(c*ProjectsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ProjectsClient) Connection (deprecated)
func(c*ProjectsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ProjectsClient) DisableXpnHost
func(c*ProjectsClient)DisableXpnHost(ctxcontext.Context,req*computepb.DisableXpnHostProjectRequest,opts...gax.CallOption)(*Operation,error)DisableXpnHost disable this project as a shared VPC host project.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DisableXpnHostProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DisableXpnHostProjectRequest.}op,err:=c.DisableXpnHost(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ProjectsClient) DisableXpnResource
func(c*ProjectsClient)DisableXpnResource(ctxcontext.Context,req*computepb.DisableXpnResourceProjectRequest,opts...gax.CallOption)(*Operation,error)DisableXpnResource disable a service resource (also known as service project) associated with this host project.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DisableXpnResourceProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DisableXpnResourceProjectRequest.}op,err:=c.DisableXpnResource(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ProjectsClient) EnableXpnHost
func(c*ProjectsClient)EnableXpnHost(ctxcontext.Context,req*computepb.EnableXpnHostProjectRequest,opts...gax.CallOption)(*Operation,error)EnableXpnHost enable this project as a shared VPC host project.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.EnableXpnHostProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#EnableXpnHostProjectRequest.}op,err:=c.EnableXpnHost(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ProjectsClient) EnableXpnResource
func(c*ProjectsClient)EnableXpnResource(ctxcontext.Context,req*computepb.EnableXpnResourceProjectRequest,opts...gax.CallOption)(*Operation,error)EnableXpnResource enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.EnableXpnResourceProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#EnableXpnResourceProjectRequest.}op,err:=c.EnableXpnResource(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ProjectsClient) Get
func(c*ProjectsClient)Get(ctxcontext.Context,req*computepb.GetProjectRequest,opts...gax.CallOption)(*computepb.Project,error)Get returns the specified Project resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas field). To exclude one or more fields, set your request’s fields query parameter to only include the fields you need. For example, to only include the id and selfLink fields, add the query parameter ?fields=id,selfLink to your request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetProjectRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ProjectsClient) GetXpnHost
func(c*ProjectsClient)GetXpnHost(ctxcontext.Context,req*computepb.GetXpnHostProjectRequest,opts...gax.CallOption)(*computepb.Project,error)GetXpnHost gets the shared VPC host project that this project links to. May be empty if no link exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetXpnHostProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetXpnHostProjectRequest.}resp,err:=c.GetXpnHost(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ProjectsClient) GetXpnResources
func(c*ProjectsClient)GetXpnResources(ctxcontext.Context,req*computepb.GetXpnResourcesProjectsRequest,opts...gax.CallOption)*XpnResourceIdIteratorGetXpnResources gets service resources (a.k.a service project) associated with this host project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetXpnResourcesProjectsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetXpnResourcesProjectsRequest.}it:=c.GetXpnResources(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ProjectsGetXpnResources)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetXpnResourcesProjectsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetXpnResourcesProjectsRequest.}forresp,err:=rangec.GetXpnResources(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ProjectsClient) ListXpnHosts
func(c*ProjectsClient)ListXpnHosts(ctxcontext.Context,req*computepb.ListXpnHostsProjectsRequest,opts...gax.CallOption)*ProjectIteratorListXpnHosts lists all shared VPC host projects visible to the user in an organization.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListXpnHostsProjectsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListXpnHostsProjectsRequest.}it:=c.ListXpnHosts(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.XpnHostList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListXpnHostsProjectsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListXpnHostsProjectsRequest.}forresp,err:=rangec.ListXpnHosts(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ProjectsClient) MoveDisk
func(c*ProjectsClient)MoveDisk(ctxcontext.Context,req*computepb.MoveDiskProjectRequest,opts...gax.CallOption)(*Operation,error)MoveDisk moves a persistent disk from one zone to another.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.MoveDiskProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#MoveDiskProjectRequest.}op,err:=c.MoveDisk(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ProjectsClient) MoveInstance
func(c*ProjectsClient)MoveInstance(ctxcontext.Context,req*computepb.MoveInstanceProjectRequest,opts...gax.CallOption)(*Operation,error)MoveInstance moves an instance and its attached persistent disks from one zone to another. Note: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the known issue (at /compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior). [Deprecated] This method is deprecated. See moving instance across zones (at /compute/docs/instances/moving-instance-across-zones) instead.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.MoveInstanceProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#MoveInstanceProjectRequest.}op,err:=c.MoveInstance(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ProjectsClient) SetCloudArmorTier
func(c*ProjectsClient)SetCloudArmorTier(ctxcontext.Context,req*computepb.SetCloudArmorTierProjectRequest,opts...gax.CallOption)(*Operation,error)SetCloudArmorTier sets the Cloud Armor tier of the project. To set ENTERPRISE or above the billing account of the project must be subscribed to Cloud Armor Enterprise. See Subscribing to Cloud Armor Enterprise for more information.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetCloudArmorTierProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetCloudArmorTierProjectRequest.}op,err:=c.SetCloudArmorTier(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ProjectsClient) SetCommonInstanceMetadata
func(c*ProjectsClient)SetCommonInstanceMetadata(ctxcontext.Context,req*computepb.SetCommonInstanceMetadataProjectRequest,opts...gax.CallOption)(*Operation,error)SetCommonInstanceMetadata sets metadata common to all instances within the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetCommonInstanceMetadataProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetCommonInstanceMetadataProjectRequest.}op,err:=c.SetCommonInstanceMetadata(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ProjectsClient) SetDefaultNetworkTier
func(c*ProjectsClient)SetDefaultNetworkTier(ctxcontext.Context,req*computepb.SetDefaultNetworkTierProjectRequest,opts...gax.CallOption)(*Operation,error)SetDefaultNetworkTier sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetDefaultNetworkTierProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetDefaultNetworkTierProjectRequest.}op,err:=c.SetDefaultNetworkTier(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ProjectsClient) SetUsageExportBucket
func(c*ProjectsClient)SetUsageExportBucket(ctxcontext.Context,req*computepb.SetUsageExportBucketProjectRequest,opts...gax.CallOption)(*Operation,error)SetUsageExportBucket enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewProjectsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetUsageExportBucketProjectRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetUsageExportBucketProjectRequest.}op,err:=c.SetUsageExportBucket(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}PublicAdvertisedPrefixIterator
typePublicAdvertisedPrefixIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.PublicAdvertisedPrefix,nextPageTokenstring,errerror)// contains filtered or unexported fields}PublicAdvertisedPrefixIterator manages a stream of *computepb.PublicAdvertisedPrefix.
func (*PublicAdvertisedPrefixIterator) All
func(it*PublicAdvertisedPrefixIterator)All()iter.Seq2[*computepb.PublicAdvertisedPrefix,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*PublicAdvertisedPrefixIterator) Next
func(it*PublicAdvertisedPrefixIterator)Next()(*computepb.PublicAdvertisedPrefix,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*PublicAdvertisedPrefixIterator) PageInfo
func(it*PublicAdvertisedPrefixIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
PublicAdvertisedPrefixesCallOptions
typePublicAdvertisedPrefixesCallOptionsstruct{Announce[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionWithdraw[]gax.CallOption}PublicAdvertisedPrefixesCallOptions contains the retry settings for each method of PublicAdvertisedPrefixesClient.
PublicAdvertisedPrefixesClient
typePublicAdvertisedPrefixesClientstruct{// The call options for this service.CallOptions*PublicAdvertisedPrefixesCallOptions// contains filtered or unexported fields}PublicAdvertisedPrefixesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The PublicAdvertisedPrefixes API.
func NewPublicAdvertisedPrefixesRESTClient
funcNewPublicAdvertisedPrefixesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*PublicAdvertisedPrefixesClient,error)NewPublicAdvertisedPrefixesRESTClient creates a new public advertised prefixes rest client.
The PublicAdvertisedPrefixes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewPublicAdvertisedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*PublicAdvertisedPrefixesClient) Announce
func(c*PublicAdvertisedPrefixesClient)Announce(ctxcontext.Context,req*computepb.AnnouncePublicAdvertisedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Announce announces the specified PublicAdvertisedPrefix
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicAdvertisedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AnnouncePublicAdvertisedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AnnouncePublicAdvertisedPrefixeRequest.}op,err:=c.Announce(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PublicAdvertisedPrefixesClient) Close
func(c*PublicAdvertisedPrefixesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*PublicAdvertisedPrefixesClient) Connection (deprecated)
func(c*PublicAdvertisedPrefixesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*PublicAdvertisedPrefixesClient) Delete
func(c*PublicAdvertisedPrefixesClient)Delete(ctxcontext.Context,req*computepb.DeletePublicAdvertisedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified PublicAdvertisedPrefix
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicAdvertisedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeletePublicAdvertisedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeletePublicAdvertisedPrefixeRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PublicAdvertisedPrefixesClient) Get
func(c*PublicAdvertisedPrefixesClient)Get(ctxcontext.Context,req*computepb.GetPublicAdvertisedPrefixeRequest,opts...gax.CallOption)(*computepb.PublicAdvertisedPrefix,error)Get returns the specified PublicAdvertisedPrefix resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicAdvertisedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetPublicAdvertisedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetPublicAdvertisedPrefixeRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*PublicAdvertisedPrefixesClient) Insert
func(c*PublicAdvertisedPrefixesClient)Insert(ctxcontext.Context,req*computepb.InsertPublicAdvertisedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Insert creates a PublicAdvertisedPrefix in the specified project using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicAdvertisedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertPublicAdvertisedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertPublicAdvertisedPrefixeRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PublicAdvertisedPrefixesClient) List
func(c*PublicAdvertisedPrefixesClient)List(ctxcontext.Context,req*computepb.ListPublicAdvertisedPrefixesRequest,opts...gax.CallOption)*PublicAdvertisedPrefixIteratorList lists the PublicAdvertisedPrefixes for a project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewPublicAdvertisedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPublicAdvertisedPrefixesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPublicAdvertisedPrefixesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.PublicAdvertisedPrefixList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicAdvertisedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPublicAdvertisedPrefixesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPublicAdvertisedPrefixesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*PublicAdvertisedPrefixesClient) Patch
func(c*PublicAdvertisedPrefixesClient)Patch(ctxcontext.Context,req*computepb.PatchPublicAdvertisedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicAdvertisedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchPublicAdvertisedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchPublicAdvertisedPrefixeRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PublicAdvertisedPrefixesClient) Withdraw
func(c*PublicAdvertisedPrefixesClient)Withdraw(ctxcontext.Context,req*computepb.WithdrawPublicAdvertisedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Withdraw withdraws the specified PublicAdvertisedPrefix
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicAdvertisedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.WithdrawPublicAdvertisedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#WithdrawPublicAdvertisedPrefixeRequest.}op,err:=c.Withdraw(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}PublicDelegatedPrefixIterator
typePublicDelegatedPrefixIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.PublicDelegatedPrefix,nextPageTokenstring,errerror)// contains filtered or unexported fields}PublicDelegatedPrefixIterator manages a stream of *computepb.PublicDelegatedPrefix.
func (*PublicDelegatedPrefixIterator) All
func(it*PublicDelegatedPrefixIterator)All()iter.Seq2[*computepb.PublicDelegatedPrefix,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*PublicDelegatedPrefixIterator) Next
func(it*PublicDelegatedPrefixIterator)Next()(*computepb.PublicDelegatedPrefix,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*PublicDelegatedPrefixIterator) PageInfo
func(it*PublicDelegatedPrefixIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
PublicDelegatedPrefixesCallOptions
typePublicDelegatedPrefixesCallOptionsstruct{AggregatedList[]gax.CallOptionAnnounce[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionWithdraw[]gax.CallOption}PublicDelegatedPrefixesCallOptions contains the retry settings for each method of PublicDelegatedPrefixesClient.
PublicDelegatedPrefixesClient
typePublicDelegatedPrefixesClientstruct{// The call options for this service.CallOptions*PublicDelegatedPrefixesCallOptions// contains filtered or unexported fields}PublicDelegatedPrefixesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The PublicDelegatedPrefixes API.
func NewPublicDelegatedPrefixesRESTClient
funcNewPublicDelegatedPrefixesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*PublicDelegatedPrefixesClient,error)NewPublicDelegatedPrefixesRESTClient creates a new public delegated prefixes rest client.
The PublicDelegatedPrefixes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*PublicDelegatedPrefixesClient) AggregatedList
func(c*PublicDelegatedPrefixesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListPublicDelegatedPrefixesRequest,opts...gax.CallOption)*PublicDelegatedPrefixesScopedListPairIteratorAggregatedList lists all PublicDelegatedPrefix resources owned by the specific project across all scopes. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListPublicDelegatedPrefixesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListPublicDelegatedPrefixesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.PublicDelegatedPrefixAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListPublicDelegatedPrefixesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListPublicDelegatedPrefixesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*PublicDelegatedPrefixesClient) Announce
func(c*PublicDelegatedPrefixesClient)Announce(ctxcontext.Context,req*computepb.AnnouncePublicDelegatedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Announce announces the specified PublicDelegatedPrefix in the given region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AnnouncePublicDelegatedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AnnouncePublicDelegatedPrefixeRequest.}op,err:=c.Announce(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PublicDelegatedPrefixesClient) Close
func(c*PublicDelegatedPrefixesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*PublicDelegatedPrefixesClient) Connection (deprecated)
func(c*PublicDelegatedPrefixesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*PublicDelegatedPrefixesClient) Delete
func(c*PublicDelegatedPrefixesClient)Delete(ctxcontext.Context,req*computepb.DeletePublicDelegatedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified PublicDelegatedPrefix in the given region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeletePublicDelegatedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeletePublicDelegatedPrefixeRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PublicDelegatedPrefixesClient) Get
func(c*PublicDelegatedPrefixesClient)Get(ctxcontext.Context,req*computepb.GetPublicDelegatedPrefixeRequest,opts...gax.CallOption)(*computepb.PublicDelegatedPrefix,error)Get returns the specified PublicDelegatedPrefix resource in the given region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetPublicDelegatedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetPublicDelegatedPrefixeRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*PublicDelegatedPrefixesClient) Insert
func(c*PublicDelegatedPrefixesClient)Insert(ctxcontext.Context,req*computepb.InsertPublicDelegatedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Insert creates a PublicDelegatedPrefix in the specified project in the given region using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertPublicDelegatedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertPublicDelegatedPrefixeRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PublicDelegatedPrefixesClient) List
func(c*PublicDelegatedPrefixesClient)List(ctxcontext.Context,req*computepb.ListPublicDelegatedPrefixesRequest,opts...gax.CallOption)*PublicDelegatedPrefixIteratorList lists the PublicDelegatedPrefixes for a project in the given region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPublicDelegatedPrefixesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPublicDelegatedPrefixesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.PublicDelegatedPrefixList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPublicDelegatedPrefixesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPublicDelegatedPrefixesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*PublicDelegatedPrefixesClient) Patch
func(c*PublicDelegatedPrefixesClient)Patch(ctxcontext.Context,req*computepb.PatchPublicDelegatedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified PublicDelegatedPrefix resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchPublicDelegatedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchPublicDelegatedPrefixeRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*PublicDelegatedPrefixesClient) Withdraw
func(c*PublicDelegatedPrefixesClient)Withdraw(ctxcontext.Context,req*computepb.WithdrawPublicDelegatedPrefixeRequest,opts...gax.CallOption)(*Operation,error)Withdraw withdraws the specified PublicDelegatedPrefix in the given region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewPublicDelegatedPrefixesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.WithdrawPublicDelegatedPrefixeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#WithdrawPublicDelegatedPrefixeRequest.}op,err:=c.Withdraw(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}PublicDelegatedPrefixesScopedListPair
typePublicDelegatedPrefixesScopedListPairstruct{KeystringValue*computepb.PublicDelegatedPrefixesScopedList}PublicDelegatedPrefixesScopedListPair is a holder type for string/*computepb.PublicDelegatedPrefixesScopedList map entries
PublicDelegatedPrefixesScopedListPairIterator
typePublicDelegatedPrefixesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]PublicDelegatedPrefixesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}PublicDelegatedPrefixesScopedListPairIterator manages a stream of PublicDelegatedPrefixesScopedListPair.
func (*PublicDelegatedPrefixesScopedListPairIterator) All
func(it*PublicDelegatedPrefixesScopedListPairIterator)All()iter.Seq2[PublicDelegatedPrefixesScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*PublicDelegatedPrefixesScopedListPairIterator) Next
func(it*PublicDelegatedPrefixesScopedListPairIterator)Next()(PublicDelegatedPrefixesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*PublicDelegatedPrefixesScopedListPairIterator) PageInfo
func(it*PublicDelegatedPrefixesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ReferenceIterator
typeReferenceIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Reference,nextPageTokenstring,errerror)// contains filtered or unexported fields}ReferenceIterator manages a stream of *computepb.Reference.
func (*ReferenceIterator) All
func(it*ReferenceIterator)All()iter.Seq2[*computepb.Reference,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ReferenceIterator) Next
func(it*ReferenceIterator)Next()(*computepb.Reference,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ReferenceIterator) PageInfo
func(it*ReferenceIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RegionAutoscalersCallOptions
typeRegionAutoscalersCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionUpdate[]gax.CallOption}RegionAutoscalersCallOptions contains the retry settings for each method of RegionAutoscalersClient.
RegionAutoscalersClient
typeRegionAutoscalersClientstruct{// The call options for this service.CallOptions*RegionAutoscalersCallOptions// contains filtered or unexported fields}RegionAutoscalersClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionAutoscalers API.
func NewRegionAutoscalersRESTClient
funcNewRegionAutoscalersRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionAutoscalersClient,error)NewRegionAutoscalersRESTClient creates a new region autoscalers rest client.
The RegionAutoscalers API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionAutoscalersClient) Close
func(c*RegionAutoscalersClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionAutoscalersClient) Connection (deprecated)
func(c*RegionAutoscalersClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionAutoscalersClient) Delete
func(c*RegionAutoscalersClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionAutoscalerRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified autoscaler.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionAutoscalerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionAutoscalerRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionAutoscalersClient) Get
func(c*RegionAutoscalersClient)Get(ctxcontext.Context,req*computepb.GetRegionAutoscalerRequest,opts...gax.CallOption)(*computepb.Autoscaler,error)Get returns the specified autoscaler.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionAutoscalerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionAutoscalerRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionAutoscalersClient) Insert
func(c*RegionAutoscalersClient)Insert(ctxcontext.Context,req*computepb.InsertRegionAutoscalerRequest,opts...gax.CallOption)(*Operation,error)Insert creates an autoscaler in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionAutoscalerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionAutoscalerRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionAutoscalersClient) List
func(c*RegionAutoscalersClient)List(ctxcontext.Context,req*computepb.ListRegionAutoscalersRequest,opts...gax.CallOption)*AutoscalerIteratorList retrieves a list of autoscalers contained within the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionAutoscalersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionAutoscalersRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RegionAutoscalerList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionAutoscalersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionAutoscalersRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionAutoscalersClient) Patch
func(c*RegionAutoscalersClient)Patch(ctxcontext.Context,req*computepb.PatchRegionAutoscalerRequest,opts...gax.CallOption)(*Operation,error)Patch updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRegionAutoscalerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRegionAutoscalerRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionAutoscalersClient) Update
func(c*RegionAutoscalersClient)Update(ctxcontext.Context,req*computepb.UpdateRegionAutoscalerRequest,opts...gax.CallOption)(*Operation,error)Update updates an autoscaler in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionAutoscalersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateRegionAutoscalerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateRegionAutoscalerRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionBackendServicesCallOptions
typeRegionBackendServicesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionGetHealth[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListUsable[]gax.CallOptionPatch[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetSecurityPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOptionUpdate[]gax.CallOption}RegionBackendServicesCallOptions contains the retry settings for each method of RegionBackendServicesClient.
RegionBackendServicesClient
typeRegionBackendServicesClientstruct{// The call options for this service.CallOptions*RegionBackendServicesCallOptions// contains filtered or unexported fields}RegionBackendServicesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionBackendServices API.
func NewRegionBackendServicesRESTClient
funcNewRegionBackendServicesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionBackendServicesClient,error)NewRegionBackendServicesRESTClient creates a new region backend services rest client.
The RegionBackendServices API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionBackendServicesClient) Close
func(c*RegionBackendServicesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionBackendServicesClient) Connection (deprecated)
func(c*RegionBackendServicesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionBackendServicesClient) Delete
func(c*RegionBackendServicesClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionBackendServiceRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified regional BackendService resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionBackendServiceRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionBackendServicesClient) Get
func(c*RegionBackendServicesClient)Get(ctxcontext.Context,req*computepb.GetRegionBackendServiceRequest,opts...gax.CallOption)(*computepb.BackendService,error)Get returns the specified regional BackendService resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionBackendServiceRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionBackendServicesClient) GetHealth
func(c*RegionBackendServicesClient)GetHealth(ctxcontext.Context,req*computepb.GetHealthRegionBackendServiceRequest,opts...gax.CallOption)(*computepb.BackendServiceGroupHealth,error)GetHealth gets the most recent health check results for this regional BackendService.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetHealthRegionBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetHealthRegionBackendServiceRequest.}resp,err:=c.GetHealth(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionBackendServicesClient) GetIamPolicy
func(c*RegionBackendServicesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyRegionBackendServiceRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyRegionBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyRegionBackendServiceRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionBackendServicesClient) Insert
func(c*RegionBackendServicesClient)Insert(ctxcontext.Context,req*computepb.InsertRegionBackendServiceRequest,opts...gax.CallOption)(*Operation,error)Insert creates a regional BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionBackendServiceRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionBackendServicesClient) List
func(c*RegionBackendServicesClient)List(ctxcontext.Context,req*computepb.ListRegionBackendServicesRequest,opts...gax.CallOption)*BackendServiceIteratorList retrieves the list of regional BackendService resources available to the specified project in the given region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionBackendServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionBackendServicesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.BackendServiceList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionBackendServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionBackendServicesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionBackendServicesClient) ListUsable
func(c*RegionBackendServicesClient)ListUsable(ctxcontext.Context,req*computepb.ListUsableRegionBackendServicesRequest,opts...gax.CallOption)*BackendServiceIteratorListUsable retrieves a list of all usable backend services in the specified project in the given region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListUsableRegionBackendServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListUsableRegionBackendServicesRequest.}it:=c.ListUsable(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.BackendServiceListUsable)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListUsableRegionBackendServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListUsableRegionBackendServicesRequest.}forresp,err:=rangec.ListUsable(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionBackendServicesClient) Patch
func(c*RegionBackendServicesClient)Patch(ctxcontext.Context,req*computepb.PatchRegionBackendServiceRequest,opts...gax.CallOption)(*Operation,error)Patch updates the specified regional BackendService resource with the data included in the request. For more information, see Understanding backend services This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRegionBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRegionBackendServiceRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionBackendServicesClient) SetIamPolicy
func(c*RegionBackendServicesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyRegionBackendServiceRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyRegionBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyRegionBackendServiceRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionBackendServicesClient) SetSecurityPolicy
func(c*RegionBackendServicesClient)SetSecurityPolicy(ctxcontext.Context,req*computepb.SetSecurityPolicyRegionBackendServiceRequest,opts...gax.CallOption)(*Operation,error)SetSecurityPolicy sets the Google Cloud Armor security policy for the specified backend service. For more information, see Google Cloud Armor Overview
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSecurityPolicyRegionBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSecurityPolicyRegionBackendServiceRequest.}op,err:=c.SetSecurityPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionBackendServicesClient) TestIamPermissions
func(c*RegionBackendServicesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsRegionBackendServiceRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsRegionBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsRegionBackendServiceRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionBackendServicesClient) Update
func(c*RegionBackendServicesClient)Update(ctxcontext.Context,req*computepb.UpdateRegionBackendServiceRequest,opts...gax.CallOption)(*Operation,error)Update updates the specified regional BackendService resource with the data included in the request. For more information, see Backend services overview .
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionBackendServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateRegionBackendServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateRegionBackendServiceRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionCommitmentsCallOptions
typeRegionCommitmentsCallOptionsstruct{AggregatedList[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionUpdate[]gax.CallOption}RegionCommitmentsCallOptions contains the retry settings for each method of RegionCommitmentsClient.
RegionCommitmentsClient
typeRegionCommitmentsClientstruct{// The call options for this service.CallOptions*RegionCommitmentsCallOptions// contains filtered or unexported fields}RegionCommitmentsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionCommitments API.
func NewRegionCommitmentsRESTClient
funcNewRegionCommitmentsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionCommitmentsClient,error)NewRegionCommitmentsRESTClient creates a new region commitments rest client.
The RegionCommitments API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionCommitmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionCommitmentsClient) AggregatedList
func(c*RegionCommitmentsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListRegionCommitmentsRequest,opts...gax.CallOption)*CommitmentsScopedListPairIteratorAggregatedList retrieves an aggregated list of commitments by region. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionCommitmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListRegionCommitmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListRegionCommitmentsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.CommitmentAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionCommitmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListRegionCommitmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListRegionCommitmentsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionCommitmentsClient) Close
func(c*RegionCommitmentsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionCommitmentsClient) Connection (deprecated)
func(c*RegionCommitmentsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionCommitmentsClient) Get
func(c*RegionCommitmentsClient)Get(ctxcontext.Context,req*computepb.GetRegionCommitmentRequest,opts...gax.CallOption)(*computepb.Commitment,error)Get returns the specified commitment resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionCommitmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionCommitmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionCommitmentRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionCommitmentsClient) Insert
func(c*RegionCommitmentsClient)Insert(ctxcontext.Context,req*computepb.InsertRegionCommitmentRequest,opts...gax.CallOption)(*Operation,error)Insert creates a commitment in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionCommitmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionCommitmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionCommitmentRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionCommitmentsClient) List
func(c*RegionCommitmentsClient)List(ctxcontext.Context,req*computepb.ListRegionCommitmentsRequest,opts...gax.CallOption)*CommitmentIteratorList retrieves a list of commitments contained within the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionCommitmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionCommitmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionCommitmentsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.CommitmentList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionCommitmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionCommitmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionCommitmentsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionCommitmentsClient) Update
func(c*RegionCommitmentsClient)Update(ctxcontext.Context,req*computepb.UpdateRegionCommitmentRequest,opts...gax.CallOption)(*Operation,error)Update updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be updated: auto_renew and plan.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionCommitmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateRegionCommitmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateRegionCommitmentRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionDiskTypesCallOptions
typeRegionDiskTypesCallOptionsstruct{Get[]gax.CallOptionList[]gax.CallOption}RegionDiskTypesCallOptions contains the retry settings for each method of RegionDiskTypesClient.
RegionDiskTypesClient
typeRegionDiskTypesClientstruct{// The call options for this service.CallOptions*RegionDiskTypesCallOptions// contains filtered or unexported fields}RegionDiskTypesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionDiskTypes API.
func NewRegionDiskTypesRESTClient
funcNewRegionDiskTypesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionDiskTypesClient,error)NewRegionDiskTypesRESTClient creates a new region disk types rest client.
The RegionDiskTypes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionDiskTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionDiskTypesClient) Close
func(c*RegionDiskTypesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionDiskTypesClient) Connection (deprecated)
func(c*RegionDiskTypesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionDiskTypesClient) Get
func(c*RegionDiskTypesClient)Get(ctxcontext.Context,req*computepb.GetRegionDiskTypeRequest,opts...gax.CallOption)(*computepb.DiskType,error)Get returns the specified regional disk type.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDiskTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionDiskTypeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionDiskTypeRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionDiskTypesClient) List
func(c*RegionDiskTypesClient)List(ctxcontext.Context,req*computepb.ListRegionDiskTypesRequest,opts...gax.CallOption)*DiskTypeIteratorList retrieves a list of regional disk types available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionDiskTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionDiskTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionDiskTypesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RegionDiskTypeList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDiskTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionDiskTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionDiskTypesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}RegionDisksCallOptions
typeRegionDisksCallOptionsstruct{AddResourcePolicies[]gax.CallOptionBulkInsert[]gax.CallOptionCreateSnapshot[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionRemoveResourcePolicies[]gax.CallOptionResize[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetLabels[]gax.CallOptionStartAsyncReplication[]gax.CallOptionStopAsyncReplication[]gax.CallOptionStopGroupAsyncReplication[]gax.CallOptionTestIamPermissions[]gax.CallOptionUpdate[]gax.CallOption}RegionDisksCallOptions contains the retry settings for each method of RegionDisksClient.
RegionDisksClient
typeRegionDisksClientstruct{// The call options for this service.CallOptions*RegionDisksCallOptions// contains filtered or unexported fields}RegionDisksClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionDisks API.
func NewRegionDisksRESTClient
funcNewRegionDisksRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionDisksClient,error)NewRegionDisksRESTClient creates a new region disks rest client.
The RegionDisks API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionDisksClient) AddResourcePolicies
func(c*RegionDisksClient)AddResourcePolicies(ctxcontext.Context,req*computepb.AddResourcePoliciesRegionDiskRequest,opts...gax.CallOption)(*Operation,error)AddResourcePolicies adds existing resource policies to a regional disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddResourcePoliciesRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddResourcePoliciesRegionDiskRequest.}op,err:=c.AddResourcePolicies(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) BulkInsert
func(c*RegionDisksClient)BulkInsert(ctxcontext.Context,req*computepb.BulkInsertRegionDiskRequest,opts...gax.CallOption)(*Operation,error)BulkInsert bulk create a set of disks.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.BulkInsertRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#BulkInsertRegionDiskRequest.}op,err:=c.BulkInsert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) Close
func(c*RegionDisksClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionDisksClient) Connection (deprecated)
func(c*RegionDisksClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionDisksClient) CreateSnapshot
func(c*RegionDisksClient)CreateSnapshot(ctxcontext.Context,req*computepb.CreateSnapshotRegionDiskRequest,opts...gax.CallOption)(*Operation,error)CreateSnapshot creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.CreateSnapshotRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#CreateSnapshotRegionDiskRequest.}op,err:=c.CreateSnapshot(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) Delete
func(c*RegionDisksClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionDiskRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified regional persistent disk. Deleting a regional disk removes all the replicas of its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionDiskRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) Get
func(c*RegionDisksClient)Get(ctxcontext.Context,req*computepb.GetRegionDiskRequest,opts...gax.CallOption)(*computepb.Disk,error)Get returns a specified regional persistent disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionDiskRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionDisksClient) GetIamPolicy
func(c*RegionDisksClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyRegionDiskRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyRegionDiskRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionDisksClient) Insert
func(c*RegionDisksClient)Insert(ctxcontext.Context,req*computepb.InsertRegionDiskRequest,opts...gax.CallOption)(*Operation,error)Insert creates a persistent regional disk in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionDiskRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) List
func(c*RegionDisksClient)List(ctxcontext.Context,req*computepb.ListRegionDisksRequest,opts...gax.CallOption)*DiskIteratorList retrieves the list of persistent disks contained within the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionDisksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionDisksRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.DiskList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionDisksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionDisksRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionDisksClient) RemoveResourcePolicies
func(c*RegionDisksClient)RemoveResourcePolicies(ctxcontext.Context,req*computepb.RemoveResourcePoliciesRegionDiskRequest,opts...gax.CallOption)(*Operation,error)RemoveResourcePolicies removes resource policies from a regional disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveResourcePoliciesRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveResourcePoliciesRegionDiskRequest.}op,err:=c.RemoveResourcePolicies(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) Resize
func(c*RegionDisksClient)Resize(ctxcontext.Context,req*computepb.ResizeRegionDiskRequest,opts...gax.CallOption)(*Operation,error)Resize resizes the specified regional persistent disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ResizeRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ResizeRegionDiskRequest.}op,err:=c.Resize(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) SetIamPolicy
func(c*RegionDisksClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyRegionDiskRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyRegionDiskRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionDisksClient) SetLabels
func(c*RegionDisksClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsRegionDiskRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on the target regional disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsRegionDiskRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) StartAsyncReplication
func(c*RegionDisksClient)StartAsyncReplication(ctxcontext.Context,req*computepb.StartAsyncReplicationRegionDiskRequest,opts...gax.CallOption)(*Operation,error)StartAsyncReplication starts asynchronous replication. Must be invoked on the primary disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StartAsyncReplicationRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StartAsyncReplicationRegionDiskRequest.}op,err:=c.StartAsyncReplication(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) StopAsyncReplication
func(c*RegionDisksClient)StopAsyncReplication(ctxcontext.Context,req*computepb.StopAsyncReplicationRegionDiskRequest,opts...gax.CallOption)(*Operation,error)StopAsyncReplication stops asynchronous replication. Can be invoked either on the primary or on the secondary disk.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StopAsyncReplicationRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StopAsyncReplicationRegionDiskRequest.}op,err:=c.StopAsyncReplication(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) StopGroupAsyncReplication
func(c*RegionDisksClient)StopGroupAsyncReplication(ctxcontext.Context,req*computepb.StopGroupAsyncReplicationRegionDiskRequest,opts...gax.CallOption)(*Operation,error)StopGroupAsyncReplication stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StopGroupAsyncReplicationRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StopGroupAsyncReplicationRegionDiskRequest.}op,err:=c.StopGroupAsyncReplication(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionDisksClient) TestIamPermissions
func(c*RegionDisksClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsRegionDiskRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsRegionDiskRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionDisksClient) Update
func(c*RegionDisksClient)Update(ctxcontext.Context,req*computepb.UpdateRegionDiskRequest,opts...gax.CallOption)(*Operation,error)Update update the specified disk with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: user_license.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionDisksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateRegionDiskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateRegionDiskRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionHealthCheckServicesCallOptions
typeRegionHealthCheckServicesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOption}RegionHealthCheckServicesCallOptions contains the retry settings for each method of RegionHealthCheckServicesClient.
RegionHealthCheckServicesClient
typeRegionHealthCheckServicesClientstruct{// The call options for this service.CallOptions*RegionHealthCheckServicesCallOptions// contains filtered or unexported fields}RegionHealthCheckServicesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionHealthCheckServices API.
func NewRegionHealthCheckServicesRESTClient
funcNewRegionHealthCheckServicesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionHealthCheckServicesClient,error)NewRegionHealthCheckServicesRESTClient creates a new region health check services rest client.
The RegionHealthCheckServices API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionHealthCheckServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionHealthCheckServicesClient) Close
func(c*RegionHealthCheckServicesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionHealthCheckServicesClient) Connection (deprecated)
func(c*RegionHealthCheckServicesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionHealthCheckServicesClient) Delete
func(c*RegionHealthCheckServicesClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionHealthCheckServiceRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified regional HealthCheckService.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthCheckServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionHealthCheckServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionHealthCheckServiceRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionHealthCheckServicesClient) Get
func(c*RegionHealthCheckServicesClient)Get(ctxcontext.Context,req*computepb.GetRegionHealthCheckServiceRequest,opts...gax.CallOption)(*computepb.HealthCheckService,error)Get returns the specified regional HealthCheckService resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthCheckServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionHealthCheckServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionHealthCheckServiceRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionHealthCheckServicesClient) Insert
func(c*RegionHealthCheckServicesClient)Insert(ctxcontext.Context,req*computepb.InsertRegionHealthCheckServiceRequest,opts...gax.CallOption)(*Operation,error)Insert creates a regional HealthCheckService resource in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthCheckServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionHealthCheckServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionHealthCheckServiceRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionHealthCheckServicesClient) List
func(c*RegionHealthCheckServicesClient)List(ctxcontext.Context,req*computepb.ListRegionHealthCheckServicesRequest,opts...gax.CallOption)*HealthCheckServiceIteratorList lists all the HealthCheckService resources that have been configured for the specified project in the given region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionHealthCheckServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionHealthCheckServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionHealthCheckServicesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.HealthCheckServicesList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthCheckServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionHealthCheckServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionHealthCheckServicesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionHealthCheckServicesClient) Patch
func(c*RegionHealthCheckServicesClient)Patch(ctxcontext.Context,req*computepb.PatchRegionHealthCheckServiceRequest,opts...gax.CallOption)(*Operation,error)Patch updates the specified regional HealthCheckService resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthCheckServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRegionHealthCheckServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRegionHealthCheckServiceRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionHealthChecksCallOptions
typeRegionHealthChecksCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionUpdate[]gax.CallOption}RegionHealthChecksCallOptions contains the retry settings for each method of RegionHealthChecksClient.
RegionHealthChecksClient
typeRegionHealthChecksClientstruct{// The call options for this service.CallOptions*RegionHealthChecksCallOptions// contains filtered or unexported fields}RegionHealthChecksClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionHealthChecks API.
func NewRegionHealthChecksRESTClient
funcNewRegionHealthChecksRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionHealthChecksClient,error)NewRegionHealthChecksRESTClient creates a new region health checks rest client.
The RegionHealthChecks API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionHealthChecksClient) Close
func(c*RegionHealthChecksClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionHealthChecksClient) Connection (deprecated)
func(c*RegionHealthChecksClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionHealthChecksClient) Delete
func(c*RegionHealthChecksClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionHealthCheckRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified HealthCheck resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionHealthCheckRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionHealthCheckRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionHealthChecksClient) Get
func(c*RegionHealthChecksClient)Get(ctxcontext.Context,req*computepb.GetRegionHealthCheckRequest,opts...gax.CallOption)(*computepb.HealthCheck,error)Get returns the specified HealthCheck resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionHealthCheckRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionHealthCheckRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionHealthChecksClient) Insert
func(c*RegionHealthChecksClient)Insert(ctxcontext.Context,req*computepb.InsertRegionHealthCheckRequest,opts...gax.CallOption)(*Operation,error)Insert creates a HealthCheck resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionHealthCheckRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionHealthCheckRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionHealthChecksClient) List
func(c*RegionHealthChecksClient)List(ctxcontext.Context,req*computepb.ListRegionHealthChecksRequest,opts...gax.CallOption)*HealthCheckIteratorList retrieves the list of HealthCheck resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionHealthChecksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionHealthChecksRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.HealthCheckList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionHealthChecksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionHealthChecksRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionHealthChecksClient) Patch
func(c*RegionHealthChecksClient)Patch(ctxcontext.Context,req*computepb.PatchRegionHealthCheckRequest,opts...gax.CallOption)(*Operation,error)Patch updates a HealthCheck resource in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRegionHealthCheckRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRegionHealthCheckRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionHealthChecksClient) Update
func(c*RegionHealthChecksClient)Update(ctxcontext.Context,req*computepb.UpdateRegionHealthCheckRequest,opts...gax.CallOption)(*Operation,error)Update updates a HealthCheck resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionHealthChecksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateRegionHealthCheckRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateRegionHealthCheckRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionInstanceGroupManagersCallOptions
typeRegionInstanceGroupManagersCallOptionsstruct{AbandonInstances[]gax.CallOptionApplyUpdatesToInstances[]gax.CallOptionCreateInstances[]gax.CallOptionDelete[]gax.CallOptionDeleteInstances[]gax.CallOptionDeletePerInstanceConfigs[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListErrors[]gax.CallOptionListManagedInstances[]gax.CallOptionListPerInstanceConfigs[]gax.CallOptionPatch[]gax.CallOptionPatchPerInstanceConfigs[]gax.CallOptionRecreateInstances[]gax.CallOptionResize[]gax.CallOptionResumeInstances[]gax.CallOptionSetInstanceTemplate[]gax.CallOptionSetTargetPools[]gax.CallOptionStartInstances[]gax.CallOptionStopInstances[]gax.CallOptionSuspendInstances[]gax.CallOptionUpdatePerInstanceConfigs[]gax.CallOption}RegionInstanceGroupManagersCallOptions contains the retry settings for each method of RegionInstanceGroupManagersClient.
RegionInstanceGroupManagersClient
typeRegionInstanceGroupManagersClientstruct{// The call options for this service.CallOptions*RegionInstanceGroupManagersCallOptions// contains filtered or unexported fields}RegionInstanceGroupManagersClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionInstanceGroupManagers API.
func NewRegionInstanceGroupManagersRESTClient
funcNewRegionInstanceGroupManagersRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionInstanceGroupManagersClient,error)NewRegionInstanceGroupManagersRESTClient creates a new region instance group managers rest client.
The RegionInstanceGroupManagers API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionInstanceGroupManagersClient) AbandonInstances
func(c*RegionInstanceGroupManagersClient)AbandonInstances(ctxcontext.Context,req*computepb.AbandonInstancesRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)AbandonInstances flags the specified instances to be immediately removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AbandonInstancesRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AbandonInstancesRegionInstanceGroupManagerRequest.}op,err:=c.AbandonInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) ApplyUpdatesToInstances
func(c*RegionInstanceGroupManagersClient)ApplyUpdatesToInstances(ctxcontext.Context,req*computepb.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)ApplyUpdatesToInstances apply updates to selected instances the managed instance group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest.}op,err:=c.ApplyUpdatesToInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) Close
func(c*RegionInstanceGroupManagersClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionInstanceGroupManagersClient) Connection (deprecated)
func(c*RegionInstanceGroupManagersClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionInstanceGroupManagersClient) CreateInstances
func(c*RegionInstanceGroupManagersClient)CreateInstances(ctxcontext.Context,req*computepb.CreateInstancesRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)CreateInstances creates instances with per-instance configurations in this regional managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.CreateInstancesRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#CreateInstancesRegionInstanceGroupManagerRequest.}op,err:=c.CreateInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) Delete
func(c*RegionInstanceGroupManagersClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified managed instance group and all of the instances in that group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionInstanceGroupManagerRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) DeleteInstances
func(c*RegionInstanceGroupManagersClient)DeleteInstances(ctxcontext.Context,req*computepb.DeleteInstancesRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)DeleteInstances flags the specified instances in the managed instance group to be immediately deleted. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. The deleteInstances operation is marked DONE if the deleteInstances request is successful. The underlying actions take additional time. You must separately verify the status of the deleting action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteInstancesRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteInstancesRegionInstanceGroupManagerRequest.}op,err:=c.DeleteInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) DeletePerInstanceConfigs
func(c*RegionInstanceGroupManagersClient)DeletePerInstanceConfigs(ctxcontext.Context,req*computepb.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)DeletePerInstanceConfigs deletes selected per-instance configurations for the managed instance group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeletePerInstanceConfigsRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeletePerInstanceConfigsRegionInstanceGroupManagerRequest.}op,err:=c.DeletePerInstanceConfigs(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) Get
func(c*RegionInstanceGroupManagersClient)Get(ctxcontext.Context,req*computepb.GetRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*computepb.InstanceGroupManager,error)Get returns all of the details about the specified managed instance group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionInstanceGroupManagerRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionInstanceGroupManagersClient) Insert
func(c*RegionInstanceGroupManagersClient)Insert(ctxcontext.Context,req*computepb.InsertRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)Insert creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A regional managed instance group can contain up to 2000 instances.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionInstanceGroupManagerRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) List
func(c*RegionInstanceGroupManagersClient)List(ctxcontext.Context,req*computepb.ListRegionInstanceGroupManagersRequest,opts...gax.CallOption)*InstanceGroupManagerIteratorList retrieves the list of managed instance groups that are contained within the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionInstanceGroupManagersRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RegionInstanceGroupManagerList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionInstanceGroupManagersRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionInstanceGroupManagersClient) ListErrors
func(c*RegionInstanceGroupManagersClient)ListErrors(ctxcontext.Context,req*computepb.ListErrorsRegionInstanceGroupManagersRequest,opts...gax.CallOption)*InstanceManagedByIgmErrorIteratorListErrors lists all errors thrown by actions on instances for a given regional managed instance group. The filter and orderBy query parameters are not supported.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListErrorsRegionInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListErrorsRegionInstanceGroupManagersRequest.}it:=c.ListErrors(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RegionInstanceGroupManagersListErrorsResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListErrorsRegionInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListErrorsRegionInstanceGroupManagersRequest.}forresp,err:=rangec.ListErrors(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionInstanceGroupManagersClient) ListManagedInstances
func(c*RegionInstanceGroupManagersClient)ListManagedInstances(ctxcontext.Context,req*computepb.ListManagedInstancesRegionInstanceGroupManagersRequest,opts...gax.CallOption)*ManagedInstanceIteratorListManagedInstances lists the instances in the managed instance group and instances that are scheduled to be created. The list includes any current actions that the group has scheduled for its instances. The orderBy query parameter is not supported. The pageToken query parameter is supported only if the group’s listManagedInstancesResults field is set to PAGINATED.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListManagedInstancesRegionInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListManagedInstancesRegionInstanceGroupManagersRequest.}it:=c.ListManagedInstances(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RegionInstanceGroupManagersListInstancesResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListManagedInstancesRegionInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListManagedInstancesRegionInstanceGroupManagersRequest.}forresp,err:=rangec.ListManagedInstances(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionInstanceGroupManagersClient) ListPerInstanceConfigs
func(c*RegionInstanceGroupManagersClient)ListPerInstanceConfigs(ctxcontext.Context,req*computepb.ListPerInstanceConfigsRegionInstanceGroupManagersRequest,opts...gax.CallOption)*PerInstanceConfigIteratorListPerInstanceConfigs lists all of the per-instance configurations defined for the managed instance group. The orderBy query parameter is not supported.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPerInstanceConfigsRegionInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPerInstanceConfigsRegionInstanceGroupManagersRequest.}it:=c.ListPerInstanceConfigs(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RegionInstanceGroupManagersListInstanceConfigsResp)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPerInstanceConfigsRegionInstanceGroupManagersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPerInstanceConfigsRegionInstanceGroupManagersRequest.}forresp,err:=rangec.ListPerInstanceConfigs(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionInstanceGroupManagersClient) Patch
func(c*RegionInstanceGroupManagersClient)Patch(ctxcontext.Context,req*computepb.PatchRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)Patch updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listmanagedinstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. If you update your group to specify a new template or instance configuration, it’s possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRegionInstanceGroupManagerRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) PatchPerInstanceConfigs
func(c*RegionInstanceGroupManagersClient)PatchPerInstanceConfigs(ctxcontext.Context,req*computepb.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)PatchPerInstanceConfigs inserts or patches per-instance configurations for the managed instance group. perInstanceConfig.name (athttp://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchPerInstanceConfigsRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchPerInstanceConfigsRegionInstanceGroupManagerRequest.}op,err:=c.PatchPerInstanceConfigs(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) RecreateInstances
func(c*RegionInstanceGroupManagersClient)RecreateInstances(ctxcontext.Context,req*computepb.RecreateInstancesRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)RecreateInstances flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group’s current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RecreateInstancesRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RecreateInstancesRegionInstanceGroupManagerRequest.}op,err:=c.RecreateInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) Resize
func(c*RegionInstanceGroupManagersClient)Resize(ctxcontext.Context,req*computepb.ResizeRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)Resize changes the intended size of the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes one or more instances. The resize operation is marked DONE if the resize request is successful. The underlying actions take additional time. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ResizeRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ResizeRegionInstanceGroupManagerRequest.}op,err:=c.Resize(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) ResumeInstances
func(c*RegionInstanceGroupManagersClient)ResumeInstances(ctxcontext.Context,req*computepb.ResumeInstancesRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)ResumeInstances flags the specified instances in the managed instance group to be resumed. This method increases the targetSize and decreases the targetSuspendedSize of the managed instance group by the number of instances that you resume. The resumeInstances operation is marked DONE if the resumeInstances request is successful. The underlying actions take additional time. You must separately verify the status of the RESUMING action with the listmanagedinstances method. In this request, you can only specify instances that are suspended. For example, if an instance was previously suspended using the suspendInstances method, it can be resumed using the resumeInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are resumed. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ResumeInstancesRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ResumeInstancesRegionInstanceGroupManagerRequest.}op,err:=c.ResumeInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) SetInstanceTemplate
func(c*RegionInstanceGroupManagersClient)SetInstanceTemplate(ctxcontext.Context,req*computepb.SetInstanceTemplateRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)SetInstanceTemplate sets the instance template to use when creating new instances or recreating instances in this group. Existing instances are not affected.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetInstanceTemplateRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetInstanceTemplateRegionInstanceGroupManagerRequest.}op,err:=c.SetInstanceTemplate(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) SetTargetPools
func(c*RegionInstanceGroupManagersClient)SetTargetPools(ctxcontext.Context,req*computepb.SetTargetPoolsRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)SetTargetPools modifies the target pools to which all new instances in this group are assigned. Existing instances in the group are not affected.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetTargetPoolsRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetTargetPoolsRegionInstanceGroupManagerRequest.}op,err:=c.SetTargetPools(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) StartInstances
func(c*RegionInstanceGroupManagersClient)StartInstances(ctxcontext.Context,req*computepb.StartInstancesRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)StartInstances flags the specified instances in the managed instance group to be started. This method increases the targetSize and decreases the targetStoppedSize of the managed instance group by the number of instances that you start. The startInstances operation is marked DONE if the startInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STARTING action with the listmanagedinstances method. In this request, you can only specify instances that are stopped. For example, if an instance was previously stopped using the stopInstances method, it can be started using the startInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are started. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StartInstancesRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StartInstancesRegionInstanceGroupManagerRequest.}op,err:=c.StartInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) StopInstances
func(c*RegionInstanceGroupManagersClient)StopInstances(ctxcontext.Context,req*computepb.StopInstancesRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)StopInstances flags the specified instances in the managed instance group to be immediately stopped. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetStoppedSize of the managed instance group by the number of instances that you stop. The stopInstances operation is marked DONE if the stopInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STOPPING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays stopping the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is stopped. Stopped instances can be started using the startInstances method. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.StopInstancesRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#StopInstancesRegionInstanceGroupManagerRequest.}op,err:=c.StopInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) SuspendInstances
func(c*RegionInstanceGroupManagersClient)SuspendInstances(ctxcontext.Context,req*computepb.SuspendInstancesRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)SuspendInstances flags the specified instances in the managed instance group to be immediately suspended. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetSuspendedSize of the managed instance group by the number of instances that you suspend. The suspendInstances operation is marked DONE if the suspendInstances request is successful. The underlying actions take additional time. You must separately verify the status of the SUSPENDING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays suspension of the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is suspended. Suspended instances can be resumed using the resumeInstances method. You can specify a maximum of 1000 instances with this method per request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SuspendInstancesRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SuspendInstancesRegionInstanceGroupManagerRequest.}op,err:=c.SuspendInstances(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceGroupManagersClient) UpdatePerInstanceConfigs
func(c*RegionInstanceGroupManagersClient)UpdatePerInstanceConfigs(ctxcontext.Context,req*computepb.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest,opts...gax.CallOption)(*Operation,error)UpdatePerInstanceConfigs inserts or updates per-instance configurations for the managed instance group. perInstanceConfig.name (athttp://perInstanceConfig.name) serves as a key used to distinguish whether to perform insert or patch.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupManagersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest.}op,err:=c.UpdatePerInstanceConfigs(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionInstanceGroupsCallOptions
typeRegionInstanceGroupsCallOptionsstruct{Get[]gax.CallOptionList[]gax.CallOptionListInstances[]gax.CallOptionSetNamedPorts[]gax.CallOption}RegionInstanceGroupsCallOptions contains the retry settings for each method of RegionInstanceGroupsClient.
RegionInstanceGroupsClient
typeRegionInstanceGroupsClientstruct{// The call options for this service.CallOptions*RegionInstanceGroupsCallOptions// contains filtered or unexported fields}RegionInstanceGroupsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionInstanceGroups API.
func NewRegionInstanceGroupsRESTClient
funcNewRegionInstanceGroupsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionInstanceGroupsClient,error)NewRegionInstanceGroupsRESTClient creates a new region instance groups rest client.
The RegionInstanceGroups API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionInstanceGroupsClient) Close
func(c*RegionInstanceGroupsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionInstanceGroupsClient) Connection (deprecated)
func(c*RegionInstanceGroupsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionInstanceGroupsClient) Get
func(c*RegionInstanceGroupsClient)Get(ctxcontext.Context,req*computepb.GetRegionInstanceGroupRequest,opts...gax.CallOption)(*computepb.InstanceGroup,error)Get returns the specified instance group resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionInstanceGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionInstanceGroupRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionInstanceGroupsClient) List
func(c*RegionInstanceGroupsClient)List(ctxcontext.Context,req*computepb.ListRegionInstanceGroupsRequest,opts...gax.CallOption)*InstanceGroupIteratorList retrieves the list of instance group resources contained within the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionInstanceGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionInstanceGroupsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RegionInstanceGroupList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionInstanceGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionInstanceGroupsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionInstanceGroupsClient) ListInstances
func(c*RegionInstanceGroupsClient)ListInstances(ctxcontext.Context,req*computepb.ListInstancesRegionInstanceGroupsRequest,opts...gax.CallOption)*InstanceWithNamedPortsIteratorListInstances lists the instances in the specified instance group and displays information about the named ports. Depending on the specified options, this method can list all instances or only the instances that are running. The orderBy query parameter is not supported.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstancesRegionInstanceGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstancesRegionInstanceGroupsRequest.}it:=c.ListInstances(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RegionInstanceGroupsListInstances)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListInstancesRegionInstanceGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListInstancesRegionInstanceGroupsRequest.}forresp,err:=rangec.ListInstances(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionInstanceGroupsClient) SetNamedPorts
func(c*RegionInstanceGroupsClient)SetNamedPorts(ctxcontext.Context,req*computepb.SetNamedPortsRegionInstanceGroupRequest,opts...gax.CallOption)(*Operation,error)SetNamedPorts sets the named ports for the specified regional instance group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetNamedPortsRegionInstanceGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetNamedPortsRegionInstanceGroupRequest.}op,err:=c.SetNamedPorts(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionInstanceTemplatesCallOptions
typeRegionInstanceTemplatesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOption}RegionInstanceTemplatesCallOptions contains the retry settings for each method of RegionInstanceTemplatesClient.
RegionInstanceTemplatesClient
typeRegionInstanceTemplatesClientstruct{// The call options for this service.CallOptions*RegionInstanceTemplatesCallOptions// contains filtered or unexported fields}RegionInstanceTemplatesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionInstanceTemplates API.
func NewRegionInstanceTemplatesRESTClient
funcNewRegionInstanceTemplatesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionInstanceTemplatesClient,error)NewRegionInstanceTemplatesRESTClient creates a new region instance templates rest client.
The RegionInstanceTemplates API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionInstanceTemplatesClient) Close
func(c*RegionInstanceTemplatesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionInstanceTemplatesClient) Connection (deprecated)
func(c*RegionInstanceTemplatesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionInstanceTemplatesClient) Delete
func(c*RegionInstanceTemplatesClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionInstanceTemplateRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified instance template. Deleting an instance template is permanent and cannot be undone.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionInstanceTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionInstanceTemplateRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceTemplatesClient) Get
func(c*RegionInstanceTemplatesClient)Get(ctxcontext.Context,req*computepb.GetRegionInstanceTemplateRequest,opts...gax.CallOption)(*computepb.InstanceTemplate,error)Get returns the specified instance template.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionInstanceTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionInstanceTemplateRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionInstanceTemplatesClient) Insert
func(c*RegionInstanceTemplatesClient)Insert(ctxcontext.Context,req*computepb.InsertRegionInstanceTemplateRequest,opts...gax.CallOption)(*Operation,error)Insert creates an instance template in the specified project and region using the global instance template whose URL is included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionInstanceTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionInstanceTemplateRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstanceTemplatesClient) List
func(c*RegionInstanceTemplatesClient)List(ctxcontext.Context,req*computepb.ListRegionInstanceTemplatesRequest,opts...gax.CallOption)*InstanceTemplateIteratorList retrieves a list of instance templates that are contained within the specified project and region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionInstanceTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionInstanceTemplatesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstanceTemplateList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstanceTemplatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionInstanceTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionInstanceTemplatesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}RegionInstancesCallOptions
typeRegionInstancesCallOptionsstruct{BulkInsert[]gax.CallOption}RegionInstancesCallOptions contains the retry settings for each method of RegionInstancesClient.
RegionInstancesClient
typeRegionInstancesClientstruct{// The call options for this service.CallOptions*RegionInstancesCallOptions// contains filtered or unexported fields}RegionInstancesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionInstances API.
func NewRegionInstancesRESTClient
funcNewRegionInstancesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionInstancesClient,error)NewRegionInstancesRESTClient creates a new region instances rest client.
The RegionInstances API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionInstancesClient) BulkInsert
func(c*RegionInstancesClient)BulkInsert(ctxcontext.Context,req*computepb.BulkInsertRegionInstanceRequest,opts...gax.CallOption)(*Operation,error)BulkInsert creates multiple instances in a given region. Count specifies the number of instances to create.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.BulkInsertRegionInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#BulkInsertRegionInstanceRequest.}op,err:=c.BulkInsert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstancesClient) Close
func(c*RegionInstancesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionInstancesClient) Connection (deprecated)
func(c*RegionInstancesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
RegionInstantSnapshotsCallOptions
typeRegionInstantSnapshotsCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetLabels[]gax.CallOptionTestIamPermissions[]gax.CallOption}RegionInstantSnapshotsCallOptions contains the retry settings for each method of RegionInstantSnapshotsClient.
RegionInstantSnapshotsClient
typeRegionInstantSnapshotsClientstruct{// The call options for this service.CallOptions*RegionInstantSnapshotsCallOptions// contains filtered or unexported fields}RegionInstantSnapshotsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionInstantSnapshots API.
func NewRegionInstantSnapshotsRESTClient
funcNewRegionInstantSnapshotsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionInstantSnapshotsClient,error)NewRegionInstantSnapshotsRESTClient creates a new region instant snapshots rest client.
The RegionInstantSnapshots API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionInstantSnapshotsClient) Close
func(c*RegionInstantSnapshotsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionInstantSnapshotsClient) Connection (deprecated)
func(c*RegionInstantSnapshotsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionInstantSnapshotsClient) Delete
func(c*RegionInstantSnapshotsClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionInstantSnapshotRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified InstantSnapshot resource. Keep in mind that deleting a single instantSnapshot might not necessarily delete all the data on that instantSnapshot. If any data on the instantSnapshot that is marked for deletion is needed for subsequent instantSnapshots, the data will be moved to the next corresponding instantSnapshot. For more information, see Deleting instantSnapshots.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionInstantSnapshotRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstantSnapshotsClient) Get
func(c*RegionInstantSnapshotsClient)Get(ctxcontext.Context,req*computepb.GetRegionInstantSnapshotRequest,opts...gax.CallOption)(*computepb.InstantSnapshot,error)Get returns the specified InstantSnapshot resource in the specified region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionInstantSnapshotRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionInstantSnapshotsClient) GetIamPolicy
func(c*RegionInstantSnapshotsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyRegionInstantSnapshotRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyRegionInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyRegionInstantSnapshotRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionInstantSnapshotsClient) Insert
func(c*RegionInstantSnapshotsClient)Insert(ctxcontext.Context,req*computepb.InsertRegionInstantSnapshotRequest,opts...gax.CallOption)(*Operation,error)Insert creates an instant snapshot in the specified region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionInstantSnapshotRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstantSnapshotsClient) List
func(c*RegionInstantSnapshotsClient)List(ctxcontext.Context,req*computepb.ListRegionInstantSnapshotsRequest,opts...gax.CallOption)*InstantSnapshotIteratorList retrieves the list of InstantSnapshot resources contained within the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionInstantSnapshotsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionInstantSnapshotsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.InstantSnapshotList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionInstantSnapshotsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionInstantSnapshotsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionInstantSnapshotsClient) SetIamPolicy
func(c*RegionInstantSnapshotsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyRegionInstantSnapshotRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyRegionInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyRegionInstantSnapshotRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionInstantSnapshotsClient) SetLabels
func(c*RegionInstantSnapshotsClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsRegionInstantSnapshotRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a instantSnapshot in the given region. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsRegionInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsRegionInstantSnapshotRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionInstantSnapshotsClient) TestIamPermissions
func(c*RegionInstantSnapshotsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsRegionInstantSnapshotRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionInstantSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsRegionInstantSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsRegionInstantSnapshotRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}RegionIterator
typeRegionIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Region,nextPageTokenstring,errerror)// contains filtered or unexported fields}RegionIterator manages a stream of *computepb.Region.
func (*RegionIterator) All
func(it*RegionIterator)All()iter.Seq2[*computepb.Region,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*RegionIterator) Next
func(it*RegionIterator)Next()(*computepb.Region,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*RegionIterator) PageInfo
func(it*RegionIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RegionNetworkEndpointGroupsCallOptions
typeRegionNetworkEndpointGroupsCallOptionsstruct{AttachNetworkEndpoints[]gax.CallOptionDelete[]gax.CallOptionDetachNetworkEndpoints[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListNetworkEndpoints[]gax.CallOption}RegionNetworkEndpointGroupsCallOptions contains the retry settings for each method of RegionNetworkEndpointGroupsClient.
RegionNetworkEndpointGroupsClient
typeRegionNetworkEndpointGroupsClientstruct{// The call options for this service.CallOptions*RegionNetworkEndpointGroupsCallOptions// contains filtered or unexported fields}RegionNetworkEndpointGroupsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionNetworkEndpointGroups API.
func NewRegionNetworkEndpointGroupsRESTClient
funcNewRegionNetworkEndpointGroupsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionNetworkEndpointGroupsClient,error)NewRegionNetworkEndpointGroupsRESTClient creates a new region network endpoint groups rest client.
The RegionNetworkEndpointGroups API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionNetworkEndpointGroupsClient) AttachNetworkEndpoints
func(c*RegionNetworkEndpointGroupsClient)AttachNetworkEndpoints(ctxcontext.Context,req*computepb.AttachNetworkEndpointsRegionNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)AttachNetworkEndpoints attach a list of network endpoints to the specified network endpoint group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AttachNetworkEndpointsRegionNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AttachNetworkEndpointsRegionNetworkEndpointGroupRequest.}op,err:=c.AttachNetworkEndpoints(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkEndpointGroupsClient) Close
func(c*RegionNetworkEndpointGroupsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionNetworkEndpointGroupsClient) Connection (deprecated)
func(c*RegionNetworkEndpointGroupsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionNetworkEndpointGroupsClient) Delete
func(c*RegionNetworkEndpointGroupsClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified network endpoint group. Note that the NEG cannot be deleted if it is configured as a backend of a backend service.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionNetworkEndpointGroupRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkEndpointGroupsClient) DetachNetworkEndpoints
func(c*RegionNetworkEndpointGroupsClient)DetachNetworkEndpoints(ctxcontext.Context,req*computepb.DetachNetworkEndpointsRegionNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)DetachNetworkEndpoints detach the network endpoint from the specified network endpoint group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DetachNetworkEndpointsRegionNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DetachNetworkEndpointsRegionNetworkEndpointGroupRequest.}op,err:=c.DetachNetworkEndpoints(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkEndpointGroupsClient) Get
func(c*RegionNetworkEndpointGroupsClient)Get(ctxcontext.Context,req*computepb.GetRegionNetworkEndpointGroupRequest,opts...gax.CallOption)(*computepb.NetworkEndpointGroup,error)Get returns the specified network endpoint group.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionNetworkEndpointGroupRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionNetworkEndpointGroupsClient) Insert
func(c*RegionNetworkEndpointGroupsClient)Insert(ctxcontext.Context,req*computepb.InsertRegionNetworkEndpointGroupRequest,opts...gax.CallOption)(*Operation,error)Insert creates a network endpoint group in the specified project using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionNetworkEndpointGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionNetworkEndpointGroupRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkEndpointGroupsClient) List
func(c*RegionNetworkEndpointGroupsClient)List(ctxcontext.Context,req*computepb.ListRegionNetworkEndpointGroupsRequest,opts...gax.CallOption)*NetworkEndpointGroupIteratorList retrieves the list of regional network endpoint groups available to the specified project in the given region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionNetworkEndpointGroupsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkEndpointGroupList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionNetworkEndpointGroupsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionNetworkEndpointGroupsClient) ListNetworkEndpoints
func(c*RegionNetworkEndpointGroupsClient)ListNetworkEndpoints(ctxcontext.Context,req*computepb.ListNetworkEndpointsRegionNetworkEndpointGroupsRequest,opts...gax.CallOption)*NetworkEndpointWithHealthStatusIteratorListNetworkEndpoints lists the network endpoints in the specified network endpoint group.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkEndpointsRegionNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkEndpointsRegionNetworkEndpointGroupsRequest.}it:=c.ListNetworkEndpoints(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NetworkEndpointGroupsListNetworkEndpoints)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkEndpointGroupsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListNetworkEndpointsRegionNetworkEndpointGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListNetworkEndpointsRegionNetworkEndpointGroupsRequest.}forresp,err:=rangec.ListNetworkEndpoints(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}RegionNetworkFirewallPoliciesCallOptions
typeRegionNetworkFirewallPoliciesCallOptionsstruct{AddAssociation[]gax.CallOptionAddRule[]gax.CallOptionCloneRules[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetAssociation[]gax.CallOptionGetEffectiveFirewalls[]gax.CallOptionGetIamPolicy[]gax.CallOptionGetRule[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionPatchRule[]gax.CallOptionRemoveAssociation[]gax.CallOptionRemoveRule[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOption}RegionNetworkFirewallPoliciesCallOptions contains the retry settings for each method of RegionNetworkFirewallPoliciesClient.
RegionNetworkFirewallPoliciesClient
typeRegionNetworkFirewallPoliciesClientstruct{// The call options for this service.CallOptions*RegionNetworkFirewallPoliciesCallOptions// contains filtered or unexported fields}RegionNetworkFirewallPoliciesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionNetworkFirewallPolicies API.
func NewRegionNetworkFirewallPoliciesRESTClient
funcNewRegionNetworkFirewallPoliciesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionNetworkFirewallPoliciesClient,error)NewRegionNetworkFirewallPoliciesRESTClient creates a new region network firewall policies rest client.
The RegionNetworkFirewallPolicies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionNetworkFirewallPoliciesClient) AddAssociation
func(c*RegionNetworkFirewallPoliciesClient)AddAssociation(ctxcontext.Context,req*computepb.AddAssociationRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)AddAssociation inserts an association for the specified network firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddAssociationRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddAssociationRegionNetworkFirewallPolicyRequest.}op,err:=c.AddAssociation(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkFirewallPoliciesClient) AddRule
func(c*RegionNetworkFirewallPoliciesClient)AddRule(ctxcontext.Context,req*computepb.AddRuleRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)AddRule inserts a rule into a network firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddRuleRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddRuleRegionNetworkFirewallPolicyRequest.}op,err:=c.AddRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkFirewallPoliciesClient) CloneRules
func(c*RegionNetworkFirewallPoliciesClient)CloneRules(ctxcontext.Context,req*computepb.CloneRulesRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)CloneRules copies rules to the specified network firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.CloneRulesRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#CloneRulesRegionNetworkFirewallPolicyRequest.}op,err:=c.CloneRules(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkFirewallPoliciesClient) Close
func(c*RegionNetworkFirewallPoliciesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionNetworkFirewallPoliciesClient) Connection (deprecated)
func(c*RegionNetworkFirewallPoliciesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionNetworkFirewallPoliciesClient) Delete
func(c*RegionNetworkFirewallPoliciesClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified network firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionNetworkFirewallPolicyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkFirewallPoliciesClient) Get
func(c*RegionNetworkFirewallPoliciesClient)Get(ctxcontext.Context,req*computepb.GetRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPolicy,error)Get returns the specified network firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionNetworkFirewallPolicyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionNetworkFirewallPoliciesClient) GetAssociation
func(c*RegionNetworkFirewallPoliciesClient)GetAssociation(ctxcontext.Context,req*computepb.GetAssociationRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPolicyAssociation,error)GetAssociation gets an association with the specified name.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetAssociationRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetAssociationRegionNetworkFirewallPolicyRequest.}resp,err:=c.GetAssociation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionNetworkFirewallPoliciesClient) GetEffectiveFirewalls
func(c*RegionNetworkFirewallPoliciesClient)GetEffectiveFirewalls(ctxcontext.Context,req*computepb.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse,error)GetEffectiveFirewalls returns the effective firewalls on a given network.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest.}resp,err:=c.GetEffectiveFirewalls(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionNetworkFirewallPoliciesClient) GetIamPolicy
func(c*RegionNetworkFirewallPoliciesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyRegionNetworkFirewallPolicyRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionNetworkFirewallPoliciesClient) GetRule
func(c*RegionNetworkFirewallPoliciesClient)GetRule(ctxcontext.Context,req*computepb.GetRuleRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.FirewallPolicyRule,error)GetRule gets a rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRuleRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRuleRegionNetworkFirewallPolicyRequest.}resp,err:=c.GetRule(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionNetworkFirewallPoliciesClient) Insert
func(c*RegionNetworkFirewallPoliciesClient)Insert(ctxcontext.Context,req*computepb.InsertRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a new network firewall policy in the specified project and region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionNetworkFirewallPolicyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkFirewallPoliciesClient) List
func(c*RegionNetworkFirewallPoliciesClient)List(ctxcontext.Context,req*computepb.ListRegionNetworkFirewallPoliciesRequest,opts...gax.CallOption)*FirewallPolicyIteratorList lists all the network firewall policies that have been configured for the specified project in the given region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionNetworkFirewallPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionNetworkFirewallPoliciesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.FirewallPolicyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionNetworkFirewallPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionNetworkFirewallPoliciesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionNetworkFirewallPoliciesClient) Patch
func(c*RegionNetworkFirewallPoliciesClient)Patch(ctxcontext.Context,req*computepb.PatchRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified network firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRegionNetworkFirewallPolicyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkFirewallPoliciesClient) PatchRule
func(c*RegionNetworkFirewallPoliciesClient)PatchRule(ctxcontext.Context,req*computepb.PatchRuleRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)PatchRule patches a rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRuleRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRuleRegionNetworkFirewallPolicyRequest.}op,err:=c.PatchRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkFirewallPoliciesClient) RemoveAssociation
func(c*RegionNetworkFirewallPoliciesClient)RemoveAssociation(ctxcontext.Context,req*computepb.RemoveAssociationRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)RemoveAssociation removes an association for the specified network firewall policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveAssociationRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveAssociationRegionNetworkFirewallPolicyRequest.}op,err:=c.RemoveAssociation(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkFirewallPoliciesClient) RemoveRule
func(c*RegionNetworkFirewallPoliciesClient)RemoveRule(ctxcontext.Context,req*computepb.RemoveRuleRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*Operation,error)RemoveRule deletes a rule of the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveRuleRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveRuleRegionNetworkFirewallPolicyRequest.}op,err:=c.RemoveRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNetworkFirewallPoliciesClient) SetIamPolicy
func(c*RegionNetworkFirewallPoliciesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyRegionNetworkFirewallPolicyRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionNetworkFirewallPoliciesClient) TestIamPermissions
func(c*RegionNetworkFirewallPoliciesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsRegionNetworkFirewallPolicyRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNetworkFirewallPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsRegionNetworkFirewallPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsRegionNetworkFirewallPolicyRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}RegionNotificationEndpointsCallOptions
typeRegionNotificationEndpointsCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOption}RegionNotificationEndpointsCallOptions contains the retry settings for each method of RegionNotificationEndpointsClient.
RegionNotificationEndpointsClient
typeRegionNotificationEndpointsClientstruct{// The call options for this service.CallOptions*RegionNotificationEndpointsCallOptions// contains filtered or unexported fields}RegionNotificationEndpointsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionNotificationEndpoints API.
func NewRegionNotificationEndpointsRESTClient
funcNewRegionNotificationEndpointsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionNotificationEndpointsClient,error)NewRegionNotificationEndpointsRESTClient creates a new region notification endpoints rest client.
The RegionNotificationEndpoints API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionNotificationEndpointsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionNotificationEndpointsClient) Close
func(c*RegionNotificationEndpointsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionNotificationEndpointsClient) Connection (deprecated)
func(c*RegionNotificationEndpointsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionNotificationEndpointsClient) Delete
func(c*RegionNotificationEndpointsClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionNotificationEndpointRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified NotificationEndpoint in the given region
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNotificationEndpointsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionNotificationEndpointRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionNotificationEndpointRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNotificationEndpointsClient) Get
func(c*RegionNotificationEndpointsClient)Get(ctxcontext.Context,req*computepb.GetRegionNotificationEndpointRequest,opts...gax.CallOption)(*computepb.NotificationEndpoint,error)Get returns the specified NotificationEndpoint resource in the given region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNotificationEndpointsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionNotificationEndpointRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionNotificationEndpointRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionNotificationEndpointsClient) Insert
func(c*RegionNotificationEndpointsClient)Insert(ctxcontext.Context,req*computepb.InsertRegionNotificationEndpointRequest,opts...gax.CallOption)(*Operation,error)Insert create a NotificationEndpoint in the specified project in the given region using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNotificationEndpointsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionNotificationEndpointRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionNotificationEndpointRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionNotificationEndpointsClient) List
func(c*RegionNotificationEndpointsClient)List(ctxcontext.Context,req*computepb.ListRegionNotificationEndpointsRequest,opts...gax.CallOption)*NotificationEndpointIteratorList lists the NotificationEndpoints for a project in the given region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionNotificationEndpointsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionNotificationEndpointsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionNotificationEndpointsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.NotificationEndpointList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionNotificationEndpointsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionNotificationEndpointsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionNotificationEndpointsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}RegionOperationsCallOptions
typeRegionOperationsCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionList[]gax.CallOptionWait[]gax.CallOption}RegionOperationsCallOptions contains the retry settings for each method of RegionOperationsClient.
RegionOperationsClient
typeRegionOperationsClientstruct{// The call options for this service.CallOptions*RegionOperationsCallOptions// contains filtered or unexported fields}RegionOperationsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionOperations API.
func NewRegionOperationsRESTClient
funcNewRegionOperationsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionOperationsClient,error)NewRegionOperationsRESTClient creates a new region operations rest client.
The RegionOperations API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionOperationsClient) Close
func(c*RegionOperationsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionOperationsClient) Connection (deprecated)
func(c*RegionOperationsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionOperationsClient) Delete
func(c*RegionOperationsClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionOperationRequest,opts...gax.CallOption)(*computepb.DeleteRegionOperationResponse,error)Delete deletes the specified region-specific Operations resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionOperationRequest.}resp,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionOperationsClient) Get
func(c*RegionOperationsClient)Get(ctxcontext.Context,req*computepb.GetRegionOperationRequest,opts...gax.CallOption)(*computepb.Operation,error)Get retrieves the specified region-specific Operations resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionOperationRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionOperationsClient) List
func(c*RegionOperationsClient)List(ctxcontext.Context,req*computepb.ListRegionOperationsRequest,opts...gax.CallOption)*OperationIteratorList retrieves a list of Operation resources contained within the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionOperationsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.OperationList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionOperationsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionOperationsClient) Wait
func(c*RegionOperationsClient)Wait(ctxcontext.Context,req*computepb.WaitRegionOperationRequest,opts...gax.CallOption)(*computepb.Operation,error)Wait waits for the specified Operation resource to return as DONE or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the GET method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be DONE or still in progress. This method is called on a best-effort basis. Specifically: - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.WaitRegionOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#WaitRegionOperationRequest.}resp,err:=c.Wait(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}RegionSecurityPoliciesCallOptions
typeRegionSecurityPoliciesCallOptionsstruct{AddRule[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetRule[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionPatchRule[]gax.CallOptionRemoveRule[]gax.CallOptionSetLabels[]gax.CallOption}RegionSecurityPoliciesCallOptions contains the retry settings for each method of RegionSecurityPoliciesClient.
RegionSecurityPoliciesClient
typeRegionSecurityPoliciesClientstruct{// The call options for this service.CallOptions*RegionSecurityPoliciesCallOptions// contains filtered or unexported fields}RegionSecurityPoliciesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionSecurityPolicies API.
func NewRegionSecurityPoliciesRESTClient
funcNewRegionSecurityPoliciesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionSecurityPoliciesClient,error)NewRegionSecurityPoliciesRESTClient creates a new region security policies rest client.
The RegionSecurityPolicies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionSecurityPoliciesClient) AddRule
func(c*RegionSecurityPoliciesClient)AddRule(ctxcontext.Context,req*computepb.AddRuleRegionSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)AddRule inserts a rule into a security policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddRuleRegionSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddRuleRegionSecurityPolicyRequest.}op,err:=c.AddRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionSecurityPoliciesClient) Close
func(c*RegionSecurityPoliciesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionSecurityPoliciesClient) Connection (deprecated)
func(c*RegionSecurityPoliciesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionSecurityPoliciesClient) Delete
func(c*RegionSecurityPoliciesClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionSecurityPolicyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionSecurityPoliciesClient) Get
func(c*RegionSecurityPoliciesClient)Get(ctxcontext.Context,req*computepb.GetRegionSecurityPolicyRequest,opts...gax.CallOption)(*computepb.SecurityPolicy,error)Get list all of the ordered rules present in a single specified policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionSecurityPolicyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionSecurityPoliciesClient) GetRule
func(c*RegionSecurityPoliciesClient)GetRule(ctxcontext.Context,req*computepb.GetRuleRegionSecurityPolicyRequest,opts...gax.CallOption)(*computepb.SecurityPolicyRule,error)GetRule gets a rule at the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRuleRegionSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRuleRegionSecurityPolicyRequest.}resp,err:=c.GetRule(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionSecurityPoliciesClient) Insert
func(c*RegionSecurityPoliciesClient)Insert(ctxcontext.Context,req*computepb.InsertRegionSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a new policy in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionSecurityPolicyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionSecurityPoliciesClient) List
func(c*RegionSecurityPoliciesClient)List(ctxcontext.Context,req*computepb.ListRegionSecurityPoliciesRequest,opts...gax.CallOption)*SecurityPolicyIteratorList list all the policies that have been configured for the specified project and region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionSecurityPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionSecurityPoliciesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SecurityPolicyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionSecurityPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionSecurityPoliciesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionSecurityPoliciesClient) Patch
func(c*RegionSecurityPoliciesClient)Patch(ctxcontext.Context,req*computepb.PatchRegionSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified policy with the data included in the request. To clear fields in the policy, leave the fields empty and specify them in the updateMask. This cannot be used to be update the rules in the policy. Please use the per rule methods like addRule, patchRule, and removeRule instead.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRegionSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRegionSecurityPolicyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionSecurityPoliciesClient) PatchRule
func(c*RegionSecurityPoliciesClient)PatchRule(ctxcontext.Context,req*computepb.PatchRuleRegionSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)PatchRule patches a rule at the specified priority. To clear fields in the rule, leave the fields empty and specify them in the updateMask.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRuleRegionSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRuleRegionSecurityPolicyRequest.}op,err:=c.PatchRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionSecurityPoliciesClient) RemoveRule
func(c*RegionSecurityPoliciesClient)RemoveRule(ctxcontext.Context,req*computepb.RemoveRuleRegionSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)RemoveRule deletes a rule at the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveRuleRegionSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveRuleRegionSecurityPolicyRequest.}op,err:=c.RemoveRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionSecurityPoliciesClient) SetLabels
func(c*RegionSecurityPoliciesClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsRegionSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a security policy. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsRegionSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsRegionSecurityPolicyRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionSslCertificatesCallOptions
typeRegionSslCertificatesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOption}RegionSslCertificatesCallOptions contains the retry settings for each method of RegionSslCertificatesClient.
RegionSslCertificatesClient
typeRegionSslCertificatesClientstruct{// The call options for this service.CallOptions*RegionSslCertificatesCallOptions// contains filtered or unexported fields}RegionSslCertificatesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionSslCertificates API.
func NewRegionSslCertificatesRESTClient
funcNewRegionSslCertificatesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionSslCertificatesClient,error)NewRegionSslCertificatesRESTClient creates a new region ssl certificates rest client.
The RegionSslCertificates API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionSslCertificatesClient) Close
func(c*RegionSslCertificatesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionSslCertificatesClient) Connection (deprecated)
func(c*RegionSslCertificatesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionSslCertificatesClient) Delete
func(c*RegionSslCertificatesClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionSslCertificateRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified SslCertificate resource in the region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionSslCertificateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionSslCertificateRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionSslCertificatesClient) Get
func(c*RegionSslCertificatesClient)Get(ctxcontext.Context,req*computepb.GetRegionSslCertificateRequest,opts...gax.CallOption)(*computepb.SslCertificate,error)Get returns the specified SslCertificate resource in the specified region. Get a list of available SSL certificates by making a list() request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionSslCertificateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionSslCertificateRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionSslCertificatesClient) Insert
func(c*RegionSslCertificatesClient)Insert(ctxcontext.Context,req*computepb.InsertRegionSslCertificateRequest,opts...gax.CallOption)(*Operation,error)Insert creates a SslCertificate resource in the specified project and region using the data included in the request
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionSslCertificateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionSslCertificateRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionSslCertificatesClient) List
func(c*RegionSslCertificatesClient)List(ctxcontext.Context,req*computepb.ListRegionSslCertificatesRequest,opts...gax.CallOption)*SslCertificateIteratorList retrieves the list of SslCertificate resources available to the specified project in the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionSslCertificatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionSslCertificatesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SslCertificateList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionSslCertificatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionSslCertificatesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}RegionSslPoliciesCallOptions
typeRegionSslPoliciesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListAvailableFeatures[]gax.CallOptionPatch[]gax.CallOption}RegionSslPoliciesCallOptions contains the retry settings for each method of RegionSslPoliciesClient.
RegionSslPoliciesClient
typeRegionSslPoliciesClientstruct{// The call options for this service.CallOptions*RegionSslPoliciesCallOptions// contains filtered or unexported fields}RegionSslPoliciesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionSslPolicies API.
func NewRegionSslPoliciesRESTClient
funcNewRegionSslPoliciesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionSslPoliciesClient,error)NewRegionSslPoliciesRESTClient creates a new region ssl policies rest client.
The RegionSslPolicies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionSslPoliciesClient) Close
func(c*RegionSslPoliciesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionSslPoliciesClient) Connection (deprecated)
func(c*RegionSslPoliciesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionSslPoliciesClient) Delete
func(c*RegionSslPoliciesClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionSslPolicyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in use by any TargetHttpsProxy or TargetSslProxy resources.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionSslPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionSslPolicyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionSslPoliciesClient) Get
func(c*RegionSslPoliciesClient)Get(ctxcontext.Context,req*computepb.GetRegionSslPolicyRequest,opts...gax.CallOption)(*computepb.SslPolicy,error)Get lists all of the ordered rules present in a single specified policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionSslPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionSslPolicyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionSslPoliciesClient) Insert
func(c*RegionSslPoliciesClient)Insert(ctxcontext.Context,req*computepb.InsertRegionSslPolicyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a new policy in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionSslPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionSslPolicyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionSslPoliciesClient) List
func(c*RegionSslPoliciesClient)List(ctxcontext.Context,req*computepb.ListRegionSslPoliciesRequest,opts...gax.CallOption)*SslPolicyIteratorList lists all the SSL policies that have been configured for the specified project and region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionSslPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionSslPoliciesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SslPoliciesList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionSslPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionSslPoliciesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionSslPoliciesClient) ListAvailableFeatures
func(c*RegionSslPoliciesClient)ListAvailableFeatures(ctxcontext.Context,req*computepb.ListAvailableFeaturesRegionSslPoliciesRequest,opts...gax.CallOption)(*computepb.SslPoliciesListAvailableFeaturesResponse,error)ListAvailableFeatures lists all features that can be specified in the SSL policy when using custom profile.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListAvailableFeaturesRegionSslPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListAvailableFeaturesRegionSslPoliciesRequest.}resp,err:=c.ListAvailableFeatures(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionSslPoliciesClient) Patch
func(c*RegionSslPoliciesClient)Patch(ctxcontext.Context,req*computepb.PatchRegionSslPolicyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified SSL policy with the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRegionSslPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRegionSslPolicyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionTargetHttpProxiesCallOptions
typeRegionTargetHttpProxiesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetUrlMap[]gax.CallOption}RegionTargetHttpProxiesCallOptions contains the retry settings for each method of RegionTargetHttpProxiesClient.
RegionTargetHttpProxiesClient
typeRegionTargetHttpProxiesClientstruct{// The call options for this service.CallOptions*RegionTargetHttpProxiesCallOptions// contains filtered or unexported fields}RegionTargetHttpProxiesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionTargetHttpProxies API.
func NewRegionTargetHttpProxiesRESTClient
funcNewRegionTargetHttpProxiesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionTargetHttpProxiesClient,error)NewRegionTargetHttpProxiesRESTClient creates a new region target http proxies rest client.
The RegionTargetHttpProxies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionTargetHttpProxiesClient) Close
func(c*RegionTargetHttpProxiesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionTargetHttpProxiesClient) Connection (deprecated)
func(c*RegionTargetHttpProxiesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionTargetHttpProxiesClient) Delete
func(c*RegionTargetHttpProxiesClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionTargetHttpProxyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified TargetHttpProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionTargetHttpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionTargetHttpProxyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionTargetHttpProxiesClient) Get
func(c*RegionTargetHttpProxiesClient)Get(ctxcontext.Context,req*computepb.GetRegionTargetHttpProxyRequest,opts...gax.CallOption)(*computepb.TargetHttpProxy,error)Get returns the specified TargetHttpProxy resource in the specified region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionTargetHttpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionTargetHttpProxyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionTargetHttpProxiesClient) Insert
func(c*RegionTargetHttpProxiesClient)Insert(ctxcontext.Context,req*computepb.InsertRegionTargetHttpProxyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a TargetHttpProxy resource in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionTargetHttpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionTargetHttpProxyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionTargetHttpProxiesClient) List
func(c*RegionTargetHttpProxiesClient)List(ctxcontext.Context,req*computepb.ListRegionTargetHttpProxiesRequest,opts...gax.CallOption)*TargetHttpProxyIteratorList retrieves the list of TargetHttpProxy resources available to the specified project in the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionTargetHttpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionTargetHttpProxiesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetHttpProxyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionTargetHttpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionTargetHttpProxiesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionTargetHttpProxiesClient) SetUrlMap
func(c*RegionTargetHttpProxiesClient)SetUrlMap(ctxcontext.Context,req*computepb.SetUrlMapRegionTargetHttpProxyRequest,opts...gax.CallOption)(*Operation,error)SetUrlMap changes the URL map for TargetHttpProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetUrlMapRegionTargetHttpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetUrlMapRegionTargetHttpProxyRequest.}op,err:=c.SetUrlMap(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionTargetHttpsProxiesCallOptions
typeRegionTargetHttpsProxiesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetSslCertificates[]gax.CallOptionSetUrlMap[]gax.CallOption}RegionTargetHttpsProxiesCallOptions contains the retry settings for each method of RegionTargetHttpsProxiesClient.
RegionTargetHttpsProxiesClient
typeRegionTargetHttpsProxiesClientstruct{// The call options for this service.CallOptions*RegionTargetHttpsProxiesCallOptions// contains filtered or unexported fields}RegionTargetHttpsProxiesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionTargetHttpsProxies API.
func NewRegionTargetHttpsProxiesRESTClient
funcNewRegionTargetHttpsProxiesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionTargetHttpsProxiesClient,error)NewRegionTargetHttpsProxiesRESTClient creates a new region target https proxies rest client.
The RegionTargetHttpsProxies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionTargetHttpsProxiesClient) Close
func(c*RegionTargetHttpsProxiesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionTargetHttpsProxiesClient) Connection (deprecated)
func(c*RegionTargetHttpsProxiesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionTargetHttpsProxiesClient) Delete
func(c*RegionTargetHttpsProxiesClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified TargetHttpsProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionTargetHttpsProxyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionTargetHttpsProxiesClient) Get
func(c*RegionTargetHttpsProxiesClient)Get(ctxcontext.Context,req*computepb.GetRegionTargetHttpsProxyRequest,opts...gax.CallOption)(*computepb.TargetHttpsProxy,error)Get returns the specified TargetHttpsProxy resource in the specified region.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionTargetHttpsProxyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionTargetHttpsProxiesClient) Insert
func(c*RegionTargetHttpsProxiesClient)Insert(ctxcontext.Context,req*computepb.InsertRegionTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a TargetHttpsProxy resource in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionTargetHttpsProxyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionTargetHttpsProxiesClient) List
func(c*RegionTargetHttpsProxiesClient)List(ctxcontext.Context,req*computepb.ListRegionTargetHttpsProxiesRequest,opts...gax.CallOption)*TargetHttpsProxyIteratorList retrieves the list of TargetHttpsProxy resources available to the specified project in the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionTargetHttpsProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionTargetHttpsProxiesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetHttpsProxyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionTargetHttpsProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionTargetHttpsProxiesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionTargetHttpsProxiesClient) Patch
func(c*RegionTargetHttpsProxiesClient)Patch(ctxcontext.Context,req*computepb.PatchRegionTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified regional TargetHttpsProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRegionTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRegionTargetHttpsProxyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionTargetHttpsProxiesClient) SetSslCertificates
func(c*RegionTargetHttpsProxiesClient)SetSslCertificates(ctxcontext.Context,req*computepb.SetSslCertificatesRegionTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)SetSslCertificates replaces SslCertificates for TargetHttpsProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSslCertificatesRegionTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSslCertificatesRegionTargetHttpsProxyRequest.}op,err:=c.SetSslCertificates(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionTargetHttpsProxiesClient) SetUrlMap
func(c*RegionTargetHttpsProxiesClient)SetUrlMap(ctxcontext.Context,req*computepb.SetUrlMapRegionTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)SetUrlMap changes the URL map for TargetHttpsProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetUrlMapRegionTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetUrlMapRegionTargetHttpsProxyRequest.}op,err:=c.SetUrlMap(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RegionTargetTcpProxiesCallOptions
typeRegionTargetTcpProxiesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOption}RegionTargetTcpProxiesCallOptions contains the retry settings for each method of RegionTargetTcpProxiesClient.
RegionTargetTcpProxiesClient
typeRegionTargetTcpProxiesClientstruct{// The call options for this service.CallOptions*RegionTargetTcpProxiesCallOptions// contains filtered or unexported fields}RegionTargetTcpProxiesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionTargetTcpProxies API.
func NewRegionTargetTcpProxiesRESTClient
funcNewRegionTargetTcpProxiesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionTargetTcpProxiesClient,error)NewRegionTargetTcpProxiesRESTClient creates a new region target tcp proxies rest client.
The RegionTargetTcpProxies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionTargetTcpProxiesClient) Close
func(c*RegionTargetTcpProxiesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionTargetTcpProxiesClient) Connection (deprecated)
func(c*RegionTargetTcpProxiesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionTargetTcpProxiesClient) Delete
func(c*RegionTargetTcpProxiesClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionTargetTcpProxyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified TargetTcpProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionTargetTcpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionTargetTcpProxyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionTargetTcpProxiesClient) Get
func(c*RegionTargetTcpProxiesClient)Get(ctxcontext.Context,req*computepb.GetRegionTargetTcpProxyRequest,opts...gax.CallOption)(*computepb.TargetTcpProxy,error)Get returns the specified TargetTcpProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionTargetTcpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionTargetTcpProxyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionTargetTcpProxiesClient) Insert
func(c*RegionTargetTcpProxiesClient)Insert(ctxcontext.Context,req*computepb.InsertRegionTargetTcpProxyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a TargetTcpProxy resource in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionTargetTcpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionTargetTcpProxyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionTargetTcpProxiesClient) List
func(c*RegionTargetTcpProxiesClient)List(ctxcontext.Context,req*computepb.ListRegionTargetTcpProxiesRequest,opts...gax.CallOption)*TargetTcpProxyIteratorList retrieves a list of TargetTcpProxy resources available to the specified project in a given region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionTargetTcpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionTargetTcpProxiesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetTcpProxyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionTargetTcpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionTargetTcpProxiesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}RegionUrlMapsCallOptions
typeRegionUrlMapsCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionUpdate[]gax.CallOptionValidate[]gax.CallOption}RegionUrlMapsCallOptions contains the retry settings for each method of RegionUrlMapsClient.
RegionUrlMapsClient
typeRegionUrlMapsClientstruct{// The call options for this service.CallOptions*RegionUrlMapsCallOptions// contains filtered or unexported fields}RegionUrlMapsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionUrlMaps API.
func NewRegionUrlMapsRESTClient
funcNewRegionUrlMapsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionUrlMapsClient,error)NewRegionUrlMapsRESTClient creates a new region url maps rest client.
The RegionUrlMaps API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionUrlMapsClient) Close
func(c*RegionUrlMapsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionUrlMapsClient) Connection (deprecated)
func(c*RegionUrlMapsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionUrlMapsClient) Delete
func(c*RegionUrlMapsClient)Delete(ctxcontext.Context,req*computepb.DeleteRegionUrlMapRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified UrlMap resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRegionUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRegionUrlMapRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionUrlMapsClient) Get
func(c*RegionUrlMapsClient)Get(ctxcontext.Context,req*computepb.GetRegionUrlMapRequest,opts...gax.CallOption)(*computepb.UrlMap,error)Get returns the specified UrlMap resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionUrlMapRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionUrlMapsClient) Insert
func(c*RegionUrlMapsClient)Insert(ctxcontext.Context,req*computepb.InsertRegionUrlMapRequest,opts...gax.CallOption)(*Operation,error)Insert creates a UrlMap resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRegionUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRegionUrlMapRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionUrlMapsClient) List
func(c*RegionUrlMapsClient)List(ctxcontext.Context,req*computepb.ListRegionUrlMapsRequest,opts...gax.CallOption)*UrlMapIteratorList retrieves the list of UrlMap resources available to the specified project in the specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionUrlMapsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionUrlMapsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.UrlMapList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionUrlMapsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionUrlMapsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RegionUrlMapsClient) Patch
func(c*RegionUrlMapsClient)Patch(ctxcontext.Context,req*computepb.PatchRegionUrlMapRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRegionUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRegionUrlMapRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionUrlMapsClient) Update
func(c*RegionUrlMapsClient)Update(ctxcontext.Context,req*computepb.UpdateRegionUrlMapRequest,opts...gax.CallOption)(*Operation,error)Update updates the specified UrlMap resource with the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateRegionUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateRegionUrlMapRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RegionUrlMapsClient) Validate
func(c*RegionUrlMapsClient)Validate(ctxcontext.Context,req*computepb.ValidateRegionUrlMapRequest,opts...gax.CallOption)(*computepb.UrlMapsValidateResponse,error)Validate runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ValidateRegionUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ValidateRegionUrlMapRequest.}resp,err:=c.Validate(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}RegionZonesCallOptions
typeRegionZonesCallOptionsstruct{List[]gax.CallOption}RegionZonesCallOptions contains the retry settings for each method of RegionZonesClient.
RegionZonesClient
typeRegionZonesClientstruct{// The call options for this service.CallOptions*RegionZonesCallOptions// contains filtered or unexported fields}RegionZonesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The RegionZones API.
func NewRegionZonesRESTClient
funcNewRegionZonesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionZonesClient,error)NewRegionZonesRESTClient creates a new region zones rest client.
The RegionZones API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionZonesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionZonesClient) Close
func(c*RegionZonesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionZonesClient) Connection (deprecated)
func(c*RegionZonesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionZonesClient) List
func(c*RegionZonesClient)List(ctxcontext.Context,req*computepb.ListRegionZonesRequest,opts...gax.CallOption)*ZoneIteratorList retrieves the list of Zone resources under the specific region available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionZonesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionZonesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionZonesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ZoneList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionZonesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionZonesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionZonesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}RegionsCallOptions
typeRegionsCallOptionsstruct{Get[]gax.CallOptionList[]gax.CallOption}RegionsCallOptions contains the retry settings for each method of RegionsClient.
RegionsClient
typeRegionsClientstruct{// The call options for this service.CallOptions*RegionsCallOptions// contains filtered or unexported fields}RegionsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Regions API.
func NewRegionsRESTClient
funcNewRegionsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RegionsClient,error)NewRegionsRESTClient creates a new regions rest client.
The Regions API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRegionsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RegionsClient) Close
func(c*RegionsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RegionsClient) Connection (deprecated)
func(c*RegionsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RegionsClient) Get
func(c*RegionsClient)Get(ctxcontext.Context,req*computepb.GetRegionRequest,opts...gax.CallOption)(*computepb.Region,error)Get returns the specified Region resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas field). To exclude one or more fields, set your request’s fields query parameter to only include the fields you need. For example, to only include the id and selfLink fields, add the query parameter ?fields=id,selfLink to your request. This method fails if the quota information is unavailable for the region and if the organization policy constraint compute.requireBasicQuotaInResponse is enforced. This constraint, when enforced, disables the fail-open behaviour when quota information (the items.quotas field) is unavailable for the region. It is recommended to use the default setting for the constraint unless your application requires the fail-closed behaviour for this method.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRegionRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRegionRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RegionsClient) List
func(c*RegionsClient)List(ctxcontext.Context,req*computepb.ListRegionsRequest,opts...gax.CallOption)*RegionIteratorList retrieves the list of region resources available to the specified project. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the items.quotas field). To exclude one or more fields, set your request’s fields query parameter to only include the fields you need. For example, to only include the id and selfLink fields, add the query parameter ?fields=id,selfLink to your request. This method fails if the quota information is unavailable for the region and if the organization policy constraint compute.requireBasicQuotaInResponse is enforced. This constraint, when enforced, disables the fail-open behaviour when quota information (the items.quotas field) is unavailable for the region. It is recommended to use the default setting for the constraint unless your application requires the fail-closed behaviour for this method.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRegionsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RegionList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRegionsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRegionsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRegionsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}ReservationBlockIterator
typeReservationBlockIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.ReservationBlock,nextPageTokenstring,errerror)// contains filtered or unexported fields}ReservationBlockIterator manages a stream of *computepb.ReservationBlock.
func (*ReservationBlockIterator) All
func(it*ReservationBlockIterator)All()iter.Seq2[*computepb.ReservationBlock,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ReservationBlockIterator) Next
func(it*ReservationBlockIterator)Next()(*computepb.ReservationBlock,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ReservationBlockIterator) PageInfo
func(it*ReservationBlockIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ReservationBlocksCallOptions
typeReservationBlocksCallOptionsstruct{Get[]gax.CallOptionList[]gax.CallOptionPerformMaintenance[]gax.CallOption}ReservationBlocksCallOptions contains the retry settings for each method of ReservationBlocksClient.
ReservationBlocksClient
typeReservationBlocksClientstruct{// The call options for this service.CallOptions*ReservationBlocksCallOptions// contains filtered or unexported fields}ReservationBlocksClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The ReservationBlocks API.
func NewReservationBlocksRESTClient
funcNewReservationBlocksRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ReservationBlocksClient,error)NewReservationBlocksRESTClient creates a new reservation blocks rest client.
The ReservationBlocks API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewReservationBlocksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ReservationBlocksClient) Close
func(c*ReservationBlocksClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ReservationBlocksClient) Connection (deprecated)
func(c*ReservationBlocksClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ReservationBlocksClient) Get
func(c*ReservationBlocksClient)Get(ctxcontext.Context,req*computepb.GetReservationBlockRequest,opts...gax.CallOption)(*computepb.ReservationBlocksGetResponse,error)Get retrieves information about the specified reservation block.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationBlocksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetReservationBlockRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetReservationBlockRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ReservationBlocksClient) List
func(c*ReservationBlocksClient)List(ctxcontext.Context,req*computepb.ListReservationBlocksRequest,opts...gax.CallOption)*ReservationBlockIteratorList retrieves a list of reservation blocks under a single reservation.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewReservationBlocksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListReservationBlocksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListReservationBlocksRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ReservationBlocksListResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationBlocksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListReservationBlocksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListReservationBlocksRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ReservationBlocksClient) PerformMaintenance
func(c*ReservationBlocksClient)PerformMaintenance(ctxcontext.Context,req*computepb.PerformMaintenanceReservationBlockRequest,opts...gax.CallOption)(*Operation,error)PerformMaintenance allows customers to perform maintenance on a reservation block
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationBlocksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PerformMaintenanceReservationBlockRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PerformMaintenanceReservationBlockRequest.}op,err:=c.PerformMaintenance(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}ReservationIterator
typeReservationIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Reservation,nextPageTokenstring,errerror)// contains filtered or unexported fields}ReservationIterator manages a stream of *computepb.Reservation.
func (*ReservationIterator) All
func(it*ReservationIterator)All()iter.Seq2[*computepb.Reservation,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ReservationIterator) Next
func(it*ReservationIterator)Next()(*computepb.Reservation,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ReservationIterator) PageInfo
func(it*ReservationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ReservationSubBlockIterator
typeReservationSubBlockIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.ReservationSubBlock,nextPageTokenstring,errerror)// contains filtered or unexported fields}ReservationSubBlockIterator manages a stream of *computepb.ReservationSubBlock.
func (*ReservationSubBlockIterator) All
func(it*ReservationSubBlockIterator)All()iter.Seq2[*computepb.ReservationSubBlock,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ReservationSubBlockIterator) Next
func(it*ReservationSubBlockIterator)Next()(*computepb.ReservationSubBlock,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ReservationSubBlockIterator) PageInfo
func(it*ReservationSubBlockIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ReservationSubBlocksCallOptions
typeReservationSubBlocksCallOptionsstruct{Get[]gax.CallOptionList[]gax.CallOptionPerformMaintenance[]gax.CallOption}ReservationSubBlocksCallOptions contains the retry settings for each method of ReservationSubBlocksClient.
ReservationSubBlocksClient
typeReservationSubBlocksClientstruct{// The call options for this service.CallOptions*ReservationSubBlocksCallOptions// contains filtered or unexported fields}ReservationSubBlocksClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The ReservationSubBlocks API.
func NewReservationSubBlocksRESTClient
funcNewReservationSubBlocksRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ReservationSubBlocksClient,error)NewReservationSubBlocksRESTClient creates a new reservation sub blocks rest client.
The ReservationSubBlocks API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewReservationSubBlocksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ReservationSubBlocksClient) Close
func(c*ReservationSubBlocksClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ReservationSubBlocksClient) Connection (deprecated)
func(c*ReservationSubBlocksClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ReservationSubBlocksClient) Get
func(c*ReservationSubBlocksClient)Get(ctxcontext.Context,req*computepb.GetReservationSubBlockRequest,opts...gax.CallOption)(*computepb.ReservationSubBlocksGetResponse,error)Get retrieves information about the specified reservation subBlock.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationSubBlocksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetReservationSubBlockRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetReservationSubBlockRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ReservationSubBlocksClient) List
func(c*ReservationSubBlocksClient)List(ctxcontext.Context,req*computepb.ListReservationSubBlocksRequest,opts...gax.CallOption)*ReservationSubBlockIteratorList retrieves a list of reservation subBlocks under a single reservation.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewReservationSubBlocksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListReservationSubBlocksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListReservationSubBlocksRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ReservationSubBlocksListResponse)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationSubBlocksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListReservationSubBlocksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListReservationSubBlocksRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ReservationSubBlocksClient) PerformMaintenance
func(c*ReservationSubBlocksClient)PerformMaintenance(ctxcontext.Context,req*computepb.PerformMaintenanceReservationSubBlockRequest,opts...gax.CallOption)(*Operation,error)PerformMaintenance allows customers to perform maintenance on a reservation subBlock
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationSubBlocksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PerformMaintenanceReservationSubBlockRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PerformMaintenanceReservationSubBlockRequest.}op,err:=c.PerformMaintenance(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}ReservationsCallOptions
typeReservationsCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPerformMaintenance[]gax.CallOptionResize[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOptionUpdate[]gax.CallOption}ReservationsCallOptions contains the retry settings for each method of ReservationsClient.
ReservationsClient
typeReservationsClientstruct{// The call options for this service.CallOptions*ReservationsCallOptions// contains filtered or unexported fields}ReservationsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Reservations API.
func NewReservationsRESTClient
funcNewReservationsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ReservationsClient,error)NewReservationsRESTClient creates a new reservations rest client.
The Reservations API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ReservationsClient) AggregatedList
func(c*ReservationsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListReservationsRequest,opts...gax.CallOption)*ReservationsScopedListPairIteratorAggregatedList retrieves an aggregated list of reservations. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListReservationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListReservationsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ReservationAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListReservationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListReservationsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ReservationsClient) Close
func(c*ReservationsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ReservationsClient) Connection (deprecated)
func(c*ReservationsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ReservationsClient) Delete
func(c*ReservationsClient)Delete(ctxcontext.Context,req*computepb.DeleteReservationRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified reservation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteReservationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteReservationRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ReservationsClient) Get
func(c*ReservationsClient)Get(ctxcontext.Context,req*computepb.GetReservationRequest,opts...gax.CallOption)(*computepb.Reservation,error)Get retrieves information about the specified reservation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetReservationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetReservationRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ReservationsClient) GetIamPolicy
func(c*ReservationsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyReservationRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyReservationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyReservationRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ReservationsClient) Insert
func(c*ReservationsClient)Insert(ctxcontext.Context,req*computepb.InsertReservationRequest,opts...gax.CallOption)(*Operation,error)Insert creates a new reservation. For more information, read Reserving zonal resources.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertReservationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertReservationRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ReservationsClient) List
func(c*ReservationsClient)List(ctxcontext.Context,req*computepb.ListReservationsRequest,opts...gax.CallOption)*ReservationIteratorList a list of all the reservations that have been configured for the specified project in specified zone.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListReservationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListReservationsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ReservationList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListReservationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListReservationsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ReservationsClient) PerformMaintenance
func(c*ReservationsClient)PerformMaintenance(ctxcontext.Context,req*computepb.PerformMaintenanceReservationRequest,opts...gax.CallOption)(*Operation,error)PerformMaintenance perform maintenance on an extended reservation
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PerformMaintenanceReservationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PerformMaintenanceReservationRequest.}op,err:=c.PerformMaintenance(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ReservationsClient) Resize
func(c*ReservationsClient)Resize(ctxcontext.Context,req*computepb.ResizeReservationRequest,opts...gax.CallOption)(*Operation,error)Resize resizes the reservation (applicable to standalone reservations only). For more information, read Modifying reservations.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ResizeReservationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ResizeReservationRequest.}op,err:=c.Resize(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ReservationsClient) SetIamPolicy
func(c*ReservationsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyReservationRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyReservationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyReservationRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ReservationsClient) TestIamPermissions
func(c*ReservationsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsReservationRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsReservationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsReservationRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ReservationsClient) Update
func(c*ReservationsClient)Update(ctxcontext.Context,req*computepb.UpdateReservationRequest,opts...gax.CallOption)(*Operation,error)Update update share settings of the reservation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewReservationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateReservationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateReservationRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}ReservationsScopedListPair
typeReservationsScopedListPairstruct{KeystringValue*computepb.ReservationsScopedList}ReservationsScopedListPair is a holder type for string/*computepb.ReservationsScopedList map entries
ReservationsScopedListPairIterator
typeReservationsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]ReservationsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}ReservationsScopedListPairIterator manages a stream of ReservationsScopedListPair.
func (*ReservationsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ReservationsScopedListPairIterator) Next
func(it*ReservationsScopedListPairIterator)Next()(ReservationsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ReservationsScopedListPairIterator) PageInfo
func(it*ReservationsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ResourcePoliciesCallOptions
typeResourcePoliciesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOption}ResourcePoliciesCallOptions contains the retry settings for each method of ResourcePoliciesClient.
ResourcePoliciesClient
typeResourcePoliciesClientstruct{// The call options for this service.CallOptions*ResourcePoliciesCallOptions// contains filtered or unexported fields}ResourcePoliciesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The ResourcePolicies API.
func NewResourcePoliciesRESTClient
funcNewResourcePoliciesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ResourcePoliciesClient,error)NewResourcePoliciesRESTClient creates a new resource policies rest client.
The ResourcePolicies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ResourcePoliciesClient) AggregatedList
func(c*ResourcePoliciesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListResourcePoliciesRequest,opts...gax.CallOption)*ResourcePoliciesScopedListPairIteratorAggregatedList retrieves an aggregated list of resource policies. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListResourcePoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListResourcePoliciesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ResourcePolicyAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListResourcePoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListResourcePoliciesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ResourcePoliciesClient) Close
func(c*ResourcePoliciesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ResourcePoliciesClient) Connection (deprecated)
func(c*ResourcePoliciesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ResourcePoliciesClient) Delete
func(c*ResourcePoliciesClient)Delete(ctxcontext.Context,req*computepb.DeleteResourcePolicyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified resource policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteResourcePolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteResourcePolicyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ResourcePoliciesClient) Get
func(c*ResourcePoliciesClient)Get(ctxcontext.Context,req*computepb.GetResourcePolicyRequest,opts...gax.CallOption)(*computepb.ResourcePolicy,error)Get retrieves all information of the specified resource policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetResourcePolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetResourcePolicyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ResourcePoliciesClient) GetIamPolicy
func(c*ResourcePoliciesClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyResourcePolicyRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyResourcePolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyResourcePolicyRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ResourcePoliciesClient) Insert
func(c*ResourcePoliciesClient)Insert(ctxcontext.Context,req*computepb.InsertResourcePolicyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a new resource policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertResourcePolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertResourcePolicyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ResourcePoliciesClient) List
func(c*ResourcePoliciesClient)List(ctxcontext.Context,req*computepb.ListResourcePoliciesRequest,opts...gax.CallOption)*ResourcePolicyIteratorList a list all the resource policies that have been configured for the specified project in specified region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListResourcePoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListResourcePoliciesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ResourcePolicyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListResourcePoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListResourcePoliciesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ResourcePoliciesClient) Patch
func(c*ResourcePoliciesClient)Patch(ctxcontext.Context,req*computepb.PatchResourcePolicyRequest,opts...gax.CallOption)(*Operation,error)Patch modify the specified resource policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchResourcePolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchResourcePolicyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ResourcePoliciesClient) SetIamPolicy
func(c*ResourcePoliciesClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyResourcePolicyRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyResourcePolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyResourcePolicyRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ResourcePoliciesClient) TestIamPermissions
func(c*ResourcePoliciesClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsResourcePolicyRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewResourcePoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsResourcePolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsResourcePolicyRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}ResourcePoliciesScopedListPair
typeResourcePoliciesScopedListPairstruct{KeystringValue*computepb.ResourcePoliciesScopedList}ResourcePoliciesScopedListPair is a holder type for string/*computepb.ResourcePoliciesScopedList map entries
ResourcePoliciesScopedListPairIterator
typeResourcePoliciesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]ResourcePoliciesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}ResourcePoliciesScopedListPairIterator manages a stream of ResourcePoliciesScopedListPair.
func (*ResourcePoliciesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ResourcePoliciesScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ResourcePoliciesScopedListPairIterator) PageInfo
func(it*ResourcePoliciesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ResourcePolicyIterator
typeResourcePolicyIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.ResourcePolicy,nextPageTokenstring,errerror)// contains filtered or unexported fields}ResourcePolicyIterator manages a stream of *computepb.ResourcePolicy.
func (*ResourcePolicyIterator) All
func(it*ResourcePolicyIterator)All()iter.Seq2[*computepb.ResourcePolicy,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ResourcePolicyIterator) Next
func(it*ResourcePolicyIterator)Next()(*computepb.ResourcePolicy,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ResourcePolicyIterator) PageInfo
func(it*ResourcePolicyIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RouteIterator
typeRouteIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Route,nextPageTokenstring,errerror)// contains filtered or unexported fields}RouteIterator manages a stream of *computepb.Route.
func (*RouteIterator) All
func(it*RouteIterator)All()iter.Seq2[*computepb.Route,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*RouteIterator) Next
func(it*RouteIterator)Next()(*computepb.Route,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*RouteIterator) PageInfo
func(it*RouteIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RoutePolicyIterator
typeRoutePolicyIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.RoutePolicy,nextPageTokenstring,errerror)// contains filtered or unexported fields}RoutePolicyIterator manages a stream of *computepb.RoutePolicy.
func (*RoutePolicyIterator) All
func(it*RoutePolicyIterator)All()iter.Seq2[*computepb.RoutePolicy,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*RoutePolicyIterator) Next
func(it*RoutePolicyIterator)Next()(*computepb.RoutePolicy,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*RoutePolicyIterator) PageInfo
func(it*RoutePolicyIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RouterIterator
typeRouterIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Router,nextPageTokenstring,errerror)// contains filtered or unexported fields}RouterIterator manages a stream of *computepb.Router.
func (*RouterIterator) All
func(it*RouterIterator)All()iter.Seq2[*computepb.Router,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*RouterIterator) Next
func(it*RouterIterator)Next()(*computepb.Router,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*RouterIterator) PageInfo
func(it*RouterIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RoutersCallOptions
typeRoutersCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionDeleteRoutePolicy[]gax.CallOptionGet[]gax.CallOptionGetNatIpInfo[]gax.CallOptionGetNatMappingInfo[]gax.CallOptionGetRoutePolicy[]gax.CallOptionGetRouterStatus[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListBgpRoutes[]gax.CallOptionListRoutePolicies[]gax.CallOptionPatch[]gax.CallOptionPatchRoutePolicy[]gax.CallOptionPreview[]gax.CallOptionUpdate[]gax.CallOptionUpdateRoutePolicy[]gax.CallOption}RoutersCallOptions contains the retry settings for each method of RoutersClient.
RoutersClient
typeRoutersClientstruct{// The call options for this service.CallOptions*RoutersCallOptions// contains filtered or unexported fields}RoutersClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Routers API.
func NewRoutersRESTClient
funcNewRoutersRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RoutersClient,error)NewRoutersRESTClient creates a new routers rest client.
The Routers API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RoutersClient) AggregatedList
func(c*RoutersClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListRoutersRequest,opts...gax.CallOption)*RoutersScopedListPairIteratorAggregatedList retrieves an aggregated list of routers. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListRoutersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListRoutersRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RouterAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListRoutersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListRoutersRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RoutersClient) Close
func(c*RoutersClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RoutersClient) Connection (deprecated)
func(c*RoutersClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RoutersClient) Delete
func(c*RoutersClient)Delete(ctxcontext.Context,req*computepb.DeleteRouterRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified Router resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRouterRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RoutersClient) DeleteRoutePolicy
func(c*RoutersClient)DeleteRoutePolicy(ctxcontext.Context,req*computepb.DeleteRoutePolicyRouterRequest,opts...gax.CallOption)(*Operation,error)DeleteRoutePolicy deletes Route Policy
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRoutePolicyRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRoutePolicyRouterRequest.}op,err:=c.DeleteRoutePolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RoutersClient) Get
func(c*RoutersClient)Get(ctxcontext.Context,req*computepb.GetRouterRequest,opts...gax.CallOption)(*computepb.Router,error)Get returns the specified Router resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRouterRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RoutersClient) GetNatIpInfo
func(c*RoutersClient)GetNatIpInfo(ctxcontext.Context,req*computepb.GetNatIpInfoRouterRequest,opts...gax.CallOption)(*computepb.NatIpInfoResponse,error)GetNatIpInfo retrieves runtime NAT IP information.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNatIpInfoRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNatIpInfoRouterRequest.}resp,err:=c.GetNatIpInfo(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RoutersClient) GetNatMappingInfo
func(c*RoutersClient)GetNatMappingInfo(ctxcontext.Context,req*computepb.GetNatMappingInfoRoutersRequest,opts...gax.CallOption)*VmEndpointNatMappingsIteratorGetNatMappingInfo retrieves runtime Nat mapping information of VM endpoints.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNatMappingInfoRoutersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNatMappingInfoRoutersRequest.}it:=c.GetNatMappingInfo(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.VmEndpointNatMappingsList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetNatMappingInfoRoutersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetNatMappingInfoRoutersRequest.}forresp,err:=rangec.GetNatMappingInfo(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RoutersClient) GetRoutePolicy
func(c*RoutersClient)GetRoutePolicy(ctxcontext.Context,req*computepb.GetRoutePolicyRouterRequest,opts...gax.CallOption)(*computepb.RoutersGetRoutePolicyResponse,error)GetRoutePolicy returns specified Route Policy
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRoutePolicyRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRoutePolicyRouterRequest.}resp,err:=c.GetRoutePolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RoutersClient) GetRouterStatus
func(c*RoutersClient)GetRouterStatus(ctxcontext.Context,req*computepb.GetRouterStatusRouterRequest,opts...gax.CallOption)(*computepb.RouterStatusResponse,error)GetRouterStatus retrieves runtime information of the specified router.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRouterStatusRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRouterStatusRouterRequest.}resp,err:=c.GetRouterStatus(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RoutersClient) Insert
func(c*RoutersClient)Insert(ctxcontext.Context,req*computepb.InsertRouterRequest,opts...gax.CallOption)(*Operation,error)Insert creates a Router resource in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRouterRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RoutersClient) List
func(c*RoutersClient)List(ctxcontext.Context,req*computepb.ListRoutersRequest,opts...gax.CallOption)*RouterIteratorList retrieves a list of Router resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRoutersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRoutersRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RouterList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRoutersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRoutersRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RoutersClient) ListBgpRoutes
func(c*RoutersClient)ListBgpRoutes(ctxcontext.Context,req*computepb.ListBgpRoutesRoutersRequest,opts...gax.CallOption)*BgpRouteIteratorListBgpRoutes retrieves a list of router bgp routes available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListBgpRoutesRoutersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListBgpRoutesRoutersRequest.}it:=c.ListBgpRoutes(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RoutersListBgpRoutes)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListBgpRoutesRoutersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListBgpRoutesRoutersRequest.}forresp,err:=rangec.ListBgpRoutes(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RoutersClient) ListRoutePolicies
func(c*RoutersClient)ListRoutePolicies(ctxcontext.Context,req*computepb.ListRoutePoliciesRoutersRequest,opts...gax.CallOption)*RoutePolicyIteratorListRoutePolicies retrieves a list of router route policy subresources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRoutePoliciesRoutersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRoutePoliciesRoutersRequest.}it:=c.ListRoutePolicies(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RoutersListRoutePolicies)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRoutePoliciesRoutersRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRoutePoliciesRoutersRequest.}forresp,err:=rangec.ListRoutePolicies(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RoutersClient) Patch
func(c*RoutersClient)Patch(ctxcontext.Context,req*computepb.PatchRouterRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRouterRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RoutersClient) PatchRoutePolicy
func(c*RoutersClient)PatchRoutePolicy(ctxcontext.Context,req*computepb.PatchRoutePolicyRouterRequest,opts...gax.CallOption)(*Operation,error)PatchRoutePolicy patches Route Policy
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRoutePolicyRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRoutePolicyRouterRequest.}op,err:=c.PatchRoutePolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RoutersClient) Preview
func(c*RoutersClient)Preview(ctxcontext.Context,req*computepb.PreviewRouterRequest,opts...gax.CallOption)(*computepb.RoutersPreviewResponse,error)Preview preview fields auto-generated during router create and update operations. Calling this method does NOT create or update the router.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PreviewRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PreviewRouterRequest.}resp,err:=c.Preview(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RoutersClient) Update
func(c*RoutersClient)Update(ctxcontext.Context,req*computepb.UpdateRouterRequest,opts...gax.CallOption)(*Operation,error)Update updates the specified Router resource with the data included in the request. This method conforms to PUT semantics, which requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateRouterRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RoutersClient) UpdateRoutePolicy
func(c*RoutersClient)UpdateRoutePolicy(ctxcontext.Context,req*computepb.UpdateRoutePolicyRouterRequest,opts...gax.CallOption)(*Operation,error)UpdateRoutePolicy updates or creates new Route Policy
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutersRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateRoutePolicyRouterRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateRoutePolicyRouterRequest.}op,err:=c.UpdateRoutePolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}RoutersScopedListPair
typeRoutersScopedListPairstruct{KeystringValue*computepb.RoutersScopedList}RoutersScopedListPair is a holder type for string/*computepb.RoutersScopedList map entries
RoutersScopedListPairIterator
typeRoutersScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]RoutersScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}RoutersScopedListPairIterator manages a stream of RoutersScopedListPair.
func (*RoutersScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*RoutersScopedListPairIterator) Next
func(it*RoutersScopedListPairIterator)Next()(RoutersScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*RoutersScopedListPairIterator) PageInfo
func(it*RoutersScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RoutesCallOptions
typeRoutesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOption}RoutesCallOptions contains the retry settings for each method of RoutesClient.
RoutesClient
typeRoutesClientstruct{// The call options for this service.CallOptions*RoutesCallOptions// contains filtered or unexported fields}RoutesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Routes API.
func NewRoutesRESTClient
funcNewRoutesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RoutesClient,error)NewRoutesRESTClient creates a new routes rest client.
The Routes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewRoutesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RoutesClient) Close
func(c*RoutesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RoutesClient) Connection (deprecated)
func(c*RoutesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RoutesClient) Delete
func(c*RoutesClient)Delete(ctxcontext.Context,req*computepb.DeleteRouteRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified Route resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteRouteRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteRouteRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RoutesClient) Get
func(c*RoutesClient)Get(ctxcontext.Context,req*computepb.GetRouteRequest,opts...gax.CallOption)(*computepb.Route,error)Get returns the specified Route resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRouteRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRouteRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RoutesClient) Insert
func(c*RoutesClient)Insert(ctxcontext.Context,req*computepb.InsertRouteRequest,opts...gax.CallOption)(*Operation,error)Insert creates a Route resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertRouteRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertRouteRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*RoutesClient) List
func(c*RoutesClient)List(ctxcontext.Context,req*computepb.ListRoutesRequest,opts...gax.CallOption)*RouteIteratorList retrieves the list of Route resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewRoutesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRoutesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRoutesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.RouteList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewRoutesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListRoutesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListRoutesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}SecurityPoliciesCallOptions
typeSecurityPoliciesCallOptionsstruct{AddRule[]gax.CallOptionAggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetRule[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListPreconfiguredExpressionSets[]gax.CallOptionPatch[]gax.CallOptionPatchRule[]gax.CallOptionRemoveRule[]gax.CallOptionSetLabels[]gax.CallOption}SecurityPoliciesCallOptions contains the retry settings for each method of SecurityPoliciesClient.
SecurityPoliciesClient
typeSecurityPoliciesClientstruct{// The call options for this service.CallOptions*SecurityPoliciesCallOptions// contains filtered or unexported fields}SecurityPoliciesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The SecurityPolicies API.
func NewSecurityPoliciesRESTClient
funcNewSecurityPoliciesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*SecurityPoliciesClient,error)NewSecurityPoliciesRESTClient creates a new security policies rest client.
The SecurityPolicies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*SecurityPoliciesClient) AddRule
func(c*SecurityPoliciesClient)AddRule(ctxcontext.Context,req*computepb.AddRuleSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)AddRule inserts a rule into a security policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddRuleSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddRuleSecurityPolicyRequest.}op,err:=c.AddRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SecurityPoliciesClient) AggregatedList
func(c*SecurityPoliciesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListSecurityPoliciesRequest,opts...gax.CallOption)*SecurityPoliciesScopedListPairIteratorAggregatedList retrieves the list of all SecurityPolicy resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListSecurityPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListSecurityPoliciesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SecurityPoliciesAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListSecurityPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListSecurityPoliciesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*SecurityPoliciesClient) Close
func(c*SecurityPoliciesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*SecurityPoliciesClient) Connection (deprecated)
func(c*SecurityPoliciesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*SecurityPoliciesClient) Delete
func(c*SecurityPoliciesClient)Delete(ctxcontext.Context,req*computepb.DeleteSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteSecurityPolicyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SecurityPoliciesClient) Get
func(c*SecurityPoliciesClient)Get(ctxcontext.Context,req*computepb.GetSecurityPolicyRequest,opts...gax.CallOption)(*computepb.SecurityPolicy,error)Get list all of the ordered rules present in a single specified policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetSecurityPolicyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SecurityPoliciesClient) GetRule
func(c*SecurityPoliciesClient)GetRule(ctxcontext.Context,req*computepb.GetRuleSecurityPolicyRequest,opts...gax.CallOption)(*computepb.SecurityPolicyRule,error)GetRule gets a rule at the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetRuleSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetRuleSecurityPolicyRequest.}resp,err:=c.GetRule(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SecurityPoliciesClient) Insert
func(c*SecurityPoliciesClient)Insert(ctxcontext.Context,req*computepb.InsertSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a new policy in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertSecurityPolicyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SecurityPoliciesClient) List
func(c*SecurityPoliciesClient)List(ctxcontext.Context,req*computepb.ListSecurityPoliciesRequest,opts...gax.CallOption)*SecurityPolicyIteratorList list all the policies that have been configured for the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListSecurityPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListSecurityPoliciesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SecurityPolicyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListSecurityPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListSecurityPoliciesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*SecurityPoliciesClient) ListPreconfiguredExpressionSets
func(c*SecurityPoliciesClient)ListPreconfiguredExpressionSets(ctxcontext.Context,req*computepb.ListPreconfiguredExpressionSetsSecurityPoliciesRequest,opts...gax.CallOption)(*computepb.SecurityPoliciesListPreconfiguredExpressionSetsResponse,error)ListPreconfiguredExpressionSets gets the current list of preconfigured Web Application Firewall (WAF) expressions.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListPreconfiguredExpressionSetsSecurityPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListPreconfiguredExpressionSetsSecurityPoliciesRequest.}resp,err:=c.ListPreconfiguredExpressionSets(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SecurityPoliciesClient) Patch
func(c*SecurityPoliciesClient)Patch(ctxcontext.Context,req*computepb.PatchSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified policy with the data included in the request. To clear fields in the policy, leave the fields empty and specify them in the updateMask. This cannot be used to be update the rules in the policy. Please use the per rule methods like addRule, patchRule, and removeRule instead.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchSecurityPolicyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SecurityPoliciesClient) PatchRule
func(c*SecurityPoliciesClient)PatchRule(ctxcontext.Context,req*computepb.PatchRuleSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)PatchRule patches a rule at the specified priority. To clear fields in the rule, leave the fields empty and specify them in the updateMask.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchRuleSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchRuleSecurityPolicyRequest.}op,err:=c.PatchRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SecurityPoliciesClient) RemoveRule
func(c*SecurityPoliciesClient)RemoveRule(ctxcontext.Context,req*computepb.RemoveRuleSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)RemoveRule deletes a rule at the specified priority.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveRuleSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveRuleSecurityPolicyRequest.}op,err:=c.RemoveRule(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SecurityPoliciesClient) SetLabels
func(c*SecurityPoliciesClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsSecurityPolicyRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a security policy. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSecurityPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsSecurityPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsSecurityPolicyRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}SecurityPoliciesScopedListPair
typeSecurityPoliciesScopedListPairstruct{KeystringValue*computepb.SecurityPoliciesScopedList}SecurityPoliciesScopedListPair is a holder type for string/*computepb.SecurityPoliciesScopedList map entries
SecurityPoliciesScopedListPairIterator
typeSecurityPoliciesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]SecurityPoliciesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}SecurityPoliciesScopedListPairIterator manages a stream of SecurityPoliciesScopedListPair.
func (*SecurityPoliciesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*SecurityPoliciesScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*SecurityPoliciesScopedListPairIterator) PageInfo
func(it*SecurityPoliciesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SecurityPolicyIterator
typeSecurityPolicyIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.SecurityPolicy,nextPageTokenstring,errerror)// contains filtered or unexported fields}SecurityPolicyIterator manages a stream of *computepb.SecurityPolicy.
func (*SecurityPolicyIterator) All
func(it*SecurityPolicyIterator)All()iter.Seq2[*computepb.SecurityPolicy,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*SecurityPolicyIterator) Next
func(it*SecurityPolicyIterator)Next()(*computepb.SecurityPolicy,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*SecurityPolicyIterator) PageInfo
func(it*SecurityPolicyIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ServiceAttachmentIterator
typeServiceAttachmentIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.ServiceAttachment,nextPageTokenstring,errerror)// contains filtered or unexported fields}ServiceAttachmentIterator manages a stream of *computepb.ServiceAttachment.
func (*ServiceAttachmentIterator) All
func(it*ServiceAttachmentIterator)All()iter.Seq2[*computepb.ServiceAttachment,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ServiceAttachmentIterator) Next
func(it*ServiceAttachmentIterator)Next()(*computepb.ServiceAttachment,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ServiceAttachmentIterator) PageInfo
func(it*ServiceAttachmentIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ServiceAttachmentsCallOptions
typeServiceAttachmentsCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOption}ServiceAttachmentsCallOptions contains the retry settings for each method of ServiceAttachmentsClient.
ServiceAttachmentsClient
typeServiceAttachmentsClientstruct{// The call options for this service.CallOptions*ServiceAttachmentsCallOptions// contains filtered or unexported fields}ServiceAttachmentsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The ServiceAttachments API.
func NewServiceAttachmentsRESTClient
funcNewServiceAttachmentsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ServiceAttachmentsClient,error)NewServiceAttachmentsRESTClient creates a new service attachments rest client.
The ServiceAttachments API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ServiceAttachmentsClient) AggregatedList
func(c*ServiceAttachmentsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListServiceAttachmentsRequest,opts...gax.CallOption)*ServiceAttachmentsScopedListPairIteratorAggregatedList retrieves the list of all ServiceAttachment resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListServiceAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListServiceAttachmentsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ServiceAttachmentAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListServiceAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListServiceAttachmentsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ServiceAttachmentsClient) Close
func(c*ServiceAttachmentsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ServiceAttachmentsClient) Connection (deprecated)
func(c*ServiceAttachmentsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ServiceAttachmentsClient) Delete
func(c*ServiceAttachmentsClient)Delete(ctxcontext.Context,req*computepb.DeleteServiceAttachmentRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified ServiceAttachment in the given scope
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteServiceAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteServiceAttachmentRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ServiceAttachmentsClient) Get
func(c*ServiceAttachmentsClient)Get(ctxcontext.Context,req*computepb.GetServiceAttachmentRequest,opts...gax.CallOption)(*computepb.ServiceAttachment,error)Get returns the specified ServiceAttachment resource in the given scope.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetServiceAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetServiceAttachmentRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServiceAttachmentsClient) GetIamPolicy
func(c*ServiceAttachmentsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyServiceAttachmentRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyServiceAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyServiceAttachmentRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServiceAttachmentsClient) Insert
func(c*ServiceAttachmentsClient)Insert(ctxcontext.Context,req*computepb.InsertServiceAttachmentRequest,opts...gax.CallOption)(*Operation,error)Insert creates a ServiceAttachment in the specified project in the given scope using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertServiceAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertServiceAttachmentRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ServiceAttachmentsClient) List
func(c*ServiceAttachmentsClient)List(ctxcontext.Context,req*computepb.ListServiceAttachmentsRequest,opts...gax.CallOption)*ServiceAttachmentIteratorList lists the ServiceAttachments for a project in the given scope.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListServiceAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListServiceAttachmentsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ServiceAttachmentList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListServiceAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListServiceAttachmentsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ServiceAttachmentsClient) Patch
func(c*ServiceAttachmentsClient)Patch(ctxcontext.Context,req*computepb.PatchServiceAttachmentRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified ServiceAttachment resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchServiceAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchServiceAttachmentRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*ServiceAttachmentsClient) SetIamPolicy
func(c*ServiceAttachmentsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyServiceAttachmentRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyServiceAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyServiceAttachmentRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServiceAttachmentsClient) TestIamPermissions
func(c*ServiceAttachmentsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsServiceAttachmentRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewServiceAttachmentsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsServiceAttachmentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsServiceAttachmentRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}ServiceAttachmentsScopedListPair
typeServiceAttachmentsScopedListPairstruct{KeystringValue*computepb.ServiceAttachmentsScopedList}ServiceAttachmentsScopedListPair is a holder type for string/*computepb.ServiceAttachmentsScopedList map entries
ServiceAttachmentsScopedListPairIterator
typeServiceAttachmentsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]ServiceAttachmentsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}ServiceAttachmentsScopedListPairIterator manages a stream of ServiceAttachmentsScopedListPair.
func (*ServiceAttachmentsScopedListPairIterator) All
func(it*ServiceAttachmentsScopedListPairIterator)All()iter.Seq2[ServiceAttachmentsScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ServiceAttachmentsScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ServiceAttachmentsScopedListPairIterator) PageInfo
func(it*ServiceAttachmentsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SnapshotIterator
typeSnapshotIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Snapshot,nextPageTokenstring,errerror)// contains filtered or unexported fields}SnapshotIterator manages a stream of *computepb.Snapshot.
func (*SnapshotIterator) All
func(it*SnapshotIterator)All()iter.Seq2[*computepb.Snapshot,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*SnapshotIterator) Next
func(it*SnapshotIterator)Next()(*computepb.Snapshot,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*SnapshotIterator) PageInfo
func(it*SnapshotIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SnapshotSettingsCallOptions
typeSnapshotSettingsCallOptionsstruct{Get[]gax.CallOptionPatch[]gax.CallOption}SnapshotSettingsCallOptions contains the retry settings for each method of SnapshotSettingsClient.
SnapshotSettingsClient
typeSnapshotSettingsClientstruct{// The call options for this service.CallOptions*SnapshotSettingsCallOptions// contains filtered or unexported fields}SnapshotSettingsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The SnapshotSettings API.
func NewSnapshotSettingsRESTClient
funcNewSnapshotSettingsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*SnapshotSettingsClient,error)NewSnapshotSettingsRESTClient creates a new snapshot settings service rest client.
The SnapshotSettings API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewSnapshotSettingsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*SnapshotSettingsClient) Close
func(c*SnapshotSettingsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*SnapshotSettingsClient) Connection (deprecated)
func(c*SnapshotSettingsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*SnapshotSettingsClient) Get
func(c*SnapshotSettingsClient)Get(ctxcontext.Context,req*computepb.GetSnapshotSettingRequest,opts...gax.CallOption)(*computepb.SnapshotSettings,error)Get get snapshot settings.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSnapshotSettingsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetSnapshotSettingRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetSnapshotSettingRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SnapshotSettingsClient) Patch
func(c*SnapshotSettingsClient)Patch(ctxcontext.Context,req*computepb.PatchSnapshotSettingRequest,opts...gax.CallOption)(*Operation,error)Patch patch snapshot settings.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSnapshotSettingsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchSnapshotSettingRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchSnapshotSettingRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}SnapshotsCallOptions
typeSnapshotsCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetLabels[]gax.CallOptionTestIamPermissions[]gax.CallOption}SnapshotsCallOptions contains the retry settings for each method of SnapshotsClient.
SnapshotsClient
typeSnapshotsClientstruct{// The call options for this service.CallOptions*SnapshotsCallOptions// contains filtered or unexported fields}SnapshotsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Snapshots API.
func NewSnapshotsRESTClient
funcNewSnapshotsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*SnapshotsClient,error)NewSnapshotsRESTClient creates a new snapshots rest client.
The Snapshots API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*SnapshotsClient) Close
func(c*SnapshotsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*SnapshotsClient) Connection (deprecated)
func(c*SnapshotsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*SnapshotsClient) Delete
func(c*SnapshotsClient)Delete(ctxcontext.Context,req*computepb.DeleteSnapshotRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. For more information, see Deleting snapshots.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteSnapshotRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SnapshotsClient) Get
func(c*SnapshotsClient)Get(ctxcontext.Context,req*computepb.GetSnapshotRequest,opts...gax.CallOption)(*computepb.Snapshot,error)Get returns the specified Snapshot resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetSnapshotRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SnapshotsClient) GetIamPolicy
func(c*SnapshotsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicySnapshotRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicySnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicySnapshotRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SnapshotsClient) Insert
func(c*SnapshotsClient)Insert(ctxcontext.Context,req*computepb.InsertSnapshotRequest,opts...gax.CallOption)(*Operation,error)Insert creates a snapshot in the specified project using the data included in the request. For regular snapshot creation, consider using this method instead of disks.createSnapshot, as this method supports more features, such as creating snapshots in a project different from the source disk project.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertSnapshotRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SnapshotsClient) List
func(c*SnapshotsClient)List(ctxcontext.Context,req*computepb.ListSnapshotsRequest,opts...gax.CallOption)*SnapshotIteratorList retrieves the list of Snapshot resources contained within the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListSnapshotsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListSnapshotsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SnapshotList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListSnapshotsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListSnapshotsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*SnapshotsClient) SetIamPolicy
func(c*SnapshotsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicySnapshotRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicySnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicySnapshotRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SnapshotsClient) SetLabels
func(c*SnapshotsClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsSnapshotRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a snapshot. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsSnapshotRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SnapshotsClient) TestIamPermissions
func(c*SnapshotsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsSnapshotRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSnapshotsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsSnapshotRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsSnapshotRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}SslCertificateIterator
typeSslCertificateIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.SslCertificate,nextPageTokenstring,errerror)// contains filtered or unexported fields}SslCertificateIterator manages a stream of *computepb.SslCertificate.
func (*SslCertificateIterator) All
func(it*SslCertificateIterator)All()iter.Seq2[*computepb.SslCertificate,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*SslCertificateIterator) Next
func(it*SslCertificateIterator)Next()(*computepb.SslCertificate,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*SslCertificateIterator) PageInfo
func(it*SslCertificateIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SslCertificatesCallOptions
typeSslCertificatesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOption}SslCertificatesCallOptions contains the retry settings for each method of SslCertificatesClient.
SslCertificatesClient
typeSslCertificatesClientstruct{// The call options for this service.CallOptions*SslCertificatesCallOptions// contains filtered or unexported fields}SslCertificatesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The SslCertificates API.
func NewSslCertificatesRESTClient
funcNewSslCertificatesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*SslCertificatesClient,error)NewSslCertificatesRESTClient creates a new ssl certificates rest client.
The SslCertificates API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*SslCertificatesClient) AggregatedList
func(c*SslCertificatesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListSslCertificatesRequest,opts...gax.CallOption)*SslCertificatesScopedListPairIteratorAggregatedList retrieves the list of all SslCertificate resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListSslCertificatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListSslCertificatesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SslCertificateAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListSslCertificatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListSslCertificatesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*SslCertificatesClient) Close
func(c*SslCertificatesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*SslCertificatesClient) Connection (deprecated)
func(c*SslCertificatesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*SslCertificatesClient) Delete
func(c*SslCertificatesClient)Delete(ctxcontext.Context,req*computepb.DeleteSslCertificateRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified SslCertificate resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteSslCertificateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteSslCertificateRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SslCertificatesClient) Get
func(c*SslCertificatesClient)Get(ctxcontext.Context,req*computepb.GetSslCertificateRequest,opts...gax.CallOption)(*computepb.SslCertificate,error)Get returns the specified SslCertificate resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetSslCertificateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetSslCertificateRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SslCertificatesClient) Insert
func(c*SslCertificatesClient)Insert(ctxcontext.Context,req*computepb.InsertSslCertificateRequest,opts...gax.CallOption)(*Operation,error)Insert creates a SslCertificate resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertSslCertificateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertSslCertificateRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SslCertificatesClient) List
func(c*SslCertificatesClient)List(ctxcontext.Context,req*computepb.ListSslCertificatesRequest,opts...gax.CallOption)*SslCertificateIteratorList retrieves the list of SslCertificate resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListSslCertificatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListSslCertificatesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SslCertificateList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslCertificatesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListSslCertificatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListSslCertificatesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}SslCertificatesScopedListPair
typeSslCertificatesScopedListPairstruct{KeystringValue*computepb.SslCertificatesScopedList}SslCertificatesScopedListPair is a holder type for string/*computepb.SslCertificatesScopedList map entries
SslCertificatesScopedListPairIterator
typeSslCertificatesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]SslCertificatesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}SslCertificatesScopedListPairIterator manages a stream of SslCertificatesScopedListPair.
func (*SslCertificatesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*SslCertificatesScopedListPairIterator) Next
func(it*SslCertificatesScopedListPairIterator)Next()(SslCertificatesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*SslCertificatesScopedListPairIterator) PageInfo
func(it*SslCertificatesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SslPoliciesCallOptions
typeSslPoliciesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListAvailableFeatures[]gax.CallOptionPatch[]gax.CallOption}SslPoliciesCallOptions contains the retry settings for each method of SslPoliciesClient.
SslPoliciesClient
typeSslPoliciesClientstruct{// The call options for this service.CallOptions*SslPoliciesCallOptions// contains filtered or unexported fields}SslPoliciesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The SslPolicies API.
func NewSslPoliciesRESTClient
funcNewSslPoliciesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*SslPoliciesClient,error)NewSslPoliciesRESTClient creates a new ssl policies rest client.
The SslPolicies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*SslPoliciesClient) AggregatedList
func(c*SslPoliciesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListSslPoliciesRequest,opts...gax.CallOption)*SslPoliciesScopedListPairIteratorAggregatedList retrieves the list of all SslPolicy resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListSslPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListSslPoliciesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SslPoliciesAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListSslPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListSslPoliciesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*SslPoliciesClient) Close
func(c*SslPoliciesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*SslPoliciesClient) Connection (deprecated)
func(c*SslPoliciesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*SslPoliciesClient) Delete
func(c*SslPoliciesClient)Delete(ctxcontext.Context,req*computepb.DeleteSslPolicyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in use by any TargetHttpsProxy or TargetSslProxy resources.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteSslPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteSslPolicyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SslPoliciesClient) Get
func(c*SslPoliciesClient)Get(ctxcontext.Context,req*computepb.GetSslPolicyRequest,opts...gax.CallOption)(*computepb.SslPolicy,error)Get lists all of the ordered rules present in a single specified policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetSslPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetSslPolicyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SslPoliciesClient) Insert
func(c*SslPoliciesClient)Insert(ctxcontext.Context,req*computepb.InsertSslPolicyRequest,opts...gax.CallOption)(*Operation,error)Insert returns the specified SSL policy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertSslPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertSslPolicyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SslPoliciesClient) List
func(c*SslPoliciesClient)List(ctxcontext.Context,req*computepb.ListSslPoliciesRequest,opts...gax.CallOption)*SslPolicyIteratorList lists all the SSL policies that have been configured for the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListSslPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListSslPoliciesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SslPoliciesList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListSslPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListSslPoliciesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*SslPoliciesClient) ListAvailableFeatures
func(c*SslPoliciesClient)ListAvailableFeatures(ctxcontext.Context,req*computepb.ListAvailableFeaturesSslPoliciesRequest,opts...gax.CallOption)(*computepb.SslPoliciesListAvailableFeaturesResponse,error)ListAvailableFeatures lists all features that can be specified in the SSL policy when using custom profile.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListAvailableFeaturesSslPoliciesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListAvailableFeaturesSslPoliciesRequest.}resp,err:=c.ListAvailableFeatures(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SslPoliciesClient) Patch
func(c*SslPoliciesClient)Patch(ctxcontext.Context,req*computepb.PatchSslPolicyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified SSL policy with the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSslPoliciesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchSslPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchSslPolicyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}SslPoliciesScopedListPair
typeSslPoliciesScopedListPairstruct{KeystringValue*computepb.SslPoliciesScopedList}SslPoliciesScopedListPair is a holder type for string/*computepb.SslPoliciesScopedList map entries
SslPoliciesScopedListPairIterator
typeSslPoliciesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]SslPoliciesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}SslPoliciesScopedListPairIterator manages a stream of SslPoliciesScopedListPair.
func (*SslPoliciesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*SslPoliciesScopedListPairIterator) Next
func(it*SslPoliciesScopedListPairIterator)Next()(SslPoliciesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*SslPoliciesScopedListPairIterator) PageInfo
func(it*SslPoliciesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SslPolicyIterator
typeSslPolicyIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.SslPolicy,nextPageTokenstring,errerror)// contains filtered or unexported fields}SslPolicyIterator manages a stream of *computepb.SslPolicy.
func (*SslPolicyIterator) All
func(it*SslPolicyIterator)All()iter.Seq2[*computepb.SslPolicy,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*SslPolicyIterator) Next
func(it*SslPolicyIterator)Next()(*computepb.SslPolicy,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*SslPolicyIterator) PageInfo
func(it*SslPolicyIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
StoragePoolDiskIterator
typeStoragePoolDiskIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.StoragePoolDisk,nextPageTokenstring,errerror)// contains filtered or unexported fields}StoragePoolDiskIterator manages a stream of *computepb.StoragePoolDisk.
func (*StoragePoolDiskIterator) All
func(it*StoragePoolDiskIterator)All()iter.Seq2[*computepb.StoragePoolDisk,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*StoragePoolDiskIterator) Next
func(it*StoragePoolDiskIterator)Next()(*computepb.StoragePoolDisk,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*StoragePoolDiskIterator) PageInfo
func(it*StoragePoolDiskIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
StoragePoolIterator
typeStoragePoolIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.StoragePool,nextPageTokenstring,errerror)// contains filtered or unexported fields}StoragePoolIterator manages a stream of *computepb.StoragePool.
func (*StoragePoolIterator) All
func(it*StoragePoolIterator)All()iter.Seq2[*computepb.StoragePool,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*StoragePoolIterator) Next
func(it*StoragePoolIterator)Next()(*computepb.StoragePool,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*StoragePoolIterator) PageInfo
func(it*StoragePoolIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
StoragePoolTypeIterator
typeStoragePoolTypeIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.StoragePoolType,nextPageTokenstring,errerror)// contains filtered or unexported fields}StoragePoolTypeIterator manages a stream of *computepb.StoragePoolType.
func (*StoragePoolTypeIterator) All
func(it*StoragePoolTypeIterator)All()iter.Seq2[*computepb.StoragePoolType,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*StoragePoolTypeIterator) Next
func(it*StoragePoolTypeIterator)Next()(*computepb.StoragePoolType,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*StoragePoolTypeIterator) PageInfo
func(it*StoragePoolTypeIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
StoragePoolTypesCallOptions
typeStoragePoolTypesCallOptionsstruct{AggregatedList[]gax.CallOptionGet[]gax.CallOptionList[]gax.CallOption}StoragePoolTypesCallOptions contains the retry settings for each method of StoragePoolTypesClient.
StoragePoolTypesClient
typeStoragePoolTypesClientstruct{// The call options for this service.CallOptions*StoragePoolTypesCallOptions// contains filtered or unexported fields}StoragePoolTypesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The StoragePoolTypes API.
func NewStoragePoolTypesRESTClient
funcNewStoragePoolTypesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*StoragePoolTypesClient,error)NewStoragePoolTypesRESTClient creates a new storage pool types rest client.
The StoragePoolTypes API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewStoragePoolTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*StoragePoolTypesClient) AggregatedList
func(c*StoragePoolTypesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListStoragePoolTypesRequest,opts...gax.CallOption)*StoragePoolTypesScopedListPairIteratorAggregatedList retrieves an aggregated list of storage pool types. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewStoragePoolTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListStoragePoolTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListStoragePoolTypesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.StoragePoolTypeAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListStoragePoolTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListStoragePoolTypesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*StoragePoolTypesClient) Close
func(c*StoragePoolTypesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*StoragePoolTypesClient) Connection (deprecated)
func(c*StoragePoolTypesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*StoragePoolTypesClient) Get
func(c*StoragePoolTypesClient)Get(ctxcontext.Context,req*computepb.GetStoragePoolTypeRequest,opts...gax.CallOption)(*computepb.StoragePoolType,error)Get returns the specified storage pool type.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetStoragePoolTypeRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetStoragePoolTypeRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*StoragePoolTypesClient) List
func(c*StoragePoolTypesClient)List(ctxcontext.Context,req*computepb.ListStoragePoolTypesRequest,opts...gax.CallOption)*StoragePoolTypeIteratorList retrieves a list of storage pool types available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewStoragePoolTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListStoragePoolTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListStoragePoolTypesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.StoragePoolTypeList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolTypesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListStoragePoolTypesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListStoragePoolTypesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}StoragePoolTypesScopedListPair
typeStoragePoolTypesScopedListPairstruct{KeystringValue*computepb.StoragePoolTypesScopedList}StoragePoolTypesScopedListPair is a holder type for string/*computepb.StoragePoolTypesScopedList map entries
StoragePoolTypesScopedListPairIterator
typeStoragePoolTypesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]StoragePoolTypesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}StoragePoolTypesScopedListPairIterator manages a stream of StoragePoolTypesScopedListPair.
func (*StoragePoolTypesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*StoragePoolTypesScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*StoragePoolTypesScopedListPairIterator) PageInfo
func(it*StoragePoolTypesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
StoragePoolsCallOptions
typeStoragePoolsCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListDisks[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOptionUpdate[]gax.CallOption}StoragePoolsCallOptions contains the retry settings for each method of StoragePoolsClient.
StoragePoolsClient
typeStoragePoolsClientstruct{// The call options for this service.CallOptions*StoragePoolsCallOptions// contains filtered or unexported fields}StoragePoolsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The StoragePools API.
func NewStoragePoolsRESTClient
funcNewStoragePoolsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*StoragePoolsClient,error)NewStoragePoolsRESTClient creates a new storage pools rest client.
The StoragePools API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*StoragePoolsClient) AggregatedList
func(c*StoragePoolsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListStoragePoolsRequest,opts...gax.CallOption)*StoragePoolsScopedListPairIteratorAggregatedList retrieves an aggregated list of storage pools. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListStoragePoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListStoragePoolsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.StoragePoolAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListStoragePoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListStoragePoolsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*StoragePoolsClient) Close
func(c*StoragePoolsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*StoragePoolsClient) Connection (deprecated)
func(c*StoragePoolsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*StoragePoolsClient) Delete
func(c*StoragePoolsClient)Delete(ctxcontext.Context,req*computepb.DeleteStoragePoolRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified storage pool. Deleting a storagePool removes its data permanently and is irreversible. However, deleting a storagePool does not delete any snapshots previously made from the storagePool. You must separately delete snapshots.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteStoragePoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteStoragePoolRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*StoragePoolsClient) Get
func(c*StoragePoolsClient)Get(ctxcontext.Context,req*computepb.GetStoragePoolRequest,opts...gax.CallOption)(*computepb.StoragePool,error)Get returns a specified storage pool. Gets a list of available storage pools by making a list() request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetStoragePoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetStoragePoolRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*StoragePoolsClient) GetIamPolicy
func(c*StoragePoolsClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicyStoragePoolRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicyStoragePoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicyStoragePoolRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*StoragePoolsClient) Insert
func(c*StoragePoolsClient)Insert(ctxcontext.Context,req*computepb.InsertStoragePoolRequest,opts...gax.CallOption)(*Operation,error)Insert creates a storage pool in the specified project using the data in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertStoragePoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertStoragePoolRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*StoragePoolsClient) List
func(c*StoragePoolsClient)List(ctxcontext.Context,req*computepb.ListStoragePoolsRequest,opts...gax.CallOption)*StoragePoolIteratorList retrieves a list of storage pools contained within the specified zone.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListStoragePoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListStoragePoolsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.StoragePoolList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListStoragePoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListStoragePoolsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*StoragePoolsClient) ListDisks
func(c*StoragePoolsClient)ListDisks(ctxcontext.Context,req*computepb.ListDisksStoragePoolsRequest,opts...gax.CallOption)*StoragePoolDiskIteratorListDisks lists the disks in a specified storage pool.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListDisksStoragePoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListDisksStoragePoolsRequest.}it:=c.ListDisks(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.StoragePoolListDisks)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListDisksStoragePoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListDisksStoragePoolsRequest.}forresp,err:=rangec.ListDisks(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*StoragePoolsClient) SetIamPolicy
func(c*StoragePoolsClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicyStoragePoolRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicyStoragePoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicyStoragePoolRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*StoragePoolsClient) TestIamPermissions
func(c*StoragePoolsClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsStoragePoolRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsStoragePoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsStoragePoolRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*StoragePoolsClient) Update
func(c*StoragePoolsClient)Update(ctxcontext.Context,req*computepb.UpdateStoragePoolRequest,opts...gax.CallOption)(*Operation,error)Update updates the specified storagePool with the data included in the request. The update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: pool_provisioned_capacity_gb, pool_provisioned_iops and pool_provisioned_throughput.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewStoragePoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateStoragePoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateStoragePoolRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}StoragePoolsScopedListPair
typeStoragePoolsScopedListPairstruct{KeystringValue*computepb.StoragePoolsScopedList}StoragePoolsScopedListPair is a holder type for string/*computepb.StoragePoolsScopedList map entries
StoragePoolsScopedListPairIterator
typeStoragePoolsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]StoragePoolsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}StoragePoolsScopedListPairIterator manages a stream of StoragePoolsScopedListPair.
func (*StoragePoolsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*StoragePoolsScopedListPairIterator) Next
func(it*StoragePoolsScopedListPairIterator)Next()(StoragePoolsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*StoragePoolsScopedListPairIterator) PageInfo
func(it*StoragePoolsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SubnetworkIterator
typeSubnetworkIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Subnetwork,nextPageTokenstring,errerror)// contains filtered or unexported fields}SubnetworkIterator manages a stream of *computepb.Subnetwork.
func (*SubnetworkIterator) All
func(it*SubnetworkIterator)All()iter.Seq2[*computepb.Subnetwork,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*SubnetworkIterator) Next
func(it*SubnetworkIterator)Next()(*computepb.Subnetwork,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*SubnetworkIterator) PageInfo
func(it*SubnetworkIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SubnetworksCallOptions
typeSubnetworksCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionExpandIpCidrRange[]gax.CallOptionGet[]gax.CallOptionGetIamPolicy[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionListUsable[]gax.CallOptionPatch[]gax.CallOptionSetIamPolicy[]gax.CallOptionSetPrivateIpGoogleAccess[]gax.CallOptionTestIamPermissions[]gax.CallOption}SubnetworksCallOptions contains the retry settings for each method of SubnetworksClient.
SubnetworksClient
typeSubnetworksClientstruct{// The call options for this service.CallOptions*SubnetworksCallOptions// contains filtered or unexported fields}SubnetworksClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Subnetworks API.
func NewSubnetworksRESTClient
funcNewSubnetworksRESTClient(ctxcontext.Context,opts...option.ClientOption)(*SubnetworksClient,error)NewSubnetworksRESTClient creates a new subnetworks rest client.
The Subnetworks API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*SubnetworksClient) AggregatedList
func(c*SubnetworksClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListSubnetworksRequest,opts...gax.CallOption)*SubnetworksScopedListPairIteratorAggregatedList retrieves an aggregated list of subnetworks. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListSubnetworksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListSubnetworksRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SubnetworkAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListSubnetworksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListSubnetworksRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*SubnetworksClient) Close
func(c*SubnetworksClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*SubnetworksClient) Connection (deprecated)
func(c*SubnetworksClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*SubnetworksClient) Delete
func(c*SubnetworksClient)Delete(ctxcontext.Context,req*computepb.DeleteSubnetworkRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified subnetwork.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteSubnetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteSubnetworkRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SubnetworksClient) ExpandIpCidrRange
func(c*SubnetworksClient)ExpandIpCidrRange(ctxcontext.Context,req*computepb.ExpandIpCidrRangeSubnetworkRequest,opts...gax.CallOption)(*Operation,error)ExpandIpCidrRange expands the IP CIDR range of the subnetwork to a specified value.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ExpandIpCidrRangeSubnetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ExpandIpCidrRangeSubnetworkRequest.}op,err:=c.ExpandIpCidrRange(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SubnetworksClient) Get
func(c*SubnetworksClient)Get(ctxcontext.Context,req*computepb.GetSubnetworkRequest,opts...gax.CallOption)(*computepb.Subnetwork,error)Get returns the specified subnetwork.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetSubnetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetSubnetworkRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SubnetworksClient) GetIamPolicy
func(c*SubnetworksClient)GetIamPolicy(ctxcontext.Context,req*computepb.GetIamPolicySubnetworkRequest,opts...gax.CallOption)(*computepb.Policy,error)GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetIamPolicySubnetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetIamPolicySubnetworkRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SubnetworksClient) Insert
func(c*SubnetworksClient)Insert(ctxcontext.Context,req*computepb.InsertSubnetworkRequest,opts...gax.CallOption)(*Operation,error)Insert creates a subnetwork in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertSubnetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertSubnetworkRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SubnetworksClient) List
func(c*SubnetworksClient)List(ctxcontext.Context,req*computepb.ListSubnetworksRequest,opts...gax.CallOption)*SubnetworkIteratorList retrieves a list of subnetworks available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListSubnetworksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListSubnetworksRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.SubnetworkList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListSubnetworksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListSubnetworksRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*SubnetworksClient) ListUsable
func(c*SubnetworksClient)ListUsable(ctxcontext.Context,req*computepb.ListUsableSubnetworksRequest,opts...gax.CallOption)*UsableSubnetworkIteratorListUsable retrieves an aggregated list of all usable subnetworks in the project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListUsableSubnetworksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListUsableSubnetworksRequest.}it:=c.ListUsable(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.UsableSubnetworksAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListUsableSubnetworksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListUsableSubnetworksRequest.}forresp,err:=rangec.ListUsable(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*SubnetworksClient) Patch
func(c*SubnetworksClient)Patch(ctxcontext.Context,req*computepb.PatchSubnetworkRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified subnetwork with the data included in the request. Only certain fields can be updated with a patch request as indicated in the field descriptions. You must specify the current fingerprint of the subnetwork resource being patched.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchSubnetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchSubnetworkRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SubnetworksClient) SetIamPolicy
func(c*SubnetworksClient)SetIamPolicy(ctxcontext.Context,req*computepb.SetIamPolicySubnetworkRequest,opts...gax.CallOption)(*computepb.Policy,error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetIamPolicySubnetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetIamPolicySubnetworkRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*SubnetworksClient) SetPrivateIpGoogleAccess
func(c*SubnetworksClient)SetPrivateIpGoogleAccess(ctxcontext.Context,req*computepb.SetPrivateIpGoogleAccessSubnetworkRequest,opts...gax.CallOption)(*Operation,error)SetPrivateIpGoogleAccess set whether VMs in this subnet can access Google services without assigning external IP addresses through Private Google Access.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetPrivateIpGoogleAccessSubnetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetPrivateIpGoogleAccessSubnetworkRequest.}op,err:=c.SetPrivateIpGoogleAccess(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*SubnetworksClient) TestIamPermissions
func(c*SubnetworksClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsSubnetworkRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewSubnetworksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsSubnetworkRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsSubnetworkRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}SubnetworksScopedListPair
typeSubnetworksScopedListPairstruct{KeystringValue*computepb.SubnetworksScopedList}SubnetworksScopedListPair is a holder type for string/*computepb.SubnetworksScopedList map entries
SubnetworksScopedListPairIterator
typeSubnetworksScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]SubnetworksScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}SubnetworksScopedListPairIterator manages a stream of SubnetworksScopedListPair.
func (*SubnetworksScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*SubnetworksScopedListPairIterator) Next
func(it*SubnetworksScopedListPairIterator)Next()(SubnetworksScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*SubnetworksScopedListPairIterator) PageInfo
func(it*SubnetworksScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetGrpcProxiesCallOptions
typeTargetGrpcProxiesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOption}TargetGrpcProxiesCallOptions contains the retry settings for each method of TargetGrpcProxiesClient.
TargetGrpcProxiesClient
typeTargetGrpcProxiesClientstruct{// The call options for this service.CallOptions*TargetGrpcProxiesCallOptions// contains filtered or unexported fields}TargetGrpcProxiesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The TargetGrpcProxies API.
func NewTargetGrpcProxiesRESTClient
funcNewTargetGrpcProxiesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*TargetGrpcProxiesClient,error)NewTargetGrpcProxiesRESTClient creates a new target grpc proxies rest client.
The TargetGrpcProxies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewTargetGrpcProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*TargetGrpcProxiesClient) Close
func(c*TargetGrpcProxiesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*TargetGrpcProxiesClient) Connection (deprecated)
func(c*TargetGrpcProxiesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*TargetGrpcProxiesClient) Delete
func(c*TargetGrpcProxiesClient)Delete(ctxcontext.Context,req*computepb.DeleteTargetGrpcProxyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified TargetGrpcProxy in the given scope
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetGrpcProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteTargetGrpcProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteTargetGrpcProxyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetGrpcProxiesClient) Get
func(c*TargetGrpcProxiesClient)Get(ctxcontext.Context,req*computepb.GetTargetGrpcProxyRequest,opts...gax.CallOption)(*computepb.TargetGrpcProxy,error)Get returns the specified TargetGrpcProxy resource in the given scope.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetGrpcProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetTargetGrpcProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetTargetGrpcProxyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TargetGrpcProxiesClient) Insert
func(c*TargetGrpcProxiesClient)Insert(ctxcontext.Context,req*computepb.InsertTargetGrpcProxyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a TargetGrpcProxy in the specified project in the given scope using the parameters that are included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetGrpcProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertTargetGrpcProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertTargetGrpcProxyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetGrpcProxiesClient) List
func(c*TargetGrpcProxiesClient)List(ctxcontext.Context,req*computepb.ListTargetGrpcProxiesRequest,opts...gax.CallOption)*TargetGrpcProxyIteratorList lists the TargetGrpcProxies for a project in the given scope.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetGrpcProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetGrpcProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetGrpcProxiesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetGrpcProxyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetGrpcProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetGrpcProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetGrpcProxiesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetGrpcProxiesClient) Patch
func(c*TargetGrpcProxiesClient)Patch(ctxcontext.Context,req*computepb.PatchTargetGrpcProxyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified TargetGrpcProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetGrpcProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchTargetGrpcProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchTargetGrpcProxyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}TargetGrpcProxyIterator
typeTargetGrpcProxyIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.TargetGrpcProxy,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetGrpcProxyIterator manages a stream of *computepb.TargetGrpcProxy.
func (*TargetGrpcProxyIterator) All
func(it*TargetGrpcProxyIterator)All()iter.Seq2[*computepb.TargetGrpcProxy,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetGrpcProxyIterator) Next
func(it*TargetGrpcProxyIterator)Next()(*computepb.TargetGrpcProxy,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetGrpcProxyIterator) PageInfo
func(it*TargetGrpcProxyIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetHttpProxiesCallOptions
typeTargetHttpProxiesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetUrlMap[]gax.CallOption}TargetHttpProxiesCallOptions contains the retry settings for each method of TargetHttpProxiesClient.
TargetHttpProxiesClient
typeTargetHttpProxiesClientstruct{// The call options for this service.CallOptions*TargetHttpProxiesCallOptions// contains filtered or unexported fields}TargetHttpProxiesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The TargetHttpProxies API.
func NewTargetHttpProxiesRESTClient
funcNewTargetHttpProxiesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*TargetHttpProxiesClient,error)NewTargetHttpProxiesRESTClient creates a new target http proxies rest client.
The TargetHttpProxies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*TargetHttpProxiesClient) AggregatedList
func(c*TargetHttpProxiesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListTargetHttpProxiesRequest,opts...gax.CallOption)*TargetHttpProxiesScopedListPairIteratorAggregatedList retrieves the list of all TargetHttpProxy resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetHttpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetHttpProxiesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetHttpProxyAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetHttpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetHttpProxiesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetHttpProxiesClient) Close
func(c*TargetHttpProxiesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*TargetHttpProxiesClient) Connection (deprecated)
func(c*TargetHttpProxiesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*TargetHttpProxiesClient) Delete
func(c*TargetHttpProxiesClient)Delete(ctxcontext.Context,req*computepb.DeleteTargetHttpProxyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified TargetHttpProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteTargetHttpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteTargetHttpProxyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetHttpProxiesClient) Get
func(c*TargetHttpProxiesClient)Get(ctxcontext.Context,req*computepb.GetTargetHttpProxyRequest,opts...gax.CallOption)(*computepb.TargetHttpProxy,error)Get returns the specified TargetHttpProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetTargetHttpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetTargetHttpProxyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TargetHttpProxiesClient) Insert
func(c*TargetHttpProxiesClient)Insert(ctxcontext.Context,req*computepb.InsertTargetHttpProxyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a TargetHttpProxy resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertTargetHttpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertTargetHttpProxyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetHttpProxiesClient) List
func(c*TargetHttpProxiesClient)List(ctxcontext.Context,req*computepb.ListTargetHttpProxiesRequest,opts...gax.CallOption)*TargetHttpProxyIteratorList retrieves the list of TargetHttpProxy resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetHttpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetHttpProxiesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetHttpProxyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetHttpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetHttpProxiesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetHttpProxiesClient) Patch
func(c*TargetHttpProxiesClient)Patch(ctxcontext.Context,req*computepb.PatchTargetHttpProxyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified TargetHttpProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchTargetHttpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchTargetHttpProxyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetHttpProxiesClient) SetUrlMap
func(c*TargetHttpProxiesClient)SetUrlMap(ctxcontext.Context,req*computepb.SetUrlMapTargetHttpProxyRequest,opts...gax.CallOption)(*Operation,error)SetUrlMap changes the URL map for TargetHttpProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetUrlMapTargetHttpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetUrlMapTargetHttpProxyRequest.}op,err:=c.SetUrlMap(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}TargetHttpProxiesScopedListPair
typeTargetHttpProxiesScopedListPairstruct{KeystringValue*computepb.TargetHttpProxiesScopedList}TargetHttpProxiesScopedListPair is a holder type for string/*computepb.TargetHttpProxiesScopedList map entries
TargetHttpProxiesScopedListPairIterator
typeTargetHttpProxiesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]TargetHttpProxiesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetHttpProxiesScopedListPairIterator manages a stream of TargetHttpProxiesScopedListPair.
func (*TargetHttpProxiesScopedListPairIterator) All
func(it*TargetHttpProxiesScopedListPairIterator)All()iter.Seq2[TargetHttpProxiesScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetHttpProxiesScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetHttpProxiesScopedListPairIterator) PageInfo
func(it*TargetHttpProxiesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetHttpProxyIterator
typeTargetHttpProxyIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.TargetHttpProxy,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetHttpProxyIterator manages a stream of *computepb.TargetHttpProxy.
func (*TargetHttpProxyIterator) All
func(it*TargetHttpProxyIterator)All()iter.Seq2[*computepb.TargetHttpProxy,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetHttpProxyIterator) Next
func(it*TargetHttpProxyIterator)Next()(*computepb.TargetHttpProxy,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetHttpProxyIterator) PageInfo
func(it*TargetHttpProxyIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetHttpsProxiesCallOptions
typeTargetHttpsProxiesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionSetCertificateMap[]gax.CallOptionSetQuicOverride[]gax.CallOptionSetSslCertificates[]gax.CallOptionSetSslPolicy[]gax.CallOptionSetUrlMap[]gax.CallOption}TargetHttpsProxiesCallOptions contains the retry settings for each method of TargetHttpsProxiesClient.
TargetHttpsProxiesClient
typeTargetHttpsProxiesClientstruct{// The call options for this service.CallOptions*TargetHttpsProxiesCallOptions// contains filtered or unexported fields}TargetHttpsProxiesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The TargetHttpsProxies API.
func NewTargetHttpsProxiesRESTClient
funcNewTargetHttpsProxiesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*TargetHttpsProxiesClient,error)NewTargetHttpsProxiesRESTClient creates a new target https proxies rest client.
The TargetHttpsProxies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*TargetHttpsProxiesClient) AggregatedList
func(c*TargetHttpsProxiesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListTargetHttpsProxiesRequest,opts...gax.CallOption)*TargetHttpsProxiesScopedListPairIteratorAggregatedList retrieves the list of all TargetHttpsProxy resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetHttpsProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetHttpsProxiesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetHttpsProxyAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetHttpsProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetHttpsProxiesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetHttpsProxiesClient) Close
func(c*TargetHttpsProxiesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*TargetHttpsProxiesClient) Connection (deprecated)
func(c*TargetHttpsProxiesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*TargetHttpsProxiesClient) Delete
func(c*TargetHttpsProxiesClient)Delete(ctxcontext.Context,req*computepb.DeleteTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified TargetHttpsProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteTargetHttpsProxyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetHttpsProxiesClient) Get
func(c*TargetHttpsProxiesClient)Get(ctxcontext.Context,req*computepb.GetTargetHttpsProxyRequest,opts...gax.CallOption)(*computepb.TargetHttpsProxy,error)Get returns the specified TargetHttpsProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetTargetHttpsProxyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TargetHttpsProxiesClient) Insert
func(c*TargetHttpsProxiesClient)Insert(ctxcontext.Context,req*computepb.InsertTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a TargetHttpsProxy resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertTargetHttpsProxyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetHttpsProxiesClient) List
func(c*TargetHttpsProxiesClient)List(ctxcontext.Context,req*computepb.ListTargetHttpsProxiesRequest,opts...gax.CallOption)*TargetHttpsProxyIteratorList retrieves the list of TargetHttpsProxy resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetHttpsProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetHttpsProxiesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetHttpsProxyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetHttpsProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetHttpsProxiesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetHttpsProxiesClient) Patch
func(c*TargetHttpsProxiesClient)Patch(ctxcontext.Context,req*computepb.PatchTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified TargetHttpsProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchTargetHttpsProxyRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetHttpsProxiesClient) SetCertificateMap
func(c*TargetHttpsProxiesClient)SetCertificateMap(ctxcontext.Context,req*computepb.SetCertificateMapTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)SetCertificateMap changes the Certificate Map for TargetHttpsProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetCertificateMapTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetCertificateMapTargetHttpsProxyRequest.}op,err:=c.SetCertificateMap(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetHttpsProxiesClient) SetQuicOverride
func(c*TargetHttpsProxiesClient)SetQuicOverride(ctxcontext.Context,req*computepb.SetQuicOverrideTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)SetQuicOverride sets the QUIC override policy for TargetHttpsProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetQuicOverrideTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetQuicOverrideTargetHttpsProxyRequest.}op,err:=c.SetQuicOverride(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetHttpsProxiesClient) SetSslCertificates
func(c*TargetHttpsProxiesClient)SetSslCertificates(ctxcontext.Context,req*computepb.SetSslCertificatesTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)SetSslCertificates replaces SslCertificates for TargetHttpsProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSslCertificatesTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSslCertificatesTargetHttpsProxyRequest.}op,err:=c.SetSslCertificates(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetHttpsProxiesClient) SetSslPolicy
func(c*TargetHttpsProxiesClient)SetSslPolicy(ctxcontext.Context,req*computepb.SetSslPolicyTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)SetSslPolicy sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the server-side support for SSL features. This affects connections between clients and the HTTPS proxy load balancer. They do not affect the connection between the load balancer and the backends.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSslPolicyTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSslPolicyTargetHttpsProxyRequest.}op,err:=c.SetSslPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetHttpsProxiesClient) SetUrlMap
func(c*TargetHttpsProxiesClient)SetUrlMap(ctxcontext.Context,req*computepb.SetUrlMapTargetHttpsProxyRequest,opts...gax.CallOption)(*Operation,error)SetUrlMap changes the URL map for TargetHttpsProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetHttpsProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetUrlMapTargetHttpsProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetUrlMapTargetHttpsProxyRequest.}op,err:=c.SetUrlMap(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}TargetHttpsProxiesScopedListPair
typeTargetHttpsProxiesScopedListPairstruct{KeystringValue*computepb.TargetHttpsProxiesScopedList}TargetHttpsProxiesScopedListPair is a holder type for string/*computepb.TargetHttpsProxiesScopedList map entries
TargetHttpsProxiesScopedListPairIterator
typeTargetHttpsProxiesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]TargetHttpsProxiesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetHttpsProxiesScopedListPairIterator manages a stream of TargetHttpsProxiesScopedListPair.
func (*TargetHttpsProxiesScopedListPairIterator) All
func(it*TargetHttpsProxiesScopedListPairIterator)All()iter.Seq2[TargetHttpsProxiesScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetHttpsProxiesScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetHttpsProxiesScopedListPairIterator) PageInfo
func(it*TargetHttpsProxiesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetHttpsProxyIterator
typeTargetHttpsProxyIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.TargetHttpsProxy,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetHttpsProxyIterator manages a stream of *computepb.TargetHttpsProxy.
func (*TargetHttpsProxyIterator) All
func(it*TargetHttpsProxyIterator)All()iter.Seq2[*computepb.TargetHttpsProxy,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetHttpsProxyIterator) Next
func(it*TargetHttpsProxyIterator)Next()(*computepb.TargetHttpsProxy,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetHttpsProxyIterator) PageInfo
func(it*TargetHttpsProxyIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetInstanceIterator
typeTargetInstanceIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.TargetInstance,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetInstanceIterator manages a stream of *computepb.TargetInstance.
func (*TargetInstanceIterator) All
func(it*TargetInstanceIterator)All()iter.Seq2[*computepb.TargetInstance,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetInstanceIterator) Next
func(it*TargetInstanceIterator)Next()(*computepb.TargetInstance,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetInstanceIterator) PageInfo
func(it*TargetInstanceIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetInstancesCallOptions
typeTargetInstancesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetSecurityPolicy[]gax.CallOption}TargetInstancesCallOptions contains the retry settings for each method of TargetInstancesClient.
TargetInstancesClient
typeTargetInstancesClientstruct{// The call options for this service.CallOptions*TargetInstancesCallOptions// contains filtered or unexported fields}TargetInstancesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The TargetInstances API.
func NewTargetInstancesRESTClient
funcNewTargetInstancesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*TargetInstancesClient,error)NewTargetInstancesRESTClient creates a new target instances rest client.
The TargetInstances API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewTargetInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*TargetInstancesClient) AggregatedList
func(c*TargetInstancesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListTargetInstancesRequest,opts...gax.CallOption)*TargetInstancesScopedListPairIteratorAggregatedList retrieves an aggregated list of target instances. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetInstancesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetInstanceAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetInstancesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetInstancesClient) Close
func(c*TargetInstancesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*TargetInstancesClient) Connection (deprecated)
func(c*TargetInstancesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*TargetInstancesClient) Delete
func(c*TargetInstancesClient)Delete(ctxcontext.Context,req*computepb.DeleteTargetInstanceRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified TargetInstance resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteTargetInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteTargetInstanceRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetInstancesClient) Get
func(c*TargetInstancesClient)Get(ctxcontext.Context,req*computepb.GetTargetInstanceRequest,opts...gax.CallOption)(*computepb.TargetInstance,error)Get returns the specified TargetInstance resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetTargetInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetTargetInstanceRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TargetInstancesClient) Insert
func(c*TargetInstancesClient)Insert(ctxcontext.Context,req*computepb.InsertTargetInstanceRequest,opts...gax.CallOption)(*Operation,error)Insert creates a TargetInstance resource in the specified project and zone using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertTargetInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertTargetInstanceRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetInstancesClient) List
func(c*TargetInstancesClient)List(ctxcontext.Context,req*computepb.ListTargetInstancesRequest,opts...gax.CallOption)*TargetInstanceIteratorList retrieves a list of TargetInstance resources available to the specified project and zone.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetInstancesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetInstanceList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetInstancesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetInstancesClient) SetSecurityPolicy
func(c*TargetInstancesClient)SetSecurityPolicy(ctxcontext.Context,req*computepb.SetSecurityPolicyTargetInstanceRequest,opts...gax.CallOption)(*Operation,error)SetSecurityPolicy sets the Google Cloud Armor security policy for the specified target instance. For more information, see Google Cloud Armor Overview
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetInstancesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSecurityPolicyTargetInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSecurityPolicyTargetInstanceRequest.}op,err:=c.SetSecurityPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}TargetInstancesScopedListPair
typeTargetInstancesScopedListPairstruct{KeystringValue*computepb.TargetInstancesScopedList}TargetInstancesScopedListPair is a holder type for string/*computepb.TargetInstancesScopedList map entries
TargetInstancesScopedListPairIterator
typeTargetInstancesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]TargetInstancesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetInstancesScopedListPairIterator manages a stream of TargetInstancesScopedListPair.
func (*TargetInstancesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetInstancesScopedListPairIterator) Next
func(it*TargetInstancesScopedListPairIterator)Next()(TargetInstancesScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetInstancesScopedListPairIterator) PageInfo
func(it*TargetInstancesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetPoolIterator
typeTargetPoolIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.TargetPool,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetPoolIterator manages a stream of *computepb.TargetPool.
func (*TargetPoolIterator) All
func(it*TargetPoolIterator)All()iter.Seq2[*computepb.TargetPool,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetPoolIterator) Next
func(it*TargetPoolIterator)Next()(*computepb.TargetPool,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetPoolIterator) PageInfo
func(it*TargetPoolIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetPoolsCallOptions
typeTargetPoolsCallOptionsstruct{AddHealthCheck[]gax.CallOptionAddInstance[]gax.CallOptionAggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetHealth[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionRemoveHealthCheck[]gax.CallOptionRemoveInstance[]gax.CallOptionSetBackup[]gax.CallOptionSetSecurityPolicy[]gax.CallOption}TargetPoolsCallOptions contains the retry settings for each method of TargetPoolsClient.
TargetPoolsClient
typeTargetPoolsClientstruct{// The call options for this service.CallOptions*TargetPoolsCallOptions// contains filtered or unexported fields}TargetPoolsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The TargetPools API.
func NewTargetPoolsRESTClient
funcNewTargetPoolsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*TargetPoolsClient,error)NewTargetPoolsRESTClient creates a new target pools rest client.
The TargetPools API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*TargetPoolsClient) AddHealthCheck
func(c*TargetPoolsClient)AddHealthCheck(ctxcontext.Context,req*computepb.AddHealthCheckTargetPoolRequest,opts...gax.CallOption)(*Operation,error)AddHealthCheck adds health check URLs to a target pool.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddHealthCheckTargetPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddHealthCheckTargetPoolRequest.}op,err:=c.AddHealthCheck(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetPoolsClient) AddInstance
func(c*TargetPoolsClient)AddInstance(ctxcontext.Context,req*computepb.AddInstanceTargetPoolRequest,opts...gax.CallOption)(*Operation,error)AddInstance adds an instance to a target pool.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AddInstanceTargetPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AddInstanceTargetPoolRequest.}op,err:=c.AddInstance(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetPoolsClient) AggregatedList
func(c*TargetPoolsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListTargetPoolsRequest,opts...gax.CallOption)*TargetPoolsScopedListPairIteratorAggregatedList retrieves an aggregated list of target pools. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetPoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetPoolsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetPoolAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetPoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetPoolsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetPoolsClient) Close
func(c*TargetPoolsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*TargetPoolsClient) Connection (deprecated)
func(c*TargetPoolsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*TargetPoolsClient) Delete
func(c*TargetPoolsClient)Delete(ctxcontext.Context,req*computepb.DeleteTargetPoolRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified target pool.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteTargetPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteTargetPoolRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetPoolsClient) Get
func(c*TargetPoolsClient)Get(ctxcontext.Context,req*computepb.GetTargetPoolRequest,opts...gax.CallOption)(*computepb.TargetPool,error)Get returns the specified target pool.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetTargetPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetTargetPoolRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TargetPoolsClient) GetHealth
func(c*TargetPoolsClient)GetHealth(ctxcontext.Context,req*computepb.GetHealthTargetPoolRequest,opts...gax.CallOption)(*computepb.TargetPoolInstanceHealth,error)GetHealth gets the most recent health check results for each IP for the instance that is referenced by the given target pool.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetHealthTargetPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetHealthTargetPoolRequest.}resp,err:=c.GetHealth(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TargetPoolsClient) Insert
func(c*TargetPoolsClient)Insert(ctxcontext.Context,req*computepb.InsertTargetPoolRequest,opts...gax.CallOption)(*Operation,error)Insert creates a target pool in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertTargetPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertTargetPoolRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetPoolsClient) List
func(c*TargetPoolsClient)List(ctxcontext.Context,req*computepb.ListTargetPoolsRequest,opts...gax.CallOption)*TargetPoolIteratorList retrieves a list of target pools available to the specified project and region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetPoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetPoolsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetPoolList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetPoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetPoolsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetPoolsClient) RemoveHealthCheck
func(c*TargetPoolsClient)RemoveHealthCheck(ctxcontext.Context,req*computepb.RemoveHealthCheckTargetPoolRequest,opts...gax.CallOption)(*Operation,error)RemoveHealthCheck removes health check URL from a target pool.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveHealthCheckTargetPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveHealthCheckTargetPoolRequest.}op,err:=c.RemoveHealthCheck(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetPoolsClient) RemoveInstance
func(c*TargetPoolsClient)RemoveInstance(ctxcontext.Context,req*computepb.RemoveInstanceTargetPoolRequest,opts...gax.CallOption)(*Operation,error)RemoveInstance removes instance URL from a target pool.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.RemoveInstanceTargetPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#RemoveInstanceTargetPoolRequest.}op,err:=c.RemoveInstance(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetPoolsClient) SetBackup
func(c*TargetPoolsClient)SetBackup(ctxcontext.Context,req*computepb.SetBackupTargetPoolRequest,opts...gax.CallOption)(*Operation,error)SetBackup changes a backup target pool’s configurations.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetBackupTargetPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetBackupTargetPoolRequest.}op,err:=c.SetBackup(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetPoolsClient) SetSecurityPolicy
func(c*TargetPoolsClient)SetSecurityPolicy(ctxcontext.Context,req*computepb.SetSecurityPolicyTargetPoolRequest,opts...gax.CallOption)(*Operation,error)SetSecurityPolicy sets the Google Cloud Armor security policy for the specified target pool. For more information, see Google Cloud Armor Overview
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSecurityPolicyTargetPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSecurityPolicyTargetPoolRequest.}op,err:=c.SetSecurityPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}TargetPoolsScopedListPair
typeTargetPoolsScopedListPairstruct{KeystringValue*computepb.TargetPoolsScopedList}TargetPoolsScopedListPair is a holder type for string/*computepb.TargetPoolsScopedList map entries
TargetPoolsScopedListPairIterator
typeTargetPoolsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]TargetPoolsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetPoolsScopedListPairIterator manages a stream of TargetPoolsScopedListPair.
func (*TargetPoolsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetPoolsScopedListPairIterator) Next
func(it*TargetPoolsScopedListPairIterator)Next()(TargetPoolsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetPoolsScopedListPairIterator) PageInfo
func(it*TargetPoolsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetSslProxiesCallOptions
typeTargetSslProxiesCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetBackendService[]gax.CallOptionSetCertificateMap[]gax.CallOptionSetProxyHeader[]gax.CallOptionSetSslCertificates[]gax.CallOptionSetSslPolicy[]gax.CallOption}TargetSslProxiesCallOptions contains the retry settings for each method of TargetSslProxiesClient.
TargetSslProxiesClient
typeTargetSslProxiesClientstruct{// The call options for this service.CallOptions*TargetSslProxiesCallOptions// contains filtered or unexported fields}TargetSslProxiesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The TargetSslProxies API.
func NewTargetSslProxiesRESTClient
funcNewTargetSslProxiesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*TargetSslProxiesClient,error)NewTargetSslProxiesRESTClient creates a new target ssl proxies rest client.
The TargetSslProxies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*TargetSslProxiesClient) Close
func(c*TargetSslProxiesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*TargetSslProxiesClient) Connection (deprecated)
func(c*TargetSslProxiesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*TargetSslProxiesClient) Delete
func(c*TargetSslProxiesClient)Delete(ctxcontext.Context,req*computepb.DeleteTargetSslProxyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified TargetSslProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteTargetSslProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteTargetSslProxyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetSslProxiesClient) Get
func(c*TargetSslProxiesClient)Get(ctxcontext.Context,req*computepb.GetTargetSslProxyRequest,opts...gax.CallOption)(*computepb.TargetSslProxy,error)Get returns the specified TargetSslProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetTargetSslProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetTargetSslProxyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TargetSslProxiesClient) Insert
func(c*TargetSslProxiesClient)Insert(ctxcontext.Context,req*computepb.InsertTargetSslProxyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a TargetSslProxy resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertTargetSslProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertTargetSslProxyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetSslProxiesClient) List
func(c*TargetSslProxiesClient)List(ctxcontext.Context,req*computepb.ListTargetSslProxiesRequest,opts...gax.CallOption)*TargetSslProxyIteratorList retrieves the list of TargetSslProxy resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetSslProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetSslProxiesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetSslProxyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetSslProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetSslProxiesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetSslProxiesClient) SetBackendService
func(c*TargetSslProxiesClient)SetBackendService(ctxcontext.Context,req*computepb.SetBackendServiceTargetSslProxyRequest,opts...gax.CallOption)(*Operation,error)SetBackendService changes the BackendService for TargetSslProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetBackendServiceTargetSslProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetBackendServiceTargetSslProxyRequest.}op,err:=c.SetBackendService(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetSslProxiesClient) SetCertificateMap
func(c*TargetSslProxiesClient)SetCertificateMap(ctxcontext.Context,req*computepb.SetCertificateMapTargetSslProxyRequest,opts...gax.CallOption)(*Operation,error)SetCertificateMap changes the Certificate Map for TargetSslProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetCertificateMapTargetSslProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetCertificateMapTargetSslProxyRequest.}op,err:=c.SetCertificateMap(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetSslProxiesClient) SetProxyHeader
func(c*TargetSslProxiesClient)SetProxyHeader(ctxcontext.Context,req*computepb.SetProxyHeaderTargetSslProxyRequest,opts...gax.CallOption)(*Operation,error)SetProxyHeader changes the ProxyHeaderType for TargetSslProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetProxyHeaderTargetSslProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetProxyHeaderTargetSslProxyRequest.}op,err:=c.SetProxyHeader(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetSslProxiesClient) SetSslCertificates
func(c*TargetSslProxiesClient)SetSslCertificates(ctxcontext.Context,req*computepb.SetSslCertificatesTargetSslProxyRequest,opts...gax.CallOption)(*Operation,error)SetSslCertificates changes SslCertificates for TargetSslProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSslCertificatesTargetSslProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSslCertificatesTargetSslProxyRequest.}op,err:=c.SetSslCertificates(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetSslProxiesClient) SetSslPolicy
func(c*TargetSslProxiesClient)SetSslPolicy(ctxcontext.Context,req*computepb.SetSslPolicyTargetSslProxyRequest,opts...gax.CallOption)(*Operation,error)SetSslPolicy sets the SSL policy for TargetSslProxy. The SSL policy specifies the server-side support for SSL features. This affects connections between clients and the load balancer. They do not affect the connection between the load balancer and the backends.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetSslProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetSslPolicyTargetSslProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetSslPolicyTargetSslProxyRequest.}op,err:=c.SetSslPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}TargetSslProxyIterator
typeTargetSslProxyIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.TargetSslProxy,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetSslProxyIterator manages a stream of *computepb.TargetSslProxy.
func (*TargetSslProxyIterator) All
func(it*TargetSslProxyIterator)All()iter.Seq2[*computepb.TargetSslProxy,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetSslProxyIterator) Next
func(it*TargetSslProxyIterator)Next()(*computepb.TargetSslProxy,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetSslProxyIterator) PageInfo
func(it*TargetSslProxyIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetTcpProxiesCallOptions
typeTargetTcpProxiesCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetBackendService[]gax.CallOptionSetProxyHeader[]gax.CallOption}TargetTcpProxiesCallOptions contains the retry settings for each method of TargetTcpProxiesClient.
TargetTcpProxiesClient
typeTargetTcpProxiesClientstruct{// The call options for this service.CallOptions*TargetTcpProxiesCallOptions// contains filtered or unexported fields}TargetTcpProxiesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The TargetTcpProxies API.
func NewTargetTcpProxiesRESTClient
funcNewTargetTcpProxiesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*TargetTcpProxiesClient,error)NewTargetTcpProxiesRESTClient creates a new target tcp proxies rest client.
The TargetTcpProxies API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*TargetTcpProxiesClient) AggregatedList
func(c*TargetTcpProxiesClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListTargetTcpProxiesRequest,opts...gax.CallOption)*TargetTcpProxiesScopedListPairIteratorAggregatedList retrieves the list of all TargetTcpProxy resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetTcpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetTcpProxiesRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetTcpProxyAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetTcpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetTcpProxiesRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetTcpProxiesClient) Close
func(c*TargetTcpProxiesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*TargetTcpProxiesClient) Connection (deprecated)
func(c*TargetTcpProxiesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*TargetTcpProxiesClient) Delete
func(c*TargetTcpProxiesClient)Delete(ctxcontext.Context,req*computepb.DeleteTargetTcpProxyRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified TargetTcpProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteTargetTcpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteTargetTcpProxyRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetTcpProxiesClient) Get
func(c*TargetTcpProxiesClient)Get(ctxcontext.Context,req*computepb.GetTargetTcpProxyRequest,opts...gax.CallOption)(*computepb.TargetTcpProxy,error)Get returns the specified TargetTcpProxy resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetTargetTcpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetTargetTcpProxyRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TargetTcpProxiesClient) Insert
func(c*TargetTcpProxiesClient)Insert(ctxcontext.Context,req*computepb.InsertTargetTcpProxyRequest,opts...gax.CallOption)(*Operation,error)Insert creates a TargetTcpProxy resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertTargetTcpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertTargetTcpProxyRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetTcpProxiesClient) List
func(c*TargetTcpProxiesClient)List(ctxcontext.Context,req*computepb.ListTargetTcpProxiesRequest,opts...gax.CallOption)*TargetTcpProxyIteratorList retrieves the list of TargetTcpProxy resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetTcpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetTcpProxiesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetTcpProxyList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetTcpProxiesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetTcpProxiesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetTcpProxiesClient) SetBackendService
func(c*TargetTcpProxiesClient)SetBackendService(ctxcontext.Context,req*computepb.SetBackendServiceTargetTcpProxyRequest,opts...gax.CallOption)(*Operation,error)SetBackendService changes the BackendService for TargetTcpProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetBackendServiceTargetTcpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetBackendServiceTargetTcpProxyRequest.}op,err:=c.SetBackendService(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetTcpProxiesClient) SetProxyHeader
func(c*TargetTcpProxiesClient)SetProxyHeader(ctxcontext.Context,req*computepb.SetProxyHeaderTargetTcpProxyRequest,opts...gax.CallOption)(*Operation,error)SetProxyHeader changes the ProxyHeaderType for TargetTcpProxy.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetTcpProxiesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetProxyHeaderTargetTcpProxyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetProxyHeaderTargetTcpProxyRequest.}op,err:=c.SetProxyHeader(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}TargetTcpProxiesScopedListPair
typeTargetTcpProxiesScopedListPairstruct{KeystringValue*computepb.TargetTcpProxiesScopedList}TargetTcpProxiesScopedListPair is a holder type for string/*computepb.TargetTcpProxiesScopedList map entries
TargetTcpProxiesScopedListPairIterator
typeTargetTcpProxiesScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]TargetTcpProxiesScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetTcpProxiesScopedListPairIterator manages a stream of TargetTcpProxiesScopedListPair.
func (*TargetTcpProxiesScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetTcpProxiesScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetTcpProxiesScopedListPairIterator) PageInfo
func(it*TargetTcpProxiesScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetTcpProxyIterator
typeTargetTcpProxyIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.TargetTcpProxy,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetTcpProxyIterator manages a stream of *computepb.TargetTcpProxy.
func (*TargetTcpProxyIterator) All
func(it*TargetTcpProxyIterator)All()iter.Seq2[*computepb.TargetTcpProxy,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetTcpProxyIterator) Next
func(it*TargetTcpProxyIterator)Next()(*computepb.TargetTcpProxy,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetTcpProxyIterator) PageInfo
func(it*TargetTcpProxyIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetVpnGatewayIterator
typeTargetVpnGatewayIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.TargetVpnGateway,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetVpnGatewayIterator manages a stream of *computepb.TargetVpnGateway.
func (*TargetVpnGatewayIterator) All
func(it*TargetVpnGatewayIterator)All()iter.Seq2[*computepb.TargetVpnGateway,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetVpnGatewayIterator) Next
func(it*TargetVpnGatewayIterator)Next()(*computepb.TargetVpnGateway,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetVpnGatewayIterator) PageInfo
func(it*TargetVpnGatewayIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TargetVpnGatewaysCallOptions
typeTargetVpnGatewaysCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetLabels[]gax.CallOption}TargetVpnGatewaysCallOptions contains the retry settings for each method of TargetVpnGatewaysClient.
TargetVpnGatewaysClient
typeTargetVpnGatewaysClientstruct{// The call options for this service.CallOptions*TargetVpnGatewaysCallOptions// contains filtered or unexported fields}TargetVpnGatewaysClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The TargetVpnGateways API.
func NewTargetVpnGatewaysRESTClient
funcNewTargetVpnGatewaysRESTClient(ctxcontext.Context,opts...option.ClientOption)(*TargetVpnGatewaysClient,error)NewTargetVpnGatewaysRESTClient creates a new target vpn gateways rest client.
The TargetVpnGateways API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewTargetVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*TargetVpnGatewaysClient) AggregatedList
func(c*TargetVpnGatewaysClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListTargetVpnGatewaysRequest,opts...gax.CallOption)*TargetVpnGatewaysScopedListPairIteratorAggregatedList retrieves an aggregated list of target VPN gateways. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetVpnGatewaysRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetVpnGatewaysRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetVpnGatewayAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListTargetVpnGatewaysRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListTargetVpnGatewaysRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetVpnGatewaysClient) Close
func(c*TargetVpnGatewaysClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*TargetVpnGatewaysClient) Connection (deprecated)
func(c*TargetVpnGatewaysClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*TargetVpnGatewaysClient) Delete
func(c*TargetVpnGatewaysClient)Delete(ctxcontext.Context,req*computepb.DeleteTargetVpnGatewayRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified target VPN gateway.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteTargetVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteTargetVpnGatewayRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetVpnGatewaysClient) Get
func(c*TargetVpnGatewaysClient)Get(ctxcontext.Context,req*computepb.GetTargetVpnGatewayRequest,opts...gax.CallOption)(*computepb.TargetVpnGateway,error)Get returns the specified target VPN gateway.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetTargetVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetTargetVpnGatewayRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TargetVpnGatewaysClient) Insert
func(c*TargetVpnGatewaysClient)Insert(ctxcontext.Context,req*computepb.InsertTargetVpnGatewayRequest,opts...gax.CallOption)(*Operation,error)Insert creates a target VPN gateway in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertTargetVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertTargetVpnGatewayRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*TargetVpnGatewaysClient) List
func(c*TargetVpnGatewaysClient)List(ctxcontext.Context,req*computepb.ListTargetVpnGatewaysRequest,opts...gax.CallOption)*TargetVpnGatewayIteratorList retrieves a list of target VPN gateways available to the specified project and region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewTargetVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetVpnGatewaysRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetVpnGatewaysRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.TargetVpnGatewayList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListTargetVpnGatewaysRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListTargetVpnGatewaysRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TargetVpnGatewaysClient) SetLabels
func(c*TargetVpnGatewaysClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsTargetVpnGatewayRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a TargetVpnGateway. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewTargetVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsTargetVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsTargetVpnGatewayRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}TargetVpnGatewaysScopedListPair
typeTargetVpnGatewaysScopedListPairstruct{KeystringValue*computepb.TargetVpnGatewaysScopedList}TargetVpnGatewaysScopedListPair is a holder type for string/*computepb.TargetVpnGatewaysScopedList map entries
TargetVpnGatewaysScopedListPairIterator
typeTargetVpnGatewaysScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]TargetVpnGatewaysScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}TargetVpnGatewaysScopedListPairIterator manages a stream of TargetVpnGatewaysScopedListPair.
func (*TargetVpnGatewaysScopedListPairIterator) All
func(it*TargetVpnGatewaysScopedListPairIterator)All()iter.Seq2[TargetVpnGatewaysScopedListPair,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TargetVpnGatewaysScopedListPairIterator) Next
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*TargetVpnGatewaysScopedListPairIterator) PageInfo
func(it*TargetVpnGatewaysScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
UrlMapIterator
typeUrlMapIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.UrlMap,nextPageTokenstring,errerror)// contains filtered or unexported fields}UrlMapIterator manages a stream of *computepb.UrlMap.
func (*UrlMapIterator) All
func(it*UrlMapIterator)All()iter.Seq2[*computepb.UrlMap,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*UrlMapIterator) Next
func(it*UrlMapIterator)Next()(*computepb.UrlMap,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*UrlMapIterator) PageInfo
func(it*UrlMapIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
UrlMapsCallOptions
typeUrlMapsCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionInvalidateCache[]gax.CallOptionList[]gax.CallOptionPatch[]gax.CallOptionUpdate[]gax.CallOptionValidate[]gax.CallOption}UrlMapsCallOptions contains the retry settings for each method of UrlMapsClient.
UrlMapsClient
typeUrlMapsClientstruct{// The call options for this service.CallOptions*UrlMapsCallOptions// contains filtered or unexported fields}UrlMapsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The UrlMaps API.
func NewUrlMapsRESTClient
funcNewUrlMapsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*UrlMapsClient,error)NewUrlMapsRESTClient creates a new url maps rest client.
The UrlMaps API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*UrlMapsClient) AggregatedList
func(c*UrlMapsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListUrlMapsRequest,opts...gax.CallOption)*UrlMapsScopedListPairIteratorAggregatedList retrieves the list of all UrlMap resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListUrlMapsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListUrlMapsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.UrlMapsAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListUrlMapsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListUrlMapsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*UrlMapsClient) Close
func(c*UrlMapsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*UrlMapsClient) Connection (deprecated)
func(c*UrlMapsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*UrlMapsClient) Delete
func(c*UrlMapsClient)Delete(ctxcontext.Context,req*computepb.DeleteUrlMapRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified UrlMap resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteUrlMapRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*UrlMapsClient) Get
func(c*UrlMapsClient)Get(ctxcontext.Context,req*computepb.GetUrlMapRequest,opts...gax.CallOption)(*computepb.UrlMap,error)Get returns the specified UrlMap resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetUrlMapRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*UrlMapsClient) Insert
func(c*UrlMapsClient)Insert(ctxcontext.Context,req*computepb.InsertUrlMapRequest,opts...gax.CallOption)(*Operation,error)Insert creates a UrlMap resource in the specified project using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertUrlMapRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*UrlMapsClient) InvalidateCache
func(c*UrlMapsClient)InvalidateCache(ctxcontext.Context,req*computepb.InvalidateCacheUrlMapRequest,opts...gax.CallOption)(*Operation,error)InvalidateCache initiates a cache invalidation operation, invalidating the specified path, scoped to the specified UrlMap. For more information, see Invalidating cached content (at /cdn/docs/invalidating-cached-content).
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InvalidateCacheUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InvalidateCacheUrlMapRequest.}op,err:=c.InvalidateCache(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*UrlMapsClient) List
func(c*UrlMapsClient)List(ctxcontext.Context,req*computepb.ListUrlMapsRequest,opts...gax.CallOption)*UrlMapIteratorList retrieves the list of UrlMap resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListUrlMapsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListUrlMapsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.UrlMapList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListUrlMapsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListUrlMapsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*UrlMapsClient) Patch
func(c*UrlMapsClient)Patch(ctxcontext.Context,req*computepb.PatchUrlMapRequest,opts...gax.CallOption)(*Operation,error)Patch patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.PatchUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#PatchUrlMapRequest.}op,err:=c.Patch(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*UrlMapsClient) Update
func(c*UrlMapsClient)Update(ctxcontext.Context,req*computepb.UpdateUrlMapRequest,opts...gax.CallOption)(*Operation,error)Update updates the specified UrlMap resource with the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.UpdateUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#UpdateUrlMapRequest.}op,err:=c.Update(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*UrlMapsClient) Validate
func(c*UrlMapsClient)Validate(ctxcontext.Context,req*computepb.ValidateUrlMapRequest,opts...gax.CallOption)(*computepb.UrlMapsValidateResponse,error)Validate runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewUrlMapsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ValidateUrlMapRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ValidateUrlMapRequest.}resp,err:=c.Validate(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}UrlMapsScopedListPair
typeUrlMapsScopedListPairstruct{KeystringValue*computepb.UrlMapsScopedList}UrlMapsScopedListPair is a holder type for string/*computepb.UrlMapsScopedList map entries
UrlMapsScopedListPairIterator
typeUrlMapsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]UrlMapsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}UrlMapsScopedListPairIterator manages a stream of UrlMapsScopedListPair.
func (*UrlMapsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*UrlMapsScopedListPairIterator) Next
func(it*UrlMapsScopedListPairIterator)Next()(UrlMapsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*UrlMapsScopedListPairIterator) PageInfo
func(it*UrlMapsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
UsableSubnetworkIterator
typeUsableSubnetworkIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.UsableSubnetwork,nextPageTokenstring,errerror)// contains filtered or unexported fields}UsableSubnetworkIterator manages a stream of *computepb.UsableSubnetwork.
func (*UsableSubnetworkIterator) All
func(it*UsableSubnetworkIterator)All()iter.Seq2[*computepb.UsableSubnetwork,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*UsableSubnetworkIterator) Next
func(it*UsableSubnetworkIterator)Next()(*computepb.UsableSubnetwork,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*UsableSubnetworkIterator) PageInfo
func(it*UsableSubnetworkIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
VmEndpointNatMappingsIterator
typeVmEndpointNatMappingsIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.VmEndpointNatMappings,nextPageTokenstring,errerror)// contains filtered or unexported fields}VmEndpointNatMappingsIterator manages a stream of *computepb.VmEndpointNatMappings.
func (*VmEndpointNatMappingsIterator) All
func(it*VmEndpointNatMappingsIterator)All()iter.Seq2[*computepb.VmEndpointNatMappings,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*VmEndpointNatMappingsIterator) Next
func(it*VmEndpointNatMappingsIterator)Next()(*computepb.VmEndpointNatMappings,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*VmEndpointNatMappingsIterator) PageInfo
func(it*VmEndpointNatMappingsIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
VpnGatewayIterator
typeVpnGatewayIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.VpnGateway,nextPageTokenstring,errerror)// contains filtered or unexported fields}VpnGatewayIterator manages a stream of *computepb.VpnGateway.
func (*VpnGatewayIterator) All
func(it*VpnGatewayIterator)All()iter.Seq2[*computepb.VpnGateway,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*VpnGatewayIterator) Next
func(it*VpnGatewayIterator)Next()(*computepb.VpnGateway,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*VpnGatewayIterator) PageInfo
func(it*VpnGatewayIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
VpnGatewaysCallOptions
typeVpnGatewaysCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionGetStatus[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetLabels[]gax.CallOptionTestIamPermissions[]gax.CallOption}VpnGatewaysCallOptions contains the retry settings for each method of VpnGatewaysClient.
VpnGatewaysClient
typeVpnGatewaysClientstruct{// The call options for this service.CallOptions*VpnGatewaysCallOptions// contains filtered or unexported fields}VpnGatewaysClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The VpnGateways API.
func NewVpnGatewaysRESTClient
funcNewVpnGatewaysRESTClient(ctxcontext.Context,opts...option.ClientOption)(*VpnGatewaysClient,error)NewVpnGatewaysRESTClient creates a new vpn gateways rest client.
The VpnGateways API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*VpnGatewaysClient) AggregatedList
func(c*VpnGatewaysClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListVpnGatewaysRequest,opts...gax.CallOption)*VpnGatewaysScopedListPairIteratorAggregatedList retrieves an aggregated list of VPN gateways. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListVpnGatewaysRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListVpnGatewaysRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.VpnGatewayAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListVpnGatewaysRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListVpnGatewaysRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*VpnGatewaysClient) Close
func(c*VpnGatewaysClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*VpnGatewaysClient) Connection (deprecated)
func(c*VpnGatewaysClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*VpnGatewaysClient) Delete
func(c*VpnGatewaysClient)Delete(ctxcontext.Context,req*computepb.DeleteVpnGatewayRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified VPN gateway.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteVpnGatewayRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*VpnGatewaysClient) Get
func(c*VpnGatewaysClient)Get(ctxcontext.Context,req*computepb.GetVpnGatewayRequest,opts...gax.CallOption)(*computepb.VpnGateway,error)Get returns the specified VPN gateway.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetVpnGatewayRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*VpnGatewaysClient) GetStatus
func(c*VpnGatewaysClient)GetStatus(ctxcontext.Context,req*computepb.GetStatusVpnGatewayRequest,opts...gax.CallOption)(*computepb.VpnGatewaysGetStatusResponse,error)GetStatus returns the status for the specified VPN gateway.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetStatusVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetStatusVpnGatewayRequest.}resp,err:=c.GetStatus(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*VpnGatewaysClient) Insert
func(c*VpnGatewaysClient)Insert(ctxcontext.Context,req*computepb.InsertVpnGatewayRequest,opts...gax.CallOption)(*Operation,error)Insert creates a VPN gateway in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertVpnGatewayRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*VpnGatewaysClient) List
func(c*VpnGatewaysClient)List(ctxcontext.Context,req*computepb.ListVpnGatewaysRequest,opts...gax.CallOption)*VpnGatewayIteratorList retrieves a list of VPN gateways available to the specified project and region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListVpnGatewaysRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListVpnGatewaysRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.VpnGatewayList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListVpnGatewaysRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListVpnGatewaysRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*VpnGatewaysClient) SetLabels
func(c*VpnGatewaysClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsVpnGatewayRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a VpnGateway. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsVpnGatewayRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*VpnGatewaysClient) TestIamPermissions
func(c*VpnGatewaysClient)TestIamPermissions(ctxcontext.Context,req*computepb.TestIamPermissionsVpnGatewayRequest,opts...gax.CallOption)(*computepb.TestPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnGatewaysRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.TestIamPermissionsVpnGatewayRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#TestIamPermissionsVpnGatewayRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}VpnGatewaysScopedListPair
typeVpnGatewaysScopedListPairstruct{KeystringValue*computepb.VpnGatewaysScopedList}VpnGatewaysScopedListPair is a holder type for string/*computepb.VpnGatewaysScopedList map entries
VpnGatewaysScopedListPairIterator
typeVpnGatewaysScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]VpnGatewaysScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}VpnGatewaysScopedListPairIterator manages a stream of VpnGatewaysScopedListPair.
func (*VpnGatewaysScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*VpnGatewaysScopedListPairIterator) Next
func(it*VpnGatewaysScopedListPairIterator)Next()(VpnGatewaysScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*VpnGatewaysScopedListPairIterator) PageInfo
func(it*VpnGatewaysScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
VpnTunnelIterator
typeVpnTunnelIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.VpnTunnel,nextPageTokenstring,errerror)// contains filtered or unexported fields}VpnTunnelIterator manages a stream of *computepb.VpnTunnel.
func (*VpnTunnelIterator) All
func(it*VpnTunnelIterator)All()iter.Seq2[*computepb.VpnTunnel,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*VpnTunnelIterator) Next
func(it*VpnTunnelIterator)Next()(*computepb.VpnTunnel,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*VpnTunnelIterator) PageInfo
func(it*VpnTunnelIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
VpnTunnelsCallOptions
typeVpnTunnelsCallOptionsstruct{AggregatedList[]gax.CallOptionDelete[]gax.CallOptionGet[]gax.CallOptionInsert[]gax.CallOptionList[]gax.CallOptionSetLabels[]gax.CallOption}VpnTunnelsCallOptions contains the retry settings for each method of VpnTunnelsClient.
VpnTunnelsClient
typeVpnTunnelsClientstruct{// The call options for this service.CallOptions*VpnTunnelsCallOptions// contains filtered or unexported fields}VpnTunnelsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The VpnTunnels API.
func NewVpnTunnelsRESTClient
funcNewVpnTunnelsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*VpnTunnelsClient,error)NewVpnTunnelsRESTClient creates a new vpn tunnels rest client.
The VpnTunnels API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewVpnTunnelsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*VpnTunnelsClient) AggregatedList
func(c*VpnTunnelsClient)AggregatedList(ctxcontext.Context,req*computepb.AggregatedListVpnTunnelsRequest,opts...gax.CallOption)*VpnTunnelsScopedListPairIteratorAggregatedList retrieves an aggregated list of VPN tunnels. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewVpnTunnelsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListVpnTunnelsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListVpnTunnelsRequest.}it:=c.AggregatedList(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.VpnTunnelAggregatedList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnTunnelsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.AggregatedListVpnTunnelsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#AggregatedListVpnTunnelsRequest.}forresp,err:=rangec.AggregatedList(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*VpnTunnelsClient) Close
func(c*VpnTunnelsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*VpnTunnelsClient) Connection (deprecated)
func(c*VpnTunnelsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*VpnTunnelsClient) Delete
func(c*VpnTunnelsClient)Delete(ctxcontext.Context,req*computepb.DeleteVpnTunnelRequest,opts...gax.CallOption)(*Operation,error)Delete deletes the specified VpnTunnel resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnTunnelsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteVpnTunnelRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteVpnTunnelRequest.}op,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*VpnTunnelsClient) Get
func(c*VpnTunnelsClient)Get(ctxcontext.Context,req*computepb.GetVpnTunnelRequest,opts...gax.CallOption)(*computepb.VpnTunnel,error)Get returns the specified VpnTunnel resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnTunnelsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetVpnTunnelRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetVpnTunnelRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*VpnTunnelsClient) Insert
func(c*VpnTunnelsClient)Insert(ctxcontext.Context,req*computepb.InsertVpnTunnelRequest,opts...gax.CallOption)(*Operation,error)Insert creates a VpnTunnel resource in the specified project and region using the data included in the request.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnTunnelsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.InsertVpnTunnelRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#InsertVpnTunnelRequest.}op,err:=c.Insert(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*VpnTunnelsClient) List
func(c*VpnTunnelsClient)List(ctxcontext.Context,req*computepb.ListVpnTunnelsRequest,opts...gax.CallOption)*VpnTunnelIteratorList retrieves a list of VpnTunnel resources contained in the specified project and region.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewVpnTunnelsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListVpnTunnelsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListVpnTunnelsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.VpnTunnelList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnTunnelsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListVpnTunnelsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListVpnTunnelsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*VpnTunnelsClient) SetLabels
func(c*VpnTunnelsClient)SetLabels(ctxcontext.Context,req*computepb.SetLabelsVpnTunnelRequest,opts...gax.CallOption)(*Operation,error)SetLabels sets the labels on a VpnTunnel. To learn more about labels, read the Labeling Resources documentation.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewVpnTunnelsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.SetLabelsVpnTunnelRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#SetLabelsVpnTunnelRequest.}op,err:=c.SetLabels(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}VpnTunnelsScopedListPair
typeVpnTunnelsScopedListPairstruct{KeystringValue*computepb.VpnTunnelsScopedList}VpnTunnelsScopedListPair is a holder type for string/*computepb.VpnTunnelsScopedList map entries
VpnTunnelsScopedListPairIterator
typeVpnTunnelsScopedListPairIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]VpnTunnelsScopedListPair,nextPageTokenstring,errerror)// contains filtered or unexported fields}VpnTunnelsScopedListPairIterator manages a stream of VpnTunnelsScopedListPair.
func (*VpnTunnelsScopedListPairIterator) All
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*VpnTunnelsScopedListPairIterator) Next
func(it*VpnTunnelsScopedListPairIterator)Next()(VpnTunnelsScopedListPair,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*VpnTunnelsScopedListPairIterator) PageInfo
func(it*VpnTunnelsScopedListPairIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
XpnResourceIdIterator
typeXpnResourceIdIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.XpnResourceId,nextPageTokenstring,errerror)// contains filtered or unexported fields}XpnResourceIdIterator manages a stream of *computepb.XpnResourceId.
func (*XpnResourceIdIterator) All
func(it*XpnResourceIdIterator)All()iter.Seq2[*computepb.XpnResourceId,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*XpnResourceIdIterator) Next
func(it*XpnResourceIdIterator)Next()(*computepb.XpnResourceId,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*XpnResourceIdIterator) PageInfo
func(it*XpnResourceIdIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ZoneIterator
typeZoneIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*computepb.Zone,nextPageTokenstring,errerror)// contains filtered or unexported fields}ZoneIterator manages a stream of *computepb.Zone.
func (*ZoneIterator) All
func(it*ZoneIterator)All()iter.Seq2[*computepb.Zone,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ZoneIterator) Next
func(it*ZoneIterator)Next()(*computepb.Zone,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*ZoneIterator) PageInfo
func(it*ZoneIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ZoneOperationsCallOptions
typeZoneOperationsCallOptionsstruct{Delete[]gax.CallOptionGet[]gax.CallOptionList[]gax.CallOptionWait[]gax.CallOption}ZoneOperationsCallOptions contains the retry settings for each method of ZoneOperationsClient.
ZoneOperationsClient
typeZoneOperationsClientstruct{// The call options for this service.CallOptions*ZoneOperationsCallOptions// contains filtered or unexported fields}ZoneOperationsClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The ZoneOperations API.
func NewZoneOperationsRESTClient
funcNewZoneOperationsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ZoneOperationsClient,error)NewZoneOperationsRESTClient creates a new zone operations rest client.
The ZoneOperations API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewZoneOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ZoneOperationsClient) Close
func(c*ZoneOperationsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ZoneOperationsClient) Connection (deprecated)
func(c*ZoneOperationsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ZoneOperationsClient) Delete
func(c*ZoneOperationsClient)Delete(ctxcontext.Context,req*computepb.DeleteZoneOperationRequest,opts...gax.CallOption)(*computepb.DeleteZoneOperationResponse,error)Delete deletes the specified zone-specific Operations resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewZoneOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.DeleteZoneOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#DeleteZoneOperationRequest.}resp,err:=c.Delete(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ZoneOperationsClient) Get
func(c*ZoneOperationsClient)Get(ctxcontext.Context,req*computepb.GetZoneOperationRequest,opts...gax.CallOption)(*computepb.Operation,error)Get retrieves the specified zone-specific Operations resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewZoneOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetZoneOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetZoneOperationRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ZoneOperationsClient) List
func(c*ZoneOperationsClient)List(ctxcontext.Context,req*computepb.ListZoneOperationsRequest,opts...gax.CallOption)*OperationIteratorList retrieves a list of Operation resources contained within the specified zone.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewZoneOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListZoneOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListZoneOperationsRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.OperationList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewZoneOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListZoneOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListZoneOperationsRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ZoneOperationsClient) Wait
func(c*ZoneOperationsClient)Wait(ctxcontext.Context,req*computepb.WaitZoneOperationRequest,opts...gax.CallOption)(*computepb.Operation,error)Wait waits for the specified Operation resource to return as DONE or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method waits for no more than the 2 minutes and then returns the current state of the operation, which might be DONE or still in progress. This method is called on a best-effort basis. Specifically: - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewZoneOperationsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.WaitZoneOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#WaitZoneOperationRequest.}resp,err:=c.Wait(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}ZonesCallOptions
typeZonesCallOptionsstruct{Get[]gax.CallOptionList[]gax.CallOption}ZonesCallOptions contains the retry settings for each method of ZonesClient.
ZonesClient
typeZonesClientstruct{// The call options for this service.CallOptions*ZonesCallOptions// contains filtered or unexported fields}ZonesClient is a client for interacting with Google Compute Engine API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Zones API.
func NewZonesRESTClient
funcNewZonesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ZonesClient,error)NewZonesRESTClient creates a new zones rest client.
The Zones API.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1")funcmain(){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_Optionsc,err:=compute.NewZonesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ZonesClient) Close
func(c*ZonesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ZonesClient) Connection (deprecated)
func(c*ZonesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ZonesClient) Get
func(c*ZonesClient)Get(ctxcontext.Context,req*computepb.GetZoneRequest,opts...gax.CallOption)(*computepb.Zone,error)Get returns the specified Zone resource.
Example
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewZonesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.GetZoneRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#GetZoneRequest.}resp,err:=c.Get(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ZonesClient) List
func(c*ZonesClient)List(ctxcontext.Context,req*computepb.ListZonesRequest,opts...gax.CallOption)*ZoneIteratorList retrieves the list of Zone resources available to the specified project.
Examples
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=compute.NewZonesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListZonesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListZonesRequest.}it:=c.List(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*computepb.ZoneList)}}all
packagemainimport("context"compute"cloud.google.com/go/compute/apiv1"computepb"cloud.google.com/go/compute/apiv1/computepb")funcmain(){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_Optionsc,err:=compute.NewZonesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&computepb.ListZonesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/compute/apiv1/computepb#ListZonesRequest.}forresp,err:=rangec.List(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-30 UTC.