Google Cloud Support API v2 - Package cloud.google.com/go/support/apiv2 (v1.4.1) Stay organized with collections Save and categorize content based on your preferences.
Package support is an auto-generated package for theGoogle Cloud Support API.
Manages Google Cloud technical support cases for Customer Care supportofferings.
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/support/apiv2@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:=support.NewCaseAttachmentClient(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:=&supportpb.ListAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#ListAttachmentsRequest.}it:=c.ListAttachments(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.(*supportpb.ListAttachmentsResponse)}
Use of Context
The ctx passed to NewCaseAttachmentClient 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.
AttachmentIterator
typeAttachmentIteratorstruct{// 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[]*supportpb.Attachment,nextPageTokenstring,errerror)// contains filtered or unexported fields}AttachmentIterator manages a stream of *supportpb.Attachment.
func (*AttachmentIterator) All
func(it*AttachmentIterator)All()iter.Seq2[*supportpb.Attachment,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*AttachmentIterator) Next
func(it*AttachmentIterator)Next()(*supportpb.Attachment,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 (*AttachmentIterator) PageInfo
func(it*AttachmentIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CaseAttachmentCallOptions
typeCaseAttachmentCallOptionsstruct{ListAttachments[]gax.CallOption}CaseAttachmentCallOptions contains the retry settings for each method of CaseAttachmentClient.
CaseAttachmentClient
typeCaseAttachmentClientstruct{// The call options for this service.CallOptions*CaseAttachmentCallOptions// contains filtered or unexported fields}CaseAttachmentClient is a client for interacting with Google Cloud Support API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
A service to manage file attachments for Google Cloud support cases.
func NewCaseAttachmentClient
funcNewCaseAttachmentClient(ctxcontext.Context,opts...option.ClientOption)(*CaseAttachmentClient,error)NewCaseAttachmentClient creates a new case attachment service client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
A service to manage file attachments for Google Cloud support cases.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseAttachmentClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewCaseAttachmentRESTClient
funcNewCaseAttachmentRESTClient(ctxcontext.Context,opts...option.ClientOption)(*CaseAttachmentClient,error)NewCaseAttachmentRESTClient creates a new case attachment service rest client.
A service to manage file attachments for Google Cloud support cases.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseAttachmentRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*CaseAttachmentClient) Close
func(c*CaseAttachmentClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*CaseAttachmentClient) Connection (deprecated)
func(c*CaseAttachmentClient)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 (*CaseAttachmentClient) ListAttachments
func(c*CaseAttachmentClient)ListAttachments(ctxcontext.Context,req*supportpb.ListAttachmentsRequest,opts...gax.CallOption)*AttachmentIteratorListAttachments list all the attachments associated with a support case.
Examples
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb""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:=support.NewCaseAttachmentClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.ListAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#ListAttachmentsRequest.}it:=c.ListAttachments(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.(*supportpb.ListAttachmentsResponse)}}all
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseAttachmentClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.ListAttachmentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#ListAttachmentsRequest.}forresp,err:=rangec.ListAttachments(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}CaseCallOptions
typeCaseCallOptionsstruct{GetCase[]gax.CallOptionListCases[]gax.CallOptionSearchCases[]gax.CallOptionCreateCase[]gax.CallOptionUpdateCase[]gax.CallOptionEscalateCase[]gax.CallOptionCloseCase[]gax.CallOptionSearchCaseClassifications[]gax.CallOption}CaseCallOptions contains the retry settings for each method of CaseClient.
CaseClassificationIterator
typeCaseClassificationIteratorstruct{// 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[]*supportpb.CaseClassification,nextPageTokenstring,errerror)// contains filtered or unexported fields}CaseClassificationIterator manages a stream of *supportpb.CaseClassification.
func (*CaseClassificationIterator) All
func(it*CaseClassificationIterator)All()iter.Seq2[*supportpb.CaseClassification,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*CaseClassificationIterator) Next
func(it*CaseClassificationIterator)Next()(*supportpb.CaseClassification,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 (*CaseClassificationIterator) PageInfo
func(it*CaseClassificationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CaseClient
typeCaseClientstruct{// The call options for this service.CallOptions*CaseCallOptions// contains filtered or unexported fields}CaseClient is a client for interacting with Google Cloud Support API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
A service to manage Google Cloud support cases.
func NewCaseClient
funcNewCaseClient(ctxcontext.Context,opts...option.ClientOption)(*CaseClient,error)NewCaseClient creates a new case service client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
A service to manage Google Cloud support cases.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewCaseRESTClient
funcNewCaseRESTClient(ctxcontext.Context,opts...option.ClientOption)(*CaseClient,error)NewCaseRESTClient creates a new case service rest client.
A service to manage Google Cloud support cases.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*CaseClient) Close
func(c*CaseClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*CaseClient) CloseCase
func(c*CaseClient)CloseCase(ctxcontext.Context,req*supportpb.CloseCaseRequest,opts...gax.CallOption)(*supportpb.Case,error)CloseCase close a case.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.CloseCaseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#CloseCaseRequest.}resp,err:=c.CloseCase(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CaseClient) Connection (deprecated)
func(c*CaseClient)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 (*CaseClient) CreateCase
func(c*CaseClient)CreateCase(ctxcontext.Context,req*supportpb.CreateCaseRequest,opts...gax.CallOption)(*supportpb.Case,error)CreateCase create a new case and associate it with a parent.
It must have the following fields set: display_name, description,classification, and priority. If you’re just testing the API and don’twant to route your case to an agent, set testCase=true.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.CreateCaseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#CreateCaseRequest.}resp,err:=c.CreateCase(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CaseClient) EscalateCase
func(c*CaseClient)EscalateCase(ctxcontext.Context,req*supportpb.EscalateCaseRequest,opts...gax.CallOption)(*supportpb.Case,error)EscalateCase escalate a case, starting the Google Cloud Support escalation managementprocess.
This operation is only available for some support services. Go tohttps://cloud.google.com/support (athttps://cloud.google.com/support) and look for ‘Technical supportescalations’ in the feature list to find out which ones let youdo that.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.EscalateCaseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#EscalateCaseRequest.}resp,err:=c.EscalateCase(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CaseClient) GetCase
func(c*CaseClient)GetCase(ctxcontext.Context,req*supportpb.GetCaseRequest,opts...gax.CallOption)(*supportpb.Case,error)GetCase retrieve a case.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.GetCaseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#GetCaseRequest.}resp,err:=c.GetCase(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CaseClient) ListCases
func(c*CaseClient)ListCases(ctxcontext.Context,req*supportpb.ListCasesRequest,opts...gax.CallOption)*CaseIteratorListCases retrieve all cases under a parent, but not its children.
For example, listing cases under an organization only returns the casesthat are directly parented by that organization. To retrieve casesunder an organization and its projects, use cases.search.
Examples
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb""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:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.ListCasesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#ListCasesRequest.}it:=c.ListCases(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.(*supportpb.ListCasesResponse)}}all
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.ListCasesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#ListCasesRequest.}forresp,err:=rangec.ListCases(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*CaseClient) SearchCaseClassifications
func(c*CaseClient)SearchCaseClassifications(ctxcontext.Context,req*supportpb.SearchCaseClassificationsRequest,opts...gax.CallOption)*CaseClassificationIteratorSearchCaseClassifications retrieve valid classifications to use when creating a support case.
Classifications are hierarchical. Each classification is a stringcontaining all levels of the hierarchy separated by " > ". For example,"Technical Issue > Compute > Compute Engine".
Classification IDs returned by this endpoint are valid for at least sixmonths. When a classification is deactivated, this endpoint immediatelystops returning it. After six months, case.create requests using theclassification will fail.
Examples
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb""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:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.SearchCaseClassificationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#SearchCaseClassificationsRequest.}it:=c.SearchCaseClassifications(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.(*supportpb.SearchCaseClassificationsResponse)}}all
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.SearchCaseClassificationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#SearchCaseClassificationsRequest.}forresp,err:=rangec.SearchCaseClassifications(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*CaseClient) SearchCases
func(c*CaseClient)SearchCases(ctxcontext.Context,req*supportpb.SearchCasesRequest,opts...gax.CallOption)*CaseIteratorSearchCases search for cases using a query.
Examples
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb""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:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.SearchCasesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#SearchCasesRequest.}it:=c.SearchCases(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.(*supportpb.SearchCasesResponse)}}all
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.SearchCasesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#SearchCasesRequest.}forresp,err:=rangec.SearchCases(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*CaseClient) UpdateCase
func(c*CaseClient)UpdateCase(ctxcontext.Context,req*supportpb.UpdateCaseRequest,opts...gax.CallOption)(*supportpb.Case,error)UpdateCase update a case. Only some fields can be updated.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCaseClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.UpdateCaseRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#UpdateCaseRequest.}resp,err:=c.UpdateCase(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}CaseIterator
typeCaseIteratorstruct{// 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[]*supportpb.Case,nextPageTokenstring,errerror)// contains filtered or unexported fields}CaseIterator manages a stream of *supportpb.Case.
func (*CaseIterator) All
func(it*CaseIterator)All()iter.Seq2[*supportpb.Case,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*CaseIterator) Next
func(it*CaseIterator)Next()(*supportpb.Case,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 (*CaseIterator) PageInfo
func(it*CaseIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CommentCallOptions
typeCommentCallOptionsstruct{ListComments[]gax.CallOptionCreateComment[]gax.CallOption}CommentCallOptions contains the retry settings for each method of CommentClient.
CommentClient
typeCommentClientstruct{// The call options for this service.CallOptions*CommentCallOptions// contains filtered or unexported fields}CommentClient is a client for interacting with Google Cloud Support API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
A service to manage comments on cases.
func NewCommentClient
funcNewCommentClient(ctxcontext.Context,opts...option.ClientOption)(*CommentClient,error)NewCommentClient creates a new comment service client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
A service to manage comments on cases.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCommentClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewCommentRESTClient
funcNewCommentRESTClient(ctxcontext.Context,opts...option.ClientOption)(*CommentClient,error)NewCommentRESTClient creates a new comment service rest client.
A service to manage comments on cases.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCommentRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*CommentClient) Close
func(c*CommentClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*CommentClient) Connection (deprecated)
func(c*CommentClient)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 (*CommentClient) CreateComment
func(c*CommentClient)CreateComment(ctxcontext.Context,req*supportpb.CreateCommentRequest,opts...gax.CallOption)(*supportpb.Comment,error)CreateComment add a new comment to a case.
The comment must have the following fields set: body.
Example
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCommentClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.CreateCommentRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#CreateCommentRequest.}resp,err:=c.CreateComment(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CommentClient) ListComments
func(c*CommentClient)ListComments(ctxcontext.Context,req*supportpb.ListCommentsRequest,opts...gax.CallOption)*CommentIteratorListComments list all the comments associated with a case.
Examples
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb""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:=support.NewCommentClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.ListCommentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#ListCommentsRequest.}it:=c.ListComments(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.(*supportpb.ListCommentsResponse)}}all
packagemainimport("context"support"cloud.google.com/go/support/apiv2"supportpb"cloud.google.com/go/support/apiv2/supportpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=support.NewCommentClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&supportpb.ListCommentsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#ListCommentsRequest.}forresp,err:=rangec.ListComments(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}CommentIterator
typeCommentIteratorstruct{// 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[]*supportpb.Comment,nextPageTokenstring,errerror)// contains filtered or unexported fields}CommentIterator manages a stream of *supportpb.Comment.
func (*CommentIterator) All
func(it*CommentIterator)All()iter.Seq2[*supportpb.Comment,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*CommentIterator) Next
func(it*CommentIterator)Next()(*supportpb.Comment,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 (*CommentIterator) PageInfo
func(it*CommentIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
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.