Package support is an auto-generated package for the Google Cloud Support API.
Manages Google Cloud technical support cases for Customer Care support offerings.
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page 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@latest ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := support.NewCaseAttachmentClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*supportpb.ListAttachmentsResponse) }
Use of Context
The ctx passed to NewCaseAttachmentClient is used for authentication requests and for 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
func DefaultAuthScopes() []stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
AttachmentIterator
type AttachmentIterator struct {
// 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.
Response interface{}
// 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.
InternalFetch func(pageSize int, pageToken string) (results []*supportpb.Attachment, nextPageToken string, err error)
// 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, the iterator 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 more results. 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
type CaseAttachmentCallOptions struct {
ListAttachments []gax.CallOption
}CaseAttachmentCallOptions contains the retry settings for each method of CaseAttachmentClient.
CaseAttachmentClient
type CaseAttachmentClient struct {
// 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
func NewCaseAttachmentClient(ctx context.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
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseAttachmentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewCaseAttachmentRESTClient
func NewCaseAttachmentRESTClient(ctx context.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
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseAttachmentRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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 when the 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 always return the same resource.
func (*CaseAttachmentClient) ListAttachments
func (c *CaseAttachmentClient) ListAttachments(ctx context.Context, req *supportpb.ListAttachmentsRequest, opts ...gax.CallOption) *AttachmentIteratorListAttachments list all the attachments associated with a support case.
Examples
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseAttachmentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*supportpb.ListAttachmentsResponse)
}
}
all
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseAttachmentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &supportpb.ListAttachmentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#ListAttachmentsRequest.
}
for resp, err := range c.ListAttachments(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
CaseCallOptions
type CaseCallOptions struct {
GetCase []gax.CallOption
ListCases []gax.CallOption
SearchCases []gax.CallOption
CreateCase []gax.CallOption
UpdateCase []gax.CallOption
EscalateCase []gax.CallOption
CloseCase []gax.CallOption
SearchCaseClassifications []gax.CallOption
}CaseCallOptions contains the retry settings for each method of CaseClient.
CaseClassificationIterator
type CaseClassificationIterator struct {
// 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.
Response interface{}
// 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.
InternalFetch func(pageSize int, pageToken string) (results []*supportpb.CaseClassification, nextPageToken string, err error)
// 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, the iterator 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 more results. 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
type CaseClient struct {
// 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
func NewCaseClient(ctx context.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
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewCaseRESTClient
func NewCaseRESTClient(ctx context.Context, opts ...option.ClientOption) (*CaseClient, error)NewCaseRESTClient creates a new case service rest client.
A service to manage Google Cloud support cases.
Example
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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 when the client is no longer required.
func (*CaseClient) CloseCase
func (c *CaseClient) CloseCase(ctx context.Context, req *supportpb.CloseCaseRequest, opts ...gax.CallOption) (*supportpb.Case, error)CloseCase close a case.
Example
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != 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 always return the same resource.
func (*CaseClient) CreateCase
func (c *CaseClient) CreateCase(ctx context.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’t want to route your case to an agent, set testCase=true.
Example
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CaseClient) EscalateCase
func (c *CaseClient) EscalateCase(ctx context.Context, req *supportpb.EscalateCaseRequest, opts ...gax.CallOption) (*supportpb.Case, error)EscalateCase escalate a case, starting the Google Cloud Support escalation management process.
This operation is only available for some support services. Go to https://cloud.google.com/support (at https://cloud.google.com/support) and look for ‘Technical support escalations’ in the feature list to find out which ones let you do that.
Example
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CaseClient) GetCase
func (c *CaseClient) GetCase(ctx context.Context, req *supportpb.GetCaseRequest, opts ...gax.CallOption) (*supportpb.Case, error)GetCase retrieve a case.
Example
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CaseClient) ListCases
func (c *CaseClient) ListCases(ctx context.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 cases that are directly parented by that organization. To retrieve cases under an organization and its projects, use cases.search.
Examples
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*supportpb.ListCasesResponse)
}
}
all
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &supportpb.ListCasesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#ListCasesRequest.
}
for resp, err := range c.ListCases(ctx, req).All() {
if err != 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(ctx context.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 string containing 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 six months. When a classification is deactivated, this endpoint immediately stops returning it. After six months, case.create requests using the classification will fail.
Examples
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*supportpb.SearchCaseClassificationsResponse)
}
}
all
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &supportpb.SearchCaseClassificationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#SearchCaseClassificationsRequest.
}
for resp, err := range c.SearchCaseClassifications(ctx, req).All() {
if err != 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(ctx context.Context, req *supportpb.SearchCasesRequest, opts ...gax.CallOption) *CaseIteratorSearchCases search for cases using a query.
Examples
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*supportpb.SearchCasesResponse)
}
}
all
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &supportpb.SearchCasesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#SearchCasesRequest.
}
for resp, err := range c.SearchCases(ctx, req).All() {
if err != 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(ctx context.Context, req *supportpb.UpdateCaseRequest, opts ...gax.CallOption) (*supportpb.Case, error)UpdateCase update a case. Only some fields can be updated.
Example
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCaseClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
CaseIterator
type CaseIterator struct {
// 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.
Response interface{}
// 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.
InternalFetch func(pageSize int, pageToken string) (results []*supportpb.Case, nextPageToken string, err error)
// 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, the iterator 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 more results. 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
type CommentCallOptions struct {
ListComments []gax.CallOption
CreateComment []gax.CallOption
}CommentCallOptions contains the retry settings for each method of CommentClient.
CommentClient
type CommentClient struct {
// 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
func NewCommentClient(ctx context.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
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCommentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewCommentRESTClient
func NewCommentRESTClient(ctx context.Context, opts ...option.ClientOption) (*CommentClient, error)NewCommentRESTClient creates a new comment service rest client.
A service to manage comments on cases.
Example
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCommentRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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 when the 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 always return the same resource.
func (*CommentClient) CreateComment
func (c *CommentClient) CreateComment(ctx context.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
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCommentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CommentClient) ListComments
func (c *CommentClient) ListComments(ctx context.Context, req *supportpb.ListCommentsRequest, opts ...gax.CallOption) *CommentIteratorListComments list all the comments associated with a case.
Examples
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCommentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*supportpb.ListCommentsResponse)
}
}
all
package main
import (
"context"
support "cloud.google.com/go/support/apiv2"
supportpb "cloud.google.com/go/support/apiv2/supportpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := support.NewCommentClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &supportpb.ListCommentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/support/apiv2/supportpb#ListCommentsRequest.
}
for resp, err := range c.ListComments(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
CommentIterator
type CommentIterator struct {
// 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.
Response interface{}
// 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.
InternalFetch func(pageSize int, pageToken string) (results []*supportpb.Comment, nextPageToken string, err error)
// 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, the iterator 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 more results. 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.