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.
ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - 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.
ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - 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) }
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() []string
DefaultAuthScopes 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.PageInfo
PageInfo 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 attachment 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 attachment 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 attachment 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() error
Close 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.ClientConn
Connection 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) *AttachmentIterator
ListAttachments retrieve all 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.
}
// 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.PageInfo
PageInfo 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() error
Close 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 the specified 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.ClientConn
Connection 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 the given Google Cloud Resource. The case object must have the following fields set: display_name, description, classification, and priority.
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. Escalating a case will initiate the Google Cloud Support escalation management process.
This operation is only available to certain Customer Care tiers. 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 tiers are able to perform escalations.
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 the specified 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) *CaseIterator
ListCases retrieve all cases under the specified parent.
Note: Listing cases under an Organization returns only the cases directly parented by that organization. To retrieve all cases under an organization, including cases parented by projects under that organization, 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.
}
// TODO: Use resp.
_ = resp
}
}
func (*CaseClient) SearchCaseClassifications
func (c *CaseClient) SearchCaseClassifications(ctx context.Context, req *supportpb.SearchCaseClassificationsRequest, opts ...gax.CallOption) *CaseClassificationIterator
SearchCaseClassifications retrieve valid classifications to be used when creating a support case. The classications are hierarchical, with each classification containing all levels of the hierarchy, separated by " > ". For example “Technical Issue > Compute > Compute Engine”.
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.
}
// TODO: Use resp.
_ = resp
}
}
func (*CaseClient) SearchCases
func (c *CaseClient) SearchCases(ctx context.Context, req *supportpb.SearchCasesRequest, opts ...gax.CallOption) *CaseIterator
SearchCases search cases using the specified 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.
}
// 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 the specified case. Only a subset of 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.PageInfo
PageInfo 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() error
Close 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.ClientConn
Connection 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 the specified Case. The comment object 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) *CommentIterator
ListComments retrieve all Comments associated with the Case object.
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.
}
// 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.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.